Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal')
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaAnnotationDefintionProvider.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java399
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaNode.java191
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaPlatformProvider.java188
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java1591
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractSynchronizerJpaProjectUpdater.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AsynchronousJpaProjectUpdater.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaAnnotationDefinitionProvider.java146
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaAnnotationProvider.java163
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatform.java249
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatformFactory.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatformProvider.java144
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JarResourceModelProvider.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JavaResourceModelProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformRegistry.java275
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformTester.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaTester.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/OrmResourceModelProvider.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/PersistenceResourceModelProvider.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/ProjectAdapterFactory.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/ResourceAdapterFactory.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SimpleJpaProjectConfig.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SynchronousJpaProjectUpdater.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/AbstractJpaContextNode.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/AbstractXmlContextNode.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/MappingTools.java245
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PersistentAttributePropertyTester.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAssociationOverrideRelationshipReference.java254
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAttributeMapping.java294
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAttributeMappingDefinition.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseColumn.java312
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java215
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMapping.java311
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEmbeddable.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java1634
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaGenerator.java209
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java383
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMappingDefinition.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinColumnJoiningStrategy.java380
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinTableJoiningStrategy.java149
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJpaContextNode.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToManyMapping.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToOneMapping.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappedSuperclass.java129
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java339
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaNamedColumn.java197
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToManyMapping.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToManyRelationshipReference.java152
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToOneMapping.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOverride.java126
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentAttribute.java712
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentType.java661
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaQuery.java200
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaRelationshipMapping.java291
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaRelationshipReference.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSequenceGenerator.java126
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java158
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTable.java501
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMapping.java207
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMappingDefinition.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMapping.java220
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinColumnInAssociationOverrideJoiningStrategy.java173
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinColumnJoiningStrategy.java180
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinTableJoiningStrategy.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaManyToManyRelationshipReference.java164
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaManyToOneRelationshipReference.java121
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaMappedByJoiningStrategy.java202
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaOneToOneRelationshipReference.java214
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnJoiningStrategy.java320
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMappingDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddableDefinition.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedMappingDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntityDefinition.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMappingDefinition.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToManyMappingDefinition.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToOneMappingDefinition.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclassDefinition.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullTypeMapping.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToManyMappingDefinition.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToOneMappingDefinition.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTransientMappingDefinition.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaVersionMappingDefinition.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAssociationOverrideAnnotation.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAssociationOverrideJoinColumnAnnotation.java127
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAttributeOverrideAnnotation.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAttributeOverrideColumnAnnotation.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualOverrideAnnotation.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractEntityMappings.java786
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmAssociationOverrideRelationshipReference.java147
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmAttributeMapping.java373
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseColumn.java302
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java208
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBasicMapping.java326
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEmbeddable.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEmbeddedMapping.java235
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java1888
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmGenerator.java236
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmIdMapping.java337
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinColumnJoiningStrategy.java409
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinTableJoiningStrategy.java148
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmManyToManyMapping.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmManyToOneMapping.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMappedSuperclass.java147
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java273
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java199
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmOneToManyMapping.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmOneToManyRelationshipReference.java173
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmOneToOneMapping.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmPersistentAttribute.java283
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmQuery.java193
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmRelationshipMapping.java357
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmRelationshipReference.java116
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmSequenceGenerator.java90
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java146
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTable.java475
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTypeMapping.java334
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVersionMapping.java239
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNode.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java469
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlDefinition.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmJoinColumnInAssociationOverrideJoiningStrategy.java145
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmJoinColumnJoiningStrategy.java126
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmJoinTableJoiningStrategy.java138
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmManyToManyRelationshipReference.java185
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmManyToOneRelationshipReference.java128
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmMappedByJoiningStrategy.java178
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOneToOneRelationshipReference.java236
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnJoiningStrategy.java259
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmXmlContextNodeFactory.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/NullOrmAssociationOverrideContainer.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmBasicMappingDefinition.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddableDefinition.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddedIdMappingDefinition.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddedMappingDefinition.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEntityDefinition.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmIdMappingDefinition.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmManyToManyMappingDefinition.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmManyToOneMappingDefinition.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmMappedSuperclassDefinition.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmOneToManyMappingDefinition.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmOneToOneMappingDefinition.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmTransientMappingDefinition.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmVersionMappingDefinition.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualCascadeType.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualMapKey.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlAssociationOverride.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlAttributeMapping.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlAttributeOverride.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlAttributeOverrideColumn.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlBasic.java173
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlColumn.java186
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlEmbedded.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlEmbeddedId.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlGeneratedValue.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlId.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlJoinColumn.java147
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlJoinTable.java137
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlManyToMany.java190
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlManyToOne.java154
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlNullAttributeMapping.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOneToMany.java203
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOneToOne.java200
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOrderColumn.java98
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlPrimaryKeyJoinColumn.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlSecondaryTable.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlSequenceGenerator.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlTableGenerator.java178
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlTransient.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlUniqueConstraint.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlVersion.java132
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractJarFileRef.java310
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractMappingFileRef.java253
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java1735
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnitProperties.java394
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlContextNode.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetActionDelegate.java81
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetDataModelProperties.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetDataModelProvider.java684
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDataModelProperties.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDataModelProvider.java205
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetUninstallDelegate.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java115
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetVersionChangeDelegate.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaLibraryProviderConstants.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/LegacyJpaLibraryProviderDetector.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/LegacyJpaLibraryProviderInstallOperation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaDataSource.java224
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaFactory.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaFile.java149
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaProject.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericRootContextNode.java260
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJarFile.java211
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverride.java187
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java396
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverrideRelationshipReference.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java200
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java386
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaBasicMapping.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaCascade.java144
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaColumn.java146
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java201
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddable.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java208
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEntity.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java208
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java270
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaIdMapping.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinColumn.java234
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinTable.java725
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaLobConverter.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaManyToManyMapping.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaManyToOneMapping.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaMappedSuperclass.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNamedQuery.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNullConverter.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOneToManyMapping.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOneToManyRelationshipReference.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOneToOneMapping.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOrderable.java358
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentType.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java163
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaQueryContainer.java293
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaQueryHint.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java398
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaSequenceGenerator.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTable.java153
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTableGenerator.java531
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTransientMapping.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java168
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVersionMapping.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/NullJavaAssociationOverrideContainer.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/VirtualAssociationOverride1_0Annotation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericEntityMappings.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java341
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideRelationshipReference.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java221
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java357
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmCascade.java242
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmColumn.java186
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java223
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEntity.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java180
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java220
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmIdMapping.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java237
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinTable.java765
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmLobConverter.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNullConverter.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOneToManyRelationshipReference.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOrderable.java274
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentType.java1058
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java146
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java253
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmQueryHint.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java388
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTable.java134
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java420
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java126
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmXml.java218
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericPersistenceUnitDefaults.java297
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericPersistenceUnitMetadata.java98
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericClassRef.java296
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericJarFileRef.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericMappingFileRef.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistence.java289
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceUnit.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceUnitProperty.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceXml.java210
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/ImpliedMappingFileRef.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryAssociationOverrides1_0Annotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryNamedQueries1_0Annotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryOneToMany1_0Annotation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryOneToOne1_0Annotation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceAssociationOverrides1_0Annotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceOneToMany1_0Annotation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceOneToOne1_0Annotation.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java163
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaPlatformFactory.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaPlatformProvider.java156
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericJpaFactory2_0.java152
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericPersistentTypeMetamodelSynchronizer.java604
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/SimpleMetamodelField.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaAssociationOverrideRelationshipReference2_0.java126
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaDerivedId2_0.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java117
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaEmbeddable2_0.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaJoinTableInAssociationOverrideJoiningStrategy2_0.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaMapsId2_0.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java87
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java165
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOrphanRemoval2_0.java109
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java105
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0.java139
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaIdMappingDefinition2_0.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaCacheable2_0.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaDerivedId2_0.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaMapsId2_0.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaOrphanRemoval2_0.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/VirtualAssociationOverride2_0Annotation.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/VirtualAssociationOverrideJoinTableAnnotation.java133
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmAssociationOverrideRelationshipReference2_0.java112
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmCacheable2_0.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmDerivedId2_0.java81
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmEmbeddable2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmJoinTableInAssociationOverrideJoiningStrategy2_0.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmMapsId2_0.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java211
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOrphanRemoval2_0.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmPersistentAttribute2_0.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmSequenceGenerator2_0.java138
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmXml2_0ContextNodeFactory.java205
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullMapsId2_0.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmCacheable2_0.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmDerivedId2_0.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmMapsId2_0.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmOrphanRemoval2_0.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/OrmElementCollectionMapping2_0Definition.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlAssociationOverride2_0.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlBasic2_0.java150
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlElementCollection2_0.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlEmbedded2_0.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlEmbeddedId2_0.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlId2_0.java171
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlManyToMany2_0.java169
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlManyToOne2_0.java150
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlNullAttributeMapping2_0.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlOneToMany2_0.java192
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlOneToOne2_0.java192
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlSequenceGenerator2_0.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlTransient2_0.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlVersion2_0.java130
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/GenericConnection2_0.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java110
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java239
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/NullOptions2_0.java124
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullAssociationOverrideJoinTableAnnotation.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullOneToMany2_0Annotation.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullOneToOne2_0Annotation.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/OneToMany2_0AnnotationDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/OneToOne2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java140
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryOneToMany2_0Annotation.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryOneToOne2_0Annotation.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java144
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java142
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java162
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java210
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java132
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOneToMany2_0Annotation.java88
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOneToOne2_0Annotation.java90
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java201
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java117
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java393
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationOperation.java124
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/JpaFileCreationDataModelProperties.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationDataModelProperties.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationDataModelProvider.java273
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationOperation.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationDataModelProperties.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationDataModelProvider.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationOperation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/prefs/JpaPreferenceInitializer.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/IndeterminateContentDescriber.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractJavaResourceNode.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/BasicAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ColumnAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddableAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EntityAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumeratedAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValueAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdClassAnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnsAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTableAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/LobAnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToManyAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOneAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MapKeyAnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueriesAnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueryAnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAnnotation.java87
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseColumnAnnotation.java113
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseTableAnnotation.java127
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBasicAnnotation.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullColumnAnnotation.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorValueAnnotation.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEmbeddedAnnotation.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEnumeratedAnnotation.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullInheritanceAnnotation.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinColumnAnnotation.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinTableAnnotation.java137
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullNamedColumnAnnotation.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullOneToManyAnnotation.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullOneToOneAnnotation.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullOwnableRelationshipMappingAnnotation.java156
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullPrimaryKeyJoinColumnAnnotation.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTableAnnotation.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTemporalAnnotation.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToManyAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOneAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OrderByAnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnsAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTableAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTablesAnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGeneratorAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableAnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableGeneratorAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TransientAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/VersionAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAnnotation.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAssociationOverridesAnnotation.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAttributeOverridesAnnotation.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java184
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseNamedQueryAnnotation.java154
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java199
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBasicAnnotation.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryClassFile.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryColumnAnnotation.java163
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryContainerAnnotation.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEntityAnnotation.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java129
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryIdAnnotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryIdClassAnnotation.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java115
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinColumnsAnnotation.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java170
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryLobAnnotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java88
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedNativeQueriesAnnotation.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java119
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedQueriesAnnotation.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNode.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java120
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOrderByAnnotation.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOverrideAnnotation.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPackageFragment.java125
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPackageFragmentRoot.java133
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentAttribute.java648
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentMember.java282
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentType.java559
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentTypeCache.java149
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java87
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnsAnnotation.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java212
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java115
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySecondaryTablesAnnotation.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTableAnnotation.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java293
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTemporalAnnotation.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTransientAnnotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryVersionAnnotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/RootBinaryNode.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/AnnotationContainerTools.java270
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAnnotation.java146
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAssociationOverrideAnnotation.java217
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAssociationOverridesAnnotation.java115
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAttributeOverrideAnnotation.java153
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java117
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseColumnAnnotation.java237
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseNamedQueryAnnotation.java305
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseTableAnnotation.java352
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBasicAnnotation.java131
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceColumnAnnotation.java224
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceCompilationUnit.java280
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceDiscriminatorColumnAnnotation.java138
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceDiscriminatorValueAnnotation.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddableAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddedAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddedIdAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEntityAnnotation.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEnumeratedAnnotation.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceGeneratedValueAnnotation.java134
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceGeneratorAnnotation.java169
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceIdAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceIdClassAnnotation.java115
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceInheritanceAnnotation.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinColumnAnnotation.java189
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinColumnsAnnotation.java117
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinTableAnnotation.java381
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceLobAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceManyToManyAnnotation.java132
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceManyToOneAnnotation.java133
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceMapKeyAnnotation.java98
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceMappedSuperclassAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedColumnAnnotation.java172
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedNativeQueriesAnnotation.java117
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedNativeQueryAnnotation.java206
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedQueriesAnnotation.java117
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedQueryAnnotation.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNode.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOneToManyAnnotation.java131
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOneToOneAnnotation.java172
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOrderByAnnotation.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOverrideAnnotation.java113
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentAttribute.java389
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentMember.java535
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentType.java724
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnAnnotation.java161
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnsAnnotation.java117
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceQueryHintAnnotation.java170
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceRelationshipMappingAnnotation.java315
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSecondaryTableAnnotation.java264
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSecondaryTablesAnnotation.java117
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java123
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTableAnnotation.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java440
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTemporalAnnotation.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTransientAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java156
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceVersionAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmXmlResourceProvider.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceXmlResourceProvider.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/xml/JpaXmlResourceAdapterFactory.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/xml/JpaXmlResourcePropertyTester.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/synch/SynchronizeClassesJob.java150
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/CallbackJobSynchronizer.java153
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/JobCommand.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/JobSynchronizer.java198
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/PlatformTools.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/SimpleSchedulingRule.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/SimpleTextRange.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/ASTNodeTextRange.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AbstractAnnotationAdapter.java165
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AbstractDeclarationAnnotationAdapter.java153
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AbstractExpressionConverter.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AbstractNestedDeclarationAnnotationAdapter.java422
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AnnotationStringArrayExpressionConverter.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/BooleanExpressionConverter.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/CharacterStringExpressionConverter.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/CombinationIndexedDeclarationAnnotationAdapter.java496
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/ConversionDeclarationAnnotationElementAdapter.java203
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/DefaultAnnotationEditFormatter.java219
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/EnumArrayDeclarationAnnotationElementAdapter.java159
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/EnumDeclarationAnnotationElementAdapter.java128
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/ExpressionDeclarationAnnotationElementAdapter.java362
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/GenericVisitor.java791
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTAttribute.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTFieldAttribute.java205
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTMember.java237
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTMethodAttribute.java256
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTModifiedDeclaration.java532
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTTools.java207
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTType.java236
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JPTTools.java344
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/MemberAnnotationAdapter.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/MemberAnnotationElementAdapter.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/MemberIndexedAnnotationAdapter.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NameStringExpressionConverter.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NestedDeclarationAnnotationAdapter.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NestedIndexedDeclarationAnnotationAdapter.java334
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NullAnnotationEditFormatter.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NullDeclarationAnnotationAdapter.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NullDeclarationAnnotationElementAdapter.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NullExpressionConverter.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NumberIntegerExpressionConverter.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/PrimitiveTypeStringExpressionConverter.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/ShortCircuitAnnotationElementAdapter.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/ShortCircuitArrayAnnotationElementAdapter.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/SimpleDeclarationAnnotationAdapter.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/SimpleTypeStringExpressionConverter.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/StringArrayExpressionConverter.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/StringExpressionConverter.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/TypeStringExpressionConverter.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/translators/BooleanTranslator.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/translators/EmptyTagBooleanTranslator.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/translators/EnumeratedValueTranslator.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/translators/SimpleRootTranslator.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/translators/SimpleTranslator.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/DefaultJpaValidationMessages.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaHelper.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationMessages.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationPreferences.java130
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidator.java126
688 files changed, 0 insertions, 94470 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaAnnotationDefintionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaAnnotationDefintionProvider.java
deleted file mode 100644
index 90bc29d85a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaAnnotationDefintionProvider.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jpt.core.JpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.utility.internal.iterators.ArrayListIterator;
-
-public abstract class AbstractJpaAnnotationDefintionProvider
- implements JpaAnnotationDefinitionProvider
-{
- private AnnotationDefinition[] typeAnnotationDefinitions;
-
- private AnnotationDefinition[] typeMappingAnnotationDefinitions;
-
- private AnnotationDefinition[] attributeAnnotationDefinitions;
-
-
- protected AbstractJpaAnnotationDefintionProvider() {
- super();
- }
-
- // ********** type annotation definitions **********
-
- public synchronized Iterator<AnnotationDefinition> typeAnnotationDefinitions() {
- if (this.typeAnnotationDefinitions == null) {
- this.typeAnnotationDefinitions = this.buildTypeAnnotationDefinitions();
- }
- return new ArrayIterator<AnnotationDefinition>(this.typeAnnotationDefinitions);
- }
-
- protected AnnotationDefinition[] buildTypeAnnotationDefinitions() {
- ArrayList<AnnotationDefinition> definitions = new ArrayList<AnnotationDefinition>();
- this.addTypeAnnotationDefinitionsTo(definitions);
- return definitions.toArray(new AnnotationDefinition[definitions.size()]);
- }
-
- /**
- * Subclasses must override this to specify type annotation definitions.
- */
- protected void addTypeAnnotationDefinitionsTo(@SuppressWarnings("unused") List<AnnotationDefinition> definitions) {
- // no op
- }
-
- // ********** type mapping annotation definitions **********
-
- public synchronized Iterator<AnnotationDefinition> typeMappingAnnotationDefinitions() {
- if (this.typeMappingAnnotationDefinitions == null) {
- this.typeMappingAnnotationDefinitions = this.buildTypeMappingAnnotationDefinitions();
- }
- return new ArrayIterator<AnnotationDefinition>(this.typeMappingAnnotationDefinitions);
- }
-
- protected AnnotationDefinition[] buildTypeMappingAnnotationDefinitions() {
- ArrayList<AnnotationDefinition> definitions = new ArrayList<AnnotationDefinition>();
- this.addTypeMappingAnnotationDefinitionsTo(definitions);
- return definitions.toArray(new AnnotationDefinition[definitions.size()]);
- }
-
- /**
- * Subclasses must override this to specify type mapping annotation
- * definitions.
- */
- protected void addTypeMappingAnnotationDefinitionsTo(@SuppressWarnings("unused") List<AnnotationDefinition> definitions) {
- // no op
- }
-
- // ********** attribute annotation definitions **********
-
- public synchronized Iterator<AnnotationDefinition> attributeAnnotationDefinitions() {
- if (this.attributeAnnotationDefinitions == null) {
- this.attributeAnnotationDefinitions = this.buildAttributeAnnotationDefinitions();
- }
- return new ArrayListIterator<AnnotationDefinition>(this.attributeAnnotationDefinitions);
- }
-
- protected AnnotationDefinition[] buildAttributeAnnotationDefinitions() {
- ArrayList<AnnotationDefinition> definitions = new ArrayList<AnnotationDefinition>();
- this.addAttributeAnnotationDefinitionsTo(definitions);
- return definitions.toArray(new AnnotationDefinition[definitions.size()]);
- }
-
- /**
- * Subclasses must override this to specify attribute annotation
- * definitions.
- */
- protected void addAttributeAnnotationDefinitionsTo(@SuppressWarnings("unused") List<AnnotationDefinition> definitions) {
- // no op
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java
deleted file mode 100644
index 139fd9b9a8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java
+++ /dev/null
@@ -1,399 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.JpaDataSource;
-import org.eclipse.jpt.core.JpaFile;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JpaResourceModel;
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.AssociationOverrideContainer;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.JpaRootContextNode;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverrideRelationshipReference;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverride;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaBaseColumn;
-import org.eclipse.jpt.core.context.java.JavaBaseJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaBasicMapping;
-import org.eclipse.jpt.core.context.java.JavaCascade;
-import org.eclipse.jpt.core.context.java.JavaColumn;
-import org.eclipse.jpt.core.context.java.JavaConverter;
-import org.eclipse.jpt.core.context.java.JavaDiscriminatorColumn;
-import org.eclipse.jpt.core.context.java.JavaEmbeddable;
-import org.eclipse.jpt.core.context.java.JavaEmbeddedIdMapping;
-import org.eclipse.jpt.core.context.java.JavaEmbeddedMapping;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.context.java.JavaEnumeratedConverter;
-import org.eclipse.jpt.core.context.java.JavaGeneratedValue;
-import org.eclipse.jpt.core.context.java.JavaGeneratorContainer;
-import org.eclipse.jpt.core.context.java.JavaIdMapping;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaJoinTable;
-import org.eclipse.jpt.core.context.java.JavaJoinTableJoiningStrategy;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaLobConverter;
-import org.eclipse.jpt.core.context.java.JavaManyToManyMapping;
-import org.eclipse.jpt.core.context.java.JavaManyToOneMapping;
-import org.eclipse.jpt.core.context.java.JavaMappedSuperclass;
-import org.eclipse.jpt.core.context.java.JavaNamedColumn;
-import org.eclipse.jpt.core.context.java.JavaNamedNativeQuery;
-import org.eclipse.jpt.core.context.java.JavaNamedQuery;
-import org.eclipse.jpt.core.context.java.JavaOneToManyMapping;
-import org.eclipse.jpt.core.context.java.JavaOneToOneMapping;
-import org.eclipse.jpt.core.context.java.JavaOrderable;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaQuery;
-import org.eclipse.jpt.core.context.java.JavaQueryContainer;
-import org.eclipse.jpt.core.context.java.JavaQueryHint;
-import org.eclipse.jpt.core.context.java.JavaRelationshipMapping;
-import org.eclipse.jpt.core.context.java.JavaSecondaryTable;
-import org.eclipse.jpt.core.context.java.JavaSequenceGenerator;
-import org.eclipse.jpt.core.context.java.JavaTable;
-import org.eclipse.jpt.core.context.java.JavaTableGenerator;
-import org.eclipse.jpt.core.context.java.JavaTemporalConverter;
-import org.eclipse.jpt.core.context.java.JavaTransientMapping;
-import org.eclipse.jpt.core.context.java.JavaTypeMapping;
-import org.eclipse.jpt.core.context.java.JavaUniqueConstraint;
-import org.eclipse.jpt.core.context.java.JavaVersionMapping;
-import org.eclipse.jpt.core.internal.context.java.JavaNullTypeMapping;
-import org.eclipse.jpt.core.internal.jpa1.GenericJpaDataSource;
-import org.eclipse.jpt.core.internal.jpa1.GenericJpaFile;
-import org.eclipse.jpt.core.internal.jpa1.GenericJpaProject;
-import org.eclipse.jpt.core.internal.jpa1.context.GenericRootContextNode;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaAssociationOverride;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaAssociationOverrideRelationshipReference;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaAttributeOverride;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaAttributeOverrideContainer;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaBasicMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaCascade;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaColumn;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaDiscriminatorColumn;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaEmbeddable;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaEmbeddedIdMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaEmbeddedMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaEntity;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaEnumeratedConverter;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaGeneratedValue;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaGeneratorContainer;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaIdMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaJoinColumn;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaJoinTable;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaLobConverter;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaManyToManyMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaManyToOneMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaMappedSuperclass;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaNamedNativeQuery;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaNamedQuery;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaNullAttributeMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaNullConverter;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaOneToManyMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaOneToOneMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaOrderable;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaPersistentType;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaQueryContainer;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaQueryHint;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaSecondaryTable;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaSequenceGenerator;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaTable;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaTableGenerator;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaTemporalConverter;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaTransientMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaUniqueConstraint;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaVersionMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.NullJavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.internal.jpa1.context.java.VirtualAssociationOverride1_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaOrderColumn2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.NullJavaCacheable2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.NullJavaDerivedId2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.NullJavaMapsId2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.NullJavaOrphanRemoval2_0;
-import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
-import org.eclipse.jpt.core.jpa2.context.PersistentType2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCacheable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCacheableHolder2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaDerivedId2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaElementCollectionMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaEmbeddedMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaMapsId2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrderColumn2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrderable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-
-/**
- * Central class that allows extenders to easily replace implementations of
- * various Dali interfaces.
- */
-public abstract class AbstractJpaFactory
- implements JpaFactory2_0
-{
- protected AbstractJpaFactory() {
- super();
- }
-
-
- // ********** Core Model **********
-
- public JpaProject buildJpaProject(JpaProject.Config config) {
- return new GenericJpaProject(config);
- }
-
- public PersistentType2_0.MetamodelSynchronizer buildPersistentTypeMetamodelSynchronizer(PersistentType2_0 persistentType) {
- return null;
- }
-
- public JpaDataSource buildJpaDataSource(JpaProject jpaProject, String connectionProfileName) {
- return new GenericJpaDataSource(jpaProject, connectionProfileName);
- }
-
- public JpaFile buildJpaFile(JpaProject jpaProject, IFile file, IContentType contentType, JpaResourceModel resourceModel) {
- return new GenericJpaFile(jpaProject, file, contentType, resourceModel);
- }
-
-
- // ********** Context Nodes **********
-
- public JpaRootContextNode buildRootContextNode(JpaProject parent) {
- return new GenericRootContextNode(parent);
- }
-
-
-
- // ********** Java Context Model **********
-
- public JavaPersistentType buildJavaPersistentType(PersistentType.Owner owner, JavaResourcePersistentType jrpt) {
- return new GenericJavaPersistentType(owner, jrpt);
- }
-
- public JavaPersistentAttribute buildJavaPersistentAttribute(PersistentType parent, JavaResourcePersistentAttribute jrpa) {
- return new GenericJavaPersistentAttribute(parent, jrpa);
- }
-
- public JavaTypeMapping buildJavaNullTypeMapping(JavaPersistentType parent) {
- return new JavaNullTypeMapping(parent);
- }
-
- public JavaEntity buildJavaEntity(JavaPersistentType parent) {
- return new GenericJavaEntity(parent);
- }
-
- public JavaMappedSuperclass buildJavaMappedSuperclass(JavaPersistentType parent) {
- return new GenericJavaMappedSuperclass(parent);
- }
-
- public JavaEmbeddable buildJavaEmbeddable(JavaPersistentType parent) {
- return new GenericJavaEmbeddable(parent);
- }
-
- public JavaTable buildJavaTable(JavaEntity parent) {
- return new GenericJavaTable(parent);
- }
-
- public JavaCascade buildJavaCascade(JavaRelationshipMapping parent) {
- return new GenericJavaCascade(parent);
- }
-
- public JavaColumn buildJavaColumn(JavaJpaContextNode parent, JavaBaseColumn.Owner owner) {
- return new GenericJavaColumn(parent, owner);
- }
-
- public JavaDiscriminatorColumn buildJavaDiscriminatorColumn(JavaEntity parent, JavaDiscriminatorColumn.Owner owner) {
- return new GenericJavaDiscriminatorColumn(parent, owner);
- }
-
- public JavaJoinColumn buildJavaJoinColumn(JavaJpaContextNode parent, JavaJoinColumn.Owner owner) {
- return new GenericJavaJoinColumn(parent, owner);
- }
-
- public JavaJoinTable buildJavaJoinTable(JavaJoinTableJoiningStrategy parent) {
- return new GenericJavaJoinTable(parent);
- }
-
- public JavaSecondaryTable buildJavaSecondaryTable(JavaEntity parent) {
- return new GenericJavaSecondaryTable(parent);
- }
-
- 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<OneToManyAnnotation>(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) {
- return new GenericJavaGeneratorContainer(parent);
- }
-
- public JavaSequenceGenerator buildJavaSequenceGenerator(JavaJpaContextNode parent) {
- return new GenericJavaSequenceGenerator(parent);
- }
-
- public JavaTableGenerator buildJavaTableGenerator(JavaJpaContextNode parent) {
- return new GenericJavaTableGenerator(parent);
- }
-
- public JavaGeneratedValue buildJavaGeneratedValue(JavaIdMapping parent) {
- return new GenericJavaGeneratedValue(parent);
- }
-
- public JavaPrimaryKeyJoinColumn buildJavaPrimaryKeyJoinColumn(JavaJpaContextNode parent, JavaBaseJoinColumn.Owner owner) {
- return new GenericJavaPrimaryKeyJoinColumn(parent, owner);
- }
-
- public JavaAttributeOverrideContainer buildJavaAttributeOverrideContainer(JavaJpaContextNode parent, JavaAttributeOverrideContainer.Owner owner) {
- return new GenericJavaAttributeOverrideContainer(parent, owner);
- }
-
- public JavaAssociationOverrideContainer buildJavaAssociationOverrideContainer(JavaEntity parent, AssociationOverrideContainer.Owner owner) {
- return new GenericJavaAssociationOverrideContainer(parent, owner);
- }
-
- public JavaAssociationOverrideContainer buildJavaAssociationOverrideContainer(JavaEmbeddedMapping2_0 parent, AssociationOverrideContainer.Owner owner) {
- return new NullJavaAssociationOverrideContainer(parent, owner);
- }
-
- public JavaAttributeOverride buildJavaAttributeOverride(JavaAttributeOverrideContainer parent, AttributeOverride.Owner owner) {
- return new GenericJavaAttributeOverride(parent, owner);
- }
-
- public JavaAssociationOverride buildJavaAssociationOverride(JavaAssociationOverrideContainer parent, AssociationOverride.Owner owner) {
- return new GenericJavaAssociationOverride(parent, owner);
- }
-
- public JavaAssociationOverrideRelationshipReference buildJavaAssociationOverrideRelationshipReference(JavaAssociationOverride parent) {
- return new GenericJavaAssociationOverrideRelationshipReference(parent);
- }
-
- public AssociationOverrideAnnotation buildJavaVirtualAssociationOverrideAnnotation(JavaResourcePersistentMember jrpm, String name, JoiningStrategy joiningStrategy) {
- return new VirtualAssociationOverride1_0Annotation(jrpm, name, joiningStrategy);
- }
-
- public JavaQueryContainer buildJavaQueryContainer(JavaJpaContextNode parent) {
- return new GenericJavaQueryContainer(parent);
- }
-
- public JavaNamedQuery buildJavaNamedQuery(JavaJpaContextNode parent) {
- return new GenericJavaNamedQuery(parent);
- }
-
- public JavaNamedNativeQuery buildJavaNamedNativeQuery(JavaJpaContextNode parent) {
- return new GenericJavaNamedNativeQuery(parent);
- }
-
- public JavaQueryHint buildJavaQueryHint(JavaQuery parent) {
- return new GenericJavaQueryHint(parent);
- }
-
- public JavaUniqueConstraint buildJavaUniqueConstraint(JavaJpaContextNode parent, UniqueConstraint.Owner owner) {
- return new GenericJavaUniqueConstraint(parent, owner);
- }
-
- public JavaEnumeratedConverter buildJavaEnumeratedConverter(JavaAttributeMapping parent, JavaResourcePersistentAttribute jrpa) {
- return new GenericJavaEnumeratedConverter(parent, jrpa);
- }
-
- public JavaTemporalConverter buildJavaTemporalConverter(JavaAttributeMapping parent, JavaResourcePersistentAttribute jrpa) {
- return new GenericJavaTemporalConverter(parent, jrpa);
- }
-
- public JavaLobConverter buildJavaLobConverter(JavaAttributeMapping parent, JavaResourcePersistentAttribute jrpa) {
- return new GenericJavaLobConverter(parent, jrpa);
- }
-
- public JavaConverter buildJavaNullConverter(JavaAttributeMapping parent) {
- return new GenericJavaNullConverter(parent);
- }
-
- public JavaOrderable buildJavaOrderable(JavaAttributeMapping parent) {
- return new GenericJavaOrderable(parent);
- }
-
- public JavaDerivedId2_0 buildJavaDerivedId(JavaSingleRelationshipMapping2_0 parent) {
- return new NullJavaDerivedId2_0(parent);
- }
-
- public JavaElementCollectionMapping2_0 buildJavaElementCollectionMapping2_0(JavaPersistentAttribute parent) {
- throw new UnsupportedOperationException();
- }
-
- public JavaMapsId2_0 buildJavaMapsId(JavaSingleRelationshipMapping2_0 parent) {
- return new NullJavaMapsId2_0(parent);
- }
-
- public JavaCacheable2_0 buildJavaCacheable(JavaCacheableHolder2_0 parent) {
- return new NullJavaCacheable2_0(parent);
- }
-
- public JavaOrphanRemovable2_0 buildJavaOrphanRemoval(JavaOrphanRemovalHolder2_0 parent) {
- return new NullJavaOrphanRemoval2_0(parent);
- }
-
- public JavaOrderColumn2_0 buildJavaOrderColumn(JavaOrderable2_0 parent, JavaNamedColumn.Owner owner) {
- return new GenericJavaOrderColumn2_0(parent, owner);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaNode.java
deleted file mode 100644
index f04be55841..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaNode.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jpt.core.JpaDataSource;
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.JpaFile;
-import org.eclipse.jpt.core.JpaNode;
-import org.eclipse.jpt.core.JpaPlatform;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JpaPlatformVariation;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.Database;
-import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.CallbackChangeSupport;
-import org.eclipse.jpt.utility.internal.model.ChangeSupport;
-
-/**
- * Some common Dali behavior:<ul>
- * <li>containment hierarchy
- * <li>Eclipse adaptable
- * <li>update triggers
- * </ul>
- */
-public abstract class AbstractJpaNode
- extends AbstractModel
- implements JpaNode
-{
- private 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 boolean forbidsParent() {
- return ! this.requiresParent(); // assume 'parent' is not optional
- }
-
- @Override
- protected ChangeSupport buildChangeSupport() {
- return new CallbackChangeSupport(this, this.buildChangeSupportListener());
- }
-
- protected CallbackChangeSupport.Listener buildChangeSupportListener() {
- return new CallbackChangeSupport.Listener() {
- public void aspectChanged(String aspectName) {
- AbstractJpaNode.this.aspectChanged(aspectName);
- }
- };
- }
-
-
- // ********** IAdaptable implementation **********
-
- @SuppressWarnings("unchecked")
- 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 JpaFactory getJpaFactory() {
- return this.getJpaPlatform().getJpaFactory();
- }
-
- protected JpaPlatformVariation getJpaPlatformVariation() {
- return this.getJpaPlatform().getJpaVariation();
- }
-
- protected JpaFile getJpaFile(IFile file) {
- return this.getJpaProject().getJpaFile(file);
- }
-
- protected JpaDataSource getDataSource() {
- return this.getJpaProject().getDataSource();
- }
-
- protected Database getDatabase() {
- return this.getDataSource().getDatabase();
- }
-
- protected boolean connectionProfileIsActive() {
- return this.getDataSource().connectionProfileIsActive();
- }
-
- /**
- * Pre-condition: specified catalog <em>identifier</em> is not null.
- * NB: Do not use the catalog <em>name</em>.
- */
- protected Catalog getDbCatalog(String catalog) {
- Database database = this.getDatabase();
- return (database == null) ? null : database.getCatalogForIdentifier(catalog);
- }
-
-
- // ********** CallbackChangeSupport.Listener support **********
-
- protected void aspectChanged(String aspectName) {
- if (this.aspectTriggersUpdate(aspectName)) {
- // System.out.println(Thread.currentThread() + " \"update\" change: " + this + ": " + aspectName);
- this.getJpaProject().update();
- }
- }
-
- private boolean aspectTriggersUpdate(String aspectName) {
- return ! this.aspectDoesNotTriggerUpdate(aspectName);
- }
-
- private boolean aspectDoesNotTriggerUpdate(String aspectName) {
- return this.nonUpdateAspectNames().contains(aspectName);
- }
-
- protected final Set<String> nonUpdateAspectNames() {
- synchronized (nonUpdateAspectNameSets) {
- HashSet<String> nonUpdateAspectNames = nonUpdateAspectNameSets.get(this.getClass());
- if (nonUpdateAspectNames == null) {
- nonUpdateAspectNames = new HashSet<String>();
- this.addNonUpdateAspectNamesTo(nonUpdateAspectNames);
- nonUpdateAspectNameSets.put(this.getClass(), nonUpdateAspectNames);
- }
- return nonUpdateAspectNames;
- }
- }
-
- private static final HashMap<Class<? extends AbstractJpaNode>, HashSet<String>> nonUpdateAspectNameSets = 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);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaPlatformProvider.java
deleted file mode 100644
index 09ae889b1a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaPlatformProvider.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import java.util.ListIterator;
-import org.eclipse.jpt.core.JpaPlatformProvider;
-import org.eclipse.jpt.core.JpaResourceModelProvider;
-import org.eclipse.jpt.core.ResourceDefinition;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.core.context.java.NullDefaultJavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.NullJavaTypeMappingDefinition;
-import org.eclipse.jpt.core.context.java.NullSpecifiedJavaAttributeMappingDefinition;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayListIterator;
-
-/**
- * All the state in the JPA platform should be "static" (i.e. unchanging once
- * it is initialized).
- */
-public abstract class AbstractJpaPlatformProvider
- implements JpaPlatformProvider
-{
- private JpaResourceModelProvider[] resourceModelProviders;
-
- private JavaTypeMappingDefinition[] javaTypeMappingDefinitions;
-
- private JavaAttributeMappingDefinition[] specifiedJavaAttributeMappingDefinitions;
-
- private JavaAttributeMappingDefinition[] defaultJavaAttributeMappingDefinitions;
-
- private ResourceDefinition[] resourceDefinitions;
-
-
- /**
- * zero-argument constructor
- */
- protected AbstractJpaPlatformProvider() {
- super();
- }
-
-
- // ********** resource models **********
-
- public ListIterator<JpaResourceModelProvider> resourceModelProviders() {
- return new ArrayListIterator<JpaResourceModelProvider>(getResourceModelProviders());
- }
-
- protected synchronized JpaResourceModelProvider[] getResourceModelProviders() {
- if (this.resourceModelProviders == null) {
- this.resourceModelProviders = this.buildResourceModelProviders();
- }
- return this.resourceModelProviders;
- }
-
- protected abstract JpaResourceModelProvider[] buildResourceModelProviders();
-
-
- // ********** Java type mappings **********
-
- public ListIterator<JavaTypeMappingDefinition> javaTypeMappingDefinitions() {
- return new ArrayListIterator<JavaTypeMappingDefinition>(getJavaTypeMappingDefinitions());
- }
-
- protected synchronized JavaTypeMappingDefinition[] getJavaTypeMappingDefinitions() {
- if (this.javaTypeMappingDefinitions == null) {
- this.javaTypeMappingDefinitions = this.buildJavaTypeMappingDefinitions();
- }
- return this.javaTypeMappingDefinitions;
- }
-
- /**
- * Return an array of 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 an
- * attribute, all following mapping definitions are ignored.
- * Extenders may either overwrite this method or {@link #buildNonNullJavaTypeMappingDefinitions()}.
- * Doing the former places the additional requirement on the extender to provide a "null"
- * mapping definition (@see {@link NullJavaTypeMappingDefinition}.)
- */
- protected JavaTypeMappingDefinition[] buildJavaTypeMappingDefinitions() {
- return ArrayTools.add(
- buildNonNullJavaTypeMappingDefinitions(),
- NullJavaTypeMappingDefinition.instance());
- }
-
- /**
- * No-op implementation of this method.
- * @see #buildJavaTypeMappingDefinitions()
- */
- protected JavaTypeMappingDefinition[] buildNonNullJavaTypeMappingDefinitions() {
- return new JavaTypeMappingDefinition[0];
- }
-
-
- // ********** Java attribute mappings **********
-
- public ListIterator<JavaAttributeMappingDefinition> defaultJavaAttributeMappingDefinitions() {
- return new ArrayListIterator<JavaAttributeMappingDefinition>(getDefaultJavaAttributeMappingDefinitions());
- }
-
- protected synchronized JavaAttributeMappingDefinition[] getDefaultJavaAttributeMappingDefinitions() {
- if (this.defaultJavaAttributeMappingDefinitions == null) {
- this.defaultJavaAttributeMappingDefinitions = this.buildDefaultJavaAttributeMappingDefinitions();
- }
- return this.defaultJavaAttributeMappingDefinitions;
- }
-
- /**
- * Return an array of mapping definitions to use for analyzing the default mapping of an attribute
- * in the absence of any annotations. The order is important, as once a mapping definition tests
- * positively for a given attribute, all following mapping definitions are ignored.
- * Extenders may either overwrite this method or
- * {@link #buildNonNullDefaultJavaAttributeMappingDefinitions()}.
- * Doing the former places the additional requirement on the extender to provide a "null"
- * mapping definition (@see {@link NullDefaultJavaAttributeMappingDefinition}.)
- */
- protected JavaAttributeMappingDefinition[] buildDefaultJavaAttributeMappingDefinitions() {
- return ArrayTools.add(
- buildNonNullDefaultJavaAttributeMappingDefinitions(),
- NullDefaultJavaAttributeMappingDefinition.instance());
- }
-
- /**
- * No-op implementation of this method.
- * @see #buildDefaultJavaAttributeMappingDefinitions()
- */
- protected JavaAttributeMappingDefinition[] buildNonNullDefaultJavaAttributeMappingDefinitions() {
- return new JavaAttributeMappingDefinition[0];
- }
-
- public ListIterator<JavaAttributeMappingDefinition> specifiedJavaAttributeMappingDefinitions() {
- return new ArrayListIterator<JavaAttributeMappingDefinition>(
- getSpecifiedJavaAttributeMappingDefinitions());
- }
-
- protected synchronized JavaAttributeMappingDefinition[] getSpecifiedJavaAttributeMappingDefinitions() {
- if (this.specifiedJavaAttributeMappingDefinitions == null) {
- this.specifiedJavaAttributeMappingDefinitions = this.buildSpecifiedJavaAttributeMappingDefinitions();
- }
- return this.specifiedJavaAttributeMappingDefinitions;
- }
-
- /**
- * Return an array of 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
- * positively for a given attribute, all following mapping definitions are ignored.
- * Extenders may either overwrite this method or
- * {@link #buildNonNullSpecifiedJavaAttributeMappingDefinitions()}.
- * Doing the former places the additional requirement on the extender to provide a "null"
- * mapping definition (@see {@link NullSpecifiedJavaAttributeMappingDefinition}.)
- */
- protected JavaAttributeMappingDefinition[] buildSpecifiedJavaAttributeMappingDefinitions() {
- return ArrayTools.add(
- buildNonNullSpecifiedJavaAttributeMappingDefinitions(),
- NullSpecifiedJavaAttributeMappingDefinition.instance());
- }
-
- /**
- * No-op implementation of this method.
- * @see #buildSpecifiedJavaAttributeMappingDefinitions()
- */
- protected JavaAttributeMappingDefinition[] buildNonNullSpecifiedJavaAttributeMappingDefinitions() {
- return new JavaAttributeMappingDefinition[0];
- }
-
-
- // ********** Mapping Files **********
-
- public ListIterator<ResourceDefinition> resourceDefinitions() {
- return new ArrayListIterator<ResourceDefinition>(getResourceDefinitions());
- }
-
- protected synchronized ResourceDefinition[] getResourceDefinitions() {
- if (this.resourceDefinitions == null) {
- this.resourceDefinitions = this.buildResourceDefinitions();
- }
- return this.resourceDefinitions;
- }
-
- protected abstract ResourceDefinition[] buildResourceDefinitions();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java
deleted file mode 100644
index 6000410166..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java
+++ /dev/null
@@ -1,1591 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.IResourceProxy;
-import org.eclipse.core.resources.IResourceProxyVisitor;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-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.core.JpaDataSource;
-import org.eclipse.jpt.core.JpaFile;
-import org.eclipse.jpt.core.JpaPlatform;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JpaResourceModel;
-import org.eclipse.jpt.core.JpaResourceModelListener;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.JpaRootContextNode;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryPersistentTypeCache;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceCompilationUnit;
-import org.eclipse.jpt.core.internal.utility.PlatformTools;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.JpaProject2_0;
-import org.eclipse.jpt.core.jpa2.context.JpaRootContextNode2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.JavaResourcePersistentType2_0;
-import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragmentRoot;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentTypeCache;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.ConnectionProfile;
-import org.eclipse.jpt.db.Database;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.SchemaContainer;
-import org.eclipse.jpt.utility.CommandExecutor;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.BitTools;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.ThreadLocalCommandExecutor;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-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;
-
-/**
- * JPA project. Holds all the JPA stuff.
- *
- * The JPA platform provides the hooks for vendor-specific stuff.
- *
- * The JPA files are the "resource" model (i.e. objects that correspond directly
- * to Eclipse resources; e.g. Java source code files, XML files, JAR files).
- *
- * The root context node is the "context"model (i.e. objects that attempt to
- * model the JPA spec, using the "resource" model as an adapter to the Eclipse
- * resources).
- *
- * The data source is an adapter to the DTP meta-data model.
- */
-public abstract class AbstractJpaProject
- extends AbstractJpaNode
- implements JpaProject2_0
-{
- /**
- * The Eclipse project corresponding to the JPA project.
- */
- protected final IProject project;
-
- /**
- * The vendor-specific JPA platform that builds the JPA project
- * and all its contents.
- */
- protected final JpaPlatform jpaPlatform;
-
- /**
- * The JPA files associated with the JPA project:
- * persistence.xml
- * orm.xml
- * java
- */
- protected final Vector<JpaFile> jpaFiles = new Vector<JpaFile>();
-
- /**
- * The "external" Java resource compilation units (source). Populated upon demand.
- */
- protected final Vector<JavaResourceCompilationUnit> externalJavaResourceCompilationUnits = new Vector<JavaResourceCompilationUnit>();
-
- /**
- * The "external" Java resource persistent types (binary). Populated upon demand.
- */
- protected final JavaResourcePersistentTypeCache externalJavaResourcePersistentTypeCache;
-
- /**
- * Resource models notify this listener when they change. A project update
- * should occur any time a resource model changes.
- */
- protected final JpaResourceModelListener resourceModelListener;
-
- /**
- * The root of the model representing the collated resources associated with
- * the JPA project.
- */
- protected final JpaRootContextNode rootContextNode;
-
- /**
- * A pluggable updater that can be used to "update" 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 "updates" occur.
- * Clients will need to explicitly configure the updater if they require
- * something other than a synchronous updater.
- */
- protected Updater updater;
-
- /**
- * The data source that wraps the DTP model.
- */
- protected final JpaDataSource dataSource;
-
- /**
- * A catalog name used to override the connection's default catalog.
- */
- protected String userOverrideDefaultCatalog;
-
- /**
- * A schema name used to override the connection's default schema.
- */
- protected String userOverrideDefaultSchema;
-
- /**
- * Flag indicating whether the project should "discover" annotated
- * classes automatically, as opposed to requiring the classes to be
- * listed in persistence.xml.
- */
- protected 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 String metamodelSourceFolderName;
-
-
- // ********** constructor/initialization **********
-
- protected AbstractJpaProject(JpaProject.Config config) {
- super(null); // JPA project is the root of the containment tree
- if ((config.getProject() == null) || (config.getJpaPlatform() == null)) {
- throw new NullPointerException();
- }
- this.project = config.getProject();
- this.jpaPlatform = config.getJpaPlatform();
- this.dataSource = this.getJpaFactory().buildJpaDataSource(this, config.getConnectionProfileName());
- this.userOverrideDefaultCatalog = config.getUserOverrideDefaultCatalog();
- this.userOverrideDefaultSchema = config.getUserOverrideDefaultSchema();
- this.discoversAnnotatedClasses = config.discoverAnnotatedClasses();
-
- this.modifySharedDocumentCommandExecutor = this.buildModifySharedDocumentCommandExecutor();
-
- this.resourceModelListener = this.buildResourceModelListener();
- // build the JPA files corresponding to the Eclipse project's files
- InitialResourceProxyVisitor visitor = this.buildInitialResourceProxyVisitor();
- visitor.visitProject(this.project);
-
- this.externalJavaResourcePersistentTypeCache = this.buildExternalJavaResourcePersistentTypeCache();
-
- if (this.isJpa2_0Compatible()) {
- this.metamodelSourceFolderName = ((JpaProject2_0.Config) config).getMetamodelSourceFolderName();
- if (this.metamodelSoureFolderNameIsInvalid()) {
- this.metamodelSourceFolderName = null;
- }
- }
-
- this.rootContextNode = this.buildRootContextNode();
-
- // "update" the project before returning
- this.setUpdater_(new SynchronousJpaProjectUpdater(this));
-
- // start listening to this cache once the context model has been built
- // and all the external types are faulted in
- this.externalJavaResourcePersistentTypeCache.addResourceModelListener(this.resourceModelListener);
- }
-
- @Override
- protected boolean requiresParent() {
- return false;
- }
-
- @Override
- public IResource getResource() {
- return this.project;
- }
-
- protected ThreadLocalCommandExecutor buildModifySharedDocumentCommandExecutor() {
- return new ThreadLocalCommandExecutor();
- }
-
- protected JpaResourceModelListener buildResourceModelListener() {
- return new DefaultResourceModelListener();
- }
-
- protected InitialResourceProxyVisitor buildInitialResourceProxyVisitor() {
- return new InitialResourceProxyVisitor();
- }
-
- protected JavaResourcePersistentTypeCache buildExternalJavaResourcePersistentTypeCache() {
- return new BinaryPersistentTypeCache(this.jpaPlatform.getAnnotationProvider());
- }
-
- protected JpaRootContextNode buildRootContextNode() {
- return this.getJpaFactory().buildRootContextNode(this);
- }
-
- protected boolean isJpa2_0Compatible() {
- return this.getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0);
- }
-
- // ***** inner class
- 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
- }
- }
- }
-
-
- // ********** miscellaneous **********
-
- /**
- * 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.getDbCatalog(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.getDbCatalog(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.getDbCatalog(catalog);
- if (dbCatalog != null) {
- return dbCatalog.getDefaultSchemaIdentifier();
- }
-
- // if we could not find a catalog on the database that matches the default
- // catalog name, return the database's default schema(?) - hmmm
- return this.getDatabaseDefaultSchema();
- }
-
- protected String getDatabaseDefaultSchema() {
- Database db = this.getDatabase();
- return (db == null ) ? null : db.getDefaultSchemaIdentifier();
- }
-
-
- // ********** user override default catalog **********
-
- public String getUserOverrideDefaultCatalog() {
- return this.userOverrideDefaultCatalog;
- }
-
- public void setUserOverrideDefaultCatalog(String catalog) {
- String old = this.userOverrideDefaultCatalog;
- this.userOverrideDefaultCatalog = catalog;
- JptCorePlugin.setUserOverrideDefaultCatalog(this.project, catalog);
- this.firePropertyChanged(USER_OVERRIDE_DEFAULT_CATALOG_PROPERTY, old, catalog);
- }
-
-
- // ********** user override default schema **********
-
- public String getUserOverrideDefaultSchema() {
- return this.userOverrideDefaultSchema;
- }
-
- public void setUserOverrideDefaultSchema(String schema) {
- String old = this.userOverrideDefaultSchema;
- this.userOverrideDefaultSchema = schema;
- JptCorePlugin.setUserOverrideDefaultSchema(this.project, schema);
- this.firePropertyChanged(USER_OVERRIDE_DEFAULT_SCHEMA_PROPERTY, old, schema);
- }
-
-
- // ********** discover annotated classes **********
-
- public boolean discoversAnnotatedClasses() {
- return this.discoversAnnotatedClasses;
- }
-
- public void setDiscoversAnnotatedClasses(boolean discoversAnnotatedClasses) {
- boolean old = this.discoversAnnotatedClasses;
- this.discoversAnnotatedClasses = discoversAnnotatedClasses;
- JptCorePlugin.setDiscoverAnnotatedClasses(this.project, discoversAnnotatedClasses);
- this.firePropertyChanged(DISCOVERS_ANNOTATED_CLASSES_PROPERTY, old, discoversAnnotatedClasses);
- }
-
-
- // ********** JPA files **********
-
- public Iterator<JpaFile> jpaFiles() {
- return this.getJpaFiles().iterator();
- }
-
- protected Iterable<JpaFile> getJpaFiles() {
- return new LiveCloneIterable<JpaFile>(this.jpaFiles); // read-only
- }
-
- public int jpaFilesSize() {
- return this.jpaFiles.size();
- }
-
- protected Iterable<JpaFile> getJpaFiles(final IContentType contentType) {
- return new FilteringIterable<JpaFile, 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.getJavaProject().isOnClasspath(file)) {
- return null; // the file must be on the Java classpath
- }
-
- JpaFile jpaFile = this.getJpaPlatform().buildJpaFile(this, file);
- if (jpaFile == null) {
- return null;
- }
- jpaFile.getResourceModel().addResourceModelListener(this.resourceModelListener);
- this.jpaFiles.add(jpaFile);
- return jpaFile;
- }
-
- /**
- * Remove the JPA file corresponding to the specified IFile, if it exists.
- * Return true if a JPA File was removed, false otherwise
- */
- protected boolean removeJpaFile(IFile file) {
- JpaFile jpaFile = this.getJpaFile(file);
- if (jpaFile != null) { // a JpaFile is not added for every IFile
- this.removeJpaFile(jpaFile);
- return true;
- }
- return false;
- }
-
- /**
- * Stop listening to the JPA file and remove it.
- */
- protected void removeJpaFile(JpaFile jpaFile) {
- jpaFile.getResourceModel().removeResourceModelListener(this.resourceModelListener);
- if ( ! this.removeItemFromCollection(jpaFile, this.jpaFiles, JPA_FILES_COLLECTION)) {
- throw new IllegalArgumentException(jpaFile.toString());
- }
- }
-
-
- // ********** external Java resource persistent types (source or binary) **********
-
- protected JavaResourcePersistentType buildPersistableExternalJavaResourcePersistentType(String typeName) {
- IType jdtType = this.findType(typeName);
- return (jdtType == null) ? null : this.buildPersistableExternalJavaResourcePersistentType(jdtType);
- }
-
- protected IType findType(String typeName) {
- try {
- return this.getJavaProject().findType(typeName);
- } catch (JavaModelException ex) {
- return null; // ignore exception?
- }
- }
-
- protected JavaResourcePersistentType buildPersistableExternalJavaResourcePersistentType(IType jdtType) {
- JavaResourcePersistentType jrpt = this.buildExternalJavaResourcePersistentType(jdtType);
- return ((jrpt != null) && jrpt.isPersistable()) ? jrpt : null;
- }
-
- protected JavaResourcePersistentType buildExternalJavaResourcePersistentType(IType jdtType) {
- return jdtType.isBinary() ?
- this.buildBinaryExternalJavaResourcePersistentType(jdtType) :
- this.buildSourceExternalJavaResourcePersistentType(jdtType);
- }
-
- protected JavaResourcePersistentType buildBinaryExternalJavaResourcePersistentType(IType jdtType) {
- return this.externalJavaResourcePersistentTypeCache.addPersistentType(jdtType);
- }
-
- protected JavaResourcePersistentType buildSourceExternalJavaResourcePersistentType(IType jdtType) {
- JavaResourceCompilationUnit jrcu = this.getExternalJavaResourceCompilationUnit(jdtType.getCompilationUnit());
- String jdtTypeName = jdtType.getFullyQualifiedName('.'); // JDT member type names use '$'
- for (Iterator<JavaResourcePersistentType> stream = jrcu.persistentTypes(); stream.hasNext(); ) {
- JavaResourcePersistentType jrpt = stream.next();
- if (jrpt.getQualifiedName().equals(jdtTypeName)) {
- return jrpt;
- }
- }
- // we can get here if the project JRE is removed;
- // see SourceCompilationUnit#getPrimaryType(CompilationUnit)
- // bug 225332
- return null;
- }
-
-
- // ********** external Java resource persistent types (binary) **********
-
- public JavaResourcePersistentTypeCache getExternalJavaResourcePersistentTypeCache() {
- return this.externalJavaResourcePersistentTypeCache;
- }
-
-
- // ********** external Java resource compilation units (source) **********
-
- public Iterator<JavaResourceCompilationUnit> externalJavaResourceCompilationUnits() {
- return this.getExternalJavaResourceCompilationUnits().iterator();
- }
-
- protected Iterable<JavaResourceCompilationUnit> getExternalJavaResourceCompilationUnits() {
- return new LiveCloneIterable<JavaResourceCompilationUnit>(this.externalJavaResourceCompilationUnits); // read-only
- }
-
- public int externalJavaResourceCompilationUnitsSize() {
- return this.externalJavaResourceCompilationUnits.size();
- }
-
- /**
- * Return the resource model compilation unit corresponding to the specified
- * JDT compilation unit. If it does not exist, build it.
- */
- protected JavaResourceCompilationUnit getExternalJavaResourceCompilationUnit(ICompilationUnit jdtCompilationUnit) {
- for (JavaResourceCompilationUnit jrcu : this.getExternalJavaResourceCompilationUnits()) {
- if (jrcu.getCompilationUnit().equals(jdtCompilationUnit)) {
- // we will get here if the JRCU could not build its persistent type...
- return jrcu;
- }
- }
- return this.addExternalJavaResourceCompilationUnit(jdtCompilationUnit);
- }
-
- /**
- * Add an external Java resource compilation unit.
- */
- protected JavaResourceCompilationUnit addExternalJavaResourceCompilationUnit(ICompilationUnit jdtCompilationUnit) {
- JavaResourceCompilationUnit jrcu = this.buildJavaResourceCompilationUnit(jdtCompilationUnit);
- this.addItemToCollection(jrcu, this.externalJavaResourceCompilationUnits, EXTERNAL_JAVA_RESOURCE_COMPILATION_UNITS_COLLECTION);
- jrcu.addResourceModelListener(this.resourceModelListener);
- return jrcu;
- }
-
- protected JavaResourceCompilationUnit buildJavaResourceCompilationUnit(ICompilationUnit jdtCompilationUnit) {
- return new SourceCompilationUnit(
- 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 convertToPlatformFile(String fileName) {
- return JptCorePlugin.getPlatformFile(this.project, fileName);
- }
-
-
- // ********** XML files **********
-
- public JpaXmlResource getPersistenceXmlResource() {
- return (JpaXmlResource) this.getResourceModel(
- JptCorePlugin.DEFAULT_PERSISTENCE_XML_FILE_PATH,
- JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE
- );
- }
-
- public JpaXmlResource getDefaultOrmXmlResource() {
- return this.getMappingFileXmlResource(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- }
-
- public JpaXmlResource getMappingFileXmlResource(String fileName) {
- return (JpaXmlResource) this.getResourceModel(fileName, JptCorePlugin.MAPPING_FILE_CONTENT_TYPE);
- }
-
- /**
- * If the specified file exists, is significant to the JPA project, and its
- * content is a "kind of" the specified content type, return the JPA
- * resource model corresponding to the file; otherwise, return null.
- */
- protected JpaResourceModel getResourceModel(String fileName, IContentType contentType) {
- IFile file = this.convertToPlatformFile(fileName);
- return 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 JpaResourceModel getResourceModel(IFile file, IContentType contentType) {
- JpaFile jpaFile = this.getJpaFile(file);
- return (jpaFile == null) ? null : jpaFile.getResourceModel(contentType);
- }
-
-
- // ********** annotated Java source classes **********
-
- public Iterator<String> annotatedJavaSourceClassNames() {
- return this.getAnnotatedJavaSourceClassNames().iterator();
- }
-
- protected Iterable<String> getAnnotatedJavaSourceClassNames() {
- return new TransformationIterable<JavaResourcePersistentType, String>(this.getInternalAnnotatedSourceJavaResourcePersistentTypes()) {
- @Override
- protected String transform(JavaResourcePersistentType jrpType) {
- return jrpType.getQualifiedName();
- }
- };
- }
-
- /**
- * return only those valid annotated Java resource persistent types that are part of the
- * JPA project, ignoring those in JARs referenced in persistence.xml
- * @see org.eclipse.jpt.core.internal.utility.jdt.JPTTools#typeIsPersistable(org.eclipse.jpt.core.internal.utility.jdt.JPTTools.TypeAdapter)
- */
- protected Iterable<JavaResourcePersistentType> getInternalAnnotatedSourceJavaResourcePersistentTypes() {
- return new FilteringIterable<JavaResourcePersistentType, JavaResourcePersistentType>(this.getInternalSourceJavaResourcePersistentTypes()) {
- @Override
- protected boolean accept(JavaResourcePersistentType jrpType) {
- return jrpType.isPersistable() && jrpType.isAnnotated(); // i.e. the type is valid and has a valid type annotation
- }
- };
- }
-
- public Iterator<String> mappedJavaSourceClassNames() {
- return this.getMappedJavaSourceClassNames().iterator();
- }
-
- protected Iterable<String> getMappedJavaSourceClassNames() {
- return new TransformationIterable<JavaResourcePersistentType, String>(this.getInternalMappedSourceJavaResourcePersistentTypes()) {
- @Override
- protected String transform(JavaResourcePersistentType jrpType) {
- return jrpType.getQualifiedName();
- }
- };
- }
-
- /**
- * return only those valid "mapped" (i.e. annotated with @Entity, @Embeddable, etc.) Java
- * resource persistent types that are part of the JPA project, ignoring those in JARs
- * referenced in persistence.xml
- */
- protected Iterable<JavaResourcePersistentType> getInternalMappedSourceJavaResourcePersistentTypes() {
- return new FilteringIterable<JavaResourcePersistentType, JavaResourcePersistentType>(this.getInternalAnnotatedSourceJavaResourcePersistentTypes()) {
- @Override
- protected boolean accept(JavaResourcePersistentType jrpType) {
- return jrpType.isMapped(); // i.e. the type is already persistable and annotated
- }
- };
- }
-
- /**
- * return only those Java resource persistent types that are
- * part of the JPA project, ignoring those in JARs referenced in persistence.xml
- */
- protected Iterable<JavaResourcePersistentType> getInternalSourceJavaResourcePersistentTypes() {
- return new CompositeIterable<JavaResourcePersistentType>(this.getInternalSourceJavaResourcePersistentTypeSets());
- }
-
- /**
- * return only those Java resource persistent types that are
- * part of the JPA project, ignoring those in JARs referenced in persistence.xml
- */
- protected Iterable<Iterable<JavaResourcePersistentType>> getInternalSourceJavaResourcePersistentTypeSets() {
- return new TransformationIterable<JavaResourceCompilationUnit, Iterable<JavaResourcePersistentType>>(this.getInternalJavaResourceCompilationUnits()) {
- @Override
- protected Iterable<JavaResourcePersistentType> transform(final JavaResourceCompilationUnit compilationUnit) {
- return new Iterable<JavaResourcePersistentType>() {
- public Iterator<JavaResourcePersistentType> iterator() {
- return compilationUnit.persistentTypes(); // *all* the types in the compilation unit
- }
- };
- }
- };
- }
-
- protected Iterable<JavaResourceCompilationUnit> getInternalJavaResourceCompilationUnits() {
- return new TransformationIterable<JpaFile, JavaResourceCompilationUnit>(this.getJavaSourceJpaFiles()) {
- @Override
- protected JavaResourceCompilationUnit transform(JpaFile jpaFile) {
- return (JavaResourceCompilationUnit) jpaFile.getResourceModel();
- }
- };
- }
-
- /**
- * return JPA files with Java source "content"
- */
- protected Iterable<JpaFile> getJavaSourceJpaFiles() {
- return this.getJpaFiles(JptCorePlugin.JAVA_SOURCE_CONTENT_TYPE);
- }
-
-
- // ********** Java resource persistent type look-up **********
-
- public JavaResourcePersistentType getJavaResourcePersistentType(String typeName) {
- for (JavaResourcePersistentType jrpType : this.getPersistableJavaResourcePersistentTypes()) {
- if (jrpType.getQualifiedName().equals(typeName)) {
- return jrpType;
- }
- }
- // if we don't have a type already, try to build new one from the project classpath
- return this.buildPersistableExternalJavaResourcePersistentType(typeName);
- }
-
- /**
- * return *all* the "persistable" Java resource persistent types, including those in JARs referenced in
- * persistence.xml
- * @see org.eclipse.jpt.core.internal.utility.jdt.JPTTools#typeIsPersistable(org.eclipse.jpt.core.internal.utility.jdt.JPTTools.TypeAdapter)
- */
- protected Iterable<JavaResourcePersistentType> getPersistableJavaResourcePersistentTypes() {
- return new FilteringIterable<JavaResourcePersistentType, JavaResourcePersistentType>(this.getJavaResourcePersistentTypes()) {
- @Override
- protected boolean accept(JavaResourcePersistentType jrpType) {
- return jrpType.isPersistable();
- }
- };
- }
-
- /**
- * return *all* the Java resource persistent types, including those in JARs referenced in
- * persistence.xml
- */
- protected Iterable<JavaResourcePersistentType> getJavaResourcePersistentTypes() {
- return new CompositeIterable<JavaResourcePersistentType>(this.getJavaResourcePersistentTypeSets());
- }
-
- /**
- * return *all* the Java resource persistent types, including those in JARs referenced in
- * persistence.xml
- */
- protected Iterable<Iterable<JavaResourcePersistentType>> getJavaResourcePersistentTypeSets() {
- return new TransformationIterable<JavaResourceNode.Root, Iterable<JavaResourcePersistentType>>(this.getJavaResourceNodeRoots()) {
- @Override
- protected Iterable<JavaResourcePersistentType> transform(final JavaResourceNode.Root root) {
- return new Iterable<JavaResourcePersistentType>() {
- public Iterator<JavaResourcePersistentType> iterator() {
- return root.persistentTypes(); // *all* the types held by the root
- }
- };
- }
- };
- }
-
- @SuppressWarnings("unchecked")
- protected Iterable<JavaResourceNode.Root> getJavaResourceNodeRoots() {
- return new CompositeIterable<JavaResourceNode.Root>(
- this.getInternalJavaResourceCompilationUnits(),
- this.getInternalJavaResourcePackageFragmentRoots(),
- this.getExternalJavaResourceCompilationUnits(),
- Collections.singleton(this.externalJavaResourcePersistentTypeCache)
- );
- }
-
-
- // ********** 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"
- */
- protected Iterable<JpaFile> getJarJpaFiles() {
- return this.getJpaFiles(JptCorePlugin.JAR_CONTENT_TYPE);
- }
-
-
- // ********** metamodel **********
-
- public Iterable<JavaResourcePersistentType2_0> getGeneratedMetamodelTypes() {
- if (this.metamodelSourceFolderName == null) {
- return EmptyIterable.instance();
- }
- final IPackageFragmentRoot genSourceFolder = this.getMetamodelPackageFragmentRoot();
- return new FilteringIterable<JavaResourcePersistentType, JavaResourcePersistentType2_0>(this.getInternalSourceJavaResourcePersistentTypes()) {
- @Override
- protected boolean accept(JavaResourcePersistentType jrpt) {
- return ((JavaResourcePersistentType2_0) jrpt).isGeneratedMetamodel(genSourceFolder);
- }
- };
- }
-
- public JavaResourcePersistentType2_0 getGeneratedMetamodelType(IFile file) {
- JavaResourceCompilationUnit jrcu = this.getJavaResourceCompilationUnit(file);
- if (jrcu == null) {
- return null; // hmmm...
- }
- Iterator<JavaResourcePersistentType> types = jrcu.persistentTypes();
- if ( ! types.hasNext()) {
- return null; // no types in the file
- }
- JavaResourcePersistentType2_0 jrpt = (JavaResourcePersistentType2_0) types.next();
- if (types.hasNext()) {
- return null; // should have only a single type in the file
- }
- return jrpt.isGeneratedMetamodel() ? jrpt : null;
- }
-
- protected JavaResourceCompilationUnit getJavaResourceCompilationUnit(IFile file) {
- return (JavaResourceCompilationUnit) this.getResourceModel(file, JptCorePlugin.JAVA_SOURCE_CONTENT_TYPE);
- }
-
- public String getMetamodelSourceFolderName() {
- return this.metamodelSourceFolderName;
- }
-
- public void setMetamodelSourceFolderName(String metamodelSourceFolderName) {
- String old = this.metamodelSourceFolderName;
- this.metamodelSourceFolderName = metamodelSourceFolderName;
- if (this.attributeValueHasChanged(old, metamodelSourceFolderName)) {
- JptCorePlugin.setMetamodelSourceFolderName(this.project, metamodelSourceFolderName);
- this.firePropertyChanged(METAMODEL_SOURCE_FOLDER_NAME_PROPERTY, old, metamodelSourceFolderName);
- if (metamodelSourceFolderName == null) {
- this.disposeMetamodel();
- } else {
- this.initializeMetamodel();
- }
- }
- }
-
- public void initializeMetamodel() {
- if (this.isJpa2_0Compatible()) {
- ((JpaRootContextNode2_0) this.rootContextNode).initializeMetamodel();
- }
- }
-
- /**
- * Synchronize the metamodel for 2.0-compatible JPA projects.
- */
- public void synchronizeMetamodel() {
- if (this.isJpa2_0Compatible()) {
- if (this.metamodelSourceFolderName != null) {
- ((JpaRootContextNode2_0) this.rootContextNode).synchronizeMetamodel();
- }
- }
- }
-
- public void disposeMetamodel() {
- if (this.isJpa2_0Compatible()) {
- ((JpaRootContextNode2_0) this.rootContextNode).disposeMetamodel();
- }
- }
-
- public IPackageFragmentRoot getMetamodelPackageFragmentRoot() {
- return this.getJavaProject().getPackageFragmentRoot(this.getMetaModelSourceFolder());
- }
-
- protected IFolder getMetaModelSourceFolder() {
- return this.getProject().getFolder(this.metamodelSourceFolderName);
- }
-
- /**
- * If the metamodel source folder is no longer a Java project source
- * folder, clear it out.
- */
- protected void checkMetamodelSourceFolderName() {
- if (this.metamodelSoureFolderNameIsInvalid()) {
- this.setMetamodelSourceFolderName(null);
- }
- }
-
- protected boolean metamodelSoureFolderNameIsInvalid() {
- return ! this.metamodelSourceFolderNameIsValid();
- }
-
- protected boolean metamodelSourceFolderNameIsValid() {
- return CollectionTools.contains(this.getJavaSourceFolderNames(), this.metamodelSourceFolderName);
- }
-
-
- // ********** Java source folder names **********
-
- public Iterable<String> getJavaSourceFolderNames() {
- try {
- return this.getJavaSourceFolderNames_();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return EmptyIterable.instance();
- }
- }
-
- protected Iterable<String> getJavaSourceFolderNames_() throws JavaModelException {
- return new TransformationIterable<IPackageFragmentRoot, String>(this.getJavaSourceFolders()) {
- @Override
- protected String transform(IPackageFragmentRoot pfr) {
- try {
- return this.transform_(pfr);
- } catch (JavaModelException ex) {
- return "Error: " + pfr.getPath(); //$NON-NLS-1$
- }
- }
- private String transform_(IPackageFragmentRoot pfr) throws JavaModelException {
- return pfr.getUnderlyingResource().getProjectRelativePath().toString();
- }
- };
- }
-
- protected Iterable<IPackageFragmentRoot> getJavaSourceFolders() throws JavaModelException {
- return new FilteringIterable<IPackageFragmentRoot, 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 CHANGED
- * (as opposed to ADDED or REMOVED) Java element and the specified flag is set.
- * (The delta flags are only significant if the delta "kind" is 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.update(this.getInternalJavaResourceCompilationUnits());
- } else {
- // TODO see if changed project is on our classpath?
- this.update(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.getJavaProject().isOnClasspath(jpaFile.getFile())) {
- this.removeJpaFile(jpaFile);
- }
- }
- }
-
- /**
- * pre-condition: delta.getElement().getElementType() == IJavaElement.JAVA_PROJECT
- */
- protected boolean classpathHasChanged(IJavaElementDelta delta) {
- return this.deltaFlagIsSet(delta, IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED);
- }
-
- protected void update(Iterable<JavaResourceCompilationUnit> javaResourceCompilationUnits) {
- for (JavaResourceCompilationUnit javaResourceCompilationUnit : javaResourceCompilationUnits) {
- javaResourceCompilationUnit.update();
- }
- }
-
- // ***** 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
- } else if (this.classpathEntryHasBeenRemoved(delta)) { // should be mutually-exclusive w/added (?)
- // TODO
- }
- }
-
- /**
- * 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.update();
- // TODO ? this.resolveJavaTypes(); // might have new member types now...
- break; // there *shouldn't* be any more...
- }
- }
- }
- // ignore the java compilation unit's children
- }
-
- protected boolean javaCompilationUnitDeltaIsRelevant(IJavaElementDelta delta) {
- // ignore changes to/from primary working copy - no content has changed;
- // and make sure there are no other flags set that indicate *both* a
- // change to/from primary working copy *and* content has changed
- if (BitTools.onlyFlagIsSet(delta.getFlags(), IJavaElementDelta.F_PRIMARY_WORKING_COPY)) {
- return false;
- }
-
- // ignore java notification for ADDED or REMOVED;
- // these are handled via resource notification
- return delta.getKind() == IJavaElementDelta.CHANGED;
- }
-
-
- // ********** validation **********
-
- public Iterator<IMessage> validationMessages(IReporter reporter) {
- List<IMessage> messages = new ArrayList<IMessage>();
- this.validate(messages, reporter);
- return messages.iterator();
- }
-
- protected void validate(List<IMessage> messages, IReporter reporter) {
- if (reporter.isCancelled()) {
- throw new ValidationCancelledException();
- }
- this.validateConnection(messages);
- this.rootContextNode.validate(messages, reporter);
- }
-
- 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.updater.stop();
- this.dataSource.dispose();
- }
-
-
- // ********** resource model listener **********
-
- protected class DefaultResourceModelListener implements JpaResourceModelListener {
- protected DefaultResourceModelListener() {
- super();
- }
- public void resourceModelChanged() {
- AbstractJpaProject.this.update();
- }
- }
-
-
- // ********** 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) {
- 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 ResourceDeltaVisitor() {
- @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 ResourceDeltaVisitor() {
- @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(JptCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
- return true;
- }
- if (contentType.equals(JptCorePlugin.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(JptCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
- return this.removeExternalJavaResourceCompilationUnit(file);
- }
- if (contentType.equals(JptCorePlugin.JAR_CONTENT_TYPE)) {
- return this.externalJavaResourcePersistentTypeCache.removePersistentTypes(file);
- }
- return false;
- }
-
- protected void resolveExternalJavaTypes() {
- for (JavaResourceCompilationUnit jrcu : this.getExternalJavaResourceCompilationUnits()) {
- jrcu.resolveTypes();
- }
- }
-
- // ***** resource delta visitors
- /**
- * add or remove a JPA file for every [appropriate] file encountered by the visitor
- */
- protected abstract class ResourceDeltaVisitor implements IResourceDeltaVisitor {
- protected boolean encounteredSignificantChange = false;
-
- protected ResourceDeltaVisitor() {
- super();
- }
-
- protected void visitDelta(IResourceDelta delta) {
- try {
- delta.accept(this);
- } catch (CoreException ex) {
- // shouldn't happen - we don't throw any CoreExceptions
- throw new RuntimeException(ex);
- }
- }
-
- public boolean visit(IResourceDelta delta) {
- IResource res = delta.getResource();
- switch (res.getType()) {
- case IResource.ROOT :
- return true; // visit children
- case IResource.PROJECT :
- return true; // visit children
- case IResource.FOLDER :
- return true; // visit children
- case IResource.FILE :
- this.fileChanged((IFile) res, delta.getKind());
- return false; // no children
- default :
- return false; // no children (probably shouldn't get here...)
- }
- }
-
- protected void fileChanged(IFile file, int deltaKind) {
- if (this.fileChangeIsSignificant(file, deltaKind)) {
- this.encounteredSignificantChange = true;
- }
- }
-
- protected abstract boolean fileChangeIsSignificant(IFile file, int deltaKind);
-
- /**
- * Return whether the visitor encountered some sort of "significant"
- * change while traversing the IResourceDelta
- * (e.g. a JPA file was added or removed).
- */
- protected boolean encounteredSignificantChange() {
- return this.encounteredSignificantChange;
- }
-
- }
-
-
- // ********** support for modifying documents shared with the UI **********
-
- public void setThreadLocalModifySharedDocumentCommandExecutor(CommandExecutor commandExecutor) {
- this.modifySharedDocumentCommandExecutor.set(commandExecutor);
- }
-
- public CommandExecutor getModifySharedDocumentCommandExecutor() {
- return this.modifySharedDocumentCommandExecutor;
- }
-
-
- // ********** project "update" **********
-
- public Updater getUpdater() {
- return this.updater;
- }
-
- public void setUpdater(Updater updater) {
- if (updater == null) {
- throw new NullPointerException();
- }
- this.updater.stop();
- this.setUpdater_(updater);
- }
-
- protected void setUpdater_(Updater updater) {
- this.updater = updater;
- this.updater.start();
- }
-
- /**
- * Delegate to the updater so clients can configure how updates occur.
- */
- public void update() {
- this.updater.update();
- }
-
- /**
- * Called by the updater.
- */
- public IStatus update(IProgressMonitor monitor) {
- this.update_(monitor);
- return Status.OK_STATUS;
- }
-
- protected void update_(IProgressMonitor monitor) {
- this.rootContextNode.update(monitor);
- this.rootContextNode.postUpdate();
- }
-
- /**
- * Also called by the updater.
- */
- public void updateQuiesced() {
- this.synchronizeMetamodel();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractSynchronizerJpaProjectUpdater.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractSynchronizerJpaProjectUpdater.java
deleted file mode 100644
index 462af6962c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractSynchronizerJpaProjectUpdater.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.synchronizers.CallbackSynchronizer;
-
-/**
- * Adapt the "callback synchronizer" interface to the JPA project "updater"
- * interface.
- * <p>
- * Subclasses are to build the appropriate callback synchronizer.
- */
-public abstract class AbstractSynchronizerJpaProjectUpdater
- implements JpaProject.Updater
-{
- protected final JpaProject jpaProject;
- protected final CallbackSynchronizer synchronizer;
-
-
- protected AbstractSynchronizerJpaProjectUpdater(JpaProject jpaProject) {
- super();
- this.jpaProject = jpaProject;
- this.synchronizer = this.buildSynchronizer();
- this.synchronizer.addListener(this.buildCallbackSynchronizerListener());
- }
-
- protected abstract CallbackSynchronizer buildSynchronizer();
-
- protected CallbackSynchronizer.Listener buildCallbackSynchronizerListener() {
- return new CallbackSynchronizer.Listener() {
- public void synchronizationQuiesced(CallbackSynchronizer s) {
- AbstractSynchronizerJpaProjectUpdater.this.jpaProject.updateQuiesced();
- }
- };
- }
-
-
- // ********** JpaProject.Updater implementation **********
-
- public void start() {
- this.synchronizer.start();
- }
-
- // recursion: we come back here if IJpaProject#update() is called again, during the "update"
- public void update() {
- this.synchronizer.synchronize();
- }
-
- public void stop() {
- this.synchronizer.stop();
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.synchronizer);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AsynchronousJpaProjectUpdater.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AsynchronousJpaProjectUpdater.java
deleted file mode 100644
index a0f67a1386..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AsynchronousJpaProjectUpdater.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.internal.utility.CallbackJobSynchronizer;
-import org.eclipse.jpt.core.internal.utility.JobCommand;
-import org.eclipse.jpt.utility.internal.synchronizers.CallbackSynchronizer;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Adapt the "callback synchronizer" interface to the JPA project "updater"
- * interface.
- * <p>
- * This updater will "update" the JPA project in an Eclipse job that executes
- * in a separate thread allowing calls to {@link JpaProject.Updater#update()}
- * to return immediately.
- */
-public class AsynchronousJpaProjectUpdater
- extends AbstractSynchronizerJpaProjectUpdater
-{
- public AsynchronousJpaProjectUpdater(JpaProject jpaProject) {
- super(jpaProject);
- }
-
- @Override
- protected CallbackSynchronizer buildSynchronizer() {
- return new CallbackJobSynchronizer(
- this.buildJobName(),
- this.buildJobCommand(),
- this.buildJobSchedulingRule()
- );
- }
-
- protected String buildJobName() {
- return NLS.bind(JptCoreMessages.UPDATE_JOB_NAME, this.jpaProject.getName());
- }
-
- protected JobCommand buildJobCommand() {
- return new JobCommand() {
- public IStatus execute(IProgressMonitor monitor) {
- return AsynchronousJpaProjectUpdater.this.jpaProject.update(monitor);
- }
- };
- }
-
- protected ISchedulingRule buildJobSchedulingRule() {
- return this.jpaProject.getProject();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java
deleted file mode 100644
index 6e622115a7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import org.eclipse.jpt.core.EntityGeneratorDatabaseAnnotationNameBuilder;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.db.ForeignKey;
-import org.eclipse.jpt.db.Table;
-
-/**
- * Singleton that delegates to the db object passed in.
- */
-public final class GenericEntityGeneratorDatabaseAnnotationNameBuilder
- implements EntityGeneratorDatabaseAnnotationNameBuilder
-{
- public static final EntityGeneratorDatabaseAnnotationNameBuilder INSTANCE
- = new GenericEntityGeneratorDatabaseAnnotationNameBuilder();
-
- public static EntityGeneratorDatabaseAnnotationNameBuilder instance() {
- return INSTANCE;
- }
-
- // ensure single instance
- private GenericEntityGeneratorDatabaseAnnotationNameBuilder() {
- super();
- }
-
- public String buildTableAnnotationName(String entityName, Table table) {
- return table.getIdentifier(entityName);
- }
-
- public String buildColumnAnnotationName(String attributeName, Column column) {
- return column.getIdentifier(attributeName);
- }
-
- public String buildJoinColumnAnnotationName(String attributeName, ForeignKey foreignKey) {
- return foreignKey.getJoinColumnAnnotationIdentifier(attributeName);
- }
-
- public String buildJoinColumnAnnotationName(Column column) {
- return column.getIdentifier();
- }
-
- public String buildJoinTableAnnotationName(Table table) {
- return table.getIdentifier();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaAnnotationDefinitionProvider.java
deleted file mode 100644
index 72d17468fb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaAnnotationDefinitionProvider.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import java.util.List;
-import org.eclipse.jpt.core.JpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.core.internal.resource.java.AssociationOverrideAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.AssociationOverridesAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.AttributeOverrideAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.AttributeOverridesAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.BasicAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.ColumnAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.DiscriminatorColumnAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.DiscriminatorValueAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.EmbeddableAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.EmbeddedAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.EmbeddedIdAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.EntityAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.EnumeratedAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.GeneratedValueAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.IdAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.IdClassAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.InheritanceAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.JoinColumnAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.JoinColumnsAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.JoinTableAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.LobAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.ManyToManyAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.ManyToOneAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.MapKeyAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.MappedSuperclassAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.NamedNativeQueriesAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.NamedNativeQueryAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.NamedQueriesAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.NamedQueryAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.OneToManyAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.OneToOneAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.OrderByAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumnAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumnsAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.SecondaryTableAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.SecondaryTablesAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.SequenceGeneratorAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.TableAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.TableGeneratorAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.TemporalAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.TransientAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.VersionAnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-
-public class GenericJpaAnnotationDefinitionProvider
- extends AbstractJpaAnnotationDefintionProvider
-{
- // singleton
- private static final JpaAnnotationDefinitionProvider INSTANCE =
- new GenericJpaAnnotationDefinitionProvider();
-
-
- /**
- * Return the singleton
- */
- public static JpaAnnotationDefinitionProvider instance() {
- return INSTANCE;
- }
-
-
- /**
- * Ensure singleton usage
- */
- protected GenericJpaAnnotationDefinitionProvider() {
- super();
- }
-
-
- @Override
- protected void addTypeAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) {
- definitions.add(AssociationOverrideAnnotationDefinition.instance());
- definitions.add(AssociationOverridesAnnotationDefinition.instance());
- definitions.add(AttributeOverrideAnnotationDefinition.instance());
- definitions.add(AttributeOverridesAnnotationDefinition.instance());
- definitions.add(DiscriminatorColumnAnnotationDefinition.instance());
- definitions.add(DiscriminatorValueAnnotationDefinition.instance());
- definitions.add(EmbeddableAnnotationDefinition.instance());
- definitions.add(EntityAnnotationDefinition.instance());
- definitions.add(IdClassAnnotationDefinition.instance());
- definitions.add(InheritanceAnnotationDefinition.instance());
- definitions.add(MappedSuperclassAnnotationDefinition.instance());
- definitions.add(NamedQueryAnnotationDefinition.instance());
- definitions.add(NamedQueriesAnnotationDefinition.instance());
- definitions.add(NamedNativeQueryAnnotationDefinition.instance());
- definitions.add(NamedNativeQueriesAnnotationDefinition.instance());
- definitions.add(PrimaryKeyJoinColumnAnnotationDefinition.instance());
- definitions.add(PrimaryKeyJoinColumnsAnnotationDefinition.instance());
- definitions.add(SecondaryTableAnnotationDefinition.instance());
- definitions.add(SecondaryTablesAnnotationDefinition.instance());
- definitions.add(SequenceGeneratorAnnotationDefinition.instance());
- definitions.add(TableAnnotationDefinition.instance());
- definitions.add(TableGeneratorAnnotationDefinition.instance());
- }
-
- @Override
- protected void addTypeMappingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) {
- definitions.add(EmbeddableAnnotationDefinition.instance());
- definitions.add(EntityAnnotationDefinition.instance());
- definitions.add(MappedSuperclassAnnotationDefinition.instance());
- }
-
- @Override
- protected void addAttributeAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) {
- definitions.add(AssociationOverrideAnnotationDefinition.instance());
- definitions.add(AssociationOverridesAnnotationDefinition.instance());
- definitions.add(AttributeOverrideAnnotationDefinition.instance());
- definitions.add(AttributeOverridesAnnotationDefinition.instance());
- definitions.add(BasicAnnotationDefinition.instance());
- definitions.add(ColumnAnnotationDefinition.instance());
- definitions.add(EmbeddedAnnotationDefinition.instance());
- definitions.add(EmbeddedIdAnnotationDefinition.instance());
- definitions.add(EnumeratedAnnotationDefinition.instance());
- definitions.add(GeneratedValueAnnotationDefinition.instance());
- definitions.add(IdAnnotationDefinition.instance());
- definitions.add(JoinColumnAnnotationDefinition.instance());
- definitions.add(JoinColumnsAnnotationDefinition.instance());
- definitions.add(JoinTableAnnotationDefinition.instance());
- definitions.add(LobAnnotationDefinition.instance());
- definitions.add(ManyToManyAnnotationDefinition.instance());
- definitions.add(ManyToOneAnnotationDefinition.instance());
- definitions.add(MapKeyAnnotationDefinition.instance());
- definitions.add(OneToManyAnnotationDefinition.instance());
- definitions.add(OneToOneAnnotationDefinition.instance());
- definitions.add(OrderByAnnotationDefinition.instance());
- definitions.add(PrimaryKeyJoinColumnAnnotationDefinition.instance());
- definitions.add(PrimaryKeyJoinColumnsAnnotationDefinition.instance());
- definitions.add(SequenceGeneratorAnnotationDefinition.instance());
- definitions.add(TableGeneratorAnnotationDefinition.instance());
- definitions.add(TemporalAnnotationDefinition.instance());
- definitions.add(TransientAnnotationDefinition.instance());
- definitions.add(VersionAnnotationDefinition.instance());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaAnnotationProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaAnnotationProvider.java
deleted file mode 100644
index 07794ca782..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaAnnotationProvider.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.JpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.core.JpaAnnotationProvider;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.Type;
-import org.eclipse.jpt.utility.internal.iterators.ArrayListIterator;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-/**
- * Delegate to annotation definition providers.
- * The platform factory will build an instance of this annotation provider,
- * passing in the appropriate array of annotation definition providers necessary
- * to build the annotations for the platform (vendor and/or version).
- */
-public class GenericJpaAnnotationProvider
- implements JpaAnnotationProvider
-{
- private final JpaAnnotationDefinitionProvider[] annotationDefinitionProviders;
-
- public GenericJpaAnnotationProvider(JpaAnnotationDefinitionProvider... annotationDefinitionProviders) {
- super();
- this.annotationDefinitionProviders = annotationDefinitionProviders;
- }
-
-
- // ********** convenience methods **********
-
- protected Iterator<String> annotationNames(Iterator<AnnotationDefinition> annotationDefinitions) {
- return new TransformationIterator<AnnotationDefinition, String>(annotationDefinitions) {
- @Override
- protected String transform(AnnotationDefinition annotationDefinition) {
- return annotationDefinition.getAnnotationName();
- }
- };
- }
-
- protected AnnotationDefinition selectAnnotationDefinition(Iterator<AnnotationDefinition> annotationDefinitions, String annotationName) {
- while (annotationDefinitions.hasNext()) {
- AnnotationDefinition annotationDefinition = annotationDefinitions.next();
- if (annotationDefinition.getAnnotationName().equals(annotationName)) {
- return annotationDefinition;
- }
- }
- return null;
- }
-
-
- // ********** annotation definition providers **********
-
- protected ListIterator<JpaAnnotationDefinitionProvider> annotationDefinitionProviders() {
- return new ArrayListIterator<JpaAnnotationDefinitionProvider>(this.annotationDefinitionProviders);
- }
-
-
- // ********** type annotations **********
-
- public Iterator<String> typeAnnotationNames() {
- return this.annotationNames(this.typeAnnotationDefinitions());
- }
-
- protected Iterator<AnnotationDefinition> typeAnnotationDefinitions() {
- return new CompositeIterator<AnnotationDefinition> (
- new TransformationIterator<JpaAnnotationDefinitionProvider, Iterator<AnnotationDefinition>>(this.annotationDefinitionProviders()) {
- @Override
- protected Iterator<AnnotationDefinition> transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) {
- return annotationDefinitionProvider.typeAnnotationDefinitions();
- }
- }
- );
- }
-
- public Iterator<String> typeMappingAnnotationNames() {
- return this.annotationNames(typeMappingAnnotationDefinitions());
- }
-
- protected Iterator<AnnotationDefinition> typeMappingAnnotationDefinitions() {
- return new CompositeIterator<AnnotationDefinition> (
- new TransformationIterator<JpaAnnotationDefinitionProvider, Iterator<AnnotationDefinition>>(this.annotationDefinitionProviders()) {
- @Override
- protected Iterator<AnnotationDefinition> transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) {
- return annotationDefinitionProvider.typeMappingAnnotationDefinitions();
- }
- }
- );
- }
-
- public Annotation buildTypeAnnotation(JavaResourcePersistentType parent, Type type, String annotationName) {
- return this.getTypeAnnotationDefinition(annotationName).buildAnnotation(parent, type);
- }
-
- public Annotation buildTypeAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
- return this.getTypeAnnotationDefinition(jdtAnnotation.getElementName()).buildAnnotation(parent, jdtAnnotation);
- }
-
- protected AnnotationDefinition getTypeAnnotationDefinition(String annotationName) {
- AnnotationDefinition annotationDefinition = this.selectAnnotationDefinition(this.typeAnnotationDefinitions(), annotationName);
- if (annotationDefinition == null) {
- throw new IllegalArgumentException("unsupported type annotation: " + annotationName); //$NON-NLS-1$
- }
- return annotationDefinition;
- }
-
- public Annotation buildNullTypeAnnotation(JavaResourcePersistentType parent, String annotationName) {
- return this.getTypeAnnotationDefinition(annotationName).buildNullAnnotation(parent);
- }
-
-
- // ********** attribute annotations **********
-
- public Iterator<String> attributeAnnotationNames() {
- return this.annotationNames(attributeAnnotationDefinitions());
- }
-
- protected Iterator<AnnotationDefinition> attributeAnnotationDefinitions() {
- return new CompositeIterator<AnnotationDefinition> (
- new TransformationIterator<JpaAnnotationDefinitionProvider, Iterator<AnnotationDefinition>>(this.annotationDefinitionProviders()) {
- @Override
- protected Iterator<AnnotationDefinition> transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) {
- return annotationDefinitionProvider.attributeAnnotationDefinitions();
- }
- }
- );
- }
-
- public Annotation buildAttributeAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute, String annotationName) {
- return this.getAttributeAnnotationDefinition(annotationName).buildAnnotation(parent, attribute);
- }
-
- public Annotation buildAttributeAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
- return this.getAttributeAnnotationDefinition(jdtAnnotation.getElementName()).buildAnnotation(parent, jdtAnnotation);
- }
-
- public Annotation buildNullAttributeAnnotation(JavaResourcePersistentAttribute parent, String annotationName) {
- return this.getAttributeAnnotationDefinition(annotationName).buildNullAnnotation(parent);
- }
-
- protected AnnotationDefinition getAttributeAnnotationDefinition(String annotationName) {
- AnnotationDefinition annotationDefinition = this.selectAnnotationDefinition(this.attributeAnnotationDefinitions(), annotationName);
- if (annotationDefinition == null) {
- throw new IllegalArgumentException("unsupported attribute annotation: " + annotationName); //$NON-NLS-1$
- }
- return annotationDefinition;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatform.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatform.java
deleted file mode 100644
index 5e4f16a1a0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatform.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import java.util.ListIterator;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.EntityGeneratorDatabaseAnnotationNameBuilder;
-import org.eclipse.jpt.core.JpaAnnotationProvider;
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.JpaFile;
-import org.eclipse.jpt.core.JpaPlatform;
-import org.eclipse.jpt.core.JpaPlatformProvider;
-import org.eclipse.jpt.core.JpaPlatformVariation;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JpaResourceModel;
-import org.eclipse.jpt.core.JpaResourceModelProvider;
-import org.eclipse.jpt.core.JpaResourceType;
-import org.eclipse.jpt.core.ResourceDefinition;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.core.internal.utility.PlatformTools;
-import org.eclipse.jpt.core.internal.utility.jdt.DefaultAnnotationEditFormatter;
-import org.eclipse.jpt.core.utility.jdt.AnnotationEditFormatter;
-import org.eclipse.jpt.db.ConnectionProfileFactory;
-import org.eclipse.jpt.db.DatabaseFinder;
-import org.eclipse.jpt.db.JptDbPlugin;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.Tools;
-
-/**
- * All the state in the JPA platform should be "static" (i.e. unchanging once
- * it is initialized).
- */
-public class GenericJpaPlatform
- implements JpaPlatform
-{
- private final String id;
-
- private final Version jpaVersion;
-
- private final JpaFactory jpaFactory;
-
- private final JpaAnnotationProvider annotationProvider;
-
- private final JpaPlatformProvider platformProvider;
-
- private final JpaPlatformVariation jpaVariation;
-
-
- public GenericJpaPlatform(String id, Version jpaVersion, JpaFactory jpaFactory, JpaAnnotationProvider jpaAnnotationProvider, JpaPlatformProvider platformProvider, JpaPlatformVariation jpaVariation) {
- super();
- this.id = id;
- this.jpaVersion = jpaVersion;
- this.jpaFactory = jpaFactory;
- this.annotationProvider = jpaAnnotationProvider;
- this.jpaVariation = jpaVariation;
- this.platformProvider = platformProvider;
- }
-
-
- public String getId() {
- return this.id;
- }
-
- 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) {
- JpaResourceModel resourceModel = this.buildResourceModel(jpaProject, file, contentType);
- return (resourceModel == null) ? null : this.jpaFactory.buildJpaFile(jpaProject, file, contentType, resourceModel);
- }
-
- protected JpaResourceModel 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 : CollectionTools.iterable(resourceModelProviders())) {
- if (contentType.equals(provider.getContentType())) {
- return provider;
- }
- }
- return null;
- }
-
- protected ListIterator<JpaResourceModelProvider> resourceModelProviders() {
- return this.platformProvider.resourceModelProviders();
- }
-
-
- // ********** Java annotations **********
-
- public JpaAnnotationProvider getAnnotationProvider() {
- return this.annotationProvider;
- }
-
- public AnnotationEditFormatter getAnnotationEditFormatter() {
- return DefaultAnnotationEditFormatter.instance();
- }
-
-
- // ********** Java type mappings **********
-
- public JavaTypeMappingDefinition getJavaTypeMappingDefinition(JavaPersistentType type) {
- for (JavaTypeMappingDefinition definition :
- CollectionTools.iterable(javaTypeMappingDefinitions())) {
- if (definition.test(type)) {
- return definition;
- }
- }
- throw new IllegalStateException("There must be a mapping definition for all types"); //$NON-NLS-1$
- }
-
- public JavaTypeMappingDefinition getJavaTypeMappingDefinition(String mappingKey) {
- for (JavaTypeMappingDefinition definition :
- CollectionTools.iterable(javaTypeMappingDefinitions())) {
- if (Tools.valuesAreEqual(definition.getKey(), mappingKey)) {
- return definition;
- }
- }
- throw new IllegalArgumentException("Illegal type mapping key: " + mappingKey); //$NON-NLS-1$
- }
-
- protected ListIterator<JavaTypeMappingDefinition> javaTypeMappingDefinitions() {
- return this.platformProvider.javaTypeMappingDefinitions();
- }
-
-
- // ********** Java attribute mappings **********
-
- public JavaAttributeMappingDefinition getDefaultJavaAttributeMappingDefinition(
- JavaPersistentAttribute attribute) {
- for (JavaAttributeMappingDefinition definition :
- CollectionTools.iterable(defaultJavaAttributeMappingDefinitions())) {
- if (definition.testDefault(attribute)) {
- return definition;
- }
- }
- throw new IllegalStateException("There must be a mapping definition for all attributes"); //$NON-NLS-1$
- }
-
- protected ListIterator<JavaAttributeMappingDefinition> defaultJavaAttributeMappingDefinitions() {
- return this.platformProvider.defaultJavaAttributeMappingDefinitions();
- }
-
- public JavaAttributeMappingDefinition getSpecifiedJavaAttributeMappingDefinition(
- JavaPersistentAttribute attribute) {
- for (JavaAttributeMappingDefinition definition :
- CollectionTools.iterable(specifiedJavaAttributeMappingDefinitions())) {
- if (definition.testSpecified(attribute)) {
- return definition;
- }
- }
- throw new IllegalStateException("There must be a mapping definition for all attributes"); //$NON-NLS-1$
- }
-
- protected ListIterator<JavaAttributeMappingDefinition> specifiedJavaAttributeMappingDefinitions() {
- return this.platformProvider.specifiedJavaAttributeMappingDefinitions();
- }
-
- public JavaAttributeMappingDefinition getSpecifiedJavaAttributeMappingDefinition(String mappingKey) {
- for (JavaAttributeMappingDefinition definition :
- CollectionTools.iterable(specifiedJavaAttributeMappingDefinitions())) {
- if (Tools.valuesAreEqual(definition.getKey(), mappingKey)) {
- return definition;
- }
- }
- throw new IllegalArgumentException("Illegal attribute mapping key: " + mappingKey); //$NON-NLS-1$
- }
-
-
- // ********** resource types and definitions **********
-
- public ResourceDefinition getResourceDefinition(JpaResourceType resourceType) {
- for (ResourceDefinition resourceDefinition : CollectionTools.iterable(resourceDefinitions())) {
- if (resourceDefinition.getResourceType().equals(resourceType)) {
- return resourceDefinition;
- }
- }
- throw new IllegalArgumentException("Illegal resource type: " + resourceType); //$NON-NLS-1$
- }
-
- protected ListIterator<ResourceDefinition> resourceDefinitions() {
- return this.platformProvider.resourceDefinitions();
- }
-
- public JpaResourceType getMostRecentSupportedResourceType(IContentType contentType) {
- return this.platformProvider.getMostRecentSupportedResourceType(contentType);
- }
-
-
- // ********** database **********
-
- public ConnectionProfileFactory getConnectionProfileFactory() {
- return JptDbPlugin.instance().getConnectionProfileFactory();
- }
-
- public EntityGeneratorDatabaseAnnotationNameBuilder getEntityGeneratorDatabaseAnnotationNameBuilder() {
- return GenericEntityGeneratorDatabaseAnnotationNameBuilder.instance();
- }
-
- public DatabaseFinder getDatabaseFinder() {
- return DatabaseFinder.Default.instance();
- }
-
-
- // ********** validation **********
-
- public JpaPlatformVariation getJpaVariation() {
- return this.jpaVariation;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatformFactory.java
deleted file mode 100644
index dbd21b794c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatformFactory.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import java.util.Comparator;
-
-import org.eclipse.jpt.core.JpaPlatform;
-import org.eclipse.jpt.core.JpaPlatformFactory;
-import org.eclipse.jpt.core.JpaPlatformVariation;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.jpa1.GenericJpaFactory;
-import org.eclipse.wst.common.project.facet.core.DefaultVersionComparator;
-
-/**
- * All the state in the JPA platform should be "static" (i.e. unchanging once
- * it is initialized).
- */
-public class GenericJpaPlatformFactory
- implements JpaPlatformFactory
-{
- /**
- * zero-argument constructor
- */
- public GenericJpaPlatformFactory() {
- super();
- }
-
- public JpaPlatform buildJpaPlatform(String id) {
- return new GenericJpaPlatform(
- id,
- this.buildJpaVersion(),
- new GenericJpaFactory(),
- new GenericJpaAnnotationProvider(GenericJpaAnnotationDefinitionProvider.instance()),
- GenericJpaPlatformProvider.instance(),
- this.buildJpaPlatformVariation());
- }
-
-
- private JpaPlatform.Version buildJpaVersion() {
- return new SimpleVersion(JptCorePlugin.JPA_FACET_VERSION_1_0);
- }
-
- protected JpaPlatformVariation buildJpaPlatformVariation() {
- return new JpaPlatformVariation() {
- public Supported getTablePerConcreteClassInheritanceIsSupported() {
- return Supported.MAYBE;
- }
- public boolean isJoinTableOverridable() {
- return false;
- }
- };
- }
-
-
- public static class SimpleVersion implements JpaPlatform.Version {
- protected final String jpaVersion;
-
- public static final Comparator<String> JPA_VERSION_COMPARATOR = new DefaultVersionComparator();
-
- public SimpleVersion(String jpaVersion) {
- super();
- this.jpaVersion = jpaVersion;
- }
-
- /**
- * The generic platform's version is the same as the JPA version.
- */
- public String getVersion() {
- return this.getJpaVersion();
- }
-
- public String getJpaVersion() {
- return this.jpaVersion;
- }
-
- /**
- * For now, generic platforms are backward-compatible.
- */
- public boolean isCompatibleWithJpaVersion(String version) {
- return JPA_VERSION_COMPARATOR.compare(this.jpaVersion, version) >= 0;
- }
-
- @Override
- public String toString() {
- return "JPA version: " + this.getJpaVersion(); //$NON-NLS-1$
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatformProvider.java
deleted file mode 100644
index 751b62c1da..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatformProvider.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.JpaPlatformProvider;
-import org.eclipse.jpt.core.JpaResourceModelProvider;
-import org.eclipse.jpt.core.JpaResourceType;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.ResourceDefinition;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaBasicMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaEmbeddableDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaEmbeddedIdMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaEmbeddedMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaEntityDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaIdMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaManyToManyMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaManyToOneMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaMappedSuperclassDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaOneToManyMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaOneToOneMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaTransientMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaVersionMappingDefinition;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
-import org.eclipse.jpt.core.internal.jpa1.context.persistence.GenericPersistenceXmlDefinition;
-
-/**
- * All the state in the JPA platform should be "static" (i.e. unchanging once
- * it is initialized).
- */
-public class GenericJpaPlatformProvider
- extends AbstractJpaPlatformProvider
-{
- public static final String ID = "generic"; //$NON-NLS-1$
-
- // 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 JpaResourceType getMostRecentSupportedResourceType(IContentType contentType) {
- if (contentType.equals(JptCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
- return JptCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptCorePlugin.JAR_CONTENT_TYPE)) {
- return JptCorePlugin.JAR_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) {
- return JptCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptCorePlugin.ORM_XML_CONTENT_TYPE)) {
- return JptCorePlugin.ORM_XML_1_0_RESOURCE_TYPE;
- }
- else {
- throw new IllegalArgumentException(contentType.toString());
- }
- }
-
- @Override
- protected JpaResourceModelProvider[] buildResourceModelProviders() {
- // order should not be important here
- return new JpaResourceModelProvider[] {
- JavaResourceModelProvider.instance(),
- JarResourceModelProvider.instance(),
- PersistenceResourceModelProvider.instance(),
- OrmResourceModelProvider.instance()};
- }
-
-
- // ********** Java type mappings **********
-
- @Override
- protected JavaTypeMappingDefinition[] buildNonNullJavaTypeMappingDefinitions() {
- // order determined by analyzing order that reference implementation (toplink) uses
- return new JavaTypeMappingDefinition[] {
- JavaEntityDefinition.instance(),
- JavaEmbeddableDefinition.instance(),
- JavaMappedSuperclassDefinition.instance()};
- }
-
-
- // ********** Java attribute mappings **********
-
- @Override
- protected JavaAttributeMappingDefinition[] buildNonNullDefaultJavaAttributeMappingDefinitions() {
- // order determined by analyzing order that reference implementation (toplink) uses
- return new JavaAttributeMappingDefinition[] {
- JavaEmbeddedMappingDefinition.instance(),
- JavaBasicMappingDefinition.instance()};
- }
-
- @Override
- protected JavaAttributeMappingDefinition[] buildNonNullSpecifiedJavaAttributeMappingDefinitions() {
- // order determined by analyzing order that reference implementation (eclipselink) uses
- return new JavaAttributeMappingDefinition[] {
- JavaTransientMappingDefinition.instance(),
- JavaIdMappingDefinition.instance(),
- JavaVersionMappingDefinition.instance(),
- JavaBasicMappingDefinition.instance(),
- JavaEmbeddedMappingDefinition.instance(),
- JavaEmbeddedIdMappingDefinition.instance(),
- JavaManyToManyMappingDefinition.instance(),
- JavaManyToOneMappingDefinition.instance(),
- JavaOneToManyMappingDefinition.instance(),
- JavaOneToOneMappingDefinition.instance()};
- }
-
-
- // ********** Mapping Files **********
-
- @Override
- protected ResourceDefinition[] buildResourceDefinitions() {
- return new ResourceDefinition[] {
- GenericPersistenceXmlDefinition.instance(),
- GenericOrmXmlDefinition.instance()};
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JarResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JarResourceModelProvider.java
deleted file mode 100644
index 1347db8270..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JarResourceModelProvider.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JpaResourceModel;
-import org.eclipse.jpt.core.JpaResourceModelProvider;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryPackageFragmentRoot;
-
-/**
- * JAR files
- */
-public class JarResourceModelProvider
- implements JpaResourceModelProvider
-{
- // singleton
- private static final JpaResourceModelProvider INSTANCE = new JarResourceModelProvider();
-
- /**
- * Return the singleton.
- */
- public static JpaResourceModelProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private JarResourceModelProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptCorePlugin.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 JpaResourceModel buildResourceModel(JpaProject jpaProject, IFile file) {
- IPackageFragmentRoot pfr = JavaCore.createJarPackageFragmentRootFrom(file);
- return (pfr ==null) ? null : new BinaryPackageFragmentRoot(pfr, jpaProject.getJpaPlatform().getAnnotationProvider());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JavaResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JavaResourceModelProvider.java
deleted file mode 100644
index 5d87c03086..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JavaResourceModelProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JpaResourceModelProvider;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceCompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
-
-/**
- * Java source code
- */
-public class JavaResourceModelProvider
- implements JpaResourceModelProvider
-{
- // singleton
- private static final JpaResourceModelProvider INSTANCE = new JavaResourceModelProvider();
-
- /**
- * Return the singleton.
- */
- public static JpaResourceModelProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private JavaResourceModelProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptCorePlugin.JAVA_SOURCE_CONTENT_TYPE;
- }
-
- public JavaResourceCompilationUnit buildResourceModel(JpaProject jpaProject, IFile file) {
- return new SourceCompilationUnit(
- JavaCore.createCompilationUnitFrom(file),
- jpaProject.getJpaPlatform().getAnnotationProvider(),
- jpaProject.getJpaPlatform().getAnnotationEditFormatter(),
- jpaProject.getModifySharedDocumentCommandExecutor()
- );
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformRegistry.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformRegistry.java
deleted file mode 100644
index 381d791dcf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformRegistry.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-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.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jpt.core.JpaPlatform;
-import org.eclipse.jpt.core.JpaPlatformFactory;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Singleton registry for storing all the registered JPA platform configuration
- * elements and instantiating JPA platforms from them.
- */
-public class JpaPlatformRegistry {
-
- private final HashMap<String, IConfigurationElement> jpaPlatformConfigurationElements;
-
-
- // singleton
- private static final JpaPlatformRegistry INSTANCE = new JpaPlatformRegistry();
-
- /**
- * Return the singleton.
- */
- public static JpaPlatformRegistry instance() {
- return INSTANCE;
- }
-
- private static final String EXTENSION_ID = "jpaPlatforms"; //$NON-NLS-1$
- private static final String PLATFORM_ELEMENT_NAME = "jpaPlatform"; //$NON-NLS-1$
- private static final String ID_ATTRIBUTE_NAME = "id"; //$NON-NLS-1$
- private static final String LABEL_ATTRIBUTE_NAME = "label"; //$NON-NLS-1$
- private static final String FACTORY_CLASS_ATTRIBUTE_NAME = "factoryClass"; //$NON-NLS-1$
- private static final String JPA_FACET_VERSION_ATTRIBUTE_NAME = "jpaFacetVersion"; //$NON-NLS-1$
- private static final String DEFAULT_ATTRIBUTE_NAME = "default"; //$NON-NLS-1$
-
-
- // ********** constructor/initialization **********
-
- /**
- * ensure single instance
- */
- private JpaPlatformRegistry() {
- super();
- this.jpaPlatformConfigurationElements = this.buildJpaPlatformConfigurationElements();
- }
-
-
- private HashMap<String, IConfigurationElement> buildJpaPlatformConfigurationElements() {
- HashMap<String, IConfigurationElement> configElements = new HashMap<String, IConfigurationElement>();
- for (IConfigurationElement configElement : this.getConfigElements()) {
- this.addConfigElementTo(configElement, configElements);
- }
- return configElements;
- }
-
- /**
- * Return the configuration elements from the Eclipse platform extension
- * registry.
- */
- private Iterable<IConfigurationElement> getConfigElements() {
- return new CompositeIterable<IConfigurationElement>(
- new TransformationIterable<IExtension, Iterable<IConfigurationElement>>(this.getExtensions()) {
- @Override
- protected Iterable<IConfigurationElement> transform(IExtension extension) {
- return CollectionTools.iterable(extension.getConfigurationElements());
- }
- }
- );
- }
-
- private Iterable<IExtension> getExtensions() {
- return CollectionTools.iterable(this.getExtensionPoint().getExtensions());
- }
-
- private IExtensionPoint getExtensionPoint() {
- return Platform.getExtensionRegistry().getExtensionPoint(JptCorePlugin.PLUGIN_ID, EXTENSION_ID);
- }
-
- private void addConfigElementTo(IConfigurationElement configElement, HashMap<String, IConfigurationElement> configElements) {
- if ( ! configElement.getName().equals(PLATFORM_ELEMENT_NAME)) {
- return;
- }
- if ( ! this.configElementIsValid(configElement)) {
- return;
- }
-
- String id = configElement.getAttribute(ID_ATTRIBUTE_NAME);
- IConfigurationElement prev = configElements.put(id, configElement);
- if (prev != null) {
- configElements.put(id, prev); // replace previous(?)
- this.logDuplicatePlatform(prev, configElement, id);
- }
- }
-
- /**
- * check *all* attributes before returning
- */
- private boolean configElementIsValid(IConfigurationElement configElement) {
- boolean valid = true;
- if (configElement.getAttribute(ID_ATTRIBUTE_NAME) == null) {
- this.logMissingAttribute(configElement, ID_ATTRIBUTE_NAME);
- valid = false;
- }
- if (configElement.getAttribute(LABEL_ATTRIBUTE_NAME) == null) {
- this.logMissingAttribute(configElement, LABEL_ATTRIBUTE_NAME);
- valid = false;
- }
- if (configElement.getAttribute(FACTORY_CLASS_ATTRIBUTE_NAME) == null) {
- this.logMissingAttribute(configElement, FACTORY_CLASS_ATTRIBUTE_NAME);
- valid = false;
- }
- return valid;
- }
-
-
- // ********** public methods **********
-
- /**
- * Return the IDs for the registered JPA platforms.
- * This does not activate any of the JPA platforms' plug-ins.
- */
- public Iterable<String> getJpaPlatformIds() {
- return this.jpaPlatformConfigurationElements.keySet();
- }
-
- /**
- * Return whether the platform id is registered
- */
- public boolean containsPlatform(String platformId) {
- return this.jpaPlatformConfigurationElements.containsKey(platformId);
- }
-
- /**
- * Return the label for the JPA platform with the specified ID.
- * This does not activate the JPA platform's plug-in.
- */
- public String getJpaPlatformLabel(String id) {
- return this.jpaPlatformConfigurationElements.get(id).getAttribute(LABEL_ATTRIBUTE_NAME);
- }
-
- /**
- * Return whether the platform represented by the given id supports the specified JPA facet version.
- * This does not active the JPA platform's plug-in.
- */
- public boolean platformSupportsJpaFacetVersion(String platformId, String jpaFacetVersion) {
- IConfigurationElement configElement = this.jpaPlatformConfigurationElements.get(platformId);
- return configElementSupportsJpaFacetVersion(configElement, jpaFacetVersion);
- }
-
- private boolean configElementSupportsJpaFacetVersion(
- IConfigurationElement configElement, String jpaFacetVersion) {
-
- // config element supports version if it explicitly sets it to that version
- // or if it specifies no version at all
- String ver = configElement.getAttribute(JPA_FACET_VERSION_ATTRIBUTE_NAME);
- return (ver == null) || ver.equals(jpaFacetVersion);
- }
-
- /**
- * Return the IDs for the registered JPA platforms that support the
- * specified JPA facet version.
- * This does not activate the JPA platforms' plug-in.
- */
- public Iterable<String> getJpaPlatformIdsForJpaFacetVersion(final String jpaFacetVersion) {
- return new TransformationIterable<IConfigurationElement, String>(this.getConfigurationElementsForJpaFacetVersion(jpaFacetVersion)) {
- @Override
- protected String transform(IConfigurationElement configElement) {
- return configElement.getAttribute(ID_ATTRIBUTE_NAME);
- }
- };
- }
-
- private Iterable<IConfigurationElement> getConfigurationElementsForJpaFacetVersion(final String jpaFacetVersion) {
- return new FilteringIterable<IConfigurationElement, IConfigurationElement>(this.jpaPlatformConfigurationElements.values()) {
- @Override
- protected boolean accept(IConfigurationElement configElement) {
- return configElementSupportsJpaFacetVersion(configElement, jpaFacetVersion);
- }
- };
- }
-
- /**
- * Return the ID for a JPA platform registered as a default platform.
- * Returns null if there are no such registered platforms.
- * Returns the first platform ID if there are multiple such registered platforms.
- */
- public String getDefaultJpaPlatformId() {
- for (Map.Entry<String, IConfigurationElement> entry: this.jpaPlatformConfigurationElements.entrySet()) {
- String defaultFlag = entry.getValue().getAttribute(DEFAULT_ATTRIBUTE_NAME);
- if ((defaultFlag != null) && defaultFlag.equals("true")) { //$NON-NLS-1$
- return entry.getKey();
- }
- }
- return null;
- }
-
- /**
- * Return a new JPA platform for the specified ID.
- * NB: This should only be called when instantiating a JPA platform
- * when building a new JPA project.
- * Unlike other registry methods, invoking this method may activate
- * the plug-in.
- */
- public JpaPlatform getJpaPlatform(IProject project) {
- String id = JptCorePlugin.getJpaPlatformId(project);
- IConfigurationElement configElement = this.jpaPlatformConfigurationElements.get(id);
- if (configElement == null) {
- this.log(JptCoreMessages.PLATFORM_ID_DOES_NOT_EXIST, id, project.getName());
- return null;
- }
- JpaPlatformFactory platformFactory;
- try {
- platformFactory = (JpaPlatformFactory) configElement.createExecutableExtension(FACTORY_CLASS_ATTRIBUTE_NAME);
- } catch (CoreException ex) {
- this.logFailedInstantiation(configElement, ex);
- throw new IllegalArgumentException(id);
- }
- return platformFactory.buildJpaPlatform(id);
- }
-
-
- // ********** errors **********
-
- private void logMissingAttribute(IConfigurationElement configElement, String attributeName) {
- this.log(JptCoreMessages.REGISTRY_MISSING_ATTRIBUTE,
- configElement.getName(),
- configElement.getContributor().getName(),
- attributeName
- );
- }
-
- private void logDuplicatePlatform(IConfigurationElement prevConfigElement, IConfigurationElement newConfigElement, String id) {
- this.log(JptCoreMessages.REGISTRY_DUPLICATE,
- prevConfigElement.getContributor().getName(),
- newConfigElement.getContributor().getName(),
- ID_ATTRIBUTE_NAME,
- PLATFORM_ELEMENT_NAME,
- id
- );
- }
-
- private void logFailedInstantiation(IConfigurationElement configElement, CoreException ex) {
- this.log(JptCoreMessages.REGISTRY_FAILED_INSTANTIATION,
- configElement.getAttribute(FACTORY_CLASS_ATTRIBUTE_NAME),
- configElement.getName(),
- configElement.getContributor().getName()
- );
- JptCorePlugin.log(ex);
- }
-
- private void log(String msg, Object... bindings) {
- JptCorePlugin.log(NLS.bind(msg, bindings));
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformTester.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformTester.java
deleted file mode 100644
index 4a6c98edfb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformTester.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Oracle. - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jpt.core.JptCorePlugin;
-
-public class JpaPlatformTester extends PropertyTester {
-
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (! property.equals("jpaPlatform")) { //$NON-NLS-1$
- return false;
- }
-
- String platformId = null;
-
- if (receiver instanceof IResource) {
- platformId = platformId(((IResource) receiver).getProject());
- }
- else if (receiver instanceof IJavaElement) {
- platformId = platformId(((IJavaElement) receiver).getResource().getProject());
- }
-
-
- return platformId == null ? false : platformId.equals(expectedValue);
- }
-
- private String platformId(IProject project) {
- return (project == null) ? null : JptCorePlugin.getJpaPlatformId(project);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaTester.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaTester.java
deleted file mode 100644
index cb32a9531c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaTester.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2008 BEA Systems, Inc and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik - initial implementation and ongoing maintenance
- * Oracle - copied and modified from org.eclipse.wst.common.project.facet.core.internal.FacetedProjectPropertyTester
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
-
-public class JpaTester extends PropertyTester {
-
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (!property.equals("projectFacet")) { //$NON-NLS-1$
- return false;
- }
- if (receiver instanceof IJavaElement) {
- IProject project = ((IJavaElement) receiver).getResource().getProject();
- if (project != null) {
-
- String val = (String) expectedValue;
- int colon = val.indexOf( ':' );
- String facetID;
- String facetVer;
- if( colon == -1 || colon == val.length() - 1 ) {
- facetID = val;
- facetVer = null;
- } else {
- facetID = val.substring( 0, colon );
- facetVer = val.substring( colon + 1 );
- }
- try {
- return FacetedProjectFramework.hasProjectFacet( project, facetID, facetVer );
- } catch (CoreException e) {
- JptCorePlugin.log(e.getStatus());
- return false;
- }
- }
- }
- return false;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java
deleted file mode 100644
index 1786c2e900..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-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_SPECIFIED;
- public static String VALIDATE_SOURCE_FOLDER_NOT_SPECIFIED;
- public static String VALIDATE_SOURCE_FOLDER_ILLEGAL;
- public static String VALIDATE_SOURCE_FOLDER_DOES_NOT_EXIST;
- public static String VALIDATE_SOURCE_FOLDER_NOT_IN_PROJECT;
- public static String VALIDATE_SOURCE_FOLDER_NOT_SOURCE_FOLDER;
- public static String VALIDATE_FILE_PATH_NOT_SPECIFIED;
- public static String VALIDATE_FILE_ALREADY_EXISTS;
- 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_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_DUPLICATE;
- public static String REGISTRY_FAILED_INSTANTIATION;
- public static String UPDATE_JOB_NAME;
- public static String PLATFORM_ID_DOES_NOT_EXIST;
- public static String DALI_EVENT_HANDLER_THREAD_NAME;
- public static String PREFERENCES_FLUSH_JOB_NAME;
-
- private static final String BUNDLE_NAME = "jpa_core"; //$NON-NLS-1$
- private static final Class<?> BUNDLE_CLASS = JptCoreMessages.class;
- static {
- NLS.initializeMessages(BUNDLE_NAME, BUNDLE_CLASS);
- }
-
- private JptCoreMessages() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/OrmResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/OrmResourceModelProvider.java
deleted file mode 100644
index 037784f18c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/OrmResourceModelProvider.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JpaResourceModelProvider;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.resource.orm.OrmXmlResourceProvider;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-
-/**
- * orm.xml
- */
-public class OrmResourceModelProvider
- implements JpaResourceModelProvider
-{
- // singleton
- private static final JpaResourceModelProvider INSTANCE = new OrmResourceModelProvider();
-
- /**
- * Return the singleton.
- */
- public static JpaResourceModelProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private OrmResourceModelProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptCorePlugin.ORM_XML_CONTENT_TYPE;
- }
-
- public JpaXmlResource buildResourceModel(JpaProject jpaProject, IFile file) {
- return OrmXmlResourceProvider.getXmlResourceProvider(file).getXmlResource();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/PersistenceResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/PersistenceResourceModelProvider.java
deleted file mode 100644
index 1e12878e0c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/PersistenceResourceModelProvider.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JpaResourceModelProvider;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.resource.persistence.PersistenceXmlResourceProvider;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-
-/**
- * persistence.xml
- */
-public class PersistenceResourceModelProvider
- implements JpaResourceModelProvider
-{
- // singleton
- private static final JpaResourceModelProvider INSTANCE = new PersistenceResourceModelProvider();
-
- /**
- * Return the singleton.
- */
- public static JpaResourceModelProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private PersistenceResourceModelProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE;
- }
-
- public JpaXmlResource buildResourceModel(JpaProject jpaProject, IFile file) {
- return PersistenceXmlResourceProvider.getXmlResourceProvider(file).getXmlResource();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/ProjectAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/ProjectAdapterFactory.java
deleted file mode 100644
index fa80271fb8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/ProjectAdapterFactory.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-
-/**
- * [Double-duty] factory to build adapters for either standard projects or
- * Java projects:
- * - JPA project
- *
- * See org.eclipse.jpt.core plugin.xml.
- */
-public class ProjectAdapterFactory
- implements IAdapterFactory
-{
- private static final Class<?>[] ADAPTER_LIST = new Class[] { JpaProject.class };
-
- public Class<?>[] getAdapterList() {
- return ADAPTER_LIST;
- }
-
- public Object getAdapter(Object adaptableObject, @SuppressWarnings("unchecked") Class adapterType) {
- if (adaptableObject instanceof IProject) {
- return this.getAdapter((IProject) adaptableObject, adapterType);
- }
- if (adaptableObject instanceof IJavaProject) {
- return this.getAdapter((IJavaProject) adaptableObject, adapterType);
- }
- return null;
- }
-
- private Object getAdapter(IProject project, Class <?>adapterType) {
- if (adapterType == JpaProject.class) {
- return this.getJpaProject(project);
- }
- return null;
- }
-
- private Object getAdapter(IJavaProject javaProject, Class <?>adapterType) {
- if (adapterType == JpaProject.class) {
- return this.getJpaProject(javaProject.getProject());
- }
- return null;
- }
-
- private JpaProject getJpaProject(IProject project) {
- return JptCorePlugin.getJpaProject(project);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/ResourceAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/ResourceAdapterFactory.java
deleted file mode 100644
index 45fa245e63..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/ResourceAdapterFactory.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jpt.core.IResourcePart;
-
-/**
- * Factory to build adapters for Eclipse resources:
- * - resource part
- *
- * See org.eclipse.jpt.core plugin.xml.
- */
-public class ResourceAdapterFactory
- implements IAdapterFactory
-{
- private static final Class<?>[] ADAPTER_LIST = new Class[] { IResourcePart.class };
-
- public Class<?>[] getAdapterList() {
- return ADAPTER_LIST;
- }
-
- public Object getAdapter(Object adaptableObject, @SuppressWarnings("unchecked") Class adapterType) {
- if (adaptableObject instanceof IResource) {
- return this.getAdapter((IResource) adaptableObject, adapterType);
- }
- return null;
- }
-
- private Object getAdapter(final IResource resource, Class <?>adapterType) {
- if (adapterType == IResourcePart.class) {
- return new IResourcePart() {
- public IResource getResource() {
- return resource;
- }
- };
- }
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SimpleJpaProjectConfig.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SimpleJpaProjectConfig.java
deleted file mode 100644
index 2433fa229e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SimpleJpaProjectConfig.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jpt.core.JpaPlatform;
-import org.eclipse.jpt.core.jpa2.JpaProject2_0;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- * Straightforward implementation of the JPA project config.
- */
-public class SimpleJpaProjectConfig implements JpaProject2_0.Config {
- protected IProject project;
- protected JpaPlatform jpaPlatform;
- protected String connectionProfileName;
- protected String userOverrideDefaultCatalog;
- protected String userOverrideDefaultSchema;
- protected boolean discoverAnnotatedClasses;
- protected String metamodelSourceFolderName;
-
- public SimpleJpaProjectConfig() {
- super();
- }
-
- public IProject getProject() {
- return this.project;
- }
-
- public void setProject(IProject project) {
- this.project = project;
- }
-
- public JpaPlatform getJpaPlatform() {
- return this.jpaPlatform;
- }
-
- public void setJpaPlatform(JpaPlatform jpaPlatform) {
- this.jpaPlatform = jpaPlatform;
- }
-
- public String getConnectionProfileName() {
- return this.connectionProfileName;
- }
-
- public void setConnectionProfileName(String connectionProfileName) {
- this.connectionProfileName = connectionProfileName;
- }
-
- public String getUserOverrideDefaultSchema() {
- return this.userOverrideDefaultSchema;
- }
-
- public void setUserOverrideDefaultSchema(String userOverrideDefaultSchema) {
- this.userOverrideDefaultSchema = userOverrideDefaultSchema;
- }
-
- public String getUserOverrideDefaultCatalog() {
- return this.userOverrideDefaultCatalog;
- }
-
- public void setUserOverrideDefaultCatalog(String userOverrideDefaultCatalog) {
- this.userOverrideDefaultCatalog = userOverrideDefaultCatalog;
- }
-
- public boolean discoverAnnotatedClasses() {
- return this.discoverAnnotatedClasses;
- }
-
- public void setDiscoverAnnotatedClasses(boolean discoverAnnotatedClasses) {
- this.discoverAnnotatedClasses = discoverAnnotatedClasses;
- }
-
- public String getMetamodelSourceFolderName() {
- return this.metamodelSourceFolderName;
- }
-
- public void setMetamodelSourceFolderName(String metamodelSourceFolderName) {
- this.metamodelSourceFolderName = metamodelSourceFolderName;
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.project.getName());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SynchronousJpaProjectUpdater.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SynchronousJpaProjectUpdater.java
deleted file mode 100644
index 314b92e8d4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SynchronousJpaProjectUpdater.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.utility.Command;
-import org.eclipse.jpt.utility.internal.synchronizers.CallbackSynchronizer;
-import org.eclipse.jpt.utility.internal.synchronizers.CallbackSynchronousSynchronizer;
-
-/**
- * Adapt the "callback synchronizer" interface to the JPA project "updater"
- * interface.
- * <p>
- * This updater will "update" the JPA project immediately and not return until
- * the "update" and all resulting "updates" are complete. This implementation
- * should be used sparingly and for as short a time as possible, as it increases
- * the probability of deadlocks. A deadlock can occur when a JPA project is
- * updated from multiple threads and various resources are locked in varying
- * orders.
- */
-public class SynchronousJpaProjectUpdater
- extends AbstractSynchronizerJpaProjectUpdater
-{
- public SynchronousJpaProjectUpdater(JpaProject jpaProject) {
- super(jpaProject);
- }
-
- @Override
- protected CallbackSynchronizer buildSynchronizer() {
- return new CallbackSynchronousSynchronizer(this.buildCommand());
- }
-
- protected Command buildCommand() {
- return new Command() {
- public void execute() {
- SynchronousJpaProjectUpdater.this.jpaProject.update(new NullProgressMonitor());
- }
- };
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/AbstractJpaContextNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/AbstractJpaContextNode.java
deleted file mode 100644
index 7868ba129a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/AbstractJpaContextNode.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context;
-
-import org.eclipse.jpt.core.JpaNode;
-import org.eclipse.jpt.core.JpaResourceType;
-import org.eclipse.jpt.core.context.JpaContextNode;
-import org.eclipse.jpt.core.context.MappingFileRoot;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.AbstractJpaNode;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.SchemaContainer;
-
-public abstract class AbstractJpaContextNode
- extends AbstractJpaNode
- implements JpaContextNode
-{
-
- // ********** constructor **********
-
- protected AbstractJpaContextNode(JpaNode parent) {
- super(parent);
- }
-
-
- // ********** JpaNode implentation **********
-
- /**
- * covariant override
- */
- @Override
- public JpaContextNode getParent() {
- return (JpaContextNode) super.getParent();
- }
-
-
- // ********** JpaContextNode implementation **********
-
- public JpaResourceType getResourceType() {
- return getParent().getResourceType();
- }
-
- /**
- * Overridden in GenericPersistence and GenericPersistenceXml to throw
- * UnsupportedOperationException.
- * Overridden in GenericRootContextNode to return null.
- * Overridden in GenericPersistenceUnit to return itself.
- */
- public PersistenceUnit getPersistenceUnit() {
- return this.getParent().getPersistenceUnit();
- }
-
- public MappingFileRoot getMappingFileRoot() {
- return this.getParent().getMappingFileRoot();
- }
-
- public Schema getContextDefaultDbSchema() {
- SchemaContainer dbSchemaContainer = this.getContextDefaultDbSchemaContainer();
- return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getContextDefaultSchema());
- }
-
- /**
- * 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.getDbCatalog(catalog) : this.getDatabase();
- }
-
- 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.
- */
- public Catalog getContextDefaultDbCatalog() {
- String catalog = this.getContextDefaultCatalog();
- return (catalog == null) ? null : this.getDbCatalog(catalog);
- }
-
- protected String getContextDefaultCatalog() {
- MappingFileRoot mfr = this.getMappingFileRoot();
- return (mfr != null) ? mfr.getCatalog() : this.getPersistenceUnit().getDefaultCatalog();
- }
-
- public void postUpdate() {
- // do nothing
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/AbstractXmlContextNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/AbstractXmlContextNode.java
deleted file mode 100644
index 66eec94d9e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/AbstractXmlContextNode.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context;
-
-import java.util.List;
-
-import org.eclipse.jpt.core.context.JpaContextNode;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractXmlContextNode
- extends AbstractJpaContextNode
- implements XmlContextNode
-{
-
- // ********** constructor **********
-
- protected AbstractXmlContextNode(JpaContextNode parent) {
- super(parent);
- }
-
-
- // ********** validation **********
-
- /**
- * All subclass implementations {@link #validate(List<IMessage>)}
- * should be preceded by a "super" call to this method
- */
- public void validate(List<IMessage> messages, IReporter reporter) {
- if (reporter.isCancelled()) {
- throw new ValidationCancelledException();
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/MappingTools.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/MappingTools.java
deleted file mode 100644
index 8524e57ead..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/MappingTools.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0, which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context;
-
-import java.util.Iterator;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.ColumnMapping;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.MultiRelationshipMapping;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.RelationshipReference;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.jpa2.context.AttributeMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.db.Table;
-
-/**
- * Gather some of the behavior common to the Java and XML models. :-(
- */
-public class MappingTools {
-
- /**
- * Default join table name from the JPA spec:
- * The concatenated names of the two associated primary
- * entity tables, separated by a underscore.
- *
- * [owning table name]_[target table name]
- *
- * NB: The *names* are concatenated, *not* the *identifiers*.
- * E.g. the join table for "Foo" and "baR" (where the "delimited" identifier
- * is required) is
- * "Foo_baR"
- * not
- * "Foo"_"baR"
- * As a result, we cannot honestly calculate the default name without a
- * database connection.
- */
- public static String buildJoinTableDefaultName(RelationshipReference relationshipReference) {
- if (relationshipReference.getJpaProject().getDataSource().connectionProfileIsActive()) {
- return buildDbJoinTableDefaultName(relationshipReference);
- }
- // continue with a "best effort":
- String owningTableName = relationshipReference.getTypeMapping().getPrimaryTableName();
- if (owningTableName == null) {
- return null;
- }
- RelationshipMapping relationshipMapping = relationshipReference.getRelationshipMapping();
- 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.
- */
- protected static String buildDbJoinTableDefaultName(RelationshipReference relationshipReference) {
- Table owningTable = relationshipReference.getTypeMapping().getPrimaryDbTable();
- if (owningTable == null) {
- return null;
- }
- RelationshipMapping relationshipMapping = relationshipReference.getRelationshipMapping();
- 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);
- }
-
- /**
- * Return the join column's default name;
- * which is typically
- * [attribute name]_[referenced column name]
- * But, if we don't have an attribute name (e.g. in a unidirectional
- * OneToMany or ManyToMany) is
- * [target entity name]_[referenced column name]
- *
- * @see #buildJoinTableDefaultName(RelationshipMapping)
- */
- public static String buildJoinColumnDefaultName(JoinColumn joinColumn) {
- JoinColumn.Owner owner = joinColumn.getOwner();
- RelationshipMapping relationshipMapping = owner.getRelationshipMapping();
- if (relationshipMapping == null) {
- return null;
- }
- if (owner.joinColumnsSize() != 1) {
- return null;
- }
- String prefix = owner.getAttributeName();
- if (prefix == null) {
- Entity targetEntity = owner.getTargetEntity();
- if (targetEntity == null) {
- return null;
- }
- prefix = targetEntity.getName();
- }
- // not sure which of these is correct...
- // (the spec implies that the referenced column is always the
- // primary key column of the target entity)
- // Column targetColumn = joinColumn.getTargetPrimaryKeyDbColumn();
- String targetColumnName = joinColumn.getReferencedColumnName();
- if (targetColumnName == null) {
- return null;
- }
- String name = prefix + '_' + targetColumnName;
- // not sure which of these is correct...
- // converting the name to an identifier will result in the identifier
- // being delimited nearly every time (at least on non-Sybase/MS
- // databases); but that probably is not the intent of the spec...
- // return targetColumn.getDatabase().convertNameToIdentifier(name);
- return name;
- }
-
- /**
- * If appropriate, return the name of the single primary key column of the
- * target entity.
- */
- public static String buildJoinColumnDefaultReferencedColumnName(JoinColumn.Owner joinColumnOwner) {
- RelationshipMapping relationshipMapping = joinColumnOwner.getRelationshipMapping();
- if (relationshipMapping == null) {
- return null;
- }
- if (joinColumnOwner.joinColumnsSize() != 1) {
- return null;
- }
- Entity targetEntity = joinColumnOwner.getTargetEntity();
- if (targetEntity == null) {
- return null;
- }
- return targetEntity.getPrimaryKeyColumnName();
- }
-
- public static ColumnMapping getColumnMapping(String attributeName, PersistentType persistentType) {
- if (attributeName == null || persistentType == null) {
- return null;
- }
- for (Iterator<PersistentAttribute> stream = persistentType.allAttributes(); stream.hasNext(); ) {
- PersistentAttribute persAttribute = stream.next();
- if (attributeName.equals(persAttribute.getName())) {
- if (persAttribute.getMapping() instanceof ColumnMapping) {
- return (ColumnMapping) persAttribute.getMapping();
- }
- // keep looking or return null???
- }
- }
- return null;
- }
-
- public static RelationshipMapping getRelationshipMapping(String attributeName, TypeMapping typeMapping) {
- if (attributeName == null || typeMapping == null) {
- return null;
- }
- for (Iterator<AttributeMapping> stream = typeMapping.allAttributeMappings(); stream.hasNext(); ) {
- AttributeMapping attributeMapping = stream.next();
- if (attributeName.equals(attributeMapping.getName())) {
- if (attributeMapping instanceof RelationshipMapping) {
- return (RelationshipMapping) attributeMapping;
- }
- // keep looking or return null???
- }
- }
- return null;
- }
-
- public static void convertJoinTableDefaultToSpecifiedJoinColumn(JoinTable joinTable) {
- JoinColumn defaultJoinColumn = joinTable.getDefaultJoinColumn();
- if (defaultJoinColumn != null) {
- String columnName = defaultJoinColumn.getDefaultName();
- String referencedColumnName = defaultJoinColumn.getDefaultReferencedColumnName();
- JoinColumn joinColumn = joinTable.addSpecifiedJoinColumn(0);
- 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(MultiRelationshipMapping mapping) {
- Entity targetEntity = mapping.getResolvedTargetEntity();
- if (targetEntity == null) {
- return MetamodelField.DEFAULT_TYPE_NAME;
- }
- String mapKey = mapping.getMapKey();
- if (mapKey == null) {
- return MetamodelField.DEFAULT_TYPE_NAME;
- }
- PersistentAttribute mapKeyAttribute = targetEntity.getPersistentType().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();
- }
-
-
- // ********** constructor **********
-
- /**
- * Suppress default constructor, ensuring non-instantiability.
- */
- private MappingTools() {
- super();
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PersistentAttributePropertyTester.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PersistentAttributePropertyTester.java
deleted file mode 100644
index 80ee5ff187..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PersistentAttributePropertyTester.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-
-public class PersistentAttributePropertyTester extends PropertyTester
-{
- public static final String IS_MAPPED = "isMapped";
-
- public static final String IS_VIRTUAL = "isVirtual";
-
-
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (IS_MAPPED.equals(property)) {
- Boolean expectedIsMapped;
-
- try {
- expectedIsMapped = (Boolean) expectedValue;
- }
- catch (ClassCastException cce) {
- return false;
- }
-
- Boolean actualIsMapped = ((PersistentAttribute) receiver).getMappingKey() != MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY;
-
- return actualIsMapped == expectedIsMapped;
- }
- else if (IS_VIRTUAL.equals(property)) {
- Boolean expectedIsVirtual;
-
- try {
- expectedIsVirtual = (Boolean) expectedValue;
- }
- catch (ClassCastException cce) {
- return false;
- }
-
- Boolean actualIsVirtual = false;
- if (receiver instanceof OrmPersistentAttribute) {
- actualIsVirtual = ((OrmPersistentAttribute) receiver).isVirtual();
- }
-
- return actualIsVirtual == expectedIsVirtual;
- }
-
- return false;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAssociationOverrideRelationshipReference.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAssociationOverrideRelationshipReference.java
deleted file mode 100644
index ee0f982f26..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAssociationOverrideRelationshipReference.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverrideRelationshipReference;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaJoinColumnInAssociationOverrideJoiningStrategy;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractJavaAssociationOverrideRelationshipReference extends AbstractJavaJpaContextNode
- implements JavaAssociationOverrideRelationshipReference
-{
-
- // cache the strategy for property change notification
- protected JoiningStrategy cachedPredominantJoiningStrategy;
-
- protected final JavaJoinColumnInAssociationOverrideJoiningStrategy joinColumnJoiningStrategy;
-
- protected AbstractJavaAssociationOverrideRelationshipReference(JavaAssociationOverride parent) {
- super(parent);
- this.joinColumnJoiningStrategy = buildJoinColumnJoiningStrategy();
- }
-
- protected JavaJoinColumnInAssociationOverrideJoiningStrategy buildJoinColumnJoiningStrategy() {
- return new GenericJavaJoinColumnInAssociationOverrideJoiningStrategy(this);
- }
-
- @Override
- public JavaAssociationOverride getParent() {
- return (JavaAssociationOverride) super.getParent();
- }
-
- public JavaAssociationOverride getAssociationOverride() {
- return getParent();
- }
-
- public boolean isOverridableAssociation() {
- return false;
- }
-
- public TypeMapping getTypeMapping() {
- return getAssociationOverride().getOwner().getTypeMapping();
- }
-
- public Entity getEntity() {
- TypeMapping typeMapping = getTypeMapping();
- return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
- }
-
- // **************** RelationshipMapping implementation *******************************
-
- public boolean isParentVirtual() {
- return getAssociationOverride().isVirtual();
- }
-
- // **************** predominant joining strategy ***************************
-
- public JoiningStrategy getPredominantJoiningStrategy() {
- return this.cachedPredominantJoiningStrategy;
- }
-
- protected void setPredominantJoiningStrategy(JoiningStrategy newJoiningStrategy) {
- JoiningStrategy oldJoiningStrategy = this.cachedPredominantJoiningStrategy;
- this.cachedPredominantJoiningStrategy = newJoiningStrategy;
- firePropertyChanged(PREDOMINANT_JOINING_STRATEGY_PROPERTY, oldJoiningStrategy, newJoiningStrategy);
- }
-
- public void initialize(AssociationOverrideAnnotation associationOverride) {
- initializeJoiningStrategies(associationOverride);
- this.cachedPredominantJoiningStrategy = calculatePredominantJoiningStrategy();
- }
-
- protected void initializeJoiningStrategies(AssociationOverrideAnnotation associationOverride) {
- this.joinColumnJoiningStrategy.initialize(associationOverride);
- }
-
- public void update(AssociationOverrideAnnotation associationOverride) {
- updateJoiningStrategies(associationOverride);
- setPredominantJoiningStrategy(calculatePredominantJoiningStrategy());
- }
-
- protected void updateJoiningStrategies(AssociationOverrideAnnotation associationOverride) {
- this.joinColumnJoiningStrategy.update(associationOverride);
- }
-
- protected abstract JoiningStrategy calculatePredominantJoiningStrategy();
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.joinColumnJoiningStrategy.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return null;
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- if (this.connectionProfileIsActive()) {
- this.validateJoinColumns(messages, astRoot);
- }
- }
-
- protected void validateJoinColumns(List<IMessage> messages, CompilationUnit astRoot) {
- for (Iterator<JavaJoinColumn> stream = this.getJoinColumnJoiningStrategy().joinColumns(); stream.hasNext(); ) {
- this.validateJoinColumn(stream.next(), messages, astRoot);
- }
- }
-
- protected void validateJoinColumn(JavaJoinColumn joinColumn, List<IMessage> messages, CompilationUnit astRoot) {
- String tableName = joinColumn.getTable();
- if (this.getAssociationOverride().getOwner().getTypeMapping().tableNameIsInvalid(tableName)) {
- if (this.getAssociationOverride().isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_TABLE,
- new String[] {this.getAssociationOverride().getName(), tableName, joinColumn.getName()},
- joinColumn,
- joinColumn.getTableTextRange(astRoot)
- )
- );
- } else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_TABLE,
- new String[] {tableName, joinColumn.getName()},
- joinColumn,
- joinColumn.getTableTextRange(astRoot)
- )
- );
- }
- return;
- }
-
- if ( ! joinColumn.isResolved()) {
- if (this.getAssociationOverride().isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {this.getAssociationOverride().getName(), joinColumn.getName()},
- joinColumn,
- joinColumn.getNameTextRange(astRoot)
- )
- );
- } else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {joinColumn.getName()},
- joinColumn,
- joinColumn.getNameTextRange(astRoot)
- )
- );
- }
- }
-
- if ( ! joinColumn.isReferencedColumnResolved()) {
- if (this.getAssociationOverride().isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME,
- new String[] {this.getAssociationOverride().getName(), joinColumn.getReferencedColumnName(), joinColumn.getName()},
- joinColumn,
- joinColumn.getReferencedColumnNameTextRange(astRoot)
- )
- );
- } else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME,
- new String[] {joinColumn.getReferencedColumnName(), joinColumn.getName()},
- joinColumn,
- joinColumn.getReferencedColumnNameTextRange(astRoot)
- )
- );
- }
- }
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return getAssociationOverride().getValidationTextRange(astRoot);
- }
-
- // **************** join columns *******************************************
-
-
- public JavaJoinColumnInAssociationOverrideJoiningStrategy getJoinColumnJoiningStrategy() {
- return this.joinColumnJoiningStrategy;
- }
-
- public boolean usesJoinColumnJoiningStrategy() {
- return getPredominantJoiningStrategy() == this.joinColumnJoiningStrategy;
- }
-
- public void setJoinColumnJoiningStrategy() {
- this.joinColumnJoiningStrategy.addStrategy();
- }
-
- public void unsetJoinColumnJoiningStrategy() {
- this.joinColumnJoiningStrategy.removeStrategy();
- }
-
- public boolean mayHaveDefaultJoinColumn() {
- return false;
- }
-
- public RelationshipMapping getRelationshipMapping() {
- return getAssociationOverride().getOwner().getRelationshipMapping(getAssociationOverride().getName());
- }
-
- public boolean isOwnedBy(RelationshipMapping mapping) {
- return getRelationshipMapping().isOwnedBy(mapping);
- }
-
- public boolean isRelationshipOwner() {
- return getRelationshipMapping().isRelationshipOwner();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAttributeMapping.java
deleted file mode 100644
index bd856bfd80..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAttributeMapping.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.ColumnMapping;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.RelationshipReference;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.jpa2.context.SimpleMetamodelField;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.AttributeMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.jpa2.context.java.JavaPersistentAttribute2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.SingleElementIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java attribute mapping
- */
-public abstract class AbstractJavaAttributeMapping<T extends Annotation>
- extends AbstractJavaJpaContextNode
- implements JavaAttributeMapping, AttributeMapping2_0
-{
- protected T mappingAnnotation;
-
- protected Vector<String> supportingAnnotationNames;
-
-
- protected AbstractJavaAttributeMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-
- @SuppressWarnings("unchecked")
- public void initialize(Annotation annotation) {
- this.mappingAnnotation = (T) annotation;
- this.initialize();
- }
-
- protected void initialize() {
- // do nothing by default
- }
-
- @SuppressWarnings("unchecked")
- public void update(Annotation annotation) {
- this.mappingAnnotation = (T) annotation;
- this.update();
- }
-
- protected void update() {
- // do nothing by default
- }
-
- @Override
- public JavaPersistentAttribute getParent() {
- return (JavaPersistentAttribute) super.getParent();
- }
-
- public JavaPersistentAttribute getPersistentAttribute() {
- return this.getParent();
- }
-
- protected JavaResourcePersistentAttribute getResourcePersistentAttribute() {
- return this.getParent().getResourcePersistentAttribute();
- }
-
- public T getMappingAnnotation() {
- return this.mappingAnnotation;
- }
-
- /**
- * the persistent attribute can tell whether there is a "specified" mapping
- * or a "default" one
- */
- public boolean isDefault() {
- return this.getPersistentAttribute().mappingIsDefault(this);
- }
-
- public boolean shouldValidateAgainstDatabase() {
- return this.getTypeMapping().shouldValidateAgainstDatabase();
- }
-
- public TypeMapping getTypeMapping() {
- return this.getPersistentAttribute().getTypeMapping();
- }
-
- public String getName() {
- return this.getPersistentAttribute().getName();
- }
-
- public Table getDbTable(String tableName) {
- return this.getTypeMapping().getDbTable(tableName);
- }
-
- public String getPrimaryKeyColumnName() {
- return null;
- }
-
- public boolean isOverridableAttributeMapping() {
- return false;
- }
-
- public boolean isOverridableAssociationMapping() {
- return false;
- }
-
- public boolean isIdMapping() {
- return false;
- }
-
- public boolean isOwnedBy(RelationshipMapping mapping) {
- return false;
- }
-
- public Iterator<String> allMappingNames() {
- return new SingleElementIterator<String>(getName());
- }
-
- public AttributeMapping resolveAttributeMapping(String name) {
- if (getName().equals(name)) {
- return this;
- }
- return null;
- }
-
- public Iterator<String> allOverrideableAttributeMappingNames() {
- if (isOverridableAttributeMapping()) {
- return allMappingNames();
- }
- return EmptyIterator.<String> instance();
- }
-
- public Iterator<String> allOverrideableAssociationMappingNames() {
- if (isOverridableAssociationMapping()) {
- return allMappingNames();
- }
- return EmptyIterator.<String> instance();
- }
-
- public Column resolveOverridenColumn(String attributeName) {
- ColumnMapping columnMapping = this.resolveColumnMapping(attributeName);
- return columnMapping == null ? null : columnMapping.getColumn();
- }
-
- protected ColumnMapping resolveColumnMapping(String name) {
- AttributeMapping attributeMapping = resolveAttributeMapping(name);
- if (attributeMapping != null && attributeMapping.isOverridableAttributeMapping()) {
- return (ColumnMapping) attributeMapping;
- }
- return null;
- }
-
- public RelationshipReference resolveRelationshipReference(String attributeName) {
- RelationshipMapping relationshipMapping = this.resolveRelationshipMapping(attributeName);
- return relationshipMapping == null ? null : relationshipMapping.getRelationshipReference();
- }
-
- protected RelationshipMapping resolveRelationshipMapping(String name) {
- AttributeMapping attributeMapping = resolveAttributeMapping(name);
- if (attributeMapping != null && attributeMapping.isOverridableAssociationMapping()) {
- return (RelationshipMapping) attributeMapping;
- }
- return null;
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getName());
- }
-
-
- // ********** supporting annotation names **********
-
- public Iterable<String> getSupportingAnnotationNames() {
- if (this.supportingAnnotationNames == null) {
- this.supportingAnnotationNames = this.buildSupportingAnnotationNames();
- }
- return this.supportingAnnotationNames;
- }
-
- protected Vector<String> buildSupportingAnnotationNames() {
- Vector<String> names = new Vector<String>();
- this.addSupportingAnnotationNamesTo(names);
- return names;
- }
-
- protected void addSupportingAnnotationNamesTo(@SuppressWarnings("unused") Vector<String> names) {
- // the default is none
- }
-
-
- // ********** metamodel **********
-
- public MetamodelField getMetamodelField() {
- return new SimpleMetamodelField(
- this.getMetamodelFieldModifiers(),
- this.getMetamodelFieldTypeName(),
- this.getMetamodelFieldTypeArgumentNames(),
- this.getMetamodelFieldName()
- );
- }
-
- protected Iterable<String> getMetamodelFieldModifiers() {
- return STANDARD_METAMODEL_FIELD_MODIFIERS;
- }
-
- /**
- * most mappings are "singular"
- */
- protected String getMetamodelFieldTypeName() {
- return JPA2_0.SINGULAR_ATTRIBUTE;
- }
-
- protected final Iterable<String> getMetamodelFieldTypeArgumentNames() {
- ArrayList<String> typeArgumentNames = new ArrayList<String>(3);
- typeArgumentNames.add(this.getTypeMapping().getPersistentType().getName());
- this.addMetamodelFieldTypeArgumentNamesTo(typeArgumentNames);
- return typeArgumentNames;
- }
-
- /**
- * by default, we add only the mapping's attribute type name;
- * but collection relationship mappings will also need to add the key type
- * name if the "collection" is of type java.util.Map
- */
- protected void addMetamodelFieldTypeArgumentNamesTo(ArrayList<String> typeArgumentNames) {
- typeArgumentNames.add(this.getMetamodelTypeName());
- }
-
- public String getMetamodelTypeName() {
- return ((JavaPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelTypeName();
- }
-
- protected String getMetamodelFieldName() {
- return this.getName();
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.validateMappingType(messages, astRoot);
- }
-
- protected void validateMappingType(List<IMessage> messages, CompilationUnit astRoot) {
- if ( ! this.getTypeMapping().attributeMappingKeyAllowed(this.getKey())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_MAPPING,
- new String[] {this.getName()},
- this,
- this.getValidationTextRange(astRoot)
- )
- );
- }
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = this.getMappingAnnotationTextRange(astRoot);
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot);
- }
-
- protected TextRange getMappingAnnotationTextRange(CompilationUnit astRoot) {
- return (this.mappingAnnotation == null) ? null : this.mappingAnnotation.getTextRange(astRoot);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAttributeMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAttributeMappingDefinition.java
deleted file mode 100644
index 46bbad8953..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAttributeMappingDefinition.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-
-public abstract class AbstractJavaAttributeMappingDefinition
- implements JavaAttributeMappingDefinition
-{
- protected AbstractJavaAttributeMappingDefinition() {
- super();
- }
-
-
- /**
- * Default implementation. Override if the mapping definition applies in the annotationless case.
- */
- public boolean testDefault(JavaPersistentAttribute persistentAttribute) {
- return false;
- }
-
- /**
- * Default implementation. Override if the mapping definition needs to do more analysis.
- */
- public boolean testSpecified(JavaPersistentAttribute persistentAttribute) {
- return persistentAttribute.getResourcePersistentAttribute().getAnnotation(getAnnotationName())
- != null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseColumn.java
deleted file mode 100644
index 98d07e6c80..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseColumn.java
+++ /dev/null
@@ -1,312 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.java.JavaBaseColumn;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.resource.java.BaseColumnAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-public abstract class AbstractJavaBaseColumn<T extends BaseColumnAnnotation> extends AbstractJavaNamedColumn<T>
- implements JavaBaseColumn
-{
-
- protected String specifiedTable;
-
- protected String defaultTable;
-
- protected Boolean specifiedUnique;
-
- protected Boolean specifiedNullable;
-
- protected Boolean specifiedInsertable;
-
- protected Boolean specifiedUpdatable;
-
- protected AbstractJavaBaseColumn(JavaJpaContextNode parent, JavaBaseColumn.Owner owner) {
- super(parent, owner);
- }
-
- @Override
- protected void initialize(T column) {
- super.initialize(column);
- this.defaultTable = this.buildDefaultTable();
- this.specifiedTable = this.getResourceTable();
- this.specifiedUnique = this.getResourceUnique();
- this.specifiedNullable = this.getResourceNullable();
- this.specifiedInsertable = this.getResourceInsertable();
- this.specifiedUpdatable = this.getResourceUpdatable();
- }
-
- @Override
- protected void update(T column) {
- super.update(column);
- this.setDefaultTable(this.buildDefaultTable());
- this.setSpecifiedTable_(this.getResourceTable());
- this.setSpecifiedUnique_(this.getResourceUnique());
- this.setSpecifiedNullable_(this.getResourceNullable());
- this.setSpecifiedInsertable_(this.getResourceInsertable());
- this.setSpecifiedUpdatable_(this.getResourceUpdatable());
- }
-
- @Override
- public JavaBaseColumn.Owner getOwner() {
- return (JavaBaseColumn.Owner) super.getOwner();
- }
-
- //************** BaseColumn implementation *******************
-
- //************** table *******************
-
- public String getTable() {
- return (this.getSpecifiedTable() == null) ? getDefaultTable() : this.getSpecifiedTable();
- }
-
- public String getSpecifiedTable() {
- return this.specifiedTable;
- }
-
- public void setSpecifiedTable(String newSpecifiedTable) {
- String oldSpecifiedTable = this.specifiedTable;
- this.specifiedTable = newSpecifiedTable;
- getResourceColumn().setTable(newSpecifiedTable);
- firePropertyChanged(BaseColumn.SPECIFIED_TABLE_PROPERTY, oldSpecifiedTable, newSpecifiedTable);
- }
-
- /**
- * internal setter used only for updating from the resource model.
- * There were problems with InvalidThreadAccess exceptions in the UI
- * when you set a value from the UI and the annotation doesn't exist yet.
- * Adding the annotation causes an update to occur and then the exception.
- */
- protected void setSpecifiedTable_(String newSpecifiedTable) {
- String oldSpecifiedTable = this.specifiedTable;
- this.specifiedTable = newSpecifiedTable;
- firePropertyChanged(BaseColumn.SPECIFIED_TABLE_PROPERTY, oldSpecifiedTable, newSpecifiedTable);
- }
-
- public String getDefaultTable() {
- return this.defaultTable;
- }
-
- protected void setDefaultTable(String newDefaultTable) {
- String oldDefaultTable = this.defaultTable;
- this.defaultTable = newDefaultTable;
- firePropertyChanged(BaseColumn.DEFAULT_TABLE_PROPERTY, oldDefaultTable, newDefaultTable);
- }
-
- protected String getResourceTable() {
- return getResourceColumn().getTable();
- }
-
- //************** unique *******************
-
- public boolean isUnique() {
- return (this.getSpecifiedUnique() == null) ? this.isDefaultUnique() : this.getSpecifiedUnique().booleanValue();
- }
-
- public boolean isDefaultUnique() {
- return BaseColumn.DEFAULT_UNIQUE;
- }
-
- public Boolean getSpecifiedUnique() {
- return this.specifiedUnique;
- }
-
- public void setSpecifiedUnique(Boolean newSpecifiedUnique) {
- Boolean oldSpecifiedUnique = this.specifiedUnique;
- this.specifiedUnique = newSpecifiedUnique;
- this.getResourceColumn().setUnique(newSpecifiedUnique);
- firePropertyChanged(BaseColumn.SPECIFIED_UNIQUE_PROPERTY, oldSpecifiedUnique, newSpecifiedUnique);
- }
-
- /**
- * internal setter used only for updating from the resource model.
- * There were problems with InvalidThreadAccess exceptions in the UI
- * when you set a value from the UI and the annotation doesn't exist yet.
- * Adding the annotation causes an update to occur and then the exception.
- */
- protected void setSpecifiedUnique_(Boolean newSpecifiedUnique) {
- Boolean oldSpecifiedUnique = this.specifiedUnique;
- this.specifiedUnique = newSpecifiedUnique;
- firePropertyChanged(BaseColumn.SPECIFIED_UNIQUE_PROPERTY, oldSpecifiedUnique, newSpecifiedUnique);
- }
-
- protected Boolean getResourceUnique() {
- return getResourceColumn().getUnique();
- }
-
- //************** nullable *******************
-
- public boolean isNullable() {
- return (this.getSpecifiedNullable() == null) ? this.isDefaultNullable() : this.getSpecifiedNullable().booleanValue();
- }
-
- public boolean isDefaultNullable() {
- return BaseColumn.DEFAULT_NULLABLE;
- }
-
- public Boolean getSpecifiedNullable() {
- return this.specifiedNullable;
- }
-
- public void setSpecifiedNullable(Boolean newSpecifiedNullable) {
- Boolean oldSpecifiedNullable = this.specifiedNullable;
- this.specifiedNullable = newSpecifiedNullable;
- this.getResourceColumn().setNullable(newSpecifiedNullable);
- firePropertyChanged(BaseColumn.SPECIFIED_NULLABLE_PROPERTY, oldSpecifiedNullable, newSpecifiedNullable);
- }
-
- /**
- * internal setter used only for updating from the resource model.
- * There were problems with InvalidThreadAccess exceptions in the UI
- * when you set a value from the UI and the annotation doesn't exist yet.
- * Adding the annotation causes an update to occur and then the exception.
- */
- protected void setSpecifiedNullable_(Boolean newSpecifiedNullable) {
- Boolean oldSpecifiedNullable = this.specifiedNullable;
- this.specifiedNullable = newSpecifiedNullable;
- firePropertyChanged(BaseColumn.SPECIFIED_NULLABLE_PROPERTY, oldSpecifiedNullable, newSpecifiedNullable);
- }
-
- protected Boolean getResourceNullable() {
- return getResourceColumn().getNullable();
- }
-
- //************** insertable *******************
-
- public boolean isInsertable() {
- return (this.getSpecifiedInsertable() == null) ? this.isDefaultInsertable() : this.getSpecifiedInsertable().booleanValue();
- }
-
- public boolean isDefaultInsertable() {
- return BaseColumn.DEFAULT_INSERTABLE;
- }
-
- public Boolean getSpecifiedInsertable() {
- return this.specifiedInsertable;
- }
-
- public void setSpecifiedInsertable(Boolean newSpecifiedInsertable) {
- Boolean oldSpecifiedInsertable = this.specifiedInsertable;
- this.specifiedInsertable = newSpecifiedInsertable;
- this.getResourceColumn().setInsertable(newSpecifiedInsertable);
- firePropertyChanged(BaseColumn.SPECIFIED_INSERTABLE_PROPERTY, oldSpecifiedInsertable, newSpecifiedInsertable);
- }
-
- /**
- * internal setter used only for updating from the resource model.
- * There were problems with InvalidThreadAccess exceptions in the UI
- * when you set a value from the UI and the annotation doesn't exist yet.
- * Adding the annotation causes an update to occur and then the exception.
- */
- protected void setSpecifiedInsertable_(Boolean newSpecifiedInsertable) {
- Boolean oldSpecifiedInsertable = this.specifiedInsertable;
- this.specifiedInsertable = newSpecifiedInsertable;
- firePropertyChanged(BaseColumn.SPECIFIED_INSERTABLE_PROPERTY, oldSpecifiedInsertable, newSpecifiedInsertable);
- }
-
- protected Boolean getResourceInsertable() {
- return getResourceColumn().getInsertable();
- }
-
- //************** updatable *******************
-
- public boolean isUpdatable() {
- return (this.getSpecifiedUpdatable() == null) ? this.isDefaultUpdatable() : this.getSpecifiedUpdatable().booleanValue();
- }
-
- public boolean isDefaultUpdatable() {
- return BaseColumn.DEFAULT_UPDATABLE;
- }
-
- public Boolean getSpecifiedUpdatable() {
- return this.specifiedUpdatable;
- }
-
- public void setSpecifiedUpdatable(Boolean newSpecifiedUpdatable) {
- Boolean oldSpecifiedUpdatable = this.specifiedUpdatable;
- this.specifiedUpdatable = newSpecifiedUpdatable;
- this.getResourceColumn().setUpdatable(newSpecifiedUpdatable);
- firePropertyChanged(BaseColumn.SPECIFIED_UPDATABLE_PROPERTY, oldSpecifiedUpdatable, newSpecifiedUpdatable);
- }
-
- /**
- * internal setter used only for updating from the resource model.
- * There were problems with InvalidThreadAccess exceptions in the UI
- * when you set a value from the UI and the annotation doesn't exist yet.
- * Adding the annotation causes an update to occur and then the exception.
- */
- protected void setSpecifiedUpdatable_(Boolean newSpecifiedUpdatable) {
- Boolean oldSpecifiedUpdatable = this.specifiedUpdatable;
- this.specifiedUpdatable = newSpecifiedUpdatable;
- firePropertyChanged(BaseColumn.SPECIFIED_UPDATABLE_PROPERTY, oldSpecifiedUpdatable, newSpecifiedUpdatable);
- }
-
- protected Boolean getResourceUpdatable() {
- return getResourceColumn().getUpdatable();
- }
-
- @Override
- protected String getTableName() {
- return this.getTable();
- }
-
- public TextRange getTableTextRange(CompilationUnit astRoot) {
- TextRange textRange = this.getResourceColumn().getTableTextRange(astRoot);
- return (textRange != null) ? textRange : this.getOwner().getValidationTextRange(astRoot);
- }
-
- public boolean tableTouches(int pos, CompilationUnit astRoot) {
- return getResourceColumn().tableTouches(pos, astRoot);
- }
-
- private Iterator<String> candidateTableNames() {
- return this.tableIsAllowed() ? this.getOwner().getTypeMapping().associatedTableNamesIncludingInherited() : EmptyIterator.<String> instance();
- }
-
- private Iterator<String> candidateTableNames(Filter<String> filter) {
- return new FilteringIterator<String, String>(this.candidateTableNames(), filter);
- }
-
- private Iterator<String> javaCandidateTableNames(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.candidateTableNames(filter));
- }
-
- /**
- * Return whether the 'table' element is allowed. It is not allowed for
- * join columns inside of join tables.
- */
- public abstract boolean tableIsAllowed();
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.tableTouches(pos, astRoot)) {
- return this.javaCandidateTableNames(filter);
- }
- return null;
- }
-
- protected String buildDefaultTable() {
- return this.getOwner().getDefaultTableName();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java
deleted file mode 100644
index 84b65f332f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.AttributeOverrideContainer;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.Embeddable;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaBaseEmbeddedMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-
-public abstract class AbstractJavaBaseEmbeddedMapping<T extends Annotation>
- extends AbstractJavaAttributeMapping<T>
- implements JavaBaseEmbeddedMapping
-{
- protected final JavaAttributeOverrideContainer attributeOverrideContainer;
-
- private Embeddable embeddable;
-
- protected AbstractJavaBaseEmbeddedMapping(JavaPersistentAttribute parent) {
- super(parent);
- this.attributeOverrideContainer = this.getJpaFactory().buildJavaAttributeOverrideContainer(this, new AttributeOverrideContainerOwner());
- }
-
- public JavaAttributeOverrideContainer getAttributeOverrideContainer() {
- return this.attributeOverrideContainer;
- }
-
- public TypeMapping getOverridableTypeMapping() {
- return this.embeddable;
- }
-
- //****************** JavaAttributeMapping implementation *******************
-
- @Override
- protected void addSupportingAnnotationNamesTo(Vector<String> names) {
- super.addSupportingAnnotationNamesTo(names);
- names.add(JPA.ATTRIBUTE_OVERRIDE);
- names.add(JPA.ATTRIBUTE_OVERRIDES);
- }
-
- public Embeddable getEmbeddable() {
- return this.embeddable;
- }
-
-
- @Override
- protected void initialize() {
- super.initialize();
- this.attributeOverrideContainer.initialize(this.getResourcePersistentAttribute());
- this.embeddable = this.getPersistentAttribute().getEmbeddable();
- }
-
- @Override
- protected void update() {
- super.update();
- this.embeddable = this.getPersistentAttribute().getEmbeddable();
- this.attributeOverrideContainer.update(this.getResourcePersistentAttribute());
- }
-
- protected Iterator<AttributeMapping> embeddableAttributeMappings() {
- if (this.getEmbeddable() == null) {
- return EmptyIterator.instance();
- }
- return this.getEmbeddable().attributeMappings();
- }
-
- @Override
- public Iterator<String> allOverrideableAttributeMappingNames() {
- if (getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
- return embeddableOverrideableAttributeMappingNames();
- }
- return super.allOverrideableAttributeMappingNames();
- }
-
- @Override
- public Iterator<String> allOverrideableAssociationMappingNames() {
- if (getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
- return embeddableOverrideableAssociationMappingNames();
- }
- return super.allOverrideableAssociationMappingNames();
- }
-
- protected Iterator<String> embeddableOverrideableAttributeMappingNames() {
- return new TransformationIterator<String, String>(
- new CompositeIterator<String>(
- new TransformationIterator<AttributeMapping, Iterator<String>>(this.embeddableAttributeMappings()) {
- @Override
- protected Iterator<String> transform(AttributeMapping mapping) {
- return mapping.allOverrideableAttributeMappingNames();
- }
- }
- )
- ) {
- @Override
- protected String transform(String next) {
- return getName() + '.' + next;
- }
- };
- }
-
- protected Iterator<String> embeddableOverrideableAssociationMappingNames() {
- return new TransformationIterator<String, String>(
- new CompositeIterator<String>(
- new TransformationIterator<AttributeMapping, Iterator<String>>(this.embeddableAttributeMappings()) {
- @Override
- protected Iterator<String> transform(AttributeMapping mapping) {
- return mapping.allOverrideableAssociationMappingNames();
- }
- }
- )
- ) {
- @Override
- protected String transform(String next) {
- return getName() + '.' + next;
- }
- };
- }
-
- @Override
- public Column resolveOverridenColumn(String attributeName) {
- if (getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
- int dotIndex = attributeName.indexOf('.');
- if (dotIndex != -1) {
- if (getName().equals(attributeName.substring(0, dotIndex))) {
- attributeName = attributeName.substring(dotIndex + 1);
- AttributeOverride override = getAttributeOverrideContainer().getAttributeOverrideNamed(attributeName);
- if (override != null && !override.isVirtual()) {
- return override.getColumn();
- }
- if (this.getEmbeddable() == null) {
- return null;
- }
- return this.getEmbeddable().resolveOverridenColumn(attributeName);
- }
- }
- }
- return null;
- }
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- result = getAttributeOverrideContainer().javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return null;
- }
-
- //******** Validation ******************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- getAttributeOverrideContainer().validate(messages, reporter, astRoot);
- }
-
-
- //********** AttributeOverrideContainer.Owner implementation *********
-
- class AttributeOverrideContainerOwner implements AttributeOverrideContainer.Owner {
- public TypeMapping getOverridableTypeMapping() {
- return AbstractJavaBaseEmbeddedMapping.this.getOverridableTypeMapping();
- }
-
- public TypeMapping getTypeMapping() {
- return AbstractJavaBaseEmbeddedMapping.this.getTypeMapping();
- }
-
- public Column resolveOverridenColumn(String attributeOverrideName) {
- TypeMapping overridableTypeMapping = getOverridableTypeMapping();
- Column column = null;
- if (overridableTypeMapping != null) {
- for (TypeMapping typeMapping : CollectionTools.iterable(overridableTypeMapping.inheritanceHierarchy())) {
- column = typeMapping.resolveOverridenColumn(attributeOverrideName);
- if (column != null) {
- return column;
- }
- }
- }
- return column;
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMapping.java
deleted file mode 100644
index b4630cbc31..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMapping.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.Fetchable;
-import org.eclipse.jpt.core.context.Nullable;
-import org.eclipse.jpt.core.context.java.JavaBasicMapping;
-import org.eclipse.jpt.core.context.java.JavaColumn;
-import org.eclipse.jpt.core.context.java.JavaConverter;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.LobAnnotation;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-
-public abstract class AbstractJavaBasicMapping
- extends AbstractJavaAttributeMapping<BasicAnnotation>
- implements JavaBasicMapping
-{
- protected FetchType specifiedFetch;
-
- protected Boolean specifiedOptional;
-
- protected final JavaColumn column;
-
- protected final JavaConverter defaultConverter;
-
- protected JavaConverter specifiedConverter;
-
-
- protected AbstractJavaBasicMapping(JavaPersistentAttribute parent) {
- super(parent);
- this.column = getJpaFactory().buildJavaColumn(this, this);
- this.defaultConverter = getJpaFactory().buildJavaNullConverter(this);
- }
-
- @Override
- protected void initialize() {
- super.initialize();
- this.column.initialize(this.getResourceColumn());
- this.specifiedConverter = this.buildSpecifiedConverter(this.getResourceConverterType());
- this.specifiedFetch = this.getResourceFetch();
- this.specifiedOptional = this.getResourceOptional();
- }
-
- public ColumnAnnotation getResourceColumn() {
- return (ColumnAnnotation) getResourcePersistentAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
- }
-
- //************** AttributeMapping implementation ***************
- public String getKey() {
- return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
- }
-
- //************** JavaAttributeMapping implementation ***************
- public String getAnnotationName() {
- return BasicAnnotation.ANNOTATION_NAME;
- }
-
- @Override
- protected void addSupportingAnnotationNamesTo(Vector<String> names) {
- super.addSupportingAnnotationNamesTo(names);
- names.add(JPA.COLUMN);
- names.add(JPA.LOB);
- names.add(JPA.TEMPORAL);
- names.add(JPA.ENUMERATED);
- }
-
- public String getDefaultColumnName() {
- return getName();
- }
-
- public String getDefaultTableName() {
- return getTypeMapping().getPrimaryTableName();
- }
-
- //************** BasicMapping implementation ***************
-
- public JavaColumn getColumn() {
- return this.column;
- }
-
- public FetchType getFetch() {
- return (this.getSpecifiedFetch() == null) ? this.getDefaultFetch() : this.getSpecifiedFetch();
- }
-
- public FetchType getDefaultFetch() {
- return DEFAULT_FETCH_TYPE;
- }
-
- public FetchType getSpecifiedFetch() {
- return this.specifiedFetch;
- }
-
- public void setSpecifiedFetch(FetchType newSpecifiedFetch) {
- FetchType oldFetch = this.specifiedFetch;
- this.specifiedFetch = newSpecifiedFetch;
- this.mappingAnnotation.setFetch(FetchType.toJavaResourceModel(newSpecifiedFetch));
- firePropertyChanged(Fetchable.SPECIFIED_FETCH_PROPERTY, oldFetch, newSpecifiedFetch);
- }
-
- /**
- * internal setter used only for updating from the resource model.
- * There were problems with InvalidThreadAccess exceptions in the UI
- * when you set a value from the UI and the annotation doesn't exist yet.
- * Adding the annotation causes an update to occur and then the exception.
- */
- protected void setSpecifiedFetch_(FetchType newSpecifiedFetch) {
- FetchType oldFetch = this.specifiedFetch;
- this.specifiedFetch = newSpecifiedFetch;
- firePropertyChanged(Fetchable.SPECIFIED_FETCH_PROPERTY, oldFetch, newSpecifiedFetch);
- }
-
- public boolean isOptional() {
- return (this.getSpecifiedOptional() == null) ? this.isDefaultOptional() : this.getSpecifiedOptional().booleanValue();
- }
-
- public boolean isDefaultOptional() {
- return Nullable.DEFAULT_OPTIONAL;
- }
-
- public Boolean getSpecifiedOptional() {
- return this.specifiedOptional;
- }
-
- public void setSpecifiedOptional(Boolean newSpecifiedOptional) {
- Boolean oldOptional = this.specifiedOptional;
- this.specifiedOptional = newSpecifiedOptional;
- this.mappingAnnotation.setOptional(newSpecifiedOptional);
- firePropertyChanged(Nullable.SPECIFIED_OPTIONAL_PROPERTY, oldOptional, newSpecifiedOptional);
- }
-
- protected void setSpecifiedOptional_(Boolean newSpecifiedOptional) {
- Boolean oldOptional = this.specifiedOptional;
- this.specifiedOptional = newSpecifiedOptional;
- firePropertyChanged(Nullable.SPECIFIED_OPTIONAL_PROPERTY, oldOptional, newSpecifiedOptional);
- }
-
- public JavaConverter getConverter() {
- return getSpecifiedConverter() == null ? getDefaultConverter() : getSpecifiedConverter();
- }
-
- public JavaConverter getDefaultConverter() {
- return this.defaultConverter;
- }
-
- public JavaConverter getSpecifiedConverter() {
- return this.specifiedConverter;
- }
-
- protected String getSpecifedConverterType() {
- if (this.specifiedConverter == null) {
- return Converter.NO_CONVERTER;
- }
- return this.specifiedConverter.getType();
- }
-
- public void setSpecifiedConverter(String converterType) {
- if (this.valuesAreEqual(getSpecifedConverterType(), converterType)) {
- return;
- }
- JavaConverter oldConverter = this.specifiedConverter;
- JavaConverter newConverter = buildSpecifiedConverter(converterType);
- this.specifiedConverter = null;
- if (oldConverter != null) {
- oldConverter.removeFromResourceModel();
- }
- this.specifiedConverter = newConverter;
- if (newConverter != null) {
- newConverter.addToResourceModel();
- }
- firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
- }
-
- protected void setSpecifiedConverter(JavaConverter newConverter) {
- JavaConverter oldConverter = this.specifiedConverter;
- this.specifiedConverter = newConverter;
- firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
- }
-
- @Override
- protected void update() {
- super.update();
- this.column.update(this.getResourceColumn());
- if (this.valuesAreEqual(getResourceConverterType(), getSpecifedConverterType())) {
- getSpecifiedConverter().update(this.getResourcePersistentAttribute());
- }
- else {
- JavaConverter javaConverter = buildSpecifiedConverter(getResourceConverterType());
- setSpecifiedConverter(javaConverter);
- }
- this.setSpecifiedFetch_(this.getResourceFetch());
- this.setSpecifiedOptional_(this.getResourceOptional());
- }
-
- protected FetchType getResourceFetch() {
- return FetchType.fromJavaResourceModel(this.mappingAnnotation.getFetch());
- }
-
- protected Boolean getResourceOptional() {
- return this.mappingAnnotation.getOptional();
- }
-
- protected JavaConverter buildSpecifiedConverter(String converterType) {
- if (this.valuesAreEqual(converterType, Converter.ENUMERATED_CONVERTER)) {
- return getJpaFactory().buildJavaEnumeratedConverter(this, this.getResourcePersistentAttribute());
- }
- if (this.valuesAreEqual(converterType, Converter.TEMPORAL_CONVERTER)) {
- return getJpaFactory().buildJavaTemporalConverter(this, this.getResourcePersistentAttribute());
- }
- if (this.valuesAreEqual(converterType, Converter.LOB_CONVERTER)) {
- return getJpaFactory().buildJavaLobConverter(this, this.getResourcePersistentAttribute());
- }
- return null;
- }
-
- protected String getResourceConverterType() {
- if (this.getResourcePersistentAttribute().getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME) != null) {
- return Converter.ENUMERATED_CONVERTER;
- }
- if (this.getResourcePersistentAttribute().getAnnotation(TemporalAnnotation.ANNOTATION_NAME) != null) {
- return Converter.TEMPORAL_CONVERTER;
- }
- if (this.getResourcePersistentAttribute().getAnnotation(LobAnnotation.ANNOTATION_NAME) != null) {
- return Converter.LOB_CONVERTER;
- }
- return null;
- }
-
- @Override
- public boolean isOverridableAttributeMapping() {
- return true;
- }
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.getColumn().javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return null;
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- if (this.shouldValidateAgainstDatabase()) {
- this.validateColumn(messages, astRoot);
- }
- if (this.specifiedConverter != null) {
- this.specifiedConverter.validate(messages, reporter, astRoot);
- }
- }
-
- protected void validateColumn(List<IMessage> messages, CompilationUnit astRoot) {
- if (this.getTypeMapping().tableNameIsInvalid(this.column.getTable())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_TABLE,
- new String[] {this.column.getTable(), this.column.getName()},
- this.column,
- this.column.getTableTextRange(astRoot)
- )
- );
- return;
- }
-
- if ( ! this.column.isResolved() && this.column.getDbTable() != null) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {this.column.getName()},
- this.column,
- this.column.getNameTextRange(astRoot)
- )
- );
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEmbeddable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEmbeddable.java
deleted file mode 100644
index 0bcff08ea6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEmbeddable.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaEmbeddable;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-
-
-public abstract class AbstractJavaEmbeddable
- extends AbstractJavaTypeMapping
- implements JavaEmbeddable
-{
- protected AbstractJavaEmbeddable(JavaPersistentType parent) {
- super(parent);
- }
-
- public String getKey() {
- return MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
- }
-
- public String getAnnotationName() {
- return EmbeddableAnnotation.ANNOTATION_NAME;
- }
-
- public Iterable<String> getSupportingAnnotationNames() {
- return EmptyIterable.instance();
- }
-
- public boolean isMapped() {
- return true;
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return false;
- }
-
- @Override
- public boolean shouldValidateAgainstDatabase() {
- return false;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java
deleted file mode 100644
index 5023cfb1f1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java
+++ /dev/null
@@ -1,1634 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.JpaPlatformVariation.Supported;
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.AssociationOverrideContainer;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.AttributeOverrideContainer;
-import org.eclipse.jpt.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.DiscriminatorColumn;
-import org.eclipse.jpt.core.context.DiscriminatorType;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.InheritanceType;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.RelationshipReference;
-import org.eclipse.jpt.core.context.SecondaryTable;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaBaseJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaDiscriminatorColumn;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.context.java.JavaGeneratorContainer;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaQueryContainer;
-import org.eclipse.jpt.core.context.java.JavaSecondaryTable;
-import org.eclipse.jpt.core.context.java.JavaTable;
-import org.eclipse.jpt.core.internal.resource.java.NullPrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCacheableHolder2_0;
-import org.eclipse.jpt.core.resource.java.DiscriminatorColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.DiscriminatorValueAnnotation;
-import org.eclipse.jpt.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.core.resource.java.IdClassAnnotation;
-import org.eclipse.jpt.core.resource.java.InheritanceAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTablesAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.SingleElementListIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-
-public abstract class AbstractJavaEntity
- extends AbstractJavaTypeMapping
- implements JavaEntity, JavaCacheableHolder2_0
-{
- protected String specifiedName;
-
- protected String defaultName;
-
- protected final JavaTable table;
-
- protected boolean specifiedTableIsAllowed;
-
- protected boolean tableIsUndefined;
-
- protected final List<JavaSecondaryTable> specifiedSecondaryTables;
-
- protected final List<JavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns;
-
- protected JavaPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn;
-
- protected InheritanceType specifiedInheritanceStrategy;
-
- protected InheritanceType defaultInheritanceStrategy;
-
- protected String defaultDiscriminatorValue;
-
- protected String specifiedDiscriminatorValue;
-
- 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 JavaQueryContainer queryContainer;
-
- protected final JavaGeneratorContainer generatorContainer;
-
- protected String idClass;
-
- protected Entity rootEntity;
-
- protected AbstractJavaEntity(JavaPersistentType parent) {
- super(parent);
- this.table = this.getJpaFactory().buildJavaTable(this);
- this.discriminatorColumn = buildJavaDiscriminatorColumn();
- this.specifiedSecondaryTables = new ArrayList<JavaSecondaryTable>();
- this.specifiedPrimaryKeyJoinColumns = new ArrayList<JavaPrimaryKeyJoinColumn>();
- this.attributeOverrideContainer = this.getJpaFactory().buildJavaAttributeOverrideContainer(this, new AttributeOverrideContainerOwner());
- this.associationOverrideContainer = this.getJpaFactory().buildJavaAssociationOverrideContainer(this, new AssociationOverrideContainerOwner());
- this.queryContainer = this.getJpaFactory().buildJavaQueryContainer(this);
- this.generatorContainer = this.getJpaFactory().buildJavaGeneratorContainer(this);
- }
-
- protected JavaBaseJoinColumn.Owner buildPrimaryKeyJoinColumnOwner() {
- return new PrimaryKeyJoinColumnOwner();
- }
-
- protected JavaDiscriminatorColumn buildJavaDiscriminatorColumn() {
- return this.getJpaFactory().buildJavaDiscriminatorColumn(this, buildDiscriminatorColumnOwner());
- }
-
- protected JavaDiscriminatorColumn.Owner buildDiscriminatorColumnOwner() {
- return new JavaDiscriminatorColumn.Owner(){
- public org.eclipse.jpt.db.Table getDbTable(String tableName) {
- return AbstractJavaEntity.this.getDbTable(tableName);
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return AbstractJavaEntity.this.getValidationTextRange(astRoot);
- }
-
- public TypeMapping getTypeMapping() {
- return AbstractJavaEntity.this;
- }
-
- public String getDefaultColumnName() {
- return isDescendant() ?
- getRootEntity().getDiscriminatorColumn().getName()
- :
- discriminatorColumnIsUndefined()?
- null
- :
- DiscriminatorColumn.DEFAULT_NAME;
- }
-
- public int getDefaultLength() {
- return isDescendant() ?
- getRootEntity().getDiscriminatorColumn().getLength()
- :
- discriminatorColumnIsUndefined()?
- 0//TODO think i want to return null here
- :
- DiscriminatorColumn.DEFAULT_LENGTH;
- }
-
- public DiscriminatorType getDefaultDiscriminatorType() {
- return isDescendant() ?
- getRootEntity().getDiscriminatorColumn().getDiscriminatorType()
- :
- discriminatorColumnIsUndefined()?
- null
- :
- DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE;
- }
- };
- }
-
- @Override
- public void initialize(JavaResourcePersistentType resourcePersistentType) {
- super.initialize(resourcePersistentType);
-
- this.specifiedName = this.getResourceName();
- this.defaultName = this.getResourceDefaultName();
- this.rootEntity = calculateRootEntity();
- this.defaultInheritanceStrategy = this.buildDefaultInheritanceStrategy();
- this.specifiedInheritanceStrategy = this.getResourceInheritanceStrategy(getResourceInheritance());
- this.specifiedDiscriminatorValueIsAllowed = this.buildSpecifiedDiscriminatorValueIsAllowed();
- this.discriminatorValueIsUndefined = this.buildDiscriminatorValueIsUndefined();
- this.specifiedDiscriminatorValue = this.getResourceDiscriminatorValue().getValue();
- this.defaultDiscriminatorValue = this.buildDefaultDiscriminatorValue();
- this.specifiedDiscriminatorColumnIsAllowed = this.buildSpecifiedDiscriminatorColumnIsAllowed();
- this.discriminatorColumnIsUndefined = this.buildDiscriminatorColumnIsUndefined();
- this.discriminatorColumn.initialize(this.getResourceDiscriminatorColumn());
- this.specifiedTableIsAllowed = this.buildSpecifiedTableIsAllowed();
- this.tableIsUndefined = this.buildTableIsUndefined();
- this.table.initialize(resourcePersistentType);
- this.initializeSecondaryTables();
- this.generatorContainer.initialize(resourcePersistentType);
- this.queryContainer.initialize(resourcePersistentType);
- this.initializePrimaryKeyJoinColumns();
- this.initializeDefaultPrimaryKeyJoinColumn();
- this.attributeOverrideContainer.initialize(resourcePersistentType);
- this.associationOverrideContainer.initialize(resourcePersistentType);
- this.initializeIdClass();
- }
-
- protected void initializeSecondaryTables() {
- for (Iterator<NestableAnnotation> stream =
- this.javaResourcePersistentType.annotations(
- SecondaryTableAnnotation.ANNOTATION_NAME,
- SecondaryTablesAnnotation.ANNOTATION_NAME);
- stream.hasNext(); ) {
- this.specifiedSecondaryTables.add(
- buildSecondaryTable((SecondaryTableAnnotation) stream.next()));
- }
- }
-
- protected void initializePrimaryKeyJoinColumns() {
- for (Iterator<NestableAnnotation> stream =
- this.javaResourcePersistentType.annotations(
- PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME,
- PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- stream.hasNext(); ) {
- this.specifiedPrimaryKeyJoinColumns.add(
- buildPrimaryKeyJoinColumn((PrimaryKeyJoinColumnAnnotation) stream.next()));
- }
- }
-
- protected boolean shouldBuildDefaultPrimaryKeyJoinColumn() {
- return !containsSpecifiedPrimaryKeyJoinColumns();
- }
-
- protected void initializeDefaultPrimaryKeyJoinColumn() {
- if (!shouldBuildDefaultPrimaryKeyJoinColumn()) {
- return;
- }
- this.defaultPrimaryKeyJoinColumn = buildPrimaryKeyJoinColumn(new NullPrimaryKeyJoinColumnAnnotation(this.javaResourcePersistentType));
- }
-
- //query for the inheritance resource every time on setters.
- //call one setter and the inheritanceResource could change.
- //You could call more than one setter before this object has received any notification
- //from the java resource model
- protected InheritanceAnnotation getResourceInheritance() {
- return (InheritanceAnnotation) this.javaResourcePersistentType.
- getNonNullAnnotation(InheritanceAnnotation.ANNOTATION_NAME);
- }
-
- protected DiscriminatorValueAnnotation getResourceDiscriminatorValue() {
- return (DiscriminatorValueAnnotation) this.javaResourcePersistentType.
- getNonNullAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME);
- }
-
- protected DiscriminatorColumnAnnotation getResourceDiscriminatorColumn() {
- return (DiscriminatorColumnAnnotation) this.javaResourcePersistentType.
- getNonNullAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME);
- }
-
- protected void initializeIdClass() {
- IdClassAnnotation resourceIdClass = getResourceIdClass();
- if (resourceIdClass != null) {
- this.idClass = resourceIdClass.getValue();
- }
- }
-
- @Override
- protected EntityAnnotation getResourceMappingAnnotation() {
- return (EntityAnnotation) super.getResourceMappingAnnotation();
- }
-
- //****************** AttributeOverrideContainer.Owner implementation *******************
-
- public TypeMapping getTypeMapping() {
- return this;
- }
-
- public TypeMapping getOverridableTypeMapping() {
- PersistentType superPersistentType = getPersistentType().getSuperPersistentType();
- return superPersistentType == null ? null : superPersistentType.getMapping();
- }
-
- //****************** TypeMapping implementation *******************
-
- public String getKey() {
- return MappingKeys.ENTITY_TYPE_MAPPING_KEY;
- }
-
- public boolean isMapped() {
- return true;
- }
-
- @Override
- public String getPrimaryTableName() {
- return this.getTable().getName();
- }
-
- @Override
- public org.eclipse.jpt.db.Table getPrimaryDbTable() {
- return getTable().getDbTable();
- }
-
- private static final org.eclipse.jpt.db.Table[] EMPTY_DB_TABLE_ARRAY = new org.eclipse.jpt.db.Table[0];
-
- @Override
- public org.eclipse.jpt.db.Table getDbTable(String tableName) {
- // the JPA platform searches database objects for us
- return this.getDataSource().selectDatabaseObjectForIdentifier(
- ArrayTools.array(this.associatedDbTablesIncludingInherited(), EMPTY_DB_TABLE_ARRAY),
- tableName
- );
- }
-
- protected Iterator<org.eclipse.jpt.db.Table> associatedDbTablesIncludingInherited() {
- return new FilteringIterator<org.eclipse.jpt.db.Table, org.eclipse.jpt.db.Table>(this.associatedDbTablesIncludingInherited_()) {
- @Override
- protected boolean accept(org.eclipse.jpt.db.Table t) {
- return t != null;
- }
- };
- }
-
- protected Iterator<org.eclipse.jpt.db.Table> associatedDbTablesIncludingInherited_() {
- return new TransformationIterator<Table, org.eclipse.jpt.db.Table>(this.associatedTablesIncludingInherited()) {
- @Override
- protected org.eclipse.jpt.db.Table transform(Table t) {
- return t.getDbTable();
- }
- };
- }
-
- @Override
- public Schema getDbSchema() {
- return getTable().getDbSchema();
- }
-
-
- //****************** JavaTypeMapping implementation *******************
-
- public String getAnnotationName() {
- return EntityAnnotation.ANNOTATION_NAME;
- }
-
- public Iterable<String> getSupportingAnnotationNames() {
- return SUPPORTING_ANNOTATION_NAMES;
- }
- protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
- JPA.TABLE,
- JPA.SECONDARY_TABLE,
- JPA.SECONDARY_TABLES,
- JPA.PRIMARY_KEY_JOIN_COLUMN,
- JPA.PRIMARY_KEY_JOIN_COLUMNS,
- JPA.ID_CLASS,
- JPA.INHERITANCE,
- JPA.DISCRIMINATOR_VALUE,
- JPA.DISCRIMINATOR_COLUMN,
- JPA.SEQUENCE_GENERATOR,
- JPA.TABLE_GENERATOR,
- JPA.NAMED_QUERY,
- JPA.NAMED_QUERIES,
- JPA.NAMED_NATIVE_QUERY,
- JPA.NAMED_NATIVE_QUERIES,
- JPA.SQL_RESULT_SET_MAPPING,
- JPA.EXCLUDE_DEFAULT_LISTENERS,
- JPA.EXCLUDE_SUPERCLASS_LISTENERS,
- JPA.ENTITY_LISTENERS,
- JPA.PRE_PERSIST,
- JPA.POST_PERSIST,
- JPA.PRE_REMOVE,
- JPA.POST_REMOVE,
- JPA.PRE_UPDATE,
- JPA.POST_UPDATE,
- JPA.POST_LOAD,
- JPA.ATTRIBUTE_OVERRIDE,
- JPA.ATTRIBUTE_OVERRIDES,
- JPA.ASSOCIATION_OVERRIDE,
- JPA.ASSOCIATION_OVERRIDES
- };
- protected static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
-
- //****************** Entity implementation *******************
-
- public String getName() {
- return (this.getSpecifiedName() == null) ? this.getDefaultName() : this.getSpecifiedName();
- }
-
- public String getSpecifiedName() {
- return this.specifiedName;
- }
-
- public void setSpecifiedName(String newSpecifiedName) {
- String oldSpecifiedName = this.specifiedName;
- this.specifiedName = newSpecifiedName;
- this.getResourceMappingAnnotation().setName(newSpecifiedName);
- firePropertyChanged(SPECIFIED_NAME_PROPERTY, oldSpecifiedName, newSpecifiedName);
- }
-
- protected void setSpecifiedName_(String newSpecifiedName) {
- String oldSpecifiedName = this.specifiedName;
- this.specifiedName = newSpecifiedName;
- firePropertyChanged(SPECIFIED_NAME_PROPERTY, oldSpecifiedName, newSpecifiedName);
- }
-
- public String getDefaultName() {
- return this.defaultName;
- }
-
- protected/*private-protected*/ void setDefaultName(String newDefaultName) {
- String oldDefaultName = this.defaultName;
- this.defaultName = newDefaultName;
- firePropertyChanged(DEFAULT_NAME_PROPERTY, oldDefaultName, newDefaultName);
- }
-
- public JavaTable getTable() {
- return this.table;
- }
-
- public ListIterator<JavaSecondaryTable> specifiedSecondaryTables() {
- return new CloneListIterator<JavaSecondaryTable>(this.specifiedSecondaryTables);
- }
-
- public int specifiedSecondaryTablesSize() {
- return this.specifiedSecondaryTables.size();
- }
-
- public JavaSecondaryTable addSpecifiedSecondaryTable(int index) {
- JavaSecondaryTable secondaryTable = getJpaFactory().buildJavaSecondaryTable(this);
- this.specifiedSecondaryTables.add(index, secondaryTable);
- SecondaryTableAnnotation secondaryTableResource =
- (SecondaryTableAnnotation) this.javaResourcePersistentType.
- addAnnotation(
- index, SecondaryTableAnnotation.ANNOTATION_NAME,
- SecondaryTablesAnnotation.ANNOTATION_NAME);
- secondaryTable.initialize(secondaryTableResource);
- fireItemAdded(SPECIFIED_SECONDARY_TABLES_LIST, index, secondaryTable);
- return secondaryTable;
- }
-
- public JavaSecondaryTable addSpecifiedSecondaryTable() {
- return this.addSpecifiedSecondaryTable(this.specifiedSecondaryTables.size());
- }
-
- protected void addSpecifiedSecondaryTable(int index, JavaSecondaryTable secondaryTable) {
- addItemToList(index, secondaryTable, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST);
- }
-
- protected void addSpecifiedSecondaryTable(JavaSecondaryTable secondaryTable) {
- this.addSpecifiedSecondaryTable(this.specifiedSecondaryTables.size(), secondaryTable);
- }
-
- public void removeSpecifiedSecondaryTable(SecondaryTable secondaryTable) {
- this.removeSpecifiedSecondaryTable(this.specifiedSecondaryTables.indexOf(secondaryTable));
- }
-
- public void removeSpecifiedSecondaryTable(int index) {
- JavaSecondaryTable removedSecondaryTable = this.specifiedSecondaryTables.remove(index);
- this.javaResourcePersistentType.removeAnnotation(
- index, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
- fireItemRemoved(SPECIFIED_SECONDARY_TABLES_LIST, index, removedSecondaryTable);
- }
-
- protected void removeSpecifiedSecondaryTable_(JavaSecondaryTable secondaryTable) {
- removeItemFromList(secondaryTable, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST);
- }
-
- public void moveSpecifiedSecondaryTable(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.specifiedSecondaryTables, targetIndex, sourceIndex);
- this.javaResourcePersistentType.moveAnnotation(
- targetIndex, sourceIndex, SecondaryTablesAnnotation.ANNOTATION_NAME);
- fireItemMoved(SPECIFIED_SECONDARY_TABLES_LIST, targetIndex, sourceIndex);
- }
-
- public ListIterator<JavaSecondaryTable> secondaryTables() {
- return specifiedSecondaryTables();
- }
-
- public int secondaryTablesSize() {
- return specifiedSecondaryTablesSize();
- }
-
- public InheritanceType getInheritanceStrategy() {
- return (this.getSpecifiedInheritanceStrategy() == null) ? this.getDefaultInheritanceStrategy() : this.getSpecifiedInheritanceStrategy();
- }
-
- public InheritanceType getDefaultInheritanceStrategy() {
- return this.defaultInheritanceStrategy;
- }
-
- protected void setDefaultInheritanceStrategy(InheritanceType newInheritanceType) {
- InheritanceType oldInheritanceType = this.defaultInheritanceStrategy;
- this.defaultInheritanceStrategy = newInheritanceType;
- firePropertyChanged(DEFAULT_INHERITANCE_STRATEGY_PROPERTY, oldInheritanceType, newInheritanceType);
- }
-
- public InheritanceType getSpecifiedInheritanceStrategy() {
- return this.specifiedInheritanceStrategy;
- }
-
- public void setSpecifiedInheritanceStrategy(InheritanceType newInheritanceType) {
- InheritanceType oldInheritanceType = this.specifiedInheritanceStrategy;
- this.specifiedInheritanceStrategy = newInheritanceType;
- getResourceInheritance().setStrategy(InheritanceType.toJavaResourceModel(newInheritanceType));
- firePropertyChanged(SPECIFIED_INHERITANCE_STRATEGY_PROPERTY, oldInheritanceType, newInheritanceType);
- }
-
- /**
- * internal setter used only for updating from the resource model.
- * There were problems with InvalidThreadAccess exceptions in the UI
- * when you set a value from the UI and the annotation doesn't exist yet.
- * Adding the annotation causes an update to occur and then the exception.
- */
- protected void setSpecifiedInheritanceStrategy_(InheritanceType newInheritanceType) {
- InheritanceType oldInheritanceType = this.specifiedInheritanceStrategy;
- this.specifiedInheritanceStrategy = newInheritanceType;
- firePropertyChanged(SPECIFIED_INHERITANCE_STRATEGY_PROPERTY, oldInheritanceType, newInheritanceType);
- }
-
- public JavaDiscriminatorColumn getDiscriminatorColumn() {
- return this.discriminatorColumn;
- }
-
- public String getDefaultDiscriminatorValue() {
- return this.defaultDiscriminatorValue;
- }
-
- protected void setDefaultDiscriminatorValue(String newDefaultDiscriminatorValue) {
- String oldDefaultDiscriminatorValue = this.defaultDiscriminatorValue;
- this.defaultDiscriminatorValue = newDefaultDiscriminatorValue;
- firePropertyChanged(DEFAULT_DISCRIMINATOR_VALUE_PROPERTY, oldDefaultDiscriminatorValue, newDefaultDiscriminatorValue);
- }
-
- public String getSpecifiedDiscriminatorValue() {
- return this.specifiedDiscriminatorValue;
- }
-
- public void setSpecifiedDiscriminatorValue(String newSpecifiedDiscriminatorValue) {
- String oldSpecifiedDiscriminatorValue = this.specifiedDiscriminatorValue;
- this.specifiedDiscriminatorValue = newSpecifiedDiscriminatorValue;
- getResourceDiscriminatorValue().setValue(newSpecifiedDiscriminatorValue);
- firePropertyChanged(SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY, oldSpecifiedDiscriminatorValue, newSpecifiedDiscriminatorValue);
- }
-
- /**
- * internal setter used only for updating from the resource model.
- * There were problems with InvalidThreadAccess exceptions in the UI
- * when you set a value from the UI and the annotation doesn't exist yet.
- * Adding the annotation causes an update to occur and then the exception.
- */
- protected void setSpecifiedDiscriminatorValue_(String newSpecifiedDiscriminatorValue) {
- String oldSpecifiedDiscriminatorValue = this.specifiedDiscriminatorValue;
- this.specifiedDiscriminatorValue = newSpecifiedDiscriminatorValue;
- firePropertyChanged(SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY, oldSpecifiedDiscriminatorValue, newSpecifiedDiscriminatorValue);
- }
-
- public String getDiscriminatorValue() {
- return (this.getSpecifiedDiscriminatorValue() == null) ? getDefaultDiscriminatorValue() : this.getSpecifiedDiscriminatorValue();
- }
-
- public boolean specifiedDiscriminatorValueIsAllowed() {
- return this.specifiedDiscriminatorValueIsAllowed;
- }
-
- protected void setSpecifiedDiscriminatorValueIsAllowed(boolean specifiedDiscriminatorValueIsAllowed) {
- boolean old = this.specifiedDiscriminatorValueIsAllowed;
- this.specifiedDiscriminatorValueIsAllowed = specifiedDiscriminatorValueIsAllowed;
- firePropertyChanged(Entity.SPECIFIED_DISCRIMINATOR_VALUE_IS_ALLOWED_PROPERTY, old, specifiedDiscriminatorValueIsAllowed);
- }
-
- public boolean discriminatorValueIsUndefined() {
- return this.discriminatorValueIsUndefined;
- }
-
- protected void setDiscriminatorValueIsUndefined(boolean discriminatorValueIsUndefined) {
- boolean old = this.discriminatorValueIsUndefined;
- this.discriminatorValueIsUndefined = discriminatorValueIsUndefined;
- firePropertyChanged(DISCRIMINATOR_VALUE_IS_UNDEFINED_PROPERTY, old, discriminatorValueIsUndefined);
- }
-
- public boolean specifiedDiscriminatorColumnIsAllowed() {
- return this.specifiedDiscriminatorColumnIsAllowed;
- }
-
- protected void setSpecifiedDiscriminatorColumnIsAllowed(boolean specifiedDiscriminatorColumnIsAllowed) {
- boolean old = this.specifiedDiscriminatorColumnIsAllowed;
- this.specifiedDiscriminatorColumnIsAllowed = specifiedDiscriminatorColumnIsAllowed;
- firePropertyChanged(SPECIFIED_DISCRIMINATOR_COLUMN_IS_ALLOWED_PROPERTY, old, specifiedDiscriminatorColumnIsAllowed);
- }
-
- public boolean discriminatorColumnIsUndefined() {
- return this.discriminatorColumnIsUndefined;
- }
-
- protected void setDiscriminatorColumnIsUndefined(boolean discriminatorColumnIsUndefined) {
- boolean old = this.discriminatorColumnIsUndefined;
- this.discriminatorColumnIsUndefined = discriminatorColumnIsUndefined;
- firePropertyChanged(DISCRIMINATOR_COLUMN_IS_UNDEFINED_PROPERTY, old, discriminatorColumnIsUndefined);
- }
-
- public boolean specifiedTableIsAllowed() {
- return this.specifiedTableIsAllowed;
- }
-
- protected void setSpecifiedTableIsAllowed(boolean specifiedTableIsAllowed) {
- boolean old = this.specifiedTableIsAllowed;
- this.specifiedTableIsAllowed = specifiedTableIsAllowed;
- firePropertyChanged(SPECIFIED_TABLE_IS_ALLOWED_PROPERTY, old, specifiedTableIsAllowed);
- }
-
- public boolean tableIsUndefined() {
- return this.tableIsUndefined;
- }
-
- protected void setTableIsUndefined(boolean tableIsUndefined) {
- boolean old = this.tableIsUndefined;
- this.tableIsUndefined = tableIsUndefined;
- firePropertyChanged(TABLE_IS_UNDEFINED_PROPERTY, old, tableIsUndefined);
- }
-
- public JavaGeneratorContainer getGeneratorContainer() {
- return this.generatorContainer;
- }
-
- public ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
- return this.containsSpecifiedPrimaryKeyJoinColumns() ? this.specifiedPrimaryKeyJoinColumns() : this.defaultPrimaryKeyJoinColumns();
- }
-
- public int primaryKeyJoinColumnsSize() {
- return this.containsSpecifiedPrimaryKeyJoinColumns() ? this.specifiedPrimaryKeyJoinColumnsSize() : this.defaultPrimaryKeyJoinColumnsSize();
- }
-
- public ListIterator<JavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns() {
- return new CloneListIterator<JavaPrimaryKeyJoinColumn>(this.specifiedPrimaryKeyJoinColumns);
- }
-
- public int specifiedPrimaryKeyJoinColumnsSize() {
- return this.specifiedPrimaryKeyJoinColumns.size();
- }
-
- public boolean containsSpecifiedPrimaryKeyJoinColumns() {
- return !this.specifiedPrimaryKeyJoinColumns.isEmpty();
- }
-
- public JavaPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn() {
- return this.defaultPrimaryKeyJoinColumn;
- }
-
- protected void setDefaultPrimaryKeyJoinColumn(JavaPrimaryKeyJoinColumn newPkJoinColumn) {
- JavaPrimaryKeyJoinColumn oldPkJoinColumn = this.defaultPrimaryKeyJoinColumn;
- this.defaultPrimaryKeyJoinColumn = newPkJoinColumn;
- firePropertyChanged(DEFAULT_PRIMARY_KEY_JOIN_COLUMN, oldPkJoinColumn, newPkJoinColumn);
- }
-
- protected ListIterator<JavaPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns() {
- if (this.defaultPrimaryKeyJoinColumn != null) {
- return new SingleElementListIterator<JavaPrimaryKeyJoinColumn>(this.defaultPrimaryKeyJoinColumn);
- }
- return EmptyListIterator.instance();
- }
-
- protected int defaultPrimaryKeyJoinColumnsSize() {
- return (this.defaultPrimaryKeyJoinColumn == null) ? 0 : 1;
- }
-
- public JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
- JavaPrimaryKeyJoinColumn oldDefaultPkJoinColumn = this.getDefaultPrimaryKeyJoinColumn();
- if (oldDefaultPkJoinColumn != null) {
- //null the default join column now if one already exists.
- //if one does not exist, there is already a specified join column.
- //Remove it now so that it doesn't get removed during an update and
- //cause change notifications to be sent to the UI in the wrong order
- this.defaultPrimaryKeyJoinColumn = null;
- }
- JavaPrimaryKeyJoinColumn primaryKeyJoinColumn = getJpaFactory().buildJavaPrimaryKeyJoinColumn(this, buildPrimaryKeyJoinColumnOwner());
- this.specifiedPrimaryKeyJoinColumns.add(index, primaryKeyJoinColumn);
- PrimaryKeyJoinColumnAnnotation pkJoinColumnResource =
- (PrimaryKeyJoinColumnAnnotation) this.javaResourcePersistentType.
- addAnnotation(
- index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME,
- PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- primaryKeyJoinColumn.initialize(pkJoinColumnResource);
- this.fireItemAdded(SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, primaryKeyJoinColumn);
- if (oldDefaultPkJoinColumn != null) {
- this.firePropertyChanged(DEFAULT_PRIMARY_KEY_JOIN_COLUMN, oldDefaultPkJoinColumn, null);
- }
- return primaryKeyJoinColumn;
- }
-
- protected void addSpecifiedPrimaryKeyJoinColumn(int index, JavaPrimaryKeyJoinColumn primaryKeyJoinColumn) {
- addItemToList(index, primaryKeyJoinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- protected void addSpecifiedPrimaryKeyJoinColumn(JavaPrimaryKeyJoinColumn primaryKeyJoinColumn) {
- this.addSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.size(), primaryKeyJoinColumn);
- }
-
- public void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn primaryKeyJoinColumn) {
- removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.indexOf(primaryKeyJoinColumn));
- }
-
- public void removeSpecifiedPrimaryKeyJoinColumn(int index) {
- JavaPrimaryKeyJoinColumn removedPrimaryKeyJoinColumn = this.specifiedPrimaryKeyJoinColumns.remove(index);
- if (!containsSpecifiedPrimaryKeyJoinColumns()) {
- //create the defaultJoinColumn now or this will happen during project update
- //after removing the join column from the resource model. That causes problems
- //in the UI because the change notifications end up in the wrong order.
- this.defaultPrimaryKeyJoinColumn = buildPrimaryKeyJoinColumn(new NullPrimaryKeyJoinColumnAnnotation(this.javaResourcePersistentType));
- }
- this.javaResourcePersistentType.removeAnnotation(
- index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME,
- PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- fireItemRemoved(SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, removedPrimaryKeyJoinColumn);
- if (this.defaultPrimaryKeyJoinColumn != null) {
- //fire change notification if a defaultJoinColumn was created above
- this.firePropertyChanged(DEFAULT_PRIMARY_KEY_JOIN_COLUMN, null, this.defaultPrimaryKeyJoinColumn);
- }
- }
-
- protected void removeSpecifiedPrimaryKeyJoinColumn_(JavaPrimaryKeyJoinColumn primaryKeyJoinColumn) {
- removeItemFromList(primaryKeyJoinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
- this.javaResourcePersistentType.moveAnnotation(
- targetIndex, sourceIndex, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- moveItemInList(targetIndex, sourceIndex, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- public JavaAttributeOverrideContainer getAttributeOverrideContainer() {
- return this.attributeOverrideContainer;
- }
-
- public JavaAssociationOverrideContainer getAssociationOverrideContainer() {
- return this.associationOverrideContainer;
- }
-
- public JavaQueryContainer getQueryContainer() {
- return this.queryContainer;
- }
-
- public char getIdClassEnclosingTypeSeparator() {
- return '.';
- }
-
- public String getIdClass() {
- return this.idClass;
- }
-
- public void setIdClass(String newIdClass) {
- String oldIdClass = this.idClass;
- this.idClass = newIdClass;
- if (this.valuesAreDifferent(newIdClass, oldIdClass)) {
- if (newIdClass != null) {
- if (getResourceIdClass() == null) {
- addResourceIdClass();
- }
- getResourceIdClass().setValue(newIdClass);
- }
- else {
- removeResourceIdClass();
- }
- }
- firePropertyChanged(ID_CLASS_PROPERTY, oldIdClass, newIdClass);
- }
-
- protected void setIdClass_(String newIdClass) {
- String oldIdClass = this.idClass;
- this.idClass = newIdClass;
- firePropertyChanged(ID_CLASS_PROPERTY, oldIdClass, newIdClass);
- }
-
- protected IdClassAnnotation getResourceIdClass() {
- return (IdClassAnnotation) this.javaResourcePersistentType.
- getAnnotation(IdClassAnnotation.ANNOTATION_NAME);
- }
-
- protected void addResourceIdClass() {
- this.javaResourcePersistentType.addAnnotation(IdClassAnnotation.ANNOTATION_NAME);
- }
-
- protected void removeResourceIdClass() {
- this.javaResourcePersistentType.removeAnnotation(IdClassAnnotation.ANNOTATION_NAME);
- }
-
- public Entity getParentEntity() {
- for (Iterator<PersistentType> stream = getPersistentType().ancestors(); stream.hasNext();) {
- TypeMapping typeMapping = stream.next().getMapping();
- if (typeMapping instanceof Entity) {
- return (Entity) typeMapping;
- }
- }
- return null;
- }
-
- /**
- * Return the ultimate top of the inheritance hierarchy
- * This method should never return null. The root
- * is defined as the persistent type in the inheritance hierarchy
- * that has no parent. The root should be an entity
- *
- * Non-entities in the hierarchy should be ignored, ie skip
- * over them in the search for the root.
- */
- protected Entity getRootEntity() {
- return this.rootEntity;
- }
-
- /**
- * Table name defaults to the entity name.
- * If the entity is part of a single table inheritance hierarchy, table
- * name defaults to the root entity's table name.
- * If the entity is abstract and part of a table per class
- * inheritance hierarchy, the table name defaults to null, no table applies
- */
- public String getDefaultTableName() {
- return this.isSingleTableDescendant() ?
- this.getRootEntity().getTable().getName()
- :
- this.isAbstractTablePerClass() ?
- null
- :
- this.getName();
- }
-
- public String getDefaultSchema() {
- return this.isSingleTableDescendant() ?
- this.getRootEntity().getTable().getSchema()
- :
- this.isAbstractTablePerClass() ?
- null
- :
- this.getContextDefaultSchema();
- }
-
- public String getDefaultCatalog() {
- return this.isSingleTableDescendant() ?
- this.getRootEntity().getTable().getCatalog()
- :
- this.isAbstractTablePerClass() ?
- null
- :
- this.getContextDefaultCatalog();
- }
-
- /**
- * Return whether the entity is a descendant of the root entity
- * of a "single table" inheritance hierarchy.
- */
- protected boolean isSingleTableDescendant() {
- return (this.getInheritanceStrategy() == InheritanceType.SINGLE_TABLE)
- && this.isDescendant();
- }
-
- /**
- * 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 the top of an inheritance hierarchy.
- */
- protected boolean isRoot() {
- return this == this.getRootEntity();
- }
-
- /**
- * 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 isRoot() && !getPersistenceUnit().entityIsRootWithSubEntities(this.getName()) && getSpecifiedInheritanceStrategy() == null;
- }
-
- /**
- * Return whether the entity is abstract and is a part of a
- * "table per class" inheritance hierarchy.
- */
- protected boolean isAbstractTablePerClass() {
- return isAbstract() && 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 isTablePerClass() && isDescendant();
- }
-
- /**
- * Return whether the type is abstract.
- */
- protected boolean isAbstract() {
- return this.javaResourcePersistentType.isAbstract();
- }
-
- public String getPrimaryKeyColumnName() {
- return getPrimaryKeyColumnName(this);
- }
-
- /**
- * Convenience implementation that is shared with ORM.
- */
- public static String getPrimaryKeyColumnName(Entity entity) {
- String pkColumnName = null;
- for (Iterator<PersistentAttribute> stream = entity.getPersistentType().allAttributes(); stream.hasNext(); ) {
- PersistentAttribute attribute = stream.next();
- String current = attribute.getPrimaryKeyColumnName();
- if (current != null) {
- // 229423 - if the attribute is a primary key, but it has an attribute override,
- // use the override column instead
- AttributeOverride attributeOverride = entity.getAttributeOverrideContainer().getAttributeOverrideNamed(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;
- }
-
- public PersistentAttribute getIdAttribute() {
- Iterator<PersistentAttribute> stream = this.allIdAttributes();
- if (stream.hasNext()) {
- PersistentAttribute attribute = stream.next();
- return stream.hasNext() ? null /*more than one*/: attribute;
- }
- return null;
- }
-
- protected Iterator<PersistentAttribute> allIdAttributes() {
- return new FilteringIterator<PersistentAttribute, PersistentAttribute>(this.getPersistentType().allAttributes()) {
- @Override
- protected boolean accept(PersistentAttribute pa) {
- return pa.isIdAttribute();
- }
- };
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return ! CollectionTools.contains(this.associatedTableNamesIncludingInherited(), tableName);
- }
-
- @Override
- public boolean shouldValidateAgainstDatabase() {
- return super.shouldValidateAgainstDatabase() && ! isAbstractTablePerClass();
- }
-
- @Override
- public Iterator<Table> associatedTables() {
- return new CompositeIterator<Table>(this.getTable(), this.secondaryTables());
- }
-
- @Override
- public Iterator<Table> associatedTablesIncludingInherited() {
- return new CompositeIterator<Table>(new TransformationIterator<TypeMapping, Iterator<Table>>(this.inheritanceHierarchy()) {
- @Override
- protected Iterator<Table> transform(TypeMapping mapping) {
- return new FilteringIterator<Table, Table>(mapping.associatedTables()) {
- @Override
- protected boolean accept(Table o) {
- return true;
- //TODO
- //filtering these out so as to avoid the duplicate table, root and children share the same table
- //return !(o instanceof SingleTableInheritanceChildTableImpl);
- }
- };
- }
- });
- }
-
- @Override
- public Iterator<String> associatedTableNamesIncludingInherited() {
- return this.nonNullTableNames(this.associatedTablesIncludingInherited());
- }
-
- protected Iterator<String> nonNullTableNames(Iterator<Table> tables) {
- return new FilteringIterator<String, String>(this.tableNames(tables)) {
- @Override
- protected boolean accept(String o) {
- return o != null;
- }
- };
- }
-
- protected Iterator<String> tableNames(Iterator<Table> tables) {
- return new TransformationIterator<Table, String>(tables) {
- @Override
- protected String transform(Table t) {
- return t.getName();
- }
- };
- }
-
- /**
- * Return an iterator of Entities, each which inherits from the one before,
- * and terminates at the root entity (or at the point of cyclicity).
- */
- protected Iterator<TypeMapping> ancestors() {
- return new TransformationIterator<PersistentType, TypeMapping>(getPersistentType().ancestors()) {
- @Override
- protected TypeMapping transform(PersistentType type) {
- return type.getMapping();
- }
- };
- }
-
- @Override
- public Iterator<String> overridableAttributeNames() {
- if (!isTablePerClass()) {
- return EmptyIterator.instance();
- }
- return super.overridableAttributeNames();
- }
-
- @Override
- public Column resolveOverridenColumn(String attributeName) {
- AttributeOverride override = getAttributeOverrideContainer().getAttributeOverrideNamed(attributeName);
- if (override != null && !override.isVirtual()) {
- return override.getColumn();
- }
- return super.resolveOverridenColumn(attributeName);
- }
-
- @Override
- public RelationshipReference resolveRelationshipReference(String attributeName) {
- AssociationOverride override = getAssociationOverrideContainer().getAssociationOverrideNamed(attributeName);
- if (override != null && !override.isVirtual()) {
- return override.getRelationshipReference();
- }
- return super.resolveRelationshipReference(attributeName);
- }
-
- @Override
- public Iterator<String> overridableAssociationNames() {
- if (!isTablePerClass()) {
- return EmptyIterator.instance();
- }
- return super.overridableAssociationNames();
- }
-
- public AttributeMapping resolveAttributeMapping(String name) {
- for (AttributeMapping attributeMapping : CollectionTools.iterable(this.allAttributeMappings())) {
- AttributeMapping resolvedMapping = attributeMapping.resolveAttributeMapping(name);
- if (resolvedMapping != null) {
- return resolvedMapping;
- }
- }
- return null;
- }
-
- @Override
- public void update(JavaResourcePersistentType resourcePersistentType) {
- super.update(resourcePersistentType);
-
- this.setSpecifiedName_(this.getResourceName());
- this.setDefaultName(this.getResourceDefaultName());
-
- this.updateRootEntity();
- this.updateInheritance(this.getResourceInheritance());
- this.updateDiscriminatorColumn();
- this.updateDiscriminatorValue(this.getResourceDiscriminatorValue());
- this.setSpecifiedTableIsAllowed(this.buildSpecifiedTableIsAllowed());
- this.setTableIsUndefined(this.buildTableIsUndefined());
- this.updateTable();
- this.updateSecondaryTables();
- this.generatorContainer.update(resourcePersistentType);
- this.queryContainer.update(resourcePersistentType);
- this.updateSpecifiedPrimaryKeyJoinColumns();
- this.updateDefaultPrimaryKeyJoinColumn();
- this.attributeOverrideContainer.update(resourcePersistentType);
- this.associationOverrideContainer.update(resourcePersistentType);
- this.updateIdClass();
- }
-
- @Override
- public void postUpdate() {
- super.postUpdate();
- this.postUpdateDiscriminatorColumn();
- this.postUpdateDiscriminatorValue();
- this.associationOverrideContainer.postUpdate();
- }
-
- protected String getResourceName() {
- return this.getResourceMappingAnnotation().getName();
- }
-
- protected String getResourceDefaultName() {
- return this.javaResourcePersistentType.getName();
- }
-
- protected void updateTable() {
- getTable().update(this.javaResourcePersistentType);
- }
-
- protected void updateInheritance(InheritanceAnnotation inheritanceResource) {
- this.setSpecifiedInheritanceStrategy_(this.getResourceInheritanceStrategy(inheritanceResource));
- this.setDefaultInheritanceStrategy(this.buildDefaultInheritanceStrategy());
- }
-
- protected InheritanceType getResourceInheritanceStrategy(InheritanceAnnotation inheritanceResource) {
- return InheritanceType.fromJavaResourceModel(inheritanceResource.getStrategy());
- }
-
- protected InheritanceType buildDefaultInheritanceStrategy() {
- return this.isRoot() ? InheritanceType.SINGLE_TABLE : this.getRootEntity().getInheritanceStrategy();
- }
-
- protected void updateRootEntity() {
- //I am making an assumption here that we don't need property change notification for rootEntity, this might be wrong
- this.rootEntity = calculateRootEntity();
- if (this.rootEntity != this) {
- this.rootEntity.addSubEntity(this);
- }
- }
-
- protected Entity calculateRootEntity() {
- Entity root = this;
- for (Iterator<TypeMapping> stream = inheritanceHierarchy(); stream.hasNext();) {
- TypeMapping typeMapping = stream.next();
- if (typeMapping instanceof Entity) {
- root = (Entity) typeMapping;
- }
- }
- return root;
- }
-
- public void addSubEntity(Entity subEntity) {
- getPersistenceUnit().addRootEntityWithSubEntities(getName());
- }
-
- protected void updateDiscriminatorColumn() {
- this.setSpecifiedDiscriminatorColumnIsAllowed(this.buildSpecifiedDiscriminatorColumnIsAllowed());
- getDiscriminatorColumn().update(this.getResourceDiscriminatorColumn());
- }
-
- protected void postUpdateDiscriminatorColumn() {
- this.setDiscriminatorColumnIsUndefined(this.buildDiscriminatorColumnIsUndefined());
- this.getDiscriminatorColumn().postUpdate();
- }
-
- protected void updateDiscriminatorValue(DiscriminatorValueAnnotation discriminatorValueResource) {
- this.setSpecifiedDiscriminatorValueIsAllowed(this.buildSpecifiedDiscriminatorValueIsAllowed());
- this.setSpecifiedDiscriminatorValue_(discriminatorValueResource.getValue());
- }
-
- protected void postUpdateDiscriminatorValue() {
- this.setDiscriminatorValueIsUndefined(this.buildDiscriminatorValueIsUndefined());
- this.setDefaultDiscriminatorValue(this.buildDefaultDiscriminatorValue());
- }
-
- /**
- * 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 (discriminatorValueIsUndefined()) {
- return null;
- }
- if (this.getDiscriminatorType() != DiscriminatorType.STRING) {
- return null;
- }
- return this.getName();
- }
-
- protected DiscriminatorType getDiscriminatorType() {
- return this.getDiscriminatorColumn().getDiscriminatorType();
- }
-
- protected boolean buildSpecifiedDiscriminatorValueIsAllowed() {
- return !isTablePerClass() && !isAbstract();
- }
-
- protected boolean buildDiscriminatorValueIsUndefined() {
- return isTablePerClass() || isAbstract() || isRootNoDescendantsNoStrategyDefined();
- }
-
- protected boolean buildSpecifiedDiscriminatorColumnIsAllowed() {
- return !isTablePerClass() && isRoot();
- }
-
- protected boolean buildDiscriminatorColumnIsUndefined() {
- return isTablePerClass() || isRootNoDescendantsNoStrategyDefined();
- }
-
- protected boolean buildSpecifiedTableIsAllowed() {
- return !isAbstractTablePerClass() && !isSingleTableDescendant();
- }
-
- protected boolean buildTableIsUndefined() {
- return isAbstractTablePerClass();
- }
-
- protected void updateSecondaryTables() {
- ListIterator<JavaSecondaryTable> secondaryTables = specifiedSecondaryTables();
- Iterator<NestableAnnotation> resourceSecondaryTables =
- this.javaResourcePersistentType.annotations(
- SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
-
- while (secondaryTables.hasNext()) {
- JavaSecondaryTable secondaryTable = secondaryTables.next();
- if (resourceSecondaryTables.hasNext()) {
- secondaryTable.update((SecondaryTableAnnotation) resourceSecondaryTables.next());
- }
- else {
- removeSpecifiedSecondaryTable_(secondaryTable);
- }
- }
-
- while (resourceSecondaryTables.hasNext()) {
- addSpecifiedSecondaryTable(buildSecondaryTable((SecondaryTableAnnotation) resourceSecondaryTables.next()));
- }
- }
-
- protected JavaSecondaryTable buildSecondaryTable(SecondaryTableAnnotation secondaryTableResource) {
- JavaSecondaryTable secondaryTable = getJpaFactory().buildJavaSecondaryTable(this);
- secondaryTable.initialize(secondaryTableResource);
- return secondaryTable;
- }
-
- protected void updateSpecifiedPrimaryKeyJoinColumns() {
- ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns = specifiedPrimaryKeyJoinColumns();
- Iterator<NestableAnnotation> resourcePrimaryKeyJoinColumns =
- this.javaResourcePersistentType.annotations(
- PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME,
- PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
-
- while (primaryKeyJoinColumns.hasNext()) {
- JavaPrimaryKeyJoinColumn primaryKeyJoinColumn = primaryKeyJoinColumns.next();
- if (resourcePrimaryKeyJoinColumns.hasNext()) {
- primaryKeyJoinColumn.update((PrimaryKeyJoinColumnAnnotation) resourcePrimaryKeyJoinColumns.next());
- }
- else {
- removeSpecifiedPrimaryKeyJoinColumn_(primaryKeyJoinColumn);
- }
- }
-
- while (resourcePrimaryKeyJoinColumns.hasNext()) {
- addSpecifiedPrimaryKeyJoinColumn(buildPrimaryKeyJoinColumn((PrimaryKeyJoinColumnAnnotation) resourcePrimaryKeyJoinColumns.next()));
- }
- }
-
- protected JavaPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(PrimaryKeyJoinColumnAnnotation primaryKeyJoinColumnResource) {
- JavaPrimaryKeyJoinColumn primaryKeyJoinColumn = getJpaFactory().buildJavaPrimaryKeyJoinColumn(this, buildPrimaryKeyJoinColumnOwner());
- primaryKeyJoinColumn.initialize(primaryKeyJoinColumnResource);
- return primaryKeyJoinColumn;
- }
-
- protected void updateDefaultPrimaryKeyJoinColumn() {
- if (!shouldBuildDefaultPrimaryKeyJoinColumn()) {
- setDefaultPrimaryKeyJoinColumn(null);
- return;
- }
- if (getDefaultPrimaryKeyJoinColumn() == null) {
- this.setDefaultPrimaryKeyJoinColumn(buildPrimaryKeyJoinColumn(new NullPrimaryKeyJoinColumnAnnotation(this.javaResourcePersistentType)));
- }
- else {
- this.defaultPrimaryKeyJoinColumn.update(new NullPrimaryKeyJoinColumnAnnotation(this.javaResourcePersistentType));
- }
- }
-
- protected void updateIdClass( ) {
- IdClassAnnotation annotation = getResourceIdClass();
- if (annotation != null) {
- setIdClass_(annotation.getValue());
- }
- else {
- setIdClass_(null);
- }
- }
-
-
- //******************** Code Completion *************************
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.getTable().javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (JavaSecondaryTable sTable : CollectionTools.iterable(this.secondaryTables())) {
- result = sTable.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- for (JavaPrimaryKeyJoinColumn column : CollectionTools.iterable(this.primaryKeyJoinColumns())) {
- result = column.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- result = this.getAttributeOverrideContainer().javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.getAssociationOverrideContainer().javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.getDiscriminatorColumn().javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.getGeneratorContainer().javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return null;
- }
-
-
- //********** Validation ********************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
-
- this.validateTable(messages, reporter, astRoot);
- this.validateId(messages, astRoot);
- this.validateInheritance(messages, reporter, astRoot);
- this.getGeneratorContainer().validate(messages, reporter, astRoot);
- this.getQueryContainer().validate(messages, reporter, astRoot);
- this.getAttributeOverrideContainer().validate(messages, reporter, astRoot);
- this.getAssociationOverrideContainer().validate(messages, reporter, astRoot);
-
- for (Iterator<JavaSecondaryTable> stream = this.specifiedSecondaryTables(); stream.hasNext();) {
- stream.next().validate(messages, reporter, astRoot);
- }
- }
-
- protected void validateTable(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- if (isAbstractTablePerClass()) {
- if (this.table.isResourceSpecified()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ENTITY_ABSTRACT_TABLE_PER_CLASS_DEFINES_TABLE,
- new String[] {this.getName()},
- this,
- this.getTable().getValidationTextRange(astRoot)
- )
- );
- }
- return;
- }
- if (isSingleTableDescendant()) {
- if (this.table.isResourceSpecified()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ENTITY_SINGLE_TABLE_DESCENDANT_DEFINES_TABLE,
- new String[] {this.getName()},
- this,
- this.getTable().getValidationTextRange(astRoot)
- )
- );
- }
- return;
- }
- this.table.validate(messages, reporter, astRoot);
- }
-
- protected void validateId(List<IMessage> messages, CompilationUnit astRoot) {
- if (this.hasNoIdMapping()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ENTITY_NO_ID,
- new String[] {this.getName()},
- this,
- this.getValidationTextRange(astRoot)
- )
- );
- }
- }
-
- protected void validateInheritance(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- validateInheritanceStrategy(messages, astRoot);
- validateDiscriminatorColumn(messages, reporter, astRoot);
- validateDiscriminatorValue(messages, astRoot);
- }
-
- protected void validateDiscriminatorColumn(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- if (specifiedDiscriminatorColumnIsAllowed() && !discriminatorColumnIsUndefined()) {
- getDiscriminatorColumn().validate(messages, reporter, astRoot);
- }
- else if (getDiscriminatorColumn().isResourceSpecified()) {
- if (!isRoot()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ENTITY_NON_ROOT_DISCRIMINATOR_COLUMN_DEFINED,
- new String[] {this.getName()},
- this,
- this.getDiscriminatorColumnTextRange(astRoot)
- )
- );
- }
- else if (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 (discriminatorValueIsUndefined() && getSpecifiedDiscriminatorValue() != null) {
- if (isAbstract()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.NORMAL_SEVERITY,
- JpaValidationMessages.ENTITY_ABSTRACT_DISCRIMINATOR_VALUE_DEFINED,
- new String[] {this.getName()},
- this,
- this.getDiscriminatorValueTextRange(astRoot)
- )
- );
- }
- else if (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 = getJpaPlatformVariation().getTablePerConcreteClassInheritanceIsSupported();
- if (tablePerConcreteClassInheritanceIsSupported == Supported.YES) {
- return;
- }
- if ((getInheritanceStrategy() == InheritanceType.TABLE_PER_CLASS) && 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 getResourceDiscriminatorValue().getTextRange(astRoot);
- }
-
- protected TextRange getDiscriminatorColumnTextRange(CompilationUnit astRoot) {
- return getDiscriminatorColumn().getValidationTextRange(astRoot);
- }
-
- protected TextRange getInheritanceStrategyTextRange(CompilationUnit astRoot) {
- return getResourceInheritance().getStrategyTextRange(astRoot);
- }
-
- protected boolean hasNoIdMapping() {
- return ! this.hasIdMapping();
- }
-
- protected boolean hasIdMapping() {
- for (Iterator<PersistentAttribute> stream = getPersistentType().allAttributes(); stream.hasNext(); ) {
- if (stream.next().isIdAttribute()) {
- return true;
- }
- }
- return false;
- }
-
-
- // ********** association override container owner **********
-
- class AssociationOverrideContainerOwner implements AssociationOverrideContainer.Owner {
-
- public TypeMapping getOverridableTypeMapping() {
- return AbstractJavaEntity.this.getOverridableTypeMapping();
- }
-
- public TypeMapping getTypeMapping() {
- return AbstractJavaEntity.this.getTypeMapping();
- }
-
- public RelationshipReference resolveRelationshipReference(String associationOverrideName) {
- TypeMapping overridableTypeMapping = getOverridableTypeMapping();
- if (overridableTypeMapping != null) {
- for (TypeMapping typeMapping : CollectionTools.iterable(overridableTypeMapping.inheritanceHierarchy())) {
- RelationshipReference relationshipReference = typeMapping.resolveRelationshipReference(associationOverrideName);
- if (relationshipReference != null) {
- return relationshipReference;
- }
- }
- }
- return null;
- }
- }
-
- //********** AttributeOverrideContainer.Owner implementation *********
-
- class AttributeOverrideContainerOwner implements AttributeOverrideContainer.Owner {
- public TypeMapping getOverridableTypeMapping() {
- return AbstractJavaEntity.this.getOverridableTypeMapping();
- }
-
- public TypeMapping getTypeMapping() {
- return AbstractJavaEntity.this.getTypeMapping();
- }
-
- public Column resolveOverridenColumn(String attributeOverrideName) {
- TypeMapping overridableTypeMapping = getOverridableTypeMapping();
- if (overridableTypeMapping != null) {
- for (TypeMapping typeMapping : CollectionTools.iterable(overridableTypeMapping.inheritanceHierarchy())) {
- Column column = typeMapping.resolveOverridenColumn(attributeOverrideName);
- if (column != null) {
- return column;
- }
- }
- }
- return null;
- }
- }
-
-
- // ********** pk join column owner **********
-
- class PrimaryKeyJoinColumnOwner implements JavaBaseJoinColumn.Owner
- {
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return AbstractJavaEntity.this.getValidationTextRange(astRoot);
- }
-
- public TypeMapping getTypeMapping() {
- return AbstractJavaEntity.this;
- }
-
- public org.eclipse.jpt.db.Table getDbTable(String tableName) {
- return AbstractJavaEntity.this.getDbTable(tableName);
- }
-
- public org.eclipse.jpt.db.Table getReferencedColumnDbTable() {
- Entity parentEntity = AbstractJavaEntity.this.getParentEntity();
- return (parentEntity == null) ? null : parentEntity.getPrimaryDbTable();
- }
-
- public int joinColumnsSize() {
- return AbstractJavaEntity.this.primaryKeyJoinColumnsSize();
- }
-
- public boolean isVirtual(BaseJoinColumn joinColumn) {
- return AbstractJavaEntity.this.defaultPrimaryKeyJoinColumn == joinColumn;
- }
-
- public String getDefaultColumnName() {
- if (joinColumnsSize() != 1) {
- return null;
- }
- Entity parentEntity = AbstractJavaEntity.this.getParentEntity();
- return (parentEntity == null) ? getPrimaryKeyColumnName() : parentEntity.getPrimaryKeyColumnName();
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaGenerator.java
deleted file mode 100644
index 1b7acb4051..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaGenerator.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.Generator;
-import org.eclipse.jpt.core.context.java.JavaGenerator;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.resource.java.GeneratorAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.SchemaContainer;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- *
- */
-public abstract class AbstractJavaGenerator
- extends AbstractJavaJpaContextNode
- implements JavaGenerator
-{
- protected String name;
-
- protected Integer specifiedInitialValue;
-
- protected Integer specifiedAllocationSize;
-
- protected GeneratorAnnotation resourceGenerator;
-
-
- protected AbstractJavaGenerator(JavaJpaContextNode parent) {
- super(parent);
- }
-
- protected GeneratorAnnotation getResourceGenerator() {
- return this.resourceGenerator;
- }
-
-
- // ********** name **********
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- String old = this.name;
- this.name = name;
- this.resourceGenerator.setName(name);
- this.firePropertyChanged(Generator.NAME_PROPERTY, old, name);
- }
-
- protected void setName_(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(Generator.NAME_PROPERTY, old, name);
- }
-
-
- // ********** initial value **********
-
- public int getInitialValue() {
- return (this.specifiedInitialValue != null) ? this.specifiedInitialValue.intValue() : this.getDefaultInitialValue();
- }
-
- public Integer getSpecifiedInitialValue() {
- return this.specifiedInitialValue;
- }
-
- public void setSpecifiedInitialValue(Integer specifiedInitialValue) {
- Integer old = this.specifiedInitialValue;
- this.specifiedInitialValue = specifiedInitialValue;
- this.resourceGenerator.setInitialValue(specifiedInitialValue);
- this.firePropertyChanged(Generator.SPECIFIED_INITIAL_VALUE_PROPERTY, old, specifiedInitialValue);
- }
-
- protected void setSpecifiedInitialValue_(Integer specifiedInitialValue) {
- Integer old = this.specifiedInitialValue;
- this.specifiedInitialValue = specifiedInitialValue;
- this.firePropertyChanged(Generator.SPECIFIED_INITIAL_VALUE_PROPERTY, old, specifiedInitialValue);
- }
-
-
- // ********** allocation size **********
-
- public int getAllocationSize() {
- return (this.specifiedAllocationSize != null) ? this.specifiedAllocationSize.intValue() : this.getDefaultAllocationSize();
- }
-
- public Integer getSpecifiedAllocationSize() {
- return this.specifiedAllocationSize;
- }
-
- public void setSpecifiedAllocationSize(Integer specifiedAllocationSize) {
- Integer old = this.specifiedAllocationSize;
- this.specifiedAllocationSize = specifiedAllocationSize;
- this.resourceGenerator.setAllocationSize(specifiedAllocationSize);
- this.firePropertyChanged(Generator.SPECIFIED_ALLOCATION_SIZE_PROPERTY, old, specifiedAllocationSize);
- }
-
- protected void setSpecifiedAllocationSize_(Integer specifiedAllocationSize) {
- Integer old = this.specifiedAllocationSize;
- this.specifiedAllocationSize = specifiedAllocationSize;
- this.firePropertyChanged(Generator.SPECIFIED_ALLOCATION_SIZE_PROPERTY, old, specifiedAllocationSize);
- }
-
- public int getDefaultAllocationSize() {
- return Generator.DEFAULT_ALLOCATION_SIZE;
- }
-
-
- // ********** text ranges **********
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getSelectionTextRange(astRoot);
- }
-
- public TextRange getSelectionTextRange(CompilationUnit astRoot) {
- return this.resourceGenerator.getTextRange(astRoot);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return this.resourceGenerator.getNameTextRange(astRoot);
- }
-
-
- // ********** resource => context **********
-
- protected void initialize(GeneratorAnnotation generatorAnnotation) {
- this.resourceGenerator = generatorAnnotation;
- this.name = generatorAnnotation.getName();
- this.specifiedInitialValue = generatorAnnotation.getInitialValue();
- this.specifiedAllocationSize = generatorAnnotation.getAllocationSize();
- }
-
- protected void update(GeneratorAnnotation generatorAnnotation) {
- this.resourceGenerator = generatorAnnotation;
- this.setName_(generatorAnnotation.getName());
- this.setSpecifiedInitialValue_(generatorAnnotation.getInitialValue());
- this.setSpecifiedAllocationSize_(generatorAnnotation.getAllocationSize());
- getPersistenceUnit().addGenerator(this);
- }
-
-
- // ********** 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.getDbCatalog(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.getDbCatalog(catalog);
- }
-
- protected abstract String getCatalog();
-
-
- // ********** misc **********
-
- public boolean isVirtual() {
- return false;
- }
-
- public boolean overrides(Generator generator) {
- // java is at the base of the tree
- return false;
- }
-
- public boolean duplicates(Generator other) {
- return (this != other)
- && ! StringTools.stringIsEmpty(this.name)
- && this.name.equals(other.getName())
- && ! this.overrides(other)
- && ! other.overrides(this);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- super.toString(sb);
- sb.append(this.name);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java
deleted file mode 100644
index b52c20ffb7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java
+++ /dev/null
@@ -1,383 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.java.JavaColumn;
-import org.eclipse.jpt.core.context.java.JavaConverter;
-import org.eclipse.jpt.core.context.java.JavaGeneratedValue;
-import org.eclipse.jpt.core.context.java.JavaGeneratorContainer;
-import org.eclipse.jpt.core.context.java.JavaIdMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-
-public abstract class AbstractJavaIdMapping
- extends AbstractJavaAttributeMapping<IdAnnotation>
- implements JavaIdMapping
-{
- protected final JavaColumn column;
-
- protected JavaGeneratedValue generatedValue;
-
- protected final JavaGeneratorContainer generatorContainer;
-
- protected final JavaConverter defaultConverter;
-
- protected JavaConverter specifiedConverter;
-
-
- protected AbstractJavaIdMapping(JavaPersistentAttribute parent) {
- super(parent);
- this.column = this.getJpaFactory().buildJavaColumn(this, this);
- this.defaultConverter = this.getJpaFactory().buildJavaNullConverter(this);
- this.generatorContainer = this.buildGeneratorContainer();
- }
-
- @Override
- protected void initialize() {
- super.initialize();
- this.column.initialize(this.getResourceColumn());
- this.generatorContainer.initialize(this.getResourcePersistentAttribute());
- this.initializeGeneratedValue();
- this.specifiedConverter = this.buildSpecifiedConverter(this.getResourceConverterType());
- }
-
- protected void initializeGeneratedValue() {
- GeneratedValueAnnotation resourceGeneratedValue = this.getResourceGeneratedValue();
- if (resourceGeneratedValue != null) {
- this.generatedValue = this.buildGeneratedValue(resourceGeneratedValue);
- }
- }
-
- public ColumnAnnotation getResourceColumn() {
- return (ColumnAnnotation) this.getResourcePersistentAttribute().
- getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
- }
-
- private JavaGeneratorContainer buildGeneratorContainer() {
- return this.getJpaFactory().buildJavaGeneratorContainer(this);
- }
-
- //************** JavaAttributeMapping implementation ***************
-
- public String getKey() {
- return MappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String getAnnotationName() {
- return IdAnnotation.ANNOTATION_NAME;
- }
-
- @Override
- protected void addSupportingAnnotationNamesTo(Vector<String> names) {
- super.addSupportingAnnotationNamesTo(names);
- names.add(JPA.COLUMN);
- names.add(JPA.GENERATED_VALUE);
- names.add(JPA.TEMPORAL);
- names.add(JPA.TABLE_GENERATOR);
- names.add(JPA.SEQUENCE_GENERATOR);
- }
-
- public String getDefaultColumnName() {
- return getName();
- }
-
- public String getDefaultTableName() {
- return getTypeMapping().getPrimaryTableName();
- }
-
- //************** IdMapping implementation ***************
-
- public JavaColumn getColumn() {
- return this.column;
- }
-
- public JavaGeneratedValue addGeneratedValue() {
- if (getGeneratedValue() != null) {
- throw new IllegalStateException("gemeratedValue already exists"); //$NON-NLS-1$
- }
- this.generatedValue = getJpaFactory().buildJavaGeneratedValue(this);
- GeneratedValueAnnotation generatedValueResource =
- (GeneratedValueAnnotation) getResourcePersistentAttribute().
- addAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME);
- this.generatedValue.initialize(generatedValueResource);
- firePropertyChanged(GENERATED_VALUE_PROPERTY, null, this.generatedValue);
- return this.generatedValue;
- }
-
- public void removeGeneratedValue() {
- if (getGeneratedValue() == null) {
- throw new IllegalStateException("gemeratedValue does not exist, cannot be removed"); //$NON-NLS-1$
- }
- JavaGeneratedValue oldGeneratedValue = this.generatedValue;
- this.generatedValue = null;
- getResourcePersistentAttribute().removeAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME);
- firePropertyChanged(GENERATED_VALUE_PROPERTY, oldGeneratedValue, null);
- }
-
- public JavaGeneratedValue getGeneratedValue() {
- return this.generatedValue;
- }
-
- protected void setGeneratedValue(JavaGeneratedValue newGeneratedValue) {
- JavaGeneratedValue oldGeneratedValue = this.generatedValue;
- this.generatedValue = newGeneratedValue;
- firePropertyChanged(GENERATED_VALUE_PROPERTY, oldGeneratedValue, newGeneratedValue);
- }
-
- public JavaGeneratorContainer getGeneratorContainer() {
- return this.generatorContainer;
- }
-
-
- public JavaConverter getConverter() {
- return getSpecifiedConverter() == null ? getDefaultConverter() : getSpecifiedConverter();
- }
-
- public JavaConverter getDefaultConverter() {
- return this.defaultConverter;
- }
-
- public JavaConverter getSpecifiedConverter() {
- return this.specifiedConverter;
- }
-
- protected String getSpecifedConverterType() {
- if (this.specifiedConverter == null) {
- return Converter.NO_CONVERTER;
- }
- return this.specifiedConverter.getType();
- }
-
- public void setSpecifiedConverter(String converterType) {
- if (this.valuesAreEqual(getSpecifedConverterType(), converterType)) {
- return;
- }
- JavaConverter oldConverter = this.specifiedConverter;
- JavaConverter newConverter = buildSpecifiedConverter(converterType);
- this.specifiedConverter = null;
- if (oldConverter != null) {
- oldConverter.removeFromResourceModel();
- }
- this.specifiedConverter = newConverter;
- if (newConverter != null) {
- newConverter.addToResourceModel();
- }
- firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
- }
-
- protected void setSpecifiedConverter(JavaConverter newConverter) {
- JavaConverter oldConverter = this.specifiedConverter;
- this.specifiedConverter = newConverter;
- firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
- }
-
- @Override
- protected void update() {
- super.update();
- this.column.update(this.getResourceColumn());
- this.generatorContainer.update(this.getResourcePersistentAttribute());
- this.updateGeneratedValue();
- if (this.valuesAreEqual(getResourceConverterType(), getSpecifedConverterType())) {
- getSpecifiedConverter().update(this.getResourcePersistentAttribute());
- }
- else {
- JavaConverter javaConverter = buildSpecifiedConverter(getResourceConverterType());
- setSpecifiedConverter(javaConverter);
- }
- }
-
- protected void updateGeneratedValue() {
- GeneratedValueAnnotation resourceGeneratedValue = getResourceGeneratedValue();
- if (resourceGeneratedValue == null) {
- if (getGeneratedValue() != null) {
- setGeneratedValue(null);
- }
- }
- else {
- if (getGeneratedValue() == null) {
- setGeneratedValue(buildGeneratedValue(resourceGeneratedValue));
- }
- else {
- getGeneratedValue().update(resourceGeneratedValue);
- }
- }
- }
-
- protected JavaGeneratedValue buildGeneratedValue(GeneratedValueAnnotation resourceGeneratedValue) {
- JavaGeneratedValue gv = getJpaFactory().buildJavaGeneratedValue(this);
- gv.initialize(resourceGeneratedValue);
- return gv;
- }
-
- protected TableGeneratorAnnotation getResourceTableGenerator() {
- return (TableGeneratorAnnotation) this.getResourcePersistentAttribute().
- getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME);
- }
-
- protected SequenceGeneratorAnnotation getResourceSequenceGenerator() {
- return (SequenceGeneratorAnnotation) this.getResourcePersistentAttribute().
- getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME);
- }
-
- protected GeneratedValueAnnotation getResourceGeneratedValue() {
- return (GeneratedValueAnnotation) this.getResourcePersistentAttribute().
- getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME);
- }
-
- protected JavaConverter buildSpecifiedConverter(String converterType) {
- if (this.valuesAreEqual(converterType, Converter.TEMPORAL_CONVERTER)) {
- return getJpaFactory().buildJavaTemporalConverter(this, this.getResourcePersistentAttribute());
- }
- return null;
- }
-
- protected String getResourceConverterType() {
- if (this.getResourcePersistentAttribute().getAnnotation(TemporalAnnotation.ANNOTATION_NAME) != null) {
- return Converter.TEMPORAL_CONVERTER;
- }
-
- return null;
- }
-
- // ********** code assist **********
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.getColumn().javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.generatorTouches(pos, astRoot)) {
- result = this.persistenceGeneratorNames(filter);
- if (result != null) {
- return result;
- }
- }
- result = this.getGeneratorContainer().javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return null;
- }
-
- // ********** code assist: generator
-
- protected boolean generatorTouches(int pos, CompilationUnit astRoot) {
- if (getResourceGeneratedValue() != null) {
- return this.getResourceGeneratedValue().generatorTouches(pos, astRoot);
- }
- return false;
- }
-
- protected Iterator<String> persistenceGeneratorNames() {
- if(this.getPersistenceUnit().generatorsSize() == 0) {
- return EmptyIterator.<String> instance();
- }
- return CollectionTools.iterator(this.getPersistenceUnit().uniqueGeneratorNames());
- }
-
- private Iterator<String> generatorNames(Filter<String> filter) {
- return new FilteringIterator<String, String>(this.persistenceGeneratorNames(), filter);
- }
-
- protected Iterator<String> persistenceGeneratorNames(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.generatorNames(filter));
- }
-
- // *************************************************************************
-
- @Override
- public String getPrimaryKeyColumnName() {
- return this.getColumn().getName();
- }
-
- @Override
- public boolean isOverridableAttributeMapping() {
- return true;
- }
-
- @Override
- public boolean isIdMapping() {
- return true;
- }
-
- //*********** Validation ************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
-
- if (this.shouldValidateAgainstDatabase()) {
- this.validateColumn(messages, astRoot);
- }
- if (this.generatedValue != null) {
- this.generatedValue.validate(messages, reporter, astRoot);
- }
- getGeneratorContainer().validate(messages, reporter, astRoot);
- if (this.specifiedConverter != null) {
- this.specifiedConverter.validate(messages, reporter, astRoot);
- }
- }
-
- protected void validateColumn(List<IMessage> messages, CompilationUnit astRoot) {
- if (this.getTypeMapping().tableNameIsInvalid(this.column.getTable())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_TABLE,
- new String[] {this.column.getTable(), this.column.getName()},
- this.column,
- this.column.getTableTextRange(astRoot)
- )
- );
- return;
- }
-
- if ( ! this.column.isResolved() && this.column.getDbTable() != null) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {this.column.getName()},
- this.column,
- this.column.getNameTextRange(astRoot)
- )
- );
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMappingDefinition.java
deleted file mode 100644
index 06fce4be77..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMappingDefinition.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-
-public abstract class AbstractJavaIdMappingDefinition
- extends AbstractJavaAttributeMappingDefinition
-{
- protected AbstractJavaIdMappingDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String getAnnotationName() {
- return IdAnnotation.ANNOTATION_NAME;
- }
-
- public JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) {
- return factory.buildJavaIdMapping(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinColumnJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinColumnJoiningStrategy.java
deleted file mode 100644
index 748c6fd41c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinColumnJoiningStrategy.java
+++ /dev/null
@@ -1,380 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinColumnEnabledRelationshipReference;
-import org.eclipse.jpt.core.context.JoinColumnJoiningStrategy;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaJoinColumnJoiningStrategy;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-import org.eclipse.jpt.utility.internal.iterators.SingleElementListIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractJavaJoinColumnJoiningStrategy
- extends AbstractJavaJpaContextNode
- implements JavaJoinColumnJoiningStrategy
-{
- protected JavaJoinColumn defaultJoinColumn;
-
- protected final Vector<JavaJoinColumn> specifiedJoinColumns = new Vector<JavaJoinColumn>();
- protected final JavaJoinColumn.Owner joinColumnOwner;
-
-
- protected AbstractJavaJoinColumnJoiningStrategy(JoinColumnEnabledRelationshipReference parent) {
- super(parent);
- this.joinColumnOwner = this.buildJoinColumnOwner();
- }
-
- protected abstract JavaJoinColumn.Owner buildJoinColumnOwner();
-
- public void initializeFrom(JoinColumnJoiningStrategy oldStrategy) {
- for (JoinColumn joinColumn : CollectionTools.iterable(oldStrategy.joinColumns())) {
- JoinColumn newJoinColumn = this.addSpecifiedJoinColumn(this.specifiedJoinColumnsSize());
- newJoinColumn.setSpecifiedName(joinColumn.getName());
- newJoinColumn.setSpecifiedReferencedColumnName(joinColumn.getReferencedColumnName());
- }
- }
-
- @Override
- public JoinColumnEnabledRelationshipReference getParent() {
- return (JoinColumnEnabledRelationshipReference) super.getParent();
- }
-
- public JoinColumnEnabledRelationshipReference getRelationshipReference() {
- return this.getParent();
- }
-
- public RelationshipMapping getRelationshipMapping() {
- return this.getRelationshipReference().getRelationshipMapping();
- }
-
- public void addStrategy() {
- if (specifiedJoinColumnsSize() == 0) {
- addSpecifiedJoinColumn(0);
- }
- }
-
- public void removeStrategy() {
- for (JoinColumn each : CollectionTools.iterable(specifiedJoinColumns())) {
- removeSpecifiedJoinColumn(each);
- }
- }
-
-
- // **************** join columns *******************************************
-
- public ListIterator<JavaJoinColumn> joinColumns() {
- return this.hasSpecifiedJoinColumns() ?
- this.specifiedJoinColumns() : this.defaultJoinColumns();
- }
-
- public int joinColumnsSize() {
- return this.hasSpecifiedJoinColumns() ?
- this.specifiedJoinColumnsSize() : this.defaultJoinColumnsSize();
- }
-
-
- // **************** default join column ************************************
-
- public JavaJoinColumn getDefaultJoinColumn() {
- return this.defaultJoinColumn;
- }
-
- protected void setDefaultJoinColumn(JavaJoinColumn column) {
- JavaJoinColumn old = this.defaultJoinColumn;
- this.defaultJoinColumn = column;
- this.firePropertyChanged(DEFAULT_JOIN_COLUMN_PROPERTY, old, column);
- }
-
- protected ListIterator<JavaJoinColumn> defaultJoinColumns() {
- if (this.defaultJoinColumn != null) {
- return new SingleElementListIterator<JavaJoinColumn>(this.defaultJoinColumn);
- }
- return EmptyListIterator.instance();
- }
-
- protected int defaultJoinColumnsSize() {
- return (this.defaultJoinColumn == null) ? 0 : 1;
- }
-
-
- // **************** specified join columns *********************************
-
- public ListIterator<JavaJoinColumn> specifiedJoinColumns() {
- return new CloneListIterator<JavaJoinColumn>(this.specifiedJoinColumns);
- }
-
- public int specifiedJoinColumnsSize() {
- return this.specifiedJoinColumns.size();
- }
-
- public boolean hasSpecifiedJoinColumns() {
- return ! this.specifiedJoinColumns.isEmpty();
- }
-
- public JavaJoinColumn addSpecifiedJoinColumn(int index) {
- // Clear out the default now so it doesn't get removed during an update and
- // cause change notifications to be sent to the UI in the wrong order.
- JavaJoinColumn oldDefault = this.defaultJoinColumn;
- this.defaultJoinColumn = null;
-
- JavaJoinColumn joinColumn = this.getJpaFactory().buildJavaJoinColumn(this, this.joinColumnOwner);
- this.specifiedJoinColumns.add(index, joinColumn);
- JoinColumnAnnotation joinColumnAnnotation = this.addAnnotation(index);
- joinColumn.initialize(joinColumnAnnotation);
- this.fireItemAdded(SPECIFIED_JOIN_COLUMNS_LIST, index, joinColumn);
-
- this.firePropertyChanged(DEFAULT_JOIN_COLUMN_PROPERTY, oldDefault, null);
- return joinColumn;
- }
-
- protected void addSpecifiedJoinColumn(int index, JavaJoinColumn joinColumn) {
- addItemToList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- }
-
- protected void addSpecifiedJoinColumn(JavaJoinColumn joinColumn) {
- addSpecifiedJoinColumn(this.specifiedJoinColumns.size(), joinColumn);
- }
-
- public void removeSpecifiedJoinColumn(JoinColumn joinColumn) {
- removeSpecifiedJoinColumn(this.specifiedJoinColumns.indexOf(joinColumn));
- }
-
- public void removeSpecifiedJoinColumn(int index) {
- JavaJoinColumn removedJoinColumn = this.specifiedJoinColumns.remove(index);
- if (this.specifiedJoinColumns.isEmpty()) {
- //create the defaultJoinColumn now or this will happen during project update
- //after removing the join column from the resource model. That causes problems
- //in the UI because the change notifications end up in the wrong order.
- this.defaultJoinColumn = buildJoinColumn(buildNullJoinColumnAnnotation());
- }
- removeAnnotation(index);
- fireItemRemoved(SPECIFIED_JOIN_COLUMNS_LIST, index, removedJoinColumn);
- if (this.defaultJoinColumn != null) {
- //fire change notification if a defaultJoinColumn was created above
- firePropertyChanged(DEFAULT_JOIN_COLUMN_PROPERTY, null, this.defaultJoinColumn);
- }
- }
-
- protected void removeSpecifiedJoinColumn_(JavaJoinColumn joinColumn) {
- removeItemFromList(joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- }
-
- public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.specifiedJoinColumns, targetIndex, sourceIndex);
- moveAnnotation(targetIndex, sourceIndex);
- fireItemMoved(SPECIFIED_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
- }
-
- protected abstract JoinColumnAnnotation addAnnotation(int index);
-
- protected abstract void removeAnnotation(int index);
-
- protected abstract void moveAnnotation(int targetIndex, int sourceIndex);
-
- protected abstract Iterator<JoinColumnAnnotation> joinColumnAnnotations();
-
- protected abstract JoinColumnAnnotation buildNullJoinColumnAnnotation();
-
-
- // **************** resource => context ************************************
-
- public void initialize() {
- initializeSpecifiedJoinColumns();
- initializeDefaultJoinColumn();
- }
-
- protected void initializeSpecifiedJoinColumns() {
- Iterator<JoinColumnAnnotation> annotations = joinColumnAnnotations();
- while (annotations.hasNext()) {
- this.specifiedJoinColumns.add(buildJoinColumn(annotations.next()));
- }
- }
-
- public void initializeDefaultJoinColumn() {
- if (mayHaveDefaultJoinColumn()) {
- this.defaultJoinColumn =
- buildJoinColumn(buildNullJoinColumnAnnotation());
- }
- }
-
- public void update() {
- updateSpecifiedJoinColumns();
- updateDefaultJoinColumn();
- }
-
- protected void updateSpecifiedJoinColumns() {
- ListIterator<JavaJoinColumn> joinColumns = specifiedJoinColumns();
- Iterator<JoinColumnAnnotation> resourceJoinColumns = joinColumnAnnotations();
-
- while (joinColumns.hasNext()) {
- JavaJoinColumn joinColumn = joinColumns.next();
- if (resourceJoinColumns.hasNext()) {
- joinColumn.update(resourceJoinColumns.next());
- }
- else {
- removeSpecifiedJoinColumn_(joinColumn);
- }
- }
-
- while (resourceJoinColumns.hasNext()) {
- addSpecifiedJoinColumn(buildJoinColumn(resourceJoinColumns.next()));
- }
- }
-
- protected void updateDefaultJoinColumn() {
- if (mayHaveDefaultJoinColumn()) {
- JoinColumnAnnotation nullAnnotation = buildNullJoinColumnAnnotation();
- if (this.defaultJoinColumn == null) {
- setDefaultJoinColumn(this.buildJoinColumn(nullAnnotation));
- }
- this.defaultJoinColumn.update(nullAnnotation);
- }
- else {
- if (this.defaultJoinColumn != null) {
- setDefaultJoinColumn(null);
- }
- }
- }
-
- protected boolean mayHaveDefaultJoinColumn() {
- return getRelationshipReference().mayHaveDefaultJoinColumn()
- && ! hasSpecifiedJoinColumns();
- }
-
- protected JavaJoinColumn buildJoinColumn(JoinColumnAnnotation joinColumnResource) {
- JavaJoinColumn joinColumn = getJpaFactory().buildJavaJoinColumn(this, this.joinColumnOwner);
- joinColumn.initialize(joinColumnResource);
- return joinColumn;
- }
-
-
- // **************** Java completion proposals ******************************
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (JavaJoinColumn column : CollectionTools.iterable(this.joinColumns())) {
- result = column.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
-
- // **************** validation *********************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- if (getRelationshipMapping().shouldValidateAgainstDatabase()) {
- for (Iterator<JavaJoinColumn> stream = this.joinColumns(); stream.hasNext(); ) {
- validateJoinColumn(stream.next(), messages, astRoot);
- }
- }
- }
-
- protected void validateJoinColumn(JavaJoinColumn joinColumn, List<IMessage> messages, CompilationUnit astRoot) {
- if (getRelationshipMapping().getTypeMapping().tableNameIsInvalid(joinColumn.getTable())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_TABLE,
- new String[] {joinColumn.getTable(), joinColumn.getName()},
- joinColumn,
- joinColumn.getTableTextRange(astRoot)
- )
- );
- return;
- }
- validateJoinColumnName(joinColumn, messages, astRoot);
- validationJoinColumnReferencedColumnName(joinColumn, messages, astRoot);
- }
-
- protected void validateJoinColumnName(JavaJoinColumn joinColumn, List<IMessage> messages, CompilationUnit astRoot) {
- if ( ! joinColumn.isResolved() && joinColumn.getDbTable() != null) {
- if (joinColumn.getName() != null) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {joinColumn.getName()},
- joinColumn,
- joinColumn.getNameTextRange(astRoot)
- )
- );
- }
- else if (joinColumn.getOwner().joinColumnsSize() > 1) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME_MULTIPLE_JOIN_COLUMNS,
- joinColumn,
- joinColumn.getNameTextRange(astRoot)
- )
- );
- }
- //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 validationJoinColumnReferencedColumnName(JavaJoinColumn joinColumn, List<IMessage> messages, CompilationUnit astRoot) {
- if ( ! joinColumn.isReferencedColumnResolved() && joinColumn.getReferencedColumnDbTable() != null) {
- if (joinColumn.getReferencedColumnName() != null) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME,
- new String[] {joinColumn.getReferencedColumnName(), joinColumn.getName()},
- joinColumn,
- joinColumn.getReferencedColumnNameTextRange(astRoot)
- )
- );
- }
- else if (joinColumn.getOwner().joinColumnsSize() > 1) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME_MULTIPLE_JOIN_COLUMNS,
- joinColumn,
- joinColumn.getReferencedColumnNameTextRange(astRoot)
- )
- );
- }
- //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
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinTableJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinTableJoiningStrategy.java
deleted file mode 100644
index fe4a4076de..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinTableJoiningStrategy.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.JoinTableEnabledRelationshipReference;
-import org.eclipse.jpt.core.context.JoinTableJoiningStrategy;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.java.JavaJoinTable;
-import org.eclipse.jpt.core.context.java.JavaJoinTableJoiningStrategy;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractJavaJoinTableJoiningStrategy
- extends AbstractJavaJpaContextNode
- implements JavaJoinTableJoiningStrategy
-{
- protected JavaJoinTable joinTable;
-
-
- protected AbstractJavaJoinTableJoiningStrategy(JoinTableEnabledRelationshipReference parent) {
- super(parent);
- }
-
-
- @Override
- public JoinTableEnabledRelationshipReference getParent() {
- return (JoinTableEnabledRelationshipReference) super.getParent();
- }
-
- public JoinTableEnabledRelationshipReference getRelationshipReference() {
- return this.getParent();
- }
-
- public RelationshipMapping getRelationshipMapping() {
- return this.getRelationshipReference().getRelationshipMapping();
- }
-
- public String getJoinTableDefaultName() {
- return MappingTools.buildJoinTableDefaultName(this.getRelationshipReference());
- }
-
- public void addStrategy() {
- if (this.joinTable == null) {
- this.joinTable = getJpaFactory().buildJavaJoinTable(this);
- addAnnotation();
- this.firePropertyChanged(JOIN_TABLE_PROPERTY, null, this.joinTable);
- }
- }
-
- public void removeStrategy() {
- if (this.joinTable != null) {
- JavaJoinTable oldJoinTable = this.joinTable;
- this.joinTable = null;
- removeAnnotation();
- this.firePropertyChanged(JOIN_TABLE_PROPERTY, oldJoinTable, null);
- }
- }
-
- public void initializeFrom(JoinTableJoiningStrategy oldStrategy) {
- JoinTable oldJoinTable = (oldStrategy.getJoinTable());
- if (oldJoinTable != null) {
- this.addStrategy();
- this.getJoinTable().setSpecifiedCatalog(oldJoinTable.getSpecifiedCatalog());
- this.getJoinTable().setSpecifiedSchema(oldJoinTable.getSpecifiedSchema());
- this.getJoinTable().setSpecifiedName(oldJoinTable.getSpecifiedName());
- }
- }
-
-
- // **************** join table *********************************************
-
- public JavaJoinTable getJoinTable() {
- return this.joinTable;
- }
-
- protected void setJoinTable_(JavaJoinTable newJoinTable) {
- JavaJoinTable oldJoinTable = this.joinTable;
- this.joinTable = newJoinTable;
- this.firePropertyChanged(JOIN_TABLE_PROPERTY, oldJoinTable, newJoinTable);
- }
-
- protected abstract JoinTableAnnotation addAnnotation();
-
- protected abstract void removeAnnotation();
-
-
- // **************** resource => context ************************************
-
- public void initialize() {
- JoinTableAnnotation annotation = getAnnotation();
- if (annotation.isSpecified() || getRelationshipReference().mayHaveDefaultJoinTable()) {
- this.joinTable = getJpaFactory().buildJavaJoinTable(this);
- this.joinTable.initialize(annotation);
- }
- }
-
- public void update() {
- JoinTableAnnotation annotation = getAnnotation();
- if (annotation.isSpecified() || getRelationshipReference().mayHaveDefaultJoinTable()) {
- if (this.joinTable == null) {
- setJoinTable_(getJpaFactory().buildJavaJoinTable(this));
- }
- this.joinTable.update(annotation);
- }
- else {
- if (this.joinTable != null) {
- // no annotation, so no clean up
- setJoinTable_(null);
- }
- }
- }
-
- // **************** Java completion proposals ******************************
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result == null && this.joinTable != null) {
- result = this.joinTable.javaCompletionProposals(pos, filter, astRoot);
- }
- return result;
- }
-
-
- // **************** validation *********************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- if (this.joinTable != null && getRelationshipMapping().shouldValidateAgainstDatabase()) {
- this.joinTable.validate(messages, reporter, astRoot);
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJpaContextNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJpaContextNode.java
deleted file mode 100644
index 8a55d4a316..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJpaContextNode.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.JpaResourceType;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.JpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.internal.context.AbstractJpaContextNode;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractJavaJpaContextNode
- extends AbstractJpaContextNode
- implements JavaJpaContextNode
-{
- // ********** constructor **********
-
- protected AbstractJavaJpaContextNode(JpaContextNode parent) {
- super(parent);
- }
-
- @Override
- public JpaResourceType getResourceType() {
- return JptCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
- }
-
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- if (this.connectionProfileIsActive()) {
- Iterator<String> result = this.connectedJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * This method is called if the database is connected, allowing us to
- * get candidates from the various database tables etc.
- * This method should NOT be cascaded to "child" objects; it should
- * only return candidates for the current object. The cascading is
- * handled by #javaCompletionProposals(int, Filter, CompilationUnit).
- */
- @SuppressWarnings("unused")
- public Iterator<String> connectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- return null;
- }
-
- // ********** validation **********
-
- /**
- * All subclass implementations {@link #validate(List, CompilationUnit))}
- * should be preceded by a "super" call to this method
- */
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- if (reporter.isCancelled()) {
- throw new ValidationCancelledException();
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToManyMapping.java
deleted file mode 100644
index 5909def13c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToManyMapping.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaManyToManyMapping;
-import org.eclipse.jpt.core.context.java.JavaManyToManyRelationshipReference;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaRelationshipReference;
-import org.eclipse.jpt.core.resource.java.ManyToManyAnnotation;
-
-
-public abstract class AbstractJavaManyToManyMapping
- extends AbstractJavaMultiRelationshipMapping<ManyToManyAnnotation>
- implements JavaManyToManyMapping
-{
- protected AbstractJavaManyToManyMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-
- @Override
- protected JavaRelationshipReference buildRelationshipReference() {
- return new GenericJavaManyToManyRelationshipReference(this);
- }
-
- public String getAnnotationName() {
- return ManyToManyAnnotation.ANNOTATION_NAME;
- }
-
- @Override
- public ManyToManyAnnotation getMappingAnnotation() {
- return super.getMappingAnnotation();
- }
-
- public String getKey() {
- return MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- public JavaManyToManyRelationshipReference getRelationshipReference() {
- return (JavaManyToManyRelationshipReference) super.getRelationshipReference();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToOneMapping.java
deleted file mode 100644
index 43cedb917d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToOneMapping.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaManyToOneRelationshipReference;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.jpa2.context.java.JavaManyToOneMapping2_0;
-import org.eclipse.jpt.core.resource.java.ManyToOneAnnotation;
-
-
-public abstract class AbstractJavaManyToOneMapping
- extends AbstractJavaSingleRelationshipMapping<ManyToOneAnnotation>
- implements JavaManyToOneMapping2_0
-{
- protected AbstractJavaManyToOneMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-
-
- @Override
- protected JavaManyToOneRelationshipReference buildRelationshipReference() {
- return new GenericJavaManyToOneRelationshipReference(this);
- }
-
- public String getAnnotationName() {
- return ManyToOneAnnotation.ANNOTATION_NAME;
- }
-
- @Override
- public ManyToOneAnnotation getMappingAnnotation() {
- return super.getMappingAnnotation();
- }
-
- public String getKey() {
- return MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- public JavaManyToOneRelationshipReference getRelationshipReference() {
- return (JavaManyToOneRelationshipReference) super.getRelationshipReference();
- }
-
- @Override
- protected Boolean getResourceOptional() {
- return this.mappingAnnotation.getOptional();
- }
-
- @Override
- protected void setResourceOptional(Boolean newOptional) {
- this.mappingAnnotation.setOptional(newOptional);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappedSuperclass.java
deleted file mode 100644
index afb7f125fc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappedSuperclass.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaMappedSuperclass;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.resource.java.IdClassAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.MappedSuperclassAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-
-public abstract class AbstractJavaMappedSuperclass extends AbstractJavaTypeMapping
- implements JavaMappedSuperclass
-{
-
- protected String idClass;
-
- protected AbstractJavaMappedSuperclass(JavaPersistentType parent) {
- super(parent);
- }
-
- public boolean isMapped() {
- return true;
- }
-
- public String getKey() {
- return MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY;
- }
-
- public String getAnnotationName() {
- return MappedSuperclassAnnotation.ANNOTATION_NAME;
- }
-
- public Iterable<String> getSupportingAnnotationNames() {
- return SUPPORTING_ANNOTATION_NAMES;
- }
- protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
- JPA.ID_CLASS,
- JPA.EXCLUDE_DEFAULT_LISTENERS,
- JPA.EXCLUDE_SUPERCLASS_LISTENERS,
- JPA.ENTITY_LISTENERS,
- JPA.PRE_PERSIST,
- JPA.POST_PERSIST,
- JPA.PRE_REMOVE,
- JPA.POST_REMOVE,
- JPA.PRE_UPDATE,
- JPA.POST_UPDATE,
- JPA.POST_LOAD
- };
- protected static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
-
- public char getIdClassEnclosingTypeSeparator() {
- return '.';
- }
-
- public String getIdClass() {
- return this.idClass;
- }
-
- public void setIdClass(String newIdClass) {
- String oldIdClass = this.idClass;
- this.idClass = newIdClass;
- if (this.valuesAreDifferent(newIdClass, oldIdClass)) {
- if (newIdClass != null) {
- if (getResourceIdClass() == null) {
- addResourceIdClass();
- }
- getResourceIdClass().setValue(newIdClass);
- }
- else {
- removeResourceIdClass();
- }
- }
- firePropertyChanged(ID_CLASS_PROPERTY, oldIdClass, newIdClass);
- }
-
- protected void setIdClass_(String newIdClass) {
- String oldIdClass = this.idClass;
- this.idClass = newIdClass;
- firePropertyChanged(ID_CLASS_PROPERTY, oldIdClass, newIdClass);
- }
-
- protected IdClassAnnotation getResourceIdClass() {
- return (IdClassAnnotation) this.javaResourcePersistentType.
- getAnnotation(IdClassAnnotation.ANNOTATION_NAME);
- }
-
- protected void addResourceIdClass() {
- this.javaResourcePersistentType.addAnnotation(IdClassAnnotation.ANNOTATION_NAME);
- }
-
- protected void removeResourceIdClass() {
- this.javaResourcePersistentType.removeAnnotation(IdClassAnnotation.ANNOTATION_NAME);
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return false;
- }
-
- @Override
- public boolean shouldValidateAgainstDatabase() {
- return false;
- }
-
- @Override
- public void initialize(JavaResourcePersistentType persistentTypeResource) {
- super.initialize(persistentTypeResource);
- this.idClass = this.getResourceIdClassName(this.getResourceIdClass());
- }
-
- @Override
- public void update(JavaResourcePersistentType persistentTypeResource) {
- super.update(persistentTypeResource);
- this.setIdClass_(this.getResourceIdClassName(this.getResourceIdClass()));
- }
-
- protected String getResourceIdClassName(IdClassAnnotation resourceIdClass) {
- return resourceIdClass == null ? null : resourceIdClass.getValue();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java
deleted file mode 100644
index 0d4eb05fd8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.Orderable;
-import org.eclipse.jpt.core.context.java.JavaMultiRelationshipMapping;
-import org.eclipse.jpt.core.context.java.JavaOrderable;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.jpa2.context.java.JavaPersistentAttribute2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.MapKeyAnnotation;
-import org.eclipse.jpt.core.resource.java.RelationshipMappingAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java multi-relationship (m:m, 1:m) mapping
- */
-public abstract class AbstractJavaMultiRelationshipMapping<T extends RelationshipMappingAnnotation>
- extends AbstractJavaRelationshipMapping<T>
- implements JavaMultiRelationshipMapping
-{
- protected final JavaOrderable orderable;
-
- protected String specifiedMapKey;
- protected boolean noMapKey = false;
- protected boolean pkMapKey = false;
- protected boolean customMapKey = false;
-
-
- protected AbstractJavaMultiRelationshipMapping(JavaPersistentAttribute parent) {
- super(parent);
- this.orderable = getJpaFactory().buildJavaOrderable(this);
- }
-
- @Override
- protected void initialize() {
- super.initialize();
- this.orderable.initialize();
- this.initializeMapKey();
- }
-
- @Override
- protected void update() {
- super.update();
- this.orderable.update();
- this.updateMapKey();
- }
-
- // ********** AbstractJavaAttributeMapping implementation **********
-
- @Override
- protected void addSupportingAnnotationNamesTo(Vector<String> names) {
- super.addSupportingAnnotationNamesTo(names);
- names.add(JPA.JOIN_TABLE);
- names.add(JPA.MAP_KEY);
- names.add(JPA.ORDER_BY);
- if (this.getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
- names.add(JPA2_0.ORDER_COLUMN);
- }
- }
-
- // ********** AbstractJavaRelationshipMapping implementation **********
-
- @Override
- protected String buildDefaultTargetEntity() {
- return this.getPersistentAttribute().getMultiReferenceEntityTypeName();
- }
-
-
- // ********** ordering **********
-
- public Orderable getOrderable() {
- return this.orderable;
- }
-
-
- // ********** Fetchable implementation **********
-
- public FetchType getDefaultFetch() {
- return DEFAULT_FETCH_TYPE;
- }
-
-
- // ********** 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$
- }
-
- public String getSpecifiedMapKey() {
- return this.specifiedMapKey;
- }
-
- public void setSpecifiedMapKey(String mapKey) {
- String old = this.specifiedMapKey;
- this.specifiedMapKey = mapKey;
- MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation();
- if (mapKey == null) {
- if (mapKeyAnnotation != null) {
- this.removeMapKeyAnnotation();
- }
- } else {
- if (mapKeyAnnotation == null) {
- mapKeyAnnotation = this.addMapKeyAnnotation();
- }
- mapKeyAnnotation.setName(mapKey);
- }
- this.firePropertyChanged(SPECIFIED_MAP_KEY_PROPERTY, old, mapKey);
- }
-
- protected void setSpecifiedMapKey_(String mapKey) {
- String old = this.specifiedMapKey;
- this.specifiedMapKey = mapKey;
- this.firePropertyChanged(SPECIFIED_MAP_KEY_PROPERTY, old, mapKey);
- }
-
- protected void initializeMapKey() {
- MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation();
- if (mapKeyAnnotation == null) {
- this.noMapKey = true;
- } else {
- this.specifiedMapKey = mapKeyAnnotation.getName();
- if (this.specifiedMapKey == null) {
- this.pkMapKey = true;
- } else {
- this.customMapKey = true;
- }
- }
- }
-
- protected void updateMapKey() {
- MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation();
- if (mapKeyAnnotation == null) {
- this.setSpecifiedMapKey_(null);
- this.setNoMapKey_(true);
- this.setPkMapKey_(false);
- this.setCustomMapKey_(false);
- } else {
- String mk = mapKeyAnnotation.getName();
- this.setSpecifiedMapKey_(mk);
- this.setNoMapKey_(false);
- this.setPkMapKey_(mk == null);
- this.setCustomMapKey_(mk != null);
- }
- }
-
- protected MapKeyAnnotation getMapKeyAnnotation() {
- return (MapKeyAnnotation) this.getResourcePersistentAttribute().getAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
- }
-
- protected MapKeyAnnotation addMapKeyAnnotation() {
- return (MapKeyAnnotation) this.getResourcePersistentAttribute().addAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
- }
-
- protected void removeMapKeyAnnotation() {
- this.getResourcePersistentAttribute().removeAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
- }
-
- protected boolean mapKeyNameTouches(int pos, CompilationUnit astRoot) {
- MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation();
- return (mapKeyAnnotation != null) && mapKeyAnnotation.nameTouches(pos, astRoot);
- }
-
-
- // ********** no map key **********
-
- public boolean isNoMapKey() {
- return this.noMapKey;
- }
-
- public void setNoMapKey(boolean noMapKey) {
- boolean old = this.noMapKey;
- this.noMapKey = noMapKey;
- if (noMapKey) {
- if (this.getMapKeyAnnotation() != null) {
- this.removeMapKeyAnnotation();
- }
- } else {
- // the 'noMapKey' flag is cleared as a
- // side-effect of setting the other flags,
- // via a call to #setNoMapKey_(boolean)
- }
- this.firePropertyChanged(NO_MAP_KEY_PROPERTY, old, noMapKey);
- }
-
- protected void setNoMapKey_(boolean noMapKey) {
- boolean old = this.noMapKey;
- this.noMapKey = noMapKey;
- this.firePropertyChanged(NO_MAP_KEY_PROPERTY, old, noMapKey);
- }
-
-
- // ********** pk map key **********
-
- public boolean isPkMapKey() {
- return this.pkMapKey;
- }
-
- public void setPkMapKey(boolean pkMapKey) {
- boolean old = this.pkMapKey;
- this.pkMapKey = pkMapKey;
- MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation();
- if (pkMapKey) {
- if (mapKeyAnnotation == null) {
- this.addMapKeyAnnotation();
- } else {
- mapKeyAnnotation.setName(null);
- }
- } else {
- // the 'pkMapKey' flag is cleared as a
- // side-effect of setting the other flags,
- // via a call to #setPkMapKey_(boolean)
- }
- this.firePropertyChanged(PK_MAP_KEY_PROPERTY, old, pkMapKey);
- }
-
- protected void setPkMapKey_(boolean pkMapKey) {
- boolean old = this.pkMapKey;
- this.pkMapKey = pkMapKey;
- this.firePropertyChanged(PK_MAP_KEY_PROPERTY, old, pkMapKey);
- }
-
-
- // ********** custom map key **********
-
- public boolean isCustomMapKey() {
- return this.customMapKey;
- }
-
- public void setCustomMapKey(boolean customMapKey) {
- boolean old = this.customMapKey;
- this.customMapKey = customMapKey;
- if (customMapKey) {
- this.setSpecifiedMapKey(""); //$NON-NLS-1$
- } else {
- // the 'customMapKey' flag is cleared as a
- // side-effect of setting the other flags,
- // via a call to #setCustomMapKey_(boolean)
- }
- this.firePropertyChanged(CUSTOM_MAP_KEY_PROPERTY, old, customMapKey);
- }
-
- protected void setCustomMapKey_(boolean customMapKey) {
- boolean old = this.customMapKey;
- this.customMapKey = customMapKey;
- this.firePropertyChanged(CUSTOM_MAP_KEY_PROPERTY, old, customMapKey);
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.mapKeyNameTouches(pos, astRoot)) {
- return this.javaCandidateMapKeyNames(filter);
- }
- return null;
- }
-
- protected Iterator<String> javaCandidateMapKeyNames(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.candidateMapKeyNames(filter));
- }
-
- protected Iterator<String> candidateMapKeyNames(Filter<String> filter) {
- return new FilteringIterator<String, String>(this.candidateMapKeyNames(), filter);
- }
-
- public Iterator<String> candidateMapKeyNames() {
- return this.allTargetEntityAttributeNames();
- }
-
-
- // ********** metamodel **********
-
- @Override
- protected String getMetamodelFieldTypeName() {
- return ((JavaPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldTypeName();
- }
-
- @Override
- protected void addMetamodelFieldTypeArgumentNamesTo(ArrayList<String> typeArgumentNames) {
- this.addMetamodelFieldMapKeyTypeArgumentNameTo(typeArgumentNames);
- super.addMetamodelFieldTypeArgumentNamesTo(typeArgumentNames);
- }
-
- protected void addMetamodelFieldMapKeyTypeArgumentNameTo(ArrayList<String> typeArgumentNames) {
- String keyTypeName = ((JavaPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldMapKeyTypeName();
- if (keyTypeName != null) {
- typeArgumentNames.add(keyTypeName);
- }
- }
-
- public String getMetamodelFieldMapKeyTypeName() {
- return MappingTools.getMetamodelFieldMapKeyTypeName(this);
- }
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.orderable.validate(messages, reporter, astRoot);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaNamedColumn.java
deleted file mode 100644
index de4f1b730a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaNamedColumn.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaNamedColumn;
-import org.eclipse.jpt.core.resource.java.NamedColumnAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-
-public abstract class AbstractJavaNamedColumn<T extends NamedColumnAnnotation> extends AbstractJavaJpaContextNode
- implements JavaNamedColumn
-{
-
- protected Owner owner;
-
- protected String specifiedName;
-
- protected String defaultName;
-
- protected String columnDefinition;
-
- protected T resourceColumn;
-
- protected AbstractJavaNamedColumn(JavaJpaContextNode parent, Owner owner) {
- super(parent);
- this.owner = owner;
- }
-
- // ******************* initialization from java resource model ********************
-
- protected void initialize(T column) {
- this.resourceColumn = column;
- this.specifiedName = column.getName();
- this.defaultName = this.buildDefaultName();
- this.columnDefinition = column.getColumnDefinition();
- }
-
- protected void update(T column) {
- this.resourceColumn = column;
- this.setSpecifiedName_(column.getName());
- this.setDefaultName(this.buildDefaultName());
- this.setColumnDefinition_(column.getColumnDefinition());
- }
-
- protected T getResourceColumn() {
- return this.resourceColumn;
- }
-
-
- //************** NamedColumn implementation *****************
- public String getName() {
- return (this.specifiedName != null) ? this.specifiedName : this.defaultName;
- }
-
- public String getSpecifiedName() {
- return this.specifiedName;
- }
-
- public void setSpecifiedName(String newSpecifiedName) {
- String oldSpecifiedName = this.specifiedName;
- this.specifiedName = newSpecifiedName;
- getResourceColumn().setName(newSpecifiedName);
- firePropertyChanged(NamedColumn.SPECIFIED_NAME_PROPERTY, oldSpecifiedName, newSpecifiedName);
- }
-
- /**
- * internal setter used only for updating from the resource model.
- * There were problems with InvalidThreadAccess exceptions in the UI
- * when you set a value from the UI and the annotation doesn't exist yet.
- * Adding the annotation causes an update to occur and then the exception.
- */
- protected void setSpecifiedName_(String newSpecifiedName) {
- String oldSpecifiedName = this.specifiedName;
- this.specifiedName = newSpecifiedName;
- firePropertyChanged(NamedColumn.SPECIFIED_NAME_PROPERTY, oldSpecifiedName, newSpecifiedName);
- }
-
- public String getDefaultName() {
- return this.defaultName;
- }
-
- protected void setDefaultName(String newDefaultName) {
- String oldDefaultName = this.defaultName;
- this.defaultName = newDefaultName;
- firePropertyChanged(NamedColumn.DEFAULT_NAME_PROPERTY, oldDefaultName, newDefaultName);
- }
-
- /**
- * Return the default column name.
- */
- protected String buildDefaultName() {
- return this.getOwner().getDefaultColumnName();
- }
-
- public String getColumnDefinition() {
- return this.columnDefinition;
- }
-
- public void setColumnDefinition(String newColumnDefinition) {
- String oldColumnDefinition = this.columnDefinition;
- this.columnDefinition = newColumnDefinition;
- getResourceColumn().setColumnDefinition(newColumnDefinition);
- firePropertyChanged(NamedColumn.COLUMN_DEFINITION_PROPERTY, oldColumnDefinition, newColumnDefinition);
- }
-
- /**
- * internal setter used only for updating from the resource model.
- * There were problems with InvalidThreadAccess exceptions in the UI
- * when you set a value from the UI and the annotation doesn't exist yet.
- * Adding the annotation causes an update to occur and then the exception.
- */
- protected void setColumnDefinition_(String newColumnDefinition) {
- String oldColumnDefinition = this.columnDefinition;
- this.columnDefinition = newColumnDefinition;
- firePropertyChanged(NamedColumn.COLUMN_DEFINITION_PROPERTY, oldColumnDefinition, newColumnDefinition);
- }
-
- public Owner getOwner() {
- return this.owner;
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- TextRange textRange = this.getResourceColumn().getNameTextRange(astRoot);
- return (textRange != null) ? textRange : this.getOwner().getValidationTextRange(astRoot);
- }
-
- public boolean nameTouches(int pos, CompilationUnit astRoot) {
- return this.getResourceColumn().nameTouches(pos, astRoot);
- }
-
- public Column getDbColumn() {
- Table table = this.getDbTable();
- return (table == null) ? null : table.getColumnForIdentifier(this.getName());
- }
-
- public Table getDbTable() {
- return getOwner().getDbTable(this.getTableName());
- }
-
- /**
- * Return the name of the column's table.
- */
- protected String getTableName() {
- return this.getOwner().getTypeMapping().getPrimaryTableName();
- }
-
- public boolean isResolved() {
- return this.getDbColumn() != null;
- }
-
- @Override
- public Iterator<String> connectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.connectedJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.nameTouches(pos, astRoot)) {
- return this.javaCandidateNames(filter);
- }
- return null;
- }
-
- private Iterator<String> javaCandidateNames(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.candidateNames(filter));
- }
-
- private Iterator<String> candidateNames(Filter<String> filter) {
- return new FilteringIterator<String, String>(this.candidateNames(), filter);
- }
-
- private Iterator<String> candidateNames() {
- Table dbTable = this.getDbTable();
- return (dbTable != null) ? dbTable.sortedColumnIdentifiers() : EmptyIterator.<String> instance();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getName());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToManyMapping.java
deleted file mode 100644
index b936a215f1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToManyMapping.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Vector;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaOneToManyRelationshipReference;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOneToManyMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-
-
-public abstract class AbstractJavaOneToManyMapping<T extends OneToManyAnnotation>
- extends AbstractJavaMultiRelationshipMapping<T>
- implements JavaOneToManyMapping2_0, JavaOrphanRemovalHolder2_0
-{
- protected final JavaOrphanRemovable2_0 orphanRemoval;
-
- protected AbstractJavaOneToManyMapping(JavaPersistentAttribute parent) {
- super(parent);
- this.orphanRemoval = ((JpaFactory2_0) this.getJpaFactory()).buildJavaOrphanRemoval(this);
- }
-
- // ********** initialize/update **********
-
- @Override
- protected void initialize() {
- super.initialize();
- this.orphanRemoval.initialize(this.getResourcePersistentAttribute());
- }
-
- @Override
- protected void update() {
- super.update();
- this.orphanRemoval.update(this.getResourcePersistentAttribute());
- }
-
-
- public String getAnnotationName() {
- return OneToManyAnnotation.ANNOTATION_NAME;
- }
-
- @Override
- protected void addSupportingAnnotationNamesTo(Vector<String> names) {
- super.addSupportingAnnotationNamesTo(names);
- names.add(JPA.JOIN_COLUMN);
- names.add(JPA.JOIN_COLUMNS);
- }
-
- public String getKey() {
- return MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-
- // ********** JavaOneToManyMapping implementation **********
-
- @Override
- public T getMappingAnnotation() {
- return super.getMappingAnnotation();
- }
-
- @Override
- public JavaOneToManyRelationshipReference getRelationshipReference() {
- return (JavaOneToManyRelationshipReference) super.getRelationshipReference();
- }
-
- // ********** JavaOrphanRemovalHolder2_0 implementation **********
-
- public JavaOrphanRemovable2_0 getOrphanRemoval() {
- return this.orphanRemoval;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToManyRelationshipReference.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToManyRelationshipReference.java
deleted file mode 100644
index a886b844d1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToManyRelationshipReference.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.java.JavaJoinTableJoiningStrategy;
-import org.eclipse.jpt.core.context.java.JavaMappedByJoiningStrategy;
-import org.eclipse.jpt.core.context.java.JavaOneToManyMapping;
-import org.eclipse.jpt.core.context.java.JavaOneToManyRelationshipReference;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractJavaOneToManyRelationshipReference
- extends AbstractJavaRelationshipReference
- implements JavaOneToManyRelationshipReference
-{
- protected final JavaMappedByJoiningStrategy mappedByJoiningStrategy;
-
- protected final JavaJoinTableJoiningStrategy joinTableJoiningStrategy;
-
-
- protected AbstractJavaOneToManyRelationshipReference(JavaOneToManyMapping parent) {
- super(parent);
- this.mappedByJoiningStrategy = buildMappedByJoiningStrategy();
- this.joinTableJoiningStrategy = buildJoinTableJoiningStrategy();
- }
-
- protected JavaMappedByJoiningStrategy buildMappedByJoiningStrategy() {
- return new GenericJavaMappedByJoiningStrategy(this);
- }
-
- protected JavaJoinTableJoiningStrategy buildJoinTableJoiningStrategy() {
- return new GenericJavaJoinTableJoiningStrategy(this);
- }
-
- @Override
- public JavaOneToManyMapping getRelationshipMapping() {
- return (JavaOneToManyMapping) getParent();
- }
-
- public OneToManyAnnotation getMappingAnnotation() {
- return getRelationshipMapping().getMappingAnnotation();
- }
-
- public boolean isRelationshipOwner() {
- return this.getMappedByJoiningStrategy().getMappedByAttribute() == null;
- }
-
- public boolean isOwnedBy(RelationshipMapping mapping) {
- return this.mappedByJoiningStrategy.relationshipIsOwnedBy(mapping);
- }
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result == null) {
- result = this.mappedByJoiningStrategy.javaCompletionProposals(pos, filter, astRoot);
- }
- if (result == null) {
- result = this.joinTableJoiningStrategy.javaCompletionProposals(pos, filter, astRoot);
- }
- return result;
- }
-
-
- // **************** mapped by **********************************************
-
- public JavaMappedByJoiningStrategy getMappedByJoiningStrategy() {
- return this.mappedByJoiningStrategy;
- }
-
- public void setMappedByJoiningStrategy() {
- this.mappedByJoiningStrategy.addStrategy();
- this.joinTableJoiningStrategy.removeStrategy();
- }
-
- public void unsetMappedByJoiningStrategy() {
- this.mappedByJoiningStrategy.removeStrategy();
- }
-
- public boolean usesMappedByJoiningStrategy() {
- return this.getPredominantJoiningStrategy() == this.mappedByJoiningStrategy;
- }
-
- public boolean mayBeMappedBy(AttributeMapping mappedByMapping) {
- return mappedByMapping.getKey() == MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
-
- // **************** join table *********************************************
-
- public JavaJoinTableJoiningStrategy getJoinTableJoiningStrategy() {
- return this.joinTableJoiningStrategy;
- }
-
- public boolean usesJoinTableJoiningStrategy() {
- return getPredominantJoiningStrategy() == this.joinTableJoiningStrategy;
- }
-
- public void setJoinTableJoiningStrategy() {
- // join table is default, so no need to add annotation
- this.mappedByJoiningStrategy.removeStrategy();
- }
-
- public void unsetJoinTableJoiningStrategy() {
- this.joinTableJoiningStrategy.removeStrategy();
- }
-
- public boolean mayHaveDefaultJoinTable() {
- return this.mappedByJoiningStrategy.getMappedByAttribute() == null;
- }
-
-
- // **************** resource => context ************************************
-
- @Override
- protected void initializeJoiningStrategies() {
- this.mappedByJoiningStrategy.initialize();
- this.joinTableJoiningStrategy.initialize();
- }
-
- @Override
- protected void updateJoiningStrategies() {
- this.mappedByJoiningStrategy.update();
- this.joinTableJoiningStrategy.update();
- }
-
-
- // **************** Validation *********************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.mappedByJoiningStrategy.validate(messages, reporter, astRoot);
- this.joinTableJoiningStrategy.validate(messages, reporter, astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToOneMapping.java
deleted file mode 100644
index a5e9c49144..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToOneMapping.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Vector;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaOneToOneRelationshipReference;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaRelationshipReference;
-import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOneToOneMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
-
-
-public abstract class AbstractJavaOneToOneMapping
- extends AbstractJavaSingleRelationshipMapping<OneToOneAnnotation>
- implements JavaOneToOneMapping2_0, JavaOrphanRemovalHolder2_0
-{
- protected final JavaOrphanRemovable2_0 orphanRemoval;
-
- // ********** constructor **********
- protected AbstractJavaOneToOneMapping(JavaPersistentAttribute parent) {
- super(parent);
- this.orphanRemoval = ((JpaFactory2_0) this.getJpaFactory()).buildJavaOrphanRemoval(this);
- }
-
- // ********** initialize/update **********
-
- @Override
- protected void initialize() {
- super.initialize();
- this.orphanRemoval.initialize(this.getResourcePersistentAttribute());
- }
-
- @Override
- protected void update() {
- super.update();
- this.orphanRemoval.update(this.getResourcePersistentAttribute());
- }
-
- @Override
- protected JavaRelationshipReference buildRelationshipReference() {
- return new GenericJavaOneToOneRelationshipReference(this);
- }
-
- public String getAnnotationName() {
- return OneToOneAnnotation.ANNOTATION_NAME;
- }
-
- @Override
- protected void addSupportingAnnotationNamesTo(Vector<String> names) {
- super.addSupportingAnnotationNamesTo(names);
- names.add(JPA.PRIMARY_KEY_JOIN_COLUMN);
- names.add(JPA.PRIMARY_KEY_JOIN_COLUMNS);
- }
-
- public String getKey() {
- return MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- protected Boolean getResourceOptional() {
- return this.mappingAnnotation.getOptional();
- }
-
- @Override
- protected void setResourceOptional(Boolean newOptional) {
- this.mappingAnnotation.setOptional(newOptional);
- }
-
- // ********** JavaOneToOneMapping implementation **********
-
- @Override
- public OneToOneAnnotation getMappingAnnotation() {
- return super.getMappingAnnotation();
- }
-
- @Override
- public JavaOneToOneRelationshipReference getRelationshipReference() {
- return (JavaOneToOneRelationshipReference) super.getRelationshipReference();
- }
-
- // ********** JavaOrphanRemovalHolder2_0 implementation **********
-
- public JavaOrphanRemovable2_0 getOrphanRemoval() {
- return this.orphanRemoval;
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOverride.java
deleted file mode 100644
index ca07b093dc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOverride.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.BaseOverride;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.resource.java.OverrideAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-
-public abstract class AbstractJavaOverride extends AbstractJavaJpaContextNode implements BaseOverride
-{
-
- protected String name;
-
- protected final Owner owner;
-
- protected OverrideAnnotation overrideAnnotation;
-
- public AbstractJavaOverride(JavaJpaContextNode parent, Owner owner) {
- super(parent);
- this.owner = owner;
- }
-
- protected void initialize(OverrideAnnotation overrideAnnotation) {
- this.overrideAnnotation = overrideAnnotation;
- this.name = this.getResourceName(overrideAnnotation);
- }
-
- protected OverrideAnnotation getOverrideAnnotation() {
- return this.overrideAnnotation;
- }
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String newName) {
- String oldName = this.name;
- this.name = newName;
- this.overrideAnnotation.setName(newName);
- firePropertyChanged(NAME_PROPERTY, oldName, newName);
- }
-
- protected void setName_(String newName) {
- String oldName = this.name;
- this.name = newName;
- firePropertyChanged(NAME_PROPERTY, oldName, newName);
- }
-
- protected void update(OverrideAnnotation overrideResource) {
- this.overrideAnnotation = overrideResource;
- this.setName_(this.getResourceName(overrideResource));
- }
-
- protected String getResourceName(OverrideAnnotation overrideAnnotation) {
- return overrideAnnotation.getName();
- }
-
- public boolean isVirtual() {
- return getOwner().isVirtual(this);
- }
-
- public BaseOverride setVirtual(boolean virtual) {
- return getOwner().setVirtual(virtual, this);
- }
-
- public Owner getOwner() {
- return this.owner;
- }
-
- @Override
- public JavaJpaContextNode getParent() {
- return (JavaJpaContextNode) super.getParent();
- }
-
- protected abstract Iterator<String> candidateNames();
-
- private Iterator<String> candidateNames(Filter<String> filter) {
- return new FilteringIterator<String, String>(this.candidateNames(), filter);
- }
-
- private Iterator<String> javaCandidateNames(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.candidateNames(filter));
- }
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.nameTouches(pos, astRoot)) {
- return this.javaCandidateNames(filter);
- }
- return null;
- }
-
- public boolean nameTouches(int pos, CompilationUnit astRoot) {
- return this.overrideAnnotation.nameTouches(pos, astRoot);
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = this.overrideAnnotation.getTextRange(astRoot);
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- super.toString(sb);
- sb.append(getName());
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentAttribute.java
deleted file mode 100644
index a66f6f2cad..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentAttribute.java
+++ /dev/null
@@ -1,712 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.Modifier;
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.Embeddable;
-import org.eclipse.jpt.core.context.MultiRelationshipMapping;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaStructureNodes;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.ClassTools;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * common state/behavior between Generic and EclipseLink persistent attributes
- */
-public abstract class AbstractJavaPersistentAttribute
- extends AbstractJavaJpaContextNode
- implements JavaPersistentAttribute
-{
- protected String name;
-
- protected JavaAttributeMapping defaultMapping;
-
- protected JavaAttributeMapping specifiedMapping;
-
- protected AccessType defaultAccess;
-
- protected JavaResourcePersistentAttribute resourcePersistentAttribute;
-
-
- protected AbstractJavaPersistentAttribute(PersistentType parent, JavaResourcePersistentAttribute resourcePersistentAttribute) {
- super(parent);
- this.resourcePersistentAttribute = resourcePersistentAttribute;
- this.name = buildName();
- this.defaultMapping = buildDefaultMapping();
- this.specifiedMapping = buildSpecifiedMapping();
- this.defaultAccess = buildDefaultAccess();
- }
-
- public void update() {
- this.setName(this.buildName());
- this.updateDefaultMapping();
- this.updateSpecifiedMapping();
- this.setDefaultAccess(this.buildDefaultAccess());
- }
-
- @Override
- public void postUpdate() {
- super.postUpdate();
- getMapping().postUpdate();
- }
-
-
- // ********** JpaStructureNode implementation **********
-
- public String getId() {
- return JavaStructureNodes.PERSISTENT_ATTRIBUTE_ID;
- }
-
- public JpaStructureNode getStructureNode(int textOffset) {
- return this;
- }
-
- public TextRange getSelectionTextRange() {
- return this.getSelectionTextRange(this.buildASTRoot());
- }
-
- protected TextRange getSelectionTextRange(CompilationUnit astRoot) {
- return this.resourcePersistentAttribute.getNameTextRange(astRoot);
- }
-
- protected CompilationUnit buildASTRoot() {
- return this.resourcePersistentAttribute.getJavaResourceCompilationUnit().buildASTRoot();
- }
-
- public void dispose() {
- //nothing to dispose
- }
-
-
- // ********** AccessHolder implementation **********
-
- public AccessType getAccess() {
- AccessType access = this.getSpecifiedAccess();
- return (access != null) ? access : this.getDefaultAccess();
- }
-
- public AccessType getDefaultAccess() {
- return this.defaultAccess;
- }
-
- protected void setDefaultAccess(AccessType defaultAccess) {
- AccessType old = this.defaultAccess;
- this.defaultAccess = defaultAccess;
- this.firePropertyChanged(DEFAULT_ACCESS_PROPERTY, old, defaultAccess);
- }
-
- protected AccessType buildDefaultAccess() {
- return this.resourcePersistentAttribute.isField() ? AccessType.FIELD : AccessType.PROPERTY;
- }
-
-
- // ********** [Java]PersistentAttribute implementation **********
-
- public JavaResourcePersistentAttribute getResourcePersistentAttribute() {
- return this.resourcePersistentAttribute;
- }
-
- public PersistentType getPersistentType() {
- return this.getParent();
- }
-
- public TypeMapping getTypeMapping() {
- return this.getPersistentType().getMapping();
- }
-
- public String getPrimaryKeyColumnName() {
- return this.getMapping().getPrimaryKeyColumnName();
- }
-
- public boolean isIdAttribute() {
- return this.getMapping().isIdMapping();
- }
-
- public boolean isVirtual() {
- return false;
- }
-
- public boolean contains(int offset, CompilationUnit astRoot) {
- TextRange fullTextRange = this.getFullTextRange(astRoot);
- // 'fullTextRange' will be null if the attribute no longer exists in the java;
- // the context model can be out of synch with the resource model
- // when a selection event occurs before the context model has a
- // chance to synch with the resource model via the update thread
- return (fullTextRange == null) ? false : fullTextRange.includes(offset);
- }
-
- protected TextRange getFullTextRange(CompilationUnit astRoot) {
- return this.resourcePersistentAttribute.getTextRange(astRoot);
- }
-
- public Embeddable getEmbeddable() {
- String typeName = this.resourcePersistentAttribute.getTypeName();
- return (typeName == null) ? null : this.getPersistenceUnit().getEmbeddable(typeName);
- }
-
- public boolean isField() {
- return this.resourcePersistentAttribute.isField();
- }
-
- public boolean isProperty() {
- return this.resourcePersistentAttribute.isProperty();
- }
-
- public boolean isPublic() {
- return Modifier.isPublic(this.resourcePersistentAttribute.getModifiers());
- }
-
- public boolean isFinal() {
- return Modifier.isFinal(this.resourcePersistentAttribute.getModifiers());
- }
-
- // ***** Basic defaults
- /**
- * From the JPA spec, when the basic mapping applies:
- * If the type of the attribute (field or property) is one of the following
- * it must be mapped as @Basic:
- * byte[]
- * java.lang.Byte[]
- * char[]
- * java.lang.Character[]
- * primitive types (except 'void')
- * primitive wrappers (except 'java.lang.Void')
- * java.lang.String
- * java.math.BigInteger
- * java.math.BigDecimal
- * java.util.Date
- * java.util.Calendar
- * java.sql.Date
- * java.sql.Time
- * java.sql.Timestamp
- * enums
- * any other type that implements java.io.Serializable
- */
- public boolean typeIsBasic() {
- // 'typeName' may include array brackets but not generic type arguments
- String typeName = this.resourcePersistentAttribute.getTypeName();
- if (typeName == null) {
- return false;
- }
-
- int arrayDepth = ClassTools.arrayDepthForTypeDeclaration(typeName);
- if (arrayDepth > 1) {
- return false; // multi-dimensional arrays are not supported
- }
-
- if (arrayDepth == 1) {
- String elementTypeName = ClassTools.elementTypeNameForTypeDeclaration(typeName, 1);
- return this.elementTypeIsValidForBasicArray(elementTypeName);
- }
-
- // arrayDepth == 0
- if (ClassTools.classNamedIsVariablePrimitive(typeName)) {
- return true; // any primitive but 'void'
- }
- if (ClassTools.classNamedIsVariablePrimitiveWrapperClass(typeName)) {
- return true; // any primitive wrapper but 'java.lang.Void'
- }
- if (this.typeIsOtherValidBasicType(typeName)) {
- return true;
- }
- if (this.resourcePersistentAttribute.typeIsEnum()) {
- return true;
- }
- if (this.resourcePersistentAttribute.typeIsSubTypeOf(SERIALIZABLE_TYPE_NAME)) {
- return true;
- }
- return false;
- }
-
- /**
- * Return whether the specified type is a valid element type for
- * a one-dimensional array that can default to a Basic mapping:
- * byte
- * char
- * java.lang.Byte
- * java.lang.Character
- */
- protected boolean elementTypeIsValidForBasicArray(String elementTypeName) {
- return ArrayTools.contains(VALID_BASIC_ARRAY_ELEMENT_TYPE_NAMES, elementTypeName);
- }
-
- protected static final String[] VALID_BASIC_ARRAY_ELEMENT_TYPE_NAMES = {
- byte.class.getName(),
- char.class.getName(),
- java.lang.Byte.class.getName(),
- java.lang.Character.class.getName()
- };
-
- /**
- * Return whether the specified type is among the various "other" types
- * that can default to a Basic mapping.
- */
- protected boolean typeIsOtherValidBasicType(String typeName) {
- return ArrayTools.contains(OTHER_VALID_BASIC_TYPE_NAMES, typeName);
- }
-
- protected static final String[] OTHER_VALID_BASIC_TYPE_NAMES = {
- java.lang.String.class.getName(),
- java.math.BigInteger.class.getName(),
- java.math.BigDecimal.class.getName(),
- java.util.Date.class.getName(),
- java.util.Calendar.class.getName(),
- java.sql.Date.class.getName(),
- java.sql.Time.class.getName(),
- java.sql.Timestamp.class.getName(),
- };
-
- protected static final String SERIALIZABLE_TYPE_NAME = java.io.Serializable.class.getName();
-
- // ***** reference entities
- public String getSingleReferenceEntityTypeName() {
- // 'typeName' may include array brackets ("[]")
- // but not generic type arguments (e.g. "<java.lang.String>")
- String typeName = this.resourcePersistentAttribute.getTypeName();
- if (typeName == null) {
- return null;
- }
- if (ClassTools.arrayDepthForTypeDeclaration(typeName) != 0) {
- return null; // arrays cannot be entities
- }
- if (this.typeIsContainer(typeName)) {
- return null; // "containers" cannot be entities
- }
- return typeName;
- }
-
- public String getMultiReferenceEntityTypeName() {
- // 'typeName' may include array brackets ("[]")
- // but not generic type arguments (e.g. "<java.lang.String>")
- String typeName = this.resourcePersistentAttribute.getTypeName();
- return (typeName == null) ? null :
- this.getJpaContainer(typeName).getMultiReferenceEntityTypeName(this.resourcePersistentAttribute);
- }
-
- /**
- * return whether the specified type is one of the container
- * types allowed by the JPA spec
- */
- protected boolean typeIsContainer(String typeName) {
- return this.getJpaContainer(typeName).isContainer();
- }
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- protected void setName(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- protected String buildName() {
- return this.resourcePersistentAttribute.getName();
- }
-
- // ***** mapping
- public JavaAttributeMapping getMapping() {
- return (this.specifiedMapping != null) ? this.specifiedMapping : this.defaultMapping;
- }
-
- public String getMappingKey() {
- return this.getMapping().getKey();
- }
-
-
- // ***** default mapping
- public JavaAttributeMapping getDefaultMapping() {
- return this.defaultMapping;
- }
-
- /**
- * clients do not set the "default" mapping
- */
- protected void setDefaultMapping(JavaAttributeMapping defaultMapping) {
- JavaAttributeMapping old = this.defaultMapping;
- this.defaultMapping = defaultMapping;
- this.firePropertyChanged(DEFAULT_MAPPING_PROPERTY, old, defaultMapping);
- }
-
- protected JavaAttributeMapping buildDefaultMapping() {
- JavaAttributeMappingDefinition mappingDefinition =
- getJpaPlatform().getDefaultJavaAttributeMappingDefinition(this);
- return buildDefaultMapping(mappingDefinition);
- }
-
- protected JavaAttributeMapping buildDefaultMapping(JavaAttributeMappingDefinition mappingDefinition) {
- Annotation annotation = this.resourcePersistentAttribute.
- buildNullAnnotation(mappingDefinition.getAnnotationName());
- JavaAttributeMapping mapping = mappingDefinition.buildMapping(this, getJpaFactory());
- mapping.initialize(annotation);
- return mapping;
- }
-
- /**
- * return null if there is no "default" mapping for the attribute
- */
- public String getDefaultMappingKey() {
- return this.defaultMapping.getKey();
- }
-
- /**
- * the mapping might be "default", but it still might be a "null" mapping...
- */
- public boolean mappingIsDefault(JavaAttributeMapping mapping) {
- return this.defaultMapping == mapping;
- }
-
- protected void updateDefaultMapping() {
- // There will always be a mapping definition, even if it is a "null" mapping definition ...
- JavaAttributeMappingDefinition mappingDefinition =
- getJpaPlatform().getDefaultJavaAttributeMappingDefinition(this);
- String mappingKey = mappingDefinition.getKey();
- if (this.valuesAreEqual(this.defaultMapping.getKey(), mappingKey)) {
- this.defaultMapping.update(this.resourcePersistentAttribute.
- buildNullAnnotation(mappingDefinition.getAnnotationName()));
- }
- else {
- setDefaultMapping(buildDefaultMapping(mappingDefinition));
- }
- }
-
- // ***** specified mapping
- public JavaAttributeMapping getSpecifiedMapping() {
- return this.specifiedMapping;
- }
-
- /**
- * clients do not set the "specified" mapping;
- * @see #setSpecifiedMappingKey(String)
- */
- protected void setSpecifiedMapping(JavaAttributeMapping specifiedMapping) {
- JavaAttributeMapping old = this.specifiedMapping;
- this.specifiedMapping = specifiedMapping;
- this.firePropertyChanged(SPECIFIED_MAPPING_PROPERTY, old, specifiedMapping);
- }
-
- protected JavaAttributeMapping buildSpecifiedMapping() {
- JavaAttributeMappingDefinition mappingDefinition =
- getJpaPlatform().getSpecifiedJavaAttributeMappingDefinition(this);
- return buildSpecifiedMapping(mappingDefinition);
- }
-
- protected JavaAttributeMapping buildSpecifiedMapping(JavaAttributeMappingDefinition mappingDefinition) {
- Annotation annotation = this.resourcePersistentAttribute.
- getAnnotation(mappingDefinition.getAnnotationName());
- JavaAttributeMapping mapping = mappingDefinition.buildMapping(this, getJpaFactory());
- // specified mappings may be null
- if (mapping != null) {
- mapping.initialize(annotation);
- }
- return mapping;
- }
-
- /**
- * return the key of the currently specified mapping or null
- * if there is no specified mapping for the attribute
- */
- protected String getSpecifiedMappingKey() {
- return (this.specifiedMapping == null) ? null : this.specifiedMapping.getKey();
- }
-
- // TODO support morphing mappings, i.e. copying common settings over
- // to the new mapping; this can't be done in the same was as XmlAttributeMapping
- // since we don't know all the possible mapping types
- public void setSpecifiedMappingKey(String key) {
- if (Tools.valuesAreEqual(key, this.getSpecifiedMappingKey())) {
- return;
- }
- JavaAttributeMapping old = this.specifiedMapping;
- JavaAttributeMapping newMapping = this.buildMappingFromMappingKey(key);
-
- this.specifiedMapping = newMapping;
-
- String newAnnotation = (newMapping == null) ? null : newMapping.getAnnotationName();
- JavaAttributeMapping mapping = (newMapping == null) ? this.defaultMapping : newMapping;
- this.resourcePersistentAttribute.setPrimaryAnnotation(newAnnotation, mapping.getSupportingAnnotationNames());
- this.firePropertyChanged(SPECIFIED_MAPPING_PROPERTY, old, newMapping);
- }
- protected static final String[] EMPTY_STRING_ARRAY = new String[0];
-
- /**
- * return the annotation name of the currently specified mapping or null
- * if there is no specified mapping for the attribute
- */
- protected String getSpecifiedMappingAnnotationName() {
- return (this.specifiedMapping == null) ? null : this.specifiedMapping.getAnnotationName();
- }
-
- protected JavaAttributeMapping buildMappingFromMappingKey(String key) {
- JavaAttributeMappingDefinition mappingDefinition = getJpaPlatform().getSpecifiedJavaAttributeMappingDefinition(key);
- JavaAttributeMapping mapping = mappingDefinition.buildMapping(this, getJpaFactory());
- //no mapping.initialize(JavaResourcePersistentAttribute) call here
- //we do not yet have a mapping annotation so we can't call initialize
- return mapping;
- }
-
- protected Iterable<String> getSupportingAnnotationNames() {
- JavaAttributeMapping mapping = this.getMapping();
- return (mapping != null) ? mapping.getSupportingAnnotationNames() : EmptyIterable.<String>instance();
- }
-
- protected void updateSpecifiedMapping() {
- // There will always be a mapping definition, even if it is a "null" mapping provider ...
- JavaAttributeMappingDefinition mappingDefinition =
- getJpaPlatform().getSpecifiedJavaAttributeMappingDefinition(this);
- String mappingKey = mappingDefinition.getKey();
- if (this.specifiedMapping != null
- && this.specifiedMapping.getKey().equals(mappingKey)) {
- this.specifiedMapping.update(this.resourcePersistentAttribute.
- getAnnotation(mappingDefinition.getAnnotationName()));
- }
- else {
- setSpecifiedMapping(buildSpecifiedMapping(mappingDefinition));
- }
- }
-
-
- // ********** misc overrides **********
-
- @Override
- public PersistentType getParent() {
- return (PersistentType) super.getParent();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- super.toString(sb);
- sb.append(this.name);
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getSelectionTextRange(astRoot);
- }
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
-
- this.validateModifiers(messages, astRoot);
-
- if (this.specifiedMapping != null) {
- this.specifiedMapping.validate(messages, reporter, astRoot);
- }
- else if (this.defaultMapping != null) {
- this.defaultMapping.validate(messages, reporter, astRoot);
- }
- }
-
-
- protected void validateModifiers(List<IMessage> messages, CompilationUnit astRoot) {
- if (this.getMappingKey() == MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY) {
- return;
- }
-
- if (this.isField()) {
- if (this.isFinal()) {
- messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_FIELD, astRoot));
- }
- if (this.isPublic()) {
- messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_PUBLIC_FIELD, astRoot));
- }
- }
- }
-
- protected IMessage buildAttributeMessage(String msgID, CompilationUnit astRoot) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- msgID,
- new String[] {getName()},
- this,
- this.getValidationTextRange(astRoot)
- );
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return this.getMapping().javaCompletionProposals(pos, filter, astRoot);
- }
-
-
- // ********** JPA containers **********
-
- /**
- * Return the JPA container corresponding to the specified type;
- * return a "null" JPA container if the specified type is not one of the
- * container types allowed by the JPA spec.
- */
- protected JpaContainer getJpaContainer(String typeName) {
- for (JpaContainer jpaContainer : JPA_CONTAINERS) {
- if (jpaContainer.getTypeName().equals(typeName)) {
- return jpaContainer;
- }
- }
- return JpaContainer.Null.instance();
- }
-
- protected static final Iterable<JpaContainer> JPA_CONTAINERS =
- new ArrayIterable<JpaContainer>(new JpaContainer[] {
- new CollectionJpaContainer(java.util.Collection.class, JPA2_0.COLLECTION_ATTRIBUTE),
- new CollectionJpaContainer(java.util.Set.class, JPA2_0.SET_ATTRIBUTE),
- new CollectionJpaContainer(java.util.List.class, JPA2_0.LIST_ATTRIBUTE),
- new MapJpaContainer(java.util.Map.class, JPA2_0.MAP_ATTRIBUTE)
- });
-
- /**
- * JPA container interface (and null implementation)
- */
- protected interface JpaContainer {
- String getTypeName();
- boolean isContainer();
- String getMultiReferenceEntityTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute);
- String getMetamodelContainerFieldTypeName();
- String getMetamodelContainerFieldMapKeyTypeName(MultiRelationshipMapping mapping);
-
- final class Null implements JpaContainer {
- public static final JpaContainer INSTANCE = new Null();
- public static JpaContainer instance() {
- return INSTANCE;
- }
- // ensure single instance
- private Null() {
- super();
- }
- public String getTypeName() {
- return null;
- }
- public boolean isContainer() {
- return false;
- }
- public String getMultiReferenceEntityTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- return null;
- }
- public String getMetamodelContainerFieldTypeName() {
- return JPA2_0.COLLECTION_ATTRIBUTE;
- }
- public String getMetamodelContainerFieldMapKeyTypeName(MultiRelationshipMapping mapping) {
- return null;
- }
- @Override
- public String toString() {
- return "JpaContainer.Null"; //$NON-NLS-1$
- }
- }
-
- }
-
- /**
- * Abstract JPA container
- */
- protected abstract static class AbstractJpaContainer implements JpaContainer {
- protected final String typeName;
- protected final String metamodelContainerFieldTypeName;
-
- protected AbstractJpaContainer(Class<?> containerClass, String metamodelContainerFieldTypeName) {
- this(containerClass.getName(), metamodelContainerFieldTypeName);
- }
-
- protected AbstractJpaContainer(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
- */
- protected static class CollectionJpaContainer extends AbstractJpaContainer {
- protected CollectionJpaContainer(Class<?> collectionClass, String staticMetamodelTypeDeclarationTypeName) {
- super(collectionClass, staticMetamodelTypeDeclarationTypeName);
- }
-
- public String getMultiReferenceEntityTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- return (resourcePersistentAttribute.typeTypeArgumentNamesSize() == 1) ?
- resourcePersistentAttribute.getTypeTypeArgumentName(0) :
- null;
- }
-
- public String getMetamodelContainerFieldMapKeyTypeName(MultiRelationshipMapping mapping) {
- return null;
- }
- }
-
- /**
- * Map JPA container
- */
- protected static class MapJpaContainer extends AbstractJpaContainer {
- protected MapJpaContainer(Class<?> mapClass, String staticMetamodelTypeDeclarationTypeName) {
- super(mapClass, staticMetamodelTypeDeclarationTypeName);
- }
-
- public String getMultiReferenceEntityTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- return (resourcePersistentAttribute.typeTypeArgumentNamesSize() == 2) ?
- resourcePersistentAttribute.getTypeTypeArgumentName(1) :
- null;
- }
-
- public String getMetamodelContainerFieldMapKeyTypeName(MultiRelationshipMapping mapping) {
- return mapping.getMetamodelFieldMapKeyTypeName();
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentType.java
deleted file mode 100644
index b9b7003fac..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentType.java
+++ /dev/null
@@ -1,661 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.JpaFile;
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaStructureNodes;
-import org.eclipse.jpt.core.context.java.JavaTypeMapping;
-import org.eclipse.jpt.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.HashBag;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterators.ChainIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.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 JavaResourcePersistentType resourcePersistentType;
-
- protected String name;
-
- protected AccessType defaultAccess;
-
- protected AccessType specifiedAccess;
-
- protected JavaTypeMapping mapping;
-
- protected final Vector<JavaPersistentAttribute> attributes = new Vector<JavaPersistentAttribute>();
-
- protected PersistentType superPersistentType;
-
-
- protected AbstractJavaPersistentType(PersistentType.Owner parent, JavaResourcePersistentType jrpt) {
- super(parent);
- this.initialize(jrpt);
- }
-
- protected void initialize(JavaResourcePersistentType jrpt) {
- this.resourcePersistentType = jrpt;
- this.superPersistentType = this.buildSuperPersistentType();
- this.name = this.buildName();
- this.defaultAccess = buildDefaultAccess();
- this.specifiedAccess = buildSpecifiedAccess();
- this.mapping = buildMapping();
- this.initializeAttributes();
- }
-
-
- // ********** update **********
-
- public void update(JavaResourcePersistentType jrpt) {
- this.resourcePersistentType = jrpt;
- this.update();
- }
-
- public void update() {
- JpaFile jpaFile = this.getJpaFile();
- if (jpaFile != null) {
- // the JPA file can be null if the resource type is "external"
- jpaFile.addRootStructureNode(this.resourcePersistentType.getQualifiedName(), this);
- }
- this.setSuperPersistentType(this.buildSuperPersistentType());
- this.setName(this.buildName());
- this.updateAccess();
- this.updateMapping();
- this.updateAttributes();
- }
-
- @Override
- public void postUpdate() {
- super.postUpdate();
- this.mapping.postUpdate();
- for (PersistentAttribute attribute : this.getAttributes()) {
- attribute.postUpdate();
- }
- }
-
-
- // ********** AbstractJpaNode overrides **********
-
- @Override
- public PersistentType.Owner getParent() {
- return (PersistentType.Owner) super.getParent();
- }
-
- @Override
- public IResource getResource() {
- return this.resourcePersistentType.getFile();
- }
-
-
- // ********** JpaStructureNode implementation **********
-
- public String getId() {
- return JavaStructureNodes.PERSISTENT_TYPE_ID;
- }
-
- // it would be nice if the we passed in an astRoot here, but then we
- // would need to pass it to the XML structure nodes too...
- public JpaStructureNode getStructureNode(int offset) {
- CompilationUnit astRoot = this.buildASTRoot();
-
- if (this.contains(offset, astRoot)) {
- for (JavaPersistentAttribute persistentAttribute : this.getAttributes()) {
- if (persistentAttribute.contains(offset, astRoot)) {
- return persistentAttribute;
- }
- }
- return this;
- }
- return null;
- }
-
- protected boolean contains(int offset, CompilationUnit astRoot) {
- TextRange fullTextRange = this.getFullTextRange(astRoot);
- // 'fullTextRange' will be null if the type no longer exists in the java;
- // the context model can be out of synch with the resource model
- // when a selection event occurs before the context model has a
- // chance to synch with the resource model via the update thread
- return (fullTextRange == null) ? false : fullTextRange.includes(offset);
- }
-
- protected TextRange getFullTextRange(CompilationUnit astRoot) {
- return this.resourcePersistentType.getTextRange(astRoot);
- }
-
- public TextRange getSelectionTextRange() {
- return this.getSelectionTextRange(this.buildASTRoot());
- }
-
- protected TextRange getSelectionTextRange(CompilationUnit astRoot) {
- return this.resourcePersistentType.getNameTextRange(astRoot);
- }
-
- public void dispose() {
- JpaFile jpaFile = this.getJpaFile();
- if (jpaFile != null) {
- // the JPA file can be null if the .java file was deleted
- // or the resource type is "external"
- jpaFile.removeRootStructureNode(this.resourcePersistentType.getQualifiedName());
- }
- }
-
-
- // ********** PersistentType implementation **********
-
- public JavaResourcePersistentType getResourcePersistentType() {
- return this.resourcePersistentType;
- }
-
-
- // ********** name **********
-
- public String getName() {
- return this.name;
- }
-
- public String getShortName(){
- return this.name.substring(this.name.lastIndexOf('.') + 1);
- }
-
- protected void setName(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- protected String buildName() {
- return this.resourcePersistentType.getQualifiedName();
- }
-
-
- // ********** access **********
-
- public AccessType getAccess() {
- return (this.specifiedAccess != null) ? this.specifiedAccess : this.defaultAccess;
- }
-
- public AccessType getDefaultAccess() {
- return this.defaultAccess;
- }
-
- protected void setDefaultAccess(AccessType defaultAccess) {
- AccessType old = this.defaultAccess;
- this.defaultAccess = defaultAccess;
- this.firePropertyChanged(DEFAULT_ACCESS_PROPERTY, old, defaultAccess);
- }
-
- public AccessType getSpecifiedAccess() {
- return this.specifiedAccess;
- }
-
- /**
- * Check the access "specified" by the Java resource model:<ul>
- * <li>Check Java annotations first
- * <li>If <code>null</code>, check XML mapping specified access
- * <li>If still <code>null</code>, check {@link #superPersistentType} access
- * <li>If still <code>null</code>, check <code>entity-mappings</code>
- * specified access setting if the corresponding <code>persistent-type</code>
- * is listed in a mapping (<code>orm.xml</code>) file
- * <li>If still <code>null</code>, check the <code>persistence-unit</code>
- * default Access
- * <li>Default to <code>FIELD</code> if all else fails.
- * </ul>
- */
- protected AccessType buildDefaultAccess() {
- AccessType accessType = AccessType.fromJavaResourceModel(this.resourcePersistentType.getAccess());
- if (accessType != null) {
- return accessType;
- }
- accessType = this.getOwnerOverrideAccess();
- if (accessType != null) {
- return accessType;
- }
-
- if (this.superPersistentType != null) {
- accessType = this.superPersistentType.getDefaultAccess();
- 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;
- }
-
- protected void updateAccess() {
- this.setDefaultAccess(this.buildDefaultAccess());
- }
-
- /**
- * Build an access type based on annotations from the resource model.
- * (This is JPA platform-dependent.)
- */
- protected abstract AccessType buildSpecifiedAccess();
-
-
- // ********** mapping **********
-
- public JavaTypeMapping getMapping() {
- return this.mapping;
- }
-
- public String getMappingKey() {
- return this.mapping.getKey();
- }
-
- public void setMappingKey(String key) {
- if (this.valuesAreEqual(key, this.mapping.getKey())) {
- return;
- }
- JavaTypeMapping oldMapping = this.mapping;
- JavaTypeMapping newMapping = this.buildMappingFromMappingKey(key);
-
- this.mapping = newMapping;
- this.resourcePersistentType.setPrimaryAnnotation(newMapping.getAnnotationName(), newMapping.getSupportingAnnotationNames());
- this.firePropertyChanged(MAPPING_PROPERTY, oldMapping, newMapping);
- }
-
- protected void setMapping(JavaTypeMapping mapping) {
- JavaTypeMapping old = this.mapping;
- this.mapping = mapping;
- this.firePropertyChanged(MAPPING_PROPERTY, old, mapping);
- }
-
- protected JavaTypeMapping buildMapping() {
- JavaTypeMappingDefinition mappingDefinition = this.getJpaPlatform().getJavaTypeMappingDefinition(this);
- return this.buildMapping(mappingDefinition);
- }
-
- protected JavaTypeMapping buildMapping(JavaTypeMappingDefinition mappingDefinition) {
- JavaTypeMapping jtMapping = mappingDefinition.buildMapping(this, this.getJpaFactory());
- // mapping may be null
- if (jtMapping != null) {
- jtMapping.initialize(this.resourcePersistentType);
- }
- return jtMapping;
- }
-
- protected JavaTypeMapping buildMappingFromMappingKey(String key) {
- JavaTypeMappingDefinition mappingDefinition = this.getJpaPlatform().getJavaTypeMappingDefinition(key);
- JavaTypeMapping jtMapping = mappingDefinition.buildMapping(this, this.getJpaFactory());
- //no mapping.initialize(JavaResourcePersistentType) call here
- //we do not yet have a mapping annotation so we can't call initialize
- return jtMapping;
- }
-
- protected void updateMapping() {
- // There will always be a mapping definition, even if it is a "null" mapping definition ...
- JavaTypeMappingDefinition mappingDefinition = this.getJpaPlatform().getJavaTypeMappingDefinition(this);
- if ((this.mapping != null) && this.valuesAreEqual(this.mapping.getKey(), mappingDefinition.getKey())) {
- this.mapping.update(this.resourcePersistentType);
- } else {
- this.setMapping(this.buildMapping(mappingDefinition));
- }
- }
-
-
- // ********** attributes **********
-
- public ListIterator<JavaPersistentAttribute> attributes() {
- return new CloneListIterator<JavaPersistentAttribute>(this.attributes);
- }
-
- protected Iterable<JavaPersistentAttribute> getAttributes() {
- return new LiveCloneIterable<JavaPersistentAttribute>(this.attributes);
- }
-
- public int attributesSize() {
- return this.attributes.size();
- }
-
- private void addAttribute(int index, JavaPersistentAttribute attribute) {
- this.addItemToList(index, attribute, this.attributes, ATTRIBUTES_LIST);
- }
-
- private void removeAttribute(JavaPersistentAttribute attribute) {
- this.removeItemFromList(attribute, this.attributes, ATTRIBUTES_LIST);
- }
-
- private void moveAttribute(int index, JavaPersistentAttribute attribute) {
- this.moveItemInList(index, this.attributes.indexOf(attribute), this.attributes, ATTRIBUTES_LIST);
- }
-
- public Iterator<String> attributeNames() {
- return this.attributeNames(this.attributes());
- }
-
- protected Iterator<String> attributeNames(Iterator<? extends PersistentAttribute> attrs) {
- return new TransformationIterator<PersistentAttribute, String>(attrs) {
- @Override
- protected String transform(PersistentAttribute attribute) {
- return attribute.getName();
- }
- };
- }
-
- public JavaPersistentAttribute getAttributeNamed(String attributeName) {
- Iterator<JavaPersistentAttribute> stream = this.attributesNamed(attributeName);
- return stream.hasNext() ? stream.next() : null;
- }
-
- public PersistentAttribute resolveAttribute(String attributeName) {
- Iterator<JavaPersistentAttribute> stream = this.attributesNamed(attributeName);
- if (stream.hasNext()) {
- JavaPersistentAttribute attribute = stream.next();
- return stream.hasNext() ? null /*more than one*/: attribute;
- }
- return (this.superPersistentType == null) ? null : this.superPersistentType.resolveAttribute(attributeName);
- }
-
- protected Iterator<JavaPersistentAttribute> attributesNamed(final String attributeName) {
- return new FilteringIterator<JavaPersistentAttribute, JavaPersistentAttribute>(this.attributes()) {
- @Override
- protected boolean accept(JavaPersistentAttribute o) {
- return attributeName.equals(o.getName());
- }
- };
- }
-
- public Iterator<PersistentAttribute> allAttributes() {
- return new CompositeIterator<PersistentAttribute>(
- new TransformationIterator<PersistentType, Iterator<PersistentAttribute>>(this.inheritanceHierarchy()) {
- @Override
- protected Iterator<PersistentAttribute> transform(PersistentType pt) {
- return pt.attributes();
- }
- }
- );
- }
-
- public Iterator<String> allAttributeNames() {
- return this.attributeNames(this.allAttributes());
- }
-
- protected void initializeAttributes() {
- for (Iterator<JavaResourcePersistentAttribute> stream = this.resourceAttributes(); stream.hasNext(); ) {
- this.attributes.add(this.createAttribute(stream.next()));
- }
- }
-
- protected Iterator<JavaResourcePersistentAttribute> resourceAttributes() {
- return (this.getAccess() == AccessType.PROPERTY) ?
- this.resourcePersistentType.persistableProperties() :
- this.resourcePersistentType.persistableFields();
- }
-
- protected void updateAttributes() {
- HashBag<JavaPersistentAttribute> contextAttributesToRemove = CollectionTools.bag(this.attributes(), this.attributesSize());
- ArrayList<JavaPersistentAttribute> contextAttributesToUpdate = new ArrayList<JavaPersistentAttribute>(this.attributesSize());
- int resourceIndex = 0;
-
- for (Iterator<JavaResourcePersistentAttribute> resourceAttributes = this.resourceAttributes(); resourceAttributes.hasNext(); ) {
- JavaResourcePersistentAttribute resourceAttribute = resourceAttributes.next();
- boolean match = false;
- for (Iterator<JavaPersistentAttribute> contextAttributes = contextAttributesToRemove.iterator(); contextAttributes.hasNext(); ) {
- JavaPersistentAttribute contextAttribute = contextAttributes.next();
- if (contextAttribute.getResourcePersistentAttribute() == resourceAttribute) {
- this.moveAttribute(resourceIndex, contextAttribute);
- contextAttributes.remove();
- contextAttributesToUpdate.add(contextAttribute);
- match = true;
- break;
- }
- }
- if ( ! match) {
- this.addAttribute(resourceIndex, this.createAttribute(resourceAttribute));
- }
- resourceIndex++;
- }
- for (JavaPersistentAttribute contextAttribute : contextAttributesToRemove) {
- this.removeAttribute(contextAttribute);
- }
- // handle adding and removing attributes first, update the
- // remaining attributes last; this reduces the churn during "update"
- for (JavaPersistentAttribute contextAttribute : contextAttributesToUpdate) {
- contextAttribute.update();
- }
- }
-
- protected JavaPersistentAttribute createAttribute(JavaResourcePersistentAttribute jrpa) {
- return this.getJpaFactory().buildJavaPersistentAttribute(this, jrpa);
- }
-
- public boolean hasAnyAnnotatedAttributes() {
- return this.resourcePersistentType.hasAnyAnnotatedAttributes();
- }
-
-
- // ********** super persistent type **********
-
- public PersistentType getSuperPersistentType() {
- return this.superPersistentType;
- }
-
- protected void setSuperPersistentType(PersistentType superPersistentType) {
- PersistentType old = this.superPersistentType;
- this.superPersistentType = superPersistentType;
- this.firePropertyChanged(SUPER_PERSISTENT_TYPE_PROPERTY, old, superPersistentType);
- }
-
- protected PersistentType buildSuperPersistentType() {
- HashSet<JavaResourcePersistentType> visited = new HashSet<JavaResourcePersistentType>();
- visited.add(this.resourcePersistentType);
- PersistentType spt = this.getSuperPersistentType(this.resourcePersistentType.getSuperclassQualifiedName(), visited);
- if (spt == null) {
- return null;
- }
- if (CollectionTools.contains(spt.inheritanceHierarchy(), this)) {
- return null; // short-circuit in this case, we have circular inheritance
- }
- return spt.isMapped() ? spt : spt.getSuperPersistentType();
- }
-
- /**
- * The JPA spec allows non-persistent types in a persistent type's
- * inheritance hierarchy. We check for a persistent type with the
- * specified name in the persistence unit. If it is not found we use
- * resource persistent type and look for *its* super type.
- *
- * The 'visited' collection is used to detect a cycle in the *resource* type
- * inheritance hierarchy and prevent the resulting stack overflow.
- * Any cycles in the *context* type inheritance hierarchy are handled in
- * #buildSuperPersistentType().
- */
- protected PersistentType getSuperPersistentType(String typeName, Collection<JavaResourcePersistentType> visited) {
- if (typeName == null) {
- return null;
- }
- JavaResourcePersistentType resourceType = this.getJpaProject().getJavaResourcePersistentType(typeName);
- if ((resourceType == null) || visited.contains(resourceType)) {
- return null;
- }
- visited.add(resourceType);
- PersistentType spt = this.getPersistentType(typeName);
- return (spt != null) ? spt : this.getSuperPersistentType(resourceType.getSuperclassQualifiedName(), visited); // recurse
- }
-
- protected PersistentType getPersistentType(String typeName) {
- return this.getPersistenceUnit().getPersistentType(typeName);
- }
-
-
- // ********** inheritance **********
-
- public Iterator<PersistentType> inheritanceHierarchy() {
- return this.inheritanceHierarchyOf(this);
- }
-
- public Iterator<PersistentType> ancestors() {
- return this.inheritanceHierarchyOf(this.superPersistentType);
- }
-
- protected Iterator<PersistentType> inheritanceHierarchyOf(PersistentType start) {
- // using a chain iterator to traverse up the inheritance tree
- return new ChainIterator<PersistentType>(start) {
- @Override
- protected PersistentType nextLink(PersistentType persistentType) {
- return persistentType.getSuperPersistentType();
- }
- };
- }
-
-
- // ********** code completion **********
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- Iterator<String> values = this.mapping.javaCompletionProposals(pos, filter, astRoot);
- if (values != null) {
- return values;
- }
- for (JavaPersistentAttribute attribute : this.getAttributes()) {
- values = attribute.javaCompletionProposals(pos, filter, astRoot);
- if (values != null) {
- return values;
- }
- }
- return EmptyIterator.instance();
- }
-
-
- // ********** validation **********
-
- public void validate(List<IMessage> messages, IReporter reporter) {
- if (reporter.isCancelled()) {
- throw new ValidationCancelledException();
- }
- // TODO temporary hack since we don't know yet where to put
- // any messages for types in another project (e.g. referenced by
- // persistence.xml)
- IFile file = this.resourcePersistentType.getFile();
- // 'file' will be null if the type is "external" and binary;
- // the file will be in a different project if the type is "external" and source;
- // the type will be binary if it is in a JAR in the current project
- if ((file != null) && file.getProject().equals(this.getJpaProject().getProject()) &&
- (this.resourcePersistentType instanceof SourceNode)) {
- // build the AST root here to pass down
- this.validate(messages, reporter, this.buildASTRoot());
- }
- }
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.validateMapping(messages, reporter, astRoot);
- this.validateAttributes(messages, reporter, astRoot);
- }
-
- protected void validateMapping(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- try {
- this.mapping.validate(messages, reporter, astRoot);
- } catch(Throwable t) {
- JptCorePlugin.log(t);
- }
- }
-
- protected void validateAttributes(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- for (JavaPersistentAttribute attribute : this.getAttributes()) {
- this.validateAttribute(attribute, reporter, messages, astRoot);
- }
- }
-
- protected void validateAttribute(JavaPersistentAttribute attribute, IReporter reporter, List<IMessage> messages, CompilationUnit astRoot) {
- try {
- attribute.validate(messages, reporter, astRoot);
- } catch(Throwable t) {
- JptCorePlugin.log(t);
- }
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getSelectionTextRange(astRoot);
- }
-
-
- // ********** misc **********
-
- public boolean isMapped() {
- return this.mapping.isMapped();
- }
-
- public AccessType getOwnerOverrideAccess() {
- return this.getParent().getOverridePersistentTypeAccess();
- }
-
- public AccessType getOwnerDefaultAccess() {
- return this.getParent().getDefaultPersistentTypeAccess();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- super.toString(sb);
- sb.append(this.name);
- }
-
- protected CompilationUnit buildASTRoot() {
- return this.resourcePersistentType.getJavaResourceCompilationUnit().buildASTRoot();
- }
-
- protected JpaFile getJpaFile() {
- return this.getJpaFile(this.resourcePersistentType.getFile());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaQuery.java
deleted file mode 100644
index 0d4a41289d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaQuery.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.Query;
-import org.eclipse.jpt.core.context.QueryHint;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaQuery;
-import org.eclipse.jpt.core.context.java.JavaQueryHint;
-import org.eclipse.jpt.core.resource.java.BaseNamedQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.QueryHintAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-
-public abstract class AbstractJavaQuery extends AbstractJavaJpaContextNode
- implements JavaQuery
-{
- protected String name;
-
- protected String query;
-
- protected final List<JavaQueryHint> hints;
-
- protected BaseNamedQueryAnnotation resourceQuery;
-
- protected AbstractJavaQuery(JavaJpaContextNode parent) {
- super(parent);
- this.hints = new ArrayList<JavaQueryHint>();
- }
-
- protected BaseNamedQueryAnnotation getResourceQuery() {
- return this.resourceQuery;
- }
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String newName) {
- String oldName = this.name;
- this.name = newName;
- this.resourceQuery.setName(newName);
- firePropertyChanged(Query.NAME_PROPERTY, oldName, newName);
- }
-
- protected void setName_(String newName) {
- String oldName = this.name;
- this.name = newName;
- firePropertyChanged(Query.NAME_PROPERTY, oldName, newName);
- }
-
- public String getQuery() {
- return this.query;
- }
-
- public void setQuery(String newQuery) {
- String oldQuery = this.query;
- this.query = newQuery;
- this.resourceQuery.setQuery(newQuery);
- firePropertyChanged(Query.QUERY_PROPERTY, oldQuery, newQuery);
- }
-
- protected void setQuery_(String newQuery) {
- String oldQuery = this.query;
- this.query = newQuery;
- firePropertyChanged(Query.QUERY_PROPERTY, oldQuery, newQuery);
- }
-
- public ListIterator<JavaQueryHint> hints() {
- return new CloneListIterator<JavaQueryHint>(this.hints);
- }
-
- public int hintsSize() {
- return this.hints.size();
- }
-
- public JavaQueryHint addHint(int index) {
- JavaQueryHint hint = getJpaFactory().buildJavaQueryHint(this);
- this.hints.add(index, hint);
- this.getResourceQuery().addHint(index);
- this.fireItemAdded(Query.HINTS_LIST, index, hint);
- return hint;
- }
-
- protected void addHint(int index, JavaQueryHint hint) {
- addItemToList(index, hint, this.hints, Query.HINTS_LIST);
- }
-
- protected void addHint(JavaQueryHint hint) {
- addHint(this.hints.size(), hint);
- }
-
- public void removeHint(QueryHint queryHint) {
- removeHint(this.hints.indexOf(queryHint));
- }
-
- public void removeHint(int index) {
- JavaQueryHint removedHint = this.hints.remove(index);
- this.getResourceQuery().removeHint(index);
- fireItemRemoved(Query.HINTS_LIST, index, removedHint);
- }
-
- protected void removeHint_(JavaQueryHint hint) {
- removeItemFromList(hint, this.hints, Query.HINTS_LIST);
- }
-
- public void moveHint(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.hints, targetIndex, sourceIndex);
- this.getResourceQuery().moveHint(targetIndex, sourceIndex);
- fireItemMoved(Query.HINTS_LIST, targetIndex, sourceIndex);
- }
-
- protected void initialize(BaseNamedQueryAnnotation queryAnnotation) {
- this.resourceQuery = queryAnnotation;
- this.name = queryAnnotation.getName();
- this.query = queryAnnotation.getQuery();
- this.initializeQueryHints();
- }
-
- protected void update(BaseNamedQueryAnnotation queryAnnotation) {
- this.resourceQuery = queryAnnotation;
- this.setName_(queryAnnotation.getName());
- this.setQuery_(queryAnnotation.getQuery());
- this.updateQueryHints();
- getPersistenceUnit().addQuery(this);
- }
-
- protected void initializeQueryHints() {
- ListIterator<QueryHintAnnotation> resourceHints = this.resourceQuery.hints();
-
- while(resourceHints.hasNext()) {
- this.hints.add(createQueryHint(resourceHints.next()));
- }
- }
-
- protected void updateQueryHints() {
- ListIterator<JavaQueryHint> contextHints = hints();
- ListIterator<QueryHintAnnotation> resourceHints = this.resourceQuery.hints();
-
- while (contextHints.hasNext()) {
- JavaQueryHint hint = contextHints.next();
- if (resourceHints.hasNext()) {
- hint.update(resourceHints.next());
- }
- else {
- removeHint_(hint);
- }
- }
-
- while (resourceHints.hasNext()) {
- addHint(createQueryHint(resourceHints.next()));
- }
- }
-
- protected JavaQueryHint createQueryHint(QueryHintAnnotation resourceQueryHint) {
- JavaQueryHint queryHint = getJpaFactory().buildJavaQueryHint(this);
- queryHint.initialize(resourceQueryHint);
- return queryHint;
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.resourceQuery.getTextRange(astRoot);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return this.resourceQuery.getNameTextRange(astRoot);
- }
-
- public boolean overrides(Query other) {
- // java is at the base of the tree
- return false;
- }
-
- public boolean duplicates(Query other) {
- return (this != other)
- && ! StringTools.stringIsEmpty(this.name)
- && this.name.equals(other.getName())
- && ! this.overrides(other)
- && ! other.overrides(this);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaRelationshipMapping.java
deleted file mode 100644
index ecdea26ca7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaRelationshipMapping.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.java.JavaCascade;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaRelationshipMapping;
-import org.eclipse.jpt.core.context.java.JavaRelationshipReference;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.resource.java.RelationshipMappingAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java relationship mapping
- */
-public abstract class AbstractJavaRelationshipMapping<T extends RelationshipMappingAnnotation>
- extends AbstractJavaAttributeMapping<T>
- implements JavaRelationshipMapping
-{
- protected String specifiedTargetEntity;
- protected String defaultTargetEntity;
- protected Entity resolvedTargetEntity;
-
- protected final JavaRelationshipReference relationshipReference;
-
- protected final JavaCascade cascade;
-
- protected FetchType specifiedFetch;
-
-
- protected AbstractJavaRelationshipMapping(JavaPersistentAttribute parent) {
- super(parent);
- this.relationshipReference = this.buildRelationshipReference();
- this.cascade = this.getJpaFactory().buildJavaCascade(this);
- }
-
- @Override
- protected void initialize() {
- super.initialize();
- this.defaultTargetEntity = this.buildDefaultTargetEntity();
- this.relationshipReference.initialize();
- this.specifiedFetch = this.getResourceFetch();
- this.cascade.initialize(this.mappingAnnotation);
- this.specifiedTargetEntity = this.getResourceTargetEntity();
- this.resolvedTargetEntity = this.buildResolvedTargetEntity();
- }
-
- @Override
- protected void update() {
- super.update();
- this.setDefaultTargetEntity(this.buildDefaultTargetEntity());
- this.relationshipReference.update();
- this.setSpecifiedFetch_(this.getResourceFetch());
- this.cascade.update(this.mappingAnnotation);
- this.setSpecifiedTargetEntity_(this.getResourceTargetEntity());
- this.setResolvedTargetEntity(this.buildResolvedTargetEntity());
- }
-
-
- // ********** target entity **********
-
- public String getTargetEntity() {
- return (this.specifiedTargetEntity != null) ? this.specifiedTargetEntity : this.defaultTargetEntity;
- }
-
- public String getSpecifiedTargetEntity() {
- return this.specifiedTargetEntity;
- }
-
- public void setSpecifiedTargetEntity(String targetEntity) {
- String old = this.specifiedTargetEntity;
- this.specifiedTargetEntity = targetEntity;
- this.mappingAnnotation.setTargetEntity(targetEntity);
- this.firePropertyChanged(SPECIFIED_TARGET_ENTITY_PROPERTY, old, targetEntity);
- }
-
- protected void setSpecifiedTargetEntity_(String targetEntity) {
- String old = this.specifiedTargetEntity;
- this.specifiedTargetEntity = targetEntity;
- this.firePropertyChanged(SPECIFIED_TARGET_ENTITY_PROPERTY, old, targetEntity);
- }
-
- protected String getResourceTargetEntity() {
- return this.mappingAnnotation.getTargetEntity();
- }
-
- public String getDefaultTargetEntity() {
- return this.defaultTargetEntity;
- }
-
- protected void setDefaultTargetEntity(String targetEntity) {
- String old = this.defaultTargetEntity;
- this.defaultTargetEntity = targetEntity;
- this.firePropertyChanged(DEFAULT_TARGET_ENTITY_PROPERTY, old, targetEntity);
- }
-
- protected abstract String buildDefaultTargetEntity();
-
- public Entity getResolvedTargetEntity() {
- return this.resolvedTargetEntity;
- }
-
- protected void setResolvedTargetEntity(Entity entity) {
- Entity old = this.resolvedTargetEntity;
- this.resolvedTargetEntity = entity;
- this.firePropertyChanged(RESOLVED_TARGET_ENTITY_PROPERTY, old, entity);
- }
-
- protected Entity buildResolvedTargetEntity() {
- String targetEntityClassName = (this.specifiedTargetEntity == null) ?
- this.defaultTargetEntity :
- this.mappingAnnotation.getFullyQualifiedTargetEntityClassName();
- return (targetEntityClassName == null) ? null : this.getPersistenceUnit().getEntity(targetEntityClassName);
- }
-
- public Iterator<String> allTargetEntityAttributeNames() {
- return new CompositeIterator<String>(
- new TransformationIterator<AttributeMapping, Iterator<String>>(this.allTargetEntityAttributeMappings()) {
- @Override
- protected Iterator<String> transform(AttributeMapping mapping) {
- return mapping.allMappingNames();
- }
- });
- }
-
- protected Iterator<AttributeMapping> allTargetEntityAttributeMappings() {
- return (this.resolvedTargetEntity != null) ?
- this.resolvedTargetEntity.allAttributeMappings() :
- EmptyIterator.<AttributeMapping> instance();
- }
-
- protected String getTargetEntityIdAttributeName() {
- PersistentAttribute attribute = this.getTargetEntityIdAttribute();
- return (attribute == null) ? null : attribute.getName();
- }
-
- protected PersistentAttribute getTargetEntityIdAttribute() {
- return (this.resolvedTargetEntity == null) ? null : this.resolvedTargetEntity.getIdAttribute();
- }
-
- public char getTargetEntityEnclosingTypeSeparator() {
- return '.';
- }
-
-
- // ********** relationship reference **********
-
- public JavaRelationshipReference getRelationshipReference() {
- return this.relationshipReference;
- }
-
- protected abstract JavaRelationshipReference buildRelationshipReference();
-
- public boolean isRelationshipOwner() {
- return this.relationshipReference.isRelationshipOwner();
- }
-
- @Override
- public boolean isOwnedBy(RelationshipMapping mapping) {
- return this.relationshipReference.isOwnedBy(mapping);
- }
-
- @Override
- public boolean isOverridableAssociationMapping() {
- return this.relationshipReference.isOverridableAssociation();
- }
-
-
- // ********** cascade **********
-
- public JavaCascade getCascade() {
- return this.cascade;
- }
-
-
- // ********** fetch **********
-
- public FetchType getFetch() {
- return (this.specifiedFetch != null) ? this.specifiedFetch : this.getDefaultFetch();
- }
-
- public FetchType getSpecifiedFetch() {
- return this.specifiedFetch;
- }
-
- public void setSpecifiedFetch(FetchType fetch) {
- FetchType old = this.specifiedFetch;
- this.specifiedFetch = fetch;
- this.mappingAnnotation.setFetch(FetchType.toJavaResourceModel(fetch));
- this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch);
- }
-
- protected void setSpecifiedFetch_(FetchType fetch) {
- FetchType old = this.specifiedFetch;
- this.specifiedFetch = fetch;
- this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch);
- }
-
- protected FetchType getResourceFetch() {
- return FetchType.fromJavaResourceModel(this.mappingAnnotation.getFetch());
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return this.relationshipReference.javaCompletionProposals(pos, filter, astRoot);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.validateTargetEntity(messages, astRoot);
- this.relationshipReference.validate(messages, reporter, astRoot);
- }
-
- protected void validateTargetEntity(List<IMessage> messages, CompilationUnit astRoot) {
- if (this.getTargetEntity() == null) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.TARGET_ENTITY_NOT_DEFINED,
- new String[] {this.getName()},
- this,
- this.getValidationTextRange(astRoot)
- )
- );
- }
- else if (this.resolvedTargetEntity == null) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.TARGET_ENTITY_IS_NOT_AN_ENTITY,
- new String[] {this.getTargetEntity(), this.getName()},
- this,
- this.getTargetEntityTextRange(astRoot)
- )
- );
- }
- }
-
- protected TextRange getTargetEntityTextRange(CompilationUnit astRoot) {
- return this.getTextRange(this.mappingAnnotation.getTargetEntityTextRange(astRoot), astRoot);
- }
-
- protected TextRange getTextRange(TextRange textRange, CompilationUnit astRoot) {
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot);
- }
-
-
- // ********** metamodel **********
-
- @Override
- public String getMetamodelTypeName() {
- String targetEntity = this.getTargetEntity();
- return (targetEntity != null) ? targetEntity : MetamodelField.DEFAULT_TYPE_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaRelationshipReference.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaRelationshipReference.java
deleted file mode 100644
index 41c77fceaf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaRelationshipReference.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaRelationshipMapping;
-import org.eclipse.jpt.core.context.java.JavaRelationshipReference;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public abstract class AbstractJavaRelationshipReference
- extends AbstractJavaJpaContextNode
- implements JavaRelationshipReference
-{
- // cache the strategy for property change notification
- protected JoiningStrategy cachedPredominantJoiningStrategy;
-
-
- public AbstractJavaRelationshipReference(JavaRelationshipMapping parent) {
- super(parent);
- }
-
-
- public JavaRelationshipMapping getRelationshipMapping() {
- return (JavaRelationshipMapping) getParent();
- }
-
- public TypeMapping getTypeMapping() {
- return getRelationshipMapping().getTypeMapping();
- }
-
- public Entity getEntity() {
- TypeMapping typeMapping = getTypeMapping();
- return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
- }
-
- public boolean isOverridableAssociation() {
- return getPredominantJoiningStrategy().isOverridableAssociation();
- }
-
- public boolean isParentVirtual() {
- return getRelationshipMapping().getPersistentAttribute().isVirtual();
- }
-
- // **************** predominant joining strategy ***************************
-
- public JoiningStrategy getPredominantJoiningStrategy() {
- return this.cachedPredominantJoiningStrategy;
- }
-
- protected void setPredominantJoiningStrategy(JoiningStrategy newJoiningStrategy) {
- JoiningStrategy oldJoiningStrategy = this.cachedPredominantJoiningStrategy;
- this.cachedPredominantJoiningStrategy = newJoiningStrategy;
- firePropertyChanged(PREDOMINANT_JOINING_STRATEGY_PROPERTY, oldJoiningStrategy, newJoiningStrategy);
- }
-
-
- // **************** resource -> context ************************************
-
- public void initialize() {
- initializeJoiningStrategies();
- this.cachedPredominantJoiningStrategy = calculatePredominantJoiningStrategy();
- }
-
- protected abstract void initializeJoiningStrategies();
-
- public void update() {
- updateJoiningStrategies();
- setPredominantJoiningStrategy(calculatePredominantJoiningStrategy());
- }
-
- protected abstract void updateJoiningStrategies();
-
- protected abstract JoiningStrategy calculatePredominantJoiningStrategy();
-
-
- // **************** validation *********************************************
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return getRelationshipMapping().getValidationTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSequenceGenerator.java
deleted file mode 100644
index 3d59451b5c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSequenceGenerator.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.SequenceGenerator;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaSequenceGenerator;
-import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-/**
- *
- */
-public abstract class AbstractJavaSequenceGenerator extends AbstractJavaGenerator
- implements JavaSequenceGenerator
-{
- protected String specifiedSequenceName;
-
-
- protected AbstractJavaSequenceGenerator(JavaJpaContextNode parent) {
- super(parent);
- }
-
-
- // ********** sequence name **********
-
- public String getSequenceName() {
- return (this.specifiedSequenceName != null) ? this.specifiedSequenceName : this.getDefaultSequenceName();
- }
-
- public String getSpecifiedSequenceName() {
- return this.specifiedSequenceName;
- }
-
- public void setSpecifiedSequenceName(String specifiedSequenceName) {
- String old = this.specifiedSequenceName;
- this.specifiedSequenceName = specifiedSequenceName;
- this.getResourceGenerator().setSequenceName(specifiedSequenceName);
- this.firePropertyChanged(SPECIFIED_SEQUENCE_NAME_PROPERTY, old, 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 null;
- }
-
-
- // ********** resource => context **********
-
- public void initialize(SequenceGeneratorAnnotation resourceSequenceGenerator) {
- super.initialize(resourceSequenceGenerator);
- this.specifiedSequenceName = resourceSequenceGenerator.getSequenceName();
- }
-
- public void update(SequenceGeneratorAnnotation resourceSequenceGenerator) {
- super.update(resourceSequenceGenerator);
- this.setSpecifiedSequenceName_(resourceSequenceGenerator.getSequenceName());
- }
-
-
- // ********** Java completion proposals **********
-
- /**
- * called if the database is connected:
- * sequenceName
- */
- @Override
- public Iterator<String> connectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.connectedJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.sequenceNameTouches(pos, astRoot)) {
- return this.javaCandidateSequences(filter);
- }
- return null;
- }
-
- protected boolean sequenceNameTouches(int pos, CompilationUnit astRoot) {
- return this.getResourceGenerator().sequenceNameTouches(pos, astRoot);
- }
-
- protected Iterator<String> javaCandidateSequences(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.candidateSequences(filter));
- }
-
- protected Iterator<String> candidateSequences(Filter<String> filter) {
- return new FilteringIterator<String, String>(this.candidateSequences(), filter);
- }
-
- protected Iterator<String> candidateSequences() {
- Schema dbSchema = this.getDbSchema();
- return (dbSchema != null) ? dbSchema.sortedSequenceIdentifiers() : EmptyIterator.<String> instance();
- }
-
-
- // ********** misc **********
-
- public int getDefaultInitialValue() {
- return SequenceGenerator.DEFAULT_INITIAL_VALUE;
- }
-
- @Override
- protected SequenceGeneratorAnnotation getResourceGenerator() {
- return (SequenceGeneratorAnnotation) super.getResourceGenerator();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java
deleted file mode 100644
index c31c4a4ca6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.Nullable;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
-import org.eclipse.jpt.core.jpa2.context.MapsId2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaDerivedId2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaMapsId2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.RelationshipMappingAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java single relationship (1:1, m:1) mapping
- */
-public abstract class AbstractJavaSingleRelationshipMapping<T extends RelationshipMappingAnnotation>
- extends AbstractJavaRelationshipMapping<T>
- implements JavaSingleRelationshipMapping2_0
-{
- protected Boolean specifiedOptional;
-
- protected final JavaDerivedId2_0 derivedId;
-
- protected final JavaMapsId2_0 mapsId;
-
-
- protected AbstractJavaSingleRelationshipMapping(JavaPersistentAttribute parent) {
- super(parent);
- this.derivedId = buildDerivedId();
- this.mapsId = buildMapsId();
- }
-
- @Override
- protected void initialize() {
- super.initialize();
- this.specifiedOptional = this.getResourceOptional();
- this.derivedId.initialize();
- this.mapsId.initialize();
- }
-
- @Override
- protected void update() {
- super.update();
- this.setSpecifiedOptional_(this.getResourceOptional());
- this.derivedId.update();
- this.mapsId.update();
- }
-
- @Override
- protected void addSupportingAnnotationNamesTo(Vector<String> names) {
- super.addSupportingAnnotationNamesTo(names);
- names.add(JPA.JOIN_COLUMN);
- names.add(JPA.JOIN_COLUMNS);
- names.add(JPA.JOIN_TABLE);
- if (this.getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
- names.add(JPA.ID);
- names.add(JPA2_0.MAPS_ID);
- }
- }
-
-
- // ********** optional **********
-
- public boolean isOptional() {
- return (this.specifiedOptional != null) ? this.specifiedOptional.booleanValue() : this.isDefaultOptional();
- }
-
- public Boolean getSpecifiedOptional() {
- return this.specifiedOptional;
- }
-
- public void setSpecifiedOptional(Boolean optional) {
- Boolean old = this.specifiedOptional;
- this.specifiedOptional = optional;
- this.setResourceOptional(optional);
- this.firePropertyChanged(Nullable.SPECIFIED_OPTIONAL_PROPERTY, old, optional);
- }
-
- protected void setSpecifiedOptional_(Boolean optional) {
- Boolean old = this.specifiedOptional;
- this.specifiedOptional = optional;
- this.firePropertyChanged(Nullable.SPECIFIED_OPTIONAL_PROPERTY, old, optional);
- }
-
- public boolean isDefaultOptional() {
- return Nullable.DEFAULT_OPTIONAL;
- }
-
- protected abstract Boolean getResourceOptional();
-
- protected abstract void setResourceOptional(Boolean newOptional);
-
-
- // ********** 2.0 derived id **********
-
- protected JavaDerivedId2_0 buildDerivedId() {
- return ((JpaFactory2_0) getJpaFactory()).buildJavaDerivedId(this);
- }
-
- public JavaDerivedId2_0 getDerivedId() {
- return this.derivedId;
- }
-
- @Override
- public boolean isIdMapping() {
- return this.derivedId.getValue();
- }
-
-
- // ********** 2.0 maps id **********
-
- protected JavaMapsId2_0 buildMapsId() {
- return ((JpaFactory2_0) getJpaFactory()).buildJavaMapsId(this);
- }
-
- public MapsId2_0 getMapsId() {
- return this.mapsId;
- }
-
-
- // ********** AbstractJavaRelationshipMapping implementation **********
-
- @Override
- protected String buildDefaultTargetEntity() {
- return this.getPersistentAttribute().getSingleReferenceEntityTypeName();
- }
-
-
- // ********** Fetchable implementation **********
-
- public FetchType getDefaultFetch() {
- return DEFAULT_FETCH_TYPE;
- }
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.derivedId.validate(messages, reporter, astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTable.java
deleted file mode 100644
index ee99590247..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTable.java
+++ /dev/null
@@ -1,501 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaUniqueConstraint;
-import org.eclipse.jpt.core.resource.java.BaseTableAnnotation;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.Database;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.SchemaContainer;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.NameTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-/**
- * Java table
- */
-public abstract class AbstractJavaTable
- extends AbstractJavaJpaContextNode
- implements Table, UniqueConstraint.Owner
-{
- protected String specifiedName;
- protected String defaultName;
-
- protected String specifiedSchema;
- protected String defaultSchema;
-
- protected String specifiedCatalog;
- protected String defaultCatalog;
-
- protected final Vector<JavaUniqueConstraint> uniqueConstraints = new Vector<JavaUniqueConstraint>();
-
-
- // ********** constructor **********
-
- protected AbstractJavaTable(JavaJpaContextNode parent) {
- super(parent);
- }
-
-
- // ********** abstract methods **********
-
- /**
- * Return the Java table annotation. Do not return null if the Java
- * annotation does not exist; return a null table annotation instead.
- */
- protected abstract BaseTableAnnotation getAnnotation();
-
- /**
- * Return the name of the Java annotation.
- */
- protected abstract String getAnnotationName();
-
- protected abstract String buildDefaultName();
-
- protected abstract String buildDefaultSchema();
-
- protected abstract String buildDefaultCatalog();
-
-
- // ********** name **********
-
- public String getName() {
- return (this.specifiedName != null) ? this.specifiedName : this.defaultName;
- }
-
- public String getSpecifiedName() {
- return this.specifiedName;
- }
-
- public void setSpecifiedName(String name) {
- String old = this.specifiedName;
- this.specifiedName = name;
- this.getAnnotation().setName(name);
- this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name);
- }
-
- /**
- * internal setter used only for updating from the resource model.
- * There were problems with InvalidThreadAccess exceptions in the UI
- * when you set a value from the UI and the annotation doesn't exist yet.
- * Adding the annotation causes an update to occur and then the exception.
- */
- protected void setSpecifiedName_(String 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);
- }
-
-
- // ********** schema **********
-
- public String getSchema() {
- return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema;
- }
-
- public String getSpecifiedSchema() {
- return this.specifiedSchema;
- }
-
- public void setSpecifiedSchema(String schema) {
- String old = this.specifiedSchema;
- this.specifiedSchema = schema;
- this.getAnnotation().setSchema(schema);
- this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema);
- }
-
- /**
- * internal setter used only for updating from the resource model.
- * There were problems with InvalidThreadAccess exceptions in the UI
- * when you set a value from the UI and the annotation doesn't exist yet.
- * Adding the annotation causes an update to occur and then the exception.
- */
- protected void setSpecifiedSchema_(String newSpecifiedSchema) {
- String oldSpecifiedSchema = this.specifiedSchema;
- this.specifiedSchema = newSpecifiedSchema;
- firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, oldSpecifiedSchema, newSpecifiedSchema);
- }
-
- 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);
- }
-
-
- // ********** catalog **********
-
- public String getCatalog() {
- return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog;
- }
-
- public String getSpecifiedCatalog() {
- return this.specifiedCatalog;
- }
-
- public void setSpecifiedCatalog(String catalog) {
- String old = this.specifiedCatalog;
- this.specifiedCatalog = catalog;
- this.getAnnotation().setCatalog(catalog);
- this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog);
- }
-
- /**
- * internal setter used only for updating from the resource model.
- * There were problems with InvalidThreadAccess exceptions in the UI
- * when you set a value from the UI and the annotation doesn't exist yet.
- * Adding the annotation causes an update to occur and then the exception.
- */
- protected void setSpecifiedCatalog_(String 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);
- }
-
-
- // ********** unique constraints **********
-
- public @SuppressWarnings("unchecked") ListIterator<JavaUniqueConstraint> uniqueConstraints() {
- return new CloneListIterator<JavaUniqueConstraint>(this.uniqueConstraints);
- }
-
- public int uniqueConstraintsSize() {
- return this.uniqueConstraints.size();
- }
-
- public JavaUniqueConstraint addUniqueConstraint(int index) {
- JavaUniqueConstraint uniqueConstraint = getJpaFactory().buildJavaUniqueConstraint(this, this);
- this.uniqueConstraints.add(index, uniqueConstraint);
- UniqueConstraintAnnotation uniqueConstraintAnnotation = this.getAnnotation().addUniqueConstraint(index);
- uniqueConstraint.initialize(uniqueConstraintAnnotation);
- fireItemAdded(UNIQUE_CONSTRAINTS_LIST, index, uniqueConstraint);
- return uniqueConstraint;
- }
-
- public void removeUniqueConstraint(UniqueConstraint uniqueConstraint) {
- this.removeUniqueConstraint(this.uniqueConstraints.indexOf(uniqueConstraint));
- }
-
- public void removeUniqueConstraint(int index) {
- JavaUniqueConstraint removedUniqueConstraint = this.uniqueConstraints.remove(index);
- this.getAnnotation().removeUniqueConstraint(index);
- fireItemRemoved(UNIQUE_CONSTRAINTS_LIST, index, removedUniqueConstraint);
- }
-
- public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.uniqueConstraints, targetIndex, sourceIndex);
- this.getAnnotation().moveUniqueConstraint(targetIndex, sourceIndex);
- fireItemMoved(UNIQUE_CONSTRAINTS_LIST, targetIndex, sourceIndex);
- }
-
- protected void addUniqueConstraint(int index, JavaUniqueConstraint uniqueConstraint) {
- addItemToList(index, uniqueConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- }
-
- protected void addUniqueConstraint(JavaUniqueConstraint uniqueConstraint) {
- this.addUniqueConstraint(this.uniqueConstraints.size(), uniqueConstraint);
- }
-
- protected void removeUniqueConstraint_(JavaUniqueConstraint uniqueConstraint) {
- removeItemFromList(uniqueConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- }
-
- protected void initializeUniqueConstraints(BaseTableAnnotation baseTableAnnotation) {
- for (Iterator<UniqueConstraintAnnotation> stream = baseTableAnnotation.uniqueConstraints(); stream.hasNext(); ) {
- this.uniqueConstraints.add(buildUniqueConstraint(stream.next()));
- }
- }
-
- protected void updateUniqueConstraints(BaseTableAnnotation baseTableAnnotation) {
- ListIterator<UniqueConstraintAnnotation> constraintAnnotations = baseTableAnnotation.uniqueConstraints();
- ListIterator<JavaUniqueConstraint> constraints = this.uniqueConstraints();
- while (constraints.hasNext()) {
- JavaUniqueConstraint uniqueConstraint = constraints.next();
- if (constraintAnnotations.hasNext()) {
- uniqueConstraint.update(constraintAnnotations.next());
- } else {
- this.removeUniqueConstraint_(uniqueConstraint);
- }
- }
-
- while (constraintAnnotations.hasNext()) {
- this.addUniqueConstraint(this.buildUniqueConstraint(constraintAnnotations.next()));
- }
- }
-
- protected JavaUniqueConstraint buildUniqueConstraint(UniqueConstraintAnnotation uniqueConstraintAnnotation) {
- JavaUniqueConstraint uniqueConstraint = this.getJpaFactory().buildJavaUniqueConstraint(this, this);
- uniqueConstraint.initialize(uniqueConstraintAnnotation);
- return uniqueConstraint;
- }
-
-
- // ********** convenience methods **********
-
- protected TextRange getTextRange(TextRange textRange, CompilationUnit astRoot) {
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot);
- }
-
- protected TextRange getNameTextRange(CompilationUnit astRoot) {
- return this.getTextRange(this.getAnnotation().getNameTextRange(astRoot), astRoot);
- }
-
- protected boolean nameTouches(int pos, CompilationUnit astRoot) {
- return this.getAnnotation().nameTouches(pos, astRoot);
- }
-
- protected TextRange getSchemaTextRange(CompilationUnit astRoot) {
- return this.getTextRange(this.getAnnotation().getSchemaTextRange(astRoot), astRoot);
- }
-
- protected boolean schemaTouches(int pos, CompilationUnit astRoot) {
- return this.getAnnotation().schemaTouches(pos, astRoot);
- }
-
- protected TextRange getCatalogTextRange(CompilationUnit astRoot) {
- return this.getTextRange(this.getAnnotation().getCatalogTextRange(astRoot), astRoot);
- }
-
- protected boolean catalogTouches(int pos, CompilationUnit astRoot) {
- return this.getAnnotation().catalogTouches(pos, astRoot);
- }
-
-
- // ********** resource => context **********
-
- protected void initialize(BaseTableAnnotation baseTableAnnotation) {
- this.defaultName = this.buildDefaultName();
- this.specifiedName = baseTableAnnotation.getName();
-
- this.defaultSchema = this.buildDefaultSchema();
- this.specifiedSchema = baseTableAnnotation.getSchema();
-
- this.defaultCatalog = this.buildDefaultCatalog();
- this.specifiedCatalog = baseTableAnnotation.getCatalog();
-
- this.initializeUniqueConstraints(baseTableAnnotation);
- }
-
- protected void update(BaseTableAnnotation baseTableAnnotation) {
- this.setDefaultName(this.buildDefaultName());
- this.setSpecifiedName_(baseTableAnnotation.getName());
-
- this.setDefaultSchema(this.buildDefaultSchema());
- this.setSpecifiedSchema_(baseTableAnnotation.getSchema());
-
- this.setDefaultCatalog(this.buildDefaultCatalog());
- this.setSpecifiedCatalog_(baseTableAnnotation.getCatalog());
-
- this.updateUniqueConstraints(baseTableAnnotation);
- }
-
-
- // ********** database **********
-
- public org.eclipse.jpt.db.Table getDbTable() {
- Schema dbSchema = this.getDbSchema();
- return (dbSchema == null) ? null : dbSchema.getTableForIdentifier(this.getName());
- }
-
- public Schema getDbSchema() {
- SchemaContainer dbSchemaContainer = this.getDbSchemaContainer();
- return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema());
- }
-
- /**
- * If we don't have a catalog (i.e. we don't even have a <em>default</em> catalog),
- * then the database probably does not support catalogs; and we need to
- * get the schema directly from the database.
- */
- public SchemaContainer getDbSchemaContainer() {
- String catalog = this.getCatalog();
- return (catalog != null) ? this.getDbCatalog(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.getDbCatalog(catalog);
- }
-
- public boolean isResolved() {
- return this.getDbTable() != null;
- }
-
- public 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.
- */
- public boolean hasResolvedCatalog() {
- String catalog = this.getCatalog();
- return (catalog == null) || (this.getDbCatalog(catalog) != null);
- }
-
-
- // ********** UniqueConstraint.Owner implementation **********
-
- public Iterator<String> candidateUniqueConstraintColumnNames() {
- org.eclipse.jpt.db.Table dbTable = this.getDbTable();
- return (dbTable != null) ? dbTable.sortedColumnIdentifiers() : EmptyIterator.<String>instance();
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getTextRange(this.getAnnotation().getTextRange(astRoot), astRoot);
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (JavaUniqueConstraint constraint : CollectionTools.iterable(this.uniqueConstraints())) {
- result = constraint.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * called if the database is connected:
- * name, schema, catalog
- */
- @Override
- public Iterator<String> connectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.connectedJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.nameTouches(pos, astRoot)) {
- return this.javaCandidateNames(filter);
- }
- if (this.schemaTouches(pos, astRoot)) {
- return this.javaCandidateSchemata(filter);
- }
- if (this.catalogTouches(pos, astRoot)) {
- return this.javaCandidateCatalogs(filter);
- }
- return null;
- }
-
- protected Iterator<String> javaCandidateNames(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.candidateNames(filter));
- }
-
- protected Iterator<String> candidateNames(Filter<String> filter) {
- return new FilteringIterator<String, String>(this.candidateNames(), filter);
- }
-
- protected Iterator<String> candidateNames() {
- Schema dbSchema = this.getDbSchema();
- return (dbSchema != null) ? dbSchema.sortedTableIdentifiers() : EmptyIterator.<String> instance();
- }
-
- protected Iterator<String> javaCandidateSchemata(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.candidateSchemata(filter));
- }
-
- protected Iterator<String> candidateSchemata(Filter<String> filter) {
- return new FilteringIterator<String, String>(this.candidateSchemata(), filter);
- }
-
- protected Iterator<String> candidateSchemata() {
- return this.getDbSchemaContainer().sortedSchemaIdentifiers();
- }
-
- protected Iterator<String> javaCandidateCatalogs(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.candidateCatalogs(filter));
- }
-
- protected Iterator<String> candidateCatalogs(Filter<String> filter) {
- return new FilteringIterator<String, String>(this.candidateCatalogs(), filter);
- }
-
- protected Iterator<String> candidateCatalogs() {
- Database db = this.getDatabase();
- return (db != null) ? db.sortedCatalogIdentifiers() : EmptyIterator.<String> instance();
- }
-
-
- // ********** misc **********
-
- /**
- * covariant override
- */
- @Override
- public JavaJpaContextNode getParent() {
- return (JavaJpaContextNode) super.getParent();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- super.toString(sb);
- sb.append(this.getQualifiedName());
- }
-
- protected String getQualifiedName() {
- return NameTools.buildQualifiedDatabaseObjectName(this.getCatalog(), this.getSchema(), this.getName());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMapping.java
deleted file mode 100644
index fe52e1e5e7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMapping.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.RelationshipReference;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaTypeMapping;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-
-public abstract class AbstractJavaTypeMapping extends AbstractJavaJpaContextNode
- implements JavaTypeMapping
-{
- protected JavaResourcePersistentType javaResourcePersistentType;
-
-
- protected AbstractJavaTypeMapping(JavaPersistentType parent) {
- super(parent);
- }
-
- @Override
- public JavaPersistentType getParent() {
- return (JavaPersistentType) super.getParent();
- }
-
- protected Annotation getResourceMappingAnnotation() {
- return this.javaResourcePersistentType.getAnnotation(getAnnotationName());
- }
-
- //***************** TypeMapping impl ***************************************
-
- public JavaPersistentType getPersistentType() {
- return getParent();
- }
-
- public String getPrimaryTableName() {
- return null;
- }
-
- public org.eclipse.jpt.db.Table getPrimaryDbTable() {
- return null;
- }
-
- public org.eclipse.jpt.db.Table getDbTable(String tableName) {
- return null;
- }
-
- public Schema getDbSchema() {
- return null;
- }
-
- public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
- return true;
- }
-
- public Iterator<Table> associatedTables() {
- return EmptyIterator.instance();
- }
-
- public Iterator<String> associatedTableNamesIncludingInherited() {
- return EmptyIterator.instance();
- }
-
- public Iterator<Table> associatedTablesIncludingInherited() {
- return EmptyIterator.instance();
- }
-
- /**
- * Return an iterator of TypeMappings, each which inherits from the one before,
- * and terminates at the root entity (or at the point of cyclicity).
- */
- public Iterator<TypeMapping> inheritanceHierarchy() {
- return new TransformationIterator<PersistentType, TypeMapping>(getPersistentType().inheritanceHierarchy()) {
- @Override
- protected TypeMapping transform(PersistentType type) {
- return type.getMapping();
- }
- };
- }
-
- public Iterator<JavaAttributeMapping> attributeMappings() {
- return new TransformationIterator<JavaPersistentAttribute, JavaAttributeMapping>(getPersistentType().attributes()) {
- @Override
- protected JavaAttributeMapping transform(JavaPersistentAttribute attribute) {
- return attribute.getMapping();
- }
- };
- }
-
- public Iterator<AttributeMapping> allAttributeMappings() {
- return new CompositeIterator<AttributeMapping>(
- new TransformationIterator<TypeMapping, Iterator<AttributeMapping>>(this.inheritanceHierarchy()) {
- @Override
- protected Iterator<AttributeMapping> transform(TypeMapping typeMapping) {
- return typeMapping == null ? EmptyIterator.<AttributeMapping> instance() : typeMapping.attributeMappings();
- }
- });
- }
-
- public Iterator<String> overridableAttributeNames() {
- return new CompositeIterator<String>(
- new TransformationIterator<AttributeMapping, Iterator<String>>(this.attributeMappings()) {
- @Override
- protected Iterator<String> transform(AttributeMapping mapping) {
- return mapping.allOverrideableAttributeMappingNames();
- }
- });
- }
-
- public Iterator<String> allOverridableAttributeNames() {
- return new CompositeIterator<String>(new TransformationIterator<TypeMapping, Iterator<String>>(this.inheritanceHierarchy()) {
- @Override
- protected Iterator<String> transform(TypeMapping mapping) {
- return mapping.overridableAttributeNames();
- }
- });
- }
-
- public Column resolveOverridenColumn(String attributeName) {
- for (AttributeMapping attributeMapping : CollectionTools.iterable(attributeMappings())) {
- Column resolvedColumn = attributeMapping.resolveOverridenColumn(attributeName);
- if (resolvedColumn != null) {
- return resolvedColumn;
- }
- }
- return null;
- }
-
- public RelationshipReference resolveRelationshipReference(String attributeName) {
- for (AttributeMapping attributeMapping : CollectionTools.iterable(attributeMappings())) {
- RelationshipReference resolvedRelationshipReference = attributeMapping.resolveRelationshipReference(attributeName);
- if (resolvedRelationshipReference != null) {
- return resolvedRelationshipReference;
- }
- }
- return null;
- }
-
- public Iterator<String> overridableAssociationNames() {
- return new CompositeIterator<String>(
- new TransformationIterator<AttributeMapping, Iterator<String>>(this.attributeMappings()) {
- @Override
- protected Iterator<String> transform(AttributeMapping mapping) {
- return mapping.allOverrideableAssociationMappingNames();
- }
- });
- }
-
- public Iterator<String> allOverridableAssociationNames() {
- return new CompositeIterator<String>(new TransformationIterator<TypeMapping, Iterator<String>>(this.inheritanceHierarchy()) {
- @Override
- protected Iterator<String> transform(TypeMapping mapping) {
- return mapping.overridableAssociationNames();
- }
- });
- }
-
-
- //******************** updating *********************
- public void initialize(JavaResourcePersistentType jrpt) {
- this.javaResourcePersistentType = jrpt;
- }
-
- public void update(JavaResourcePersistentType jrpt) {
- this.javaResourcePersistentType = jrpt;
- }
-
- //******************** validation *********************
-
- public boolean shouldValidateAgainstDatabase() {
- return getPersistenceUnit().shouldValidateAgainstDatabase();
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = this.getResourceMappingAnnotation().getTextRange(astRoot);
- return (textRange != null) ? textRange : this.getPersistentType().getValidationTextRange(astRoot);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getPersistentType().getName());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMappingDefinition.java
deleted file mode 100644
index 65e6850206..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMappingDefinition.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-public abstract class AbstractJavaTypeMappingDefinition
- implements JavaTypeMappingDefinition
-{
- protected AbstractJavaTypeMappingDefinition() {
- super();
- }
-
-
- /**
- * Default implementation. Override if the mapping definition needs to do more analysis.
- */
- public boolean test(JavaPersistentType persistentType) {
- return persistentType.getResourcePersistentType().getAnnotation(getAnnotationName())
- != null;
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.getAnnotationName());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMapping.java
deleted file mode 100644
index 9c6fba30fa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMapping.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.java.JavaColumn;
-import org.eclipse.jpt.core.context.java.JavaConverter;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaVersionMapping;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.core.resource.java.VersionAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-
-public abstract class AbstractJavaVersionMapping
- extends AbstractJavaAttributeMapping<VersionAnnotation>
- implements JavaVersionMapping
-{
- protected final JavaColumn column;
-
- protected final JavaConverter defaultConverter;
-
- protected JavaConverter specifiedConverter;
-
- protected AbstractJavaVersionMapping(JavaPersistentAttribute parent) {
- super(parent);
- this.column = getJpaFactory().buildJavaColumn(this, this);
- this.defaultConverter = getJpaFactory().buildJavaNullConverter(this);
- }
-
- @Override
- protected void initialize( ) {
- super.initialize();
- this.column.initialize(this.getResourceColumn());
- this.specifiedConverter = this.buildSpecifiedConverter(this.getResourceConverterType());
- }
-
- public ColumnAnnotation getResourceColumn() {
- return (ColumnAnnotation) getResourcePersistentAttribute().
- getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
- }
-
- //************** JavaAttributeMapping implementation ***************
-
- public String getKey() {
- return MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String getAnnotationName() {
- return VersionAnnotation.ANNOTATION_NAME;
- }
-
-
- @Override
- protected void addSupportingAnnotationNamesTo(Vector<String> names) {
- super.addSupportingAnnotationNamesTo(names);
- names.add(JPA.COLUMN);
- names.add(JPA.TEMPORAL);
- }
-
- //************** NamedColumn.Owner implementation ***************
-
- public String getDefaultColumnName() {
- return getName();
- }
-
- public String getDefaultTableName() {
- return getTypeMapping().getPrimaryTableName();
- }
-
- //************** VersionMapping implementation ***************
-
- public JavaColumn getColumn() {
- return this.column;
- }
-
- public JavaConverter getConverter() {
- return getSpecifiedConverter() == null ? getDefaultConverter() : getSpecifiedConverter();
- }
-
- public JavaConverter getDefaultConverter() {
- return this.defaultConverter;
- }
-
- public JavaConverter getSpecifiedConverter() {
- return this.specifiedConverter;
- }
-
- protected String getSpecifedConverterType() {
- if (this.specifiedConverter == null) {
- return Converter.NO_CONVERTER;
- }
- return this.specifiedConverter.getType();
- }
-
- public void setSpecifiedConverter(String converterType) {
- if (this.valuesAreEqual(getSpecifedConverterType(), converterType)) {
- return;
- }
- JavaConverter oldConverter = this.specifiedConverter;
- JavaConverter newConverter = buildSpecifiedConverter(converterType);
- this.specifiedConverter = null;
- if (oldConverter != null) {
- oldConverter.removeFromResourceModel();
- }
- this.specifiedConverter = newConverter;
- if (newConverter != null) {
- newConverter.addToResourceModel();
- }
- firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
- }
-
- protected void setSpecifiedConverter(JavaConverter newConverter) {
- JavaConverter oldConverter = this.specifiedConverter;
- this.specifiedConverter = newConverter;
- firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
- }
-
-
- @Override
- protected void update() {
- super.update();
- this.column.update(this.getResourceColumn());
- if (this.valuesAreEqual(getResourceConverterType(), getSpecifedConverterType())) {
- getSpecifiedConverter().update(this.getResourcePersistentAttribute());
- }
- else {
- JavaConverter javaConverter = buildSpecifiedConverter(getResourceConverterType());
- setSpecifiedConverter(javaConverter);
- }
- }
-
- protected JavaConverter buildSpecifiedConverter(String converterType) {
- if (this.valuesAreEqual(converterType, Converter.TEMPORAL_CONVERTER)) {
- return getJpaFactory().buildJavaTemporalConverter(this, this.getResourcePersistentAttribute());
- }
- return null;
- }
-
- protected String getResourceConverterType() {
- if (this.getResourcePersistentAttribute().getAnnotation(TemporalAnnotation.ANNOTATION_NAME) != null) {
- return Converter.TEMPORAL_CONVERTER;
- }
- return null;
- }
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.getColumn().javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return null;
- }
-
- //*********** Validation ******************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- if (this.shouldValidateAgainstDatabase()) {
- this.validateColumn(messages, astRoot);
- }
- if (this.specifiedConverter != null) {
- this.specifiedConverter.validate(messages, reporter, astRoot);
- }
- }
-
- protected void validateColumn(List<IMessage> messages, CompilationUnit astRoot) {
- String tableName = this.column.getTable();
- if (this.getTypeMapping().tableNameIsInvalid(tableName)) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_TABLE,
- new String[] {tableName, this.column.getName()},
- this.column,
- this.column.getTableTextRange(astRoot)
- )
- );
- return;
- }
-
- if ( ! this.column.isResolved() && this.column.getDbTable() != null) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {this.column.getName()},
- this.column,
- this.column.getNameTextRange(astRoot)
- )
- );
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinColumnInAssociationOverrideJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinColumnInAssociationOverrideJoiningStrategy.java
deleted file mode 100644
index cca5eff2f7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinColumnInAssociationOverrideJoiningStrategy.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.ListIterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverrideRelationshipReference;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaJoinColumnInAssociationOverrideJoiningStrategy;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn.Owner;
-import org.eclipse.jpt.core.internal.resource.java.NullJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Table;
-
-public class GenericJavaJoinColumnInAssociationOverrideJoiningStrategy
- extends AbstractJavaJoinColumnJoiningStrategy
- implements JavaJoinColumnInAssociationOverrideJoiningStrategy
-{
- protected transient AssociationOverrideAnnotation associationOverrideAnnotation;
-
- public GenericJavaJoinColumnInAssociationOverrideJoiningStrategy(JavaAssociationOverrideRelationshipReference parent) {
- super(parent);
- }
-
- @Override
- protected Owner buildJoinColumnOwner() {
- return new JoinColumnOwner();
- }
-
- public TypeMapping getTypeMapping() {
- return getAssociationOverride().getOwner().getTypeMapping();
- }
-
- public boolean isOverridableAssociation() {
- return false;
- }
-
- protected JavaAssociationOverride getAssociationOverride() {
- return this.getRelationshipReference().getAssociationOverride();
- }
-
- @Override
- public JavaAssociationOverrideRelationshipReference getRelationshipReference() {
- return (JavaAssociationOverrideRelationshipReference) super.getRelationshipReference();
- }
-
- @Override
- protected ListIterator<JoinColumnAnnotation> joinColumnAnnotations() {
- return this.associationOverrideAnnotation.joinColumns();
- }
-
- @Override
- protected JoinColumnAnnotation buildNullJoinColumnAnnotation() {
- return new NullJoinColumnAnnotation(this.associationOverrideAnnotation);
- }
-
- @Override
- protected JoinColumnAnnotation addAnnotation(int index) {
- return this.associationOverrideAnnotation.addJoinColumn(index);
- }
-
- @Override
- protected void removeAnnotation(int index) {
- this.associationOverrideAnnotation.removeJoinColumn(index);
- }
-
- @Override
- protected void moveAnnotation(int targetIndex, int sourceIndex) {
- this.associationOverrideAnnotation.moveJoinColumn(targetIndex, sourceIndex);
- }
-
- public void initialize(AssociationOverrideAnnotation associationOverride) {
- this.associationOverrideAnnotation = associationOverride;
- super.initialize();
- }
-
- public void update(AssociationOverrideAnnotation associationOverride) {
- this.associationOverrideAnnotation = associationOverride;
- super.update();
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getRelationshipReference().getValidationTextRange(astRoot);
- }
-
-// ********** join column owner adapter **********
-
- protected class JoinColumnOwner
- implements JavaJoinColumn.Owner
- {
-
- protected JoinColumnOwner() {
- super();
- }
-
- /**
- * by default, the join column is in the type mapping's primary table
- */
- public String getDefaultTableName() {
- return getTypeMapping().getPrimaryTableName();
- }
-
- public String getDefaultColumnName() {
- //built in MappingTools.buildJoinColumnDefaultName()
- return null;
- }
-
- public Entity getTargetEntity() {
- RelationshipMapping relationshipMapping = getRelationshipMapping();
- return relationshipMapping == null ? null : relationshipMapping.getResolvedTargetEntity();
- }
-
- public String getAttributeName() {
- return GenericJavaJoinColumnInAssociationOverrideJoiningStrategy.this.getRelationshipReference().getAssociationOverride().getName();
- }
-
- public RelationshipMapping getRelationshipMapping() {
- return GenericJavaJoinColumnInAssociationOverrideJoiningStrategy.this.getRelationshipReference().getAssociationOverride().getOwner().getRelationshipMapping(GenericJavaJoinColumnInAssociationOverrideJoiningStrategy.this.getRelationshipReference().getAssociationOverride().getName());
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return getTypeMapping().tableNameIsInvalid(tableName);
- }
-
- /**
- * the join column can be on a secondary table
- */
- public boolean tableIsAllowed() {
- return true;
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return GenericJavaJoinColumnInAssociationOverrideJoiningStrategy.this.getValidationTextRange(astRoot);
- }
-
- public TypeMapping getTypeMapping() {
- return GenericJavaJoinColumnInAssociationOverrideJoiningStrategy.this.getRelationshipReference().getAssociationOverride().getOwner().getTypeMapping();
- }
-
- public Table getDbTable(String tableName) {
- return getTypeMapping().getDbTable(tableName);
- }
-
- public Table getReferencedColumnDbTable() {
- Entity targetEntity = getTargetEntity();
- return (targetEntity == null) ? null : targetEntity.getPrimaryDbTable();
- }
-
- public boolean isVirtual(BaseJoinColumn joinColumn) {
- return false;
- }
-
- public int joinColumnsSize() {
- return GenericJavaJoinColumnInAssociationOverrideJoiningStrategy.this.getRelationshipReference().getJoinColumnJoiningStrategy().joinColumnsSize();
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinColumnJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinColumnJoiningStrategy.java
deleted file mode 100644
index 8ca8fb555c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinColumnJoiningStrategy.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaJoinColumnEnabledRelationshipReference;
-import org.eclipse.jpt.core.context.java.JavaRelationshipMapping;
-import org.eclipse.jpt.core.internal.resource.java.NullJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinColumnsAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-public class GenericJavaJoinColumnJoiningStrategy
- extends AbstractJavaJoinColumnJoiningStrategy
-{
-
- public GenericJavaJoinColumnJoiningStrategy(JavaJoinColumnEnabledRelationshipReference parent) {
- super(parent);
- }
-
- @Override
- protected JavaJoinColumn.Owner buildJoinColumnOwner() {
- return new JoinColumnOwner();
- }
-
- public TypeMapping getTypeMapping() {
- return getRelationshipMapping().getTypeMapping();
- }
-
- public boolean isOverridableAssociation() {
- return true;
- }
-
- @Override
- public JavaJoinColumnEnabledRelationshipReference getRelationshipReference() {
- return (JavaJoinColumnEnabledRelationshipReference) super.getRelationshipReference();
- }
-
- @Override
- public JavaRelationshipMapping getRelationshipMapping() {
- return getRelationshipReference().getRelationshipMapping();
- }
-
- protected JavaResourcePersistentAttribute getResourcePersistentAttribute() {
- return getRelationshipMapping().getPersistentAttribute().getResourcePersistentAttribute();
- }
-
- @Override
- protected Iterator<JoinColumnAnnotation> joinColumnAnnotations() {
- return new TransformationIterator<NestableAnnotation, JoinColumnAnnotation>(
- this.getResourcePersistentAttribute().annotations(
- JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME)) {
- @Override
- protected JoinColumnAnnotation transform(NestableAnnotation next) {
- return (JoinColumnAnnotation) next;
- }
- };
- }
-
- @Override
- protected JoinColumnAnnotation buildNullJoinColumnAnnotation() {
- return new NullJoinColumnAnnotation(this.getResourcePersistentAttribute());
- }
-
- @Override
- protected JoinColumnAnnotation addAnnotation(int index) {
- return (JoinColumnAnnotation) this.getResourcePersistentAttribute().
- addAnnotation(
- index,
- JoinColumnAnnotation.ANNOTATION_NAME,
- JoinColumnsAnnotation.ANNOTATION_NAME);
- }
-
- @Override
- protected void removeAnnotation(int index) {
- this.getResourcePersistentAttribute().
- removeAnnotation(
- index,
- JoinColumnAnnotation.ANNOTATION_NAME,
- JoinColumnsAnnotation.ANNOTATION_NAME);
- }
-
- @Override
- protected void moveAnnotation(int targetIndex, int sourceIndex) {
- this.getResourcePersistentAttribute().
- moveAnnotation(
- targetIndex,
- sourceIndex,
- JoinColumnsAnnotation.ANNOTATION_NAME);
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getRelationshipReference().getValidationTextRange(astRoot);
- }
- protected class JoinColumnOwner
- implements JavaJoinColumn.Owner
-{
- protected JoinColumnOwner() {
- super();
- }
-
-
- /**
- * by default, the join column is in the type mapping's primary table
- */
- public String getDefaultTableName() {
- return getTypeMapping().getPrimaryTableName();
- }
-
- public String getDefaultColumnName() {
- //built in MappingTools.buildJoinColumnDefaultName()
- return null;
- }
-
- public Entity getTargetEntity() {
- return getRelationshipMapping().getResolvedTargetEntity();
- }
-
- public String getAttributeName() {
- return getRelationshipMapping().getPersistentAttribute().getName();
- }
-
- public RelationshipMapping getRelationshipMapping() {
- return GenericJavaJoinColumnJoiningStrategy.this.getRelationshipMapping();
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return getTypeMapping().tableNameIsInvalid(tableName);
- }
-
- /**
- * the join column can be on a secondary table
- */
- public boolean tableIsAllowed() {
- return true;
- }
-
- public TypeMapping getTypeMapping() {
- return getRelationshipMapping().getTypeMapping();
- }
-
- public Table getDbTable(String tableName) {
- return getTypeMapping().getDbTable(tableName);
- }
-
- public Table getReferencedColumnDbTable() {
- Entity targetEntity = getTargetEntity();
- return (targetEntity == null) ? null : targetEntity.getPrimaryDbTable();
- }
-
- public boolean isVirtual(BaseJoinColumn joinColumn) {
- return GenericJavaJoinColumnJoiningStrategy.this.defaultJoinColumn == joinColumn;
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return GenericJavaJoinColumnJoiningStrategy.this.getValidationTextRange(astRoot);
- }
-
- public int joinColumnsSize() {
- return GenericJavaJoinColumnJoiningStrategy.this.joinColumnsSize();
- }
-}
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinTableJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinTableJoiningStrategy.java
deleted file mode 100644
index 8cbca2c542..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaJoinTableJoiningStrategy.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.java.JavaJoinTableEnabledRelationshipReference;
-import org.eclipse.jpt.core.context.java.JavaRelationshipMapping;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class GenericJavaJoinTableJoiningStrategy
- extends AbstractJavaJoinTableJoiningStrategy
-{
- protected JavaResourcePersistentAttribute resourcePersistentAttribute;
-
-
- public GenericJavaJoinTableJoiningStrategy(JavaJoinTableEnabledRelationshipReference parent) {
- super(parent);
- }
-
- public boolean isOverridableAssociation() {
- return getJpaPlatformVariation().isJoinTableOverridable();
- }
-
- @Override
- public JavaJoinTableEnabledRelationshipReference getParent() {
- return (JavaJoinTableEnabledRelationshipReference) super.getParent();
- }
-
- @Override
- public JavaJoinTableEnabledRelationshipReference getRelationshipReference() {
- return this.getParent();
- }
-
- @Override
- public JavaRelationshipMapping getRelationshipMapping() {
- return this.getRelationshipReference().getRelationshipMapping();
- }
-
-
- // **************** join table *********************************************
-
- @Override
- protected JoinTableAnnotation addAnnotation() {
- return (JoinTableAnnotation) this.resourcePersistentAttribute.
- addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- }
-
- @Override
- protected void removeAnnotation() {
- this.resourcePersistentAttribute.
- removeAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- }
-
-
- // **************** resource => context ************************************
-
- @Override
- public void initialize() {
- this.resourcePersistentAttribute =
- getRelationshipReference().getRelationshipMapping().
- getPersistentAttribute().getResourcePersistentAttribute();
- super.initialize();
- }
-
- @Override
- public void update() {
- this.resourcePersistentAttribute =
- getRelationshipReference().getRelationshipMapping().
- getPersistentAttribute().getResourcePersistentAttribute();
- super.update();
- }
-
- public JoinTableAnnotation getAnnotation() {
- return (JoinTableAnnotation) this.resourcePersistentAttribute.
- getNonNullAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- }
-
-
- // **************** validation *********************************************
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getRelationshipReference().getValidationTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaManyToManyRelationshipReference.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaManyToManyRelationshipReference.java
deleted file mode 100644
index 5808c4beb4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaManyToManyRelationshipReference.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.java.JavaJoinTableJoiningStrategy;
-import org.eclipse.jpt.core.context.java.JavaManyToManyMapping;
-import org.eclipse.jpt.core.context.java.JavaManyToManyRelationshipReference;
-import org.eclipse.jpt.core.context.java.JavaMappedByJoiningStrategy;
-import org.eclipse.jpt.core.resource.java.OwnableRelationshipMappingAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaManyToManyRelationshipReference
- extends AbstractJavaRelationshipReference
- implements JavaManyToManyRelationshipReference
-{
- protected final JavaMappedByJoiningStrategy mappedByJoiningStrategy;
-
- protected final JavaJoinTableJoiningStrategy joinTableJoiningStrategy;
-
-
- public GenericJavaManyToManyRelationshipReference(JavaManyToManyMapping parent) {
- super(parent);
- this.mappedByJoiningStrategy = buildMappedByJoiningStrategy();
- this.joinTableJoiningStrategy = buildJoinTableJoiningStrategy();
- }
-
-
- protected JavaMappedByJoiningStrategy buildMappedByJoiningStrategy() {
- return new GenericJavaMappedByJoiningStrategy(this);
- }
-
- protected JavaJoinTableJoiningStrategy buildJoinTableJoiningStrategy() {
- return new GenericJavaJoinTableJoiningStrategy(this);
- }
-
- @Override
- public JavaManyToManyMapping getRelationshipMapping() {
- return (JavaManyToManyMapping) getParent();
- }
-
- public OwnableRelationshipMappingAnnotation getMappingAnnotation() {
- return getRelationshipMapping().getMappingAnnotation();
- }
-
- public boolean isRelationshipOwner() {
- return this.getMappedByJoiningStrategy().getMappedByAttribute() == null;
- }
-
- public boolean isOwnedBy(RelationshipMapping mapping) {
- return this.mappedByJoiningStrategy.relationshipIsOwnedBy(mapping);
- }
-
- @Override
- protected JoiningStrategy calculatePredominantJoiningStrategy() {
- if (this.mappedByJoiningStrategy.getMappedByAttribute() != null) {
- return this.mappedByJoiningStrategy;
- }
- else {
- return this.joinTableJoiningStrategy;
- }
- }
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result == null) {
- result = this.mappedByJoiningStrategy.javaCompletionProposals(pos, filter, astRoot);
- }
- if (result == null) {
- result = this.joinTableJoiningStrategy.javaCompletionProposals(pos, filter, astRoot);
- }
- return result;
- }
-
-
- // **************** mapped by **********************************************
-
- public JavaMappedByJoiningStrategy getMappedByJoiningStrategy() {
- return this.mappedByJoiningStrategy;
- }
-
- public void setMappedByJoiningStrategy() {
- this.mappedByJoiningStrategy.addStrategy();
- this.joinTableJoiningStrategy.removeStrategy();
- }
-
- public void unsetMappedByJoiningStrategy() {
- this.mappedByJoiningStrategy.removeStrategy();
- }
-
- public boolean usesMappedByJoiningStrategy() {
- return getPredominantJoiningStrategy() == this.mappedByJoiningStrategy;
- }
-
- public boolean mayBeMappedBy(AttributeMapping mappedByMapping) {
- return mappedByMapping.getKey() == MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-
-
- // **************** join table joining strategy ***************************
-
- public JavaJoinTableJoiningStrategy getJoinTableJoiningStrategy() {
- return this.joinTableJoiningStrategy;
- }
-
- public boolean usesJoinTableJoiningStrategy() {
- return getPredominantJoiningStrategy() == this.joinTableJoiningStrategy;
- }
-
- public void setJoinTableJoiningStrategy() {
- // join table is default option, so no need to add to resource
- this.mappedByJoiningStrategy.removeStrategy();
- }
-
- public void unsetJoinTableJoiningStrategy() {
- this.joinTableJoiningStrategy.removeStrategy();
- }
-
- public boolean mayHaveDefaultJoinTable() {
- return getMappedByJoiningStrategy().getMappedByAttribute() == null;
- }
-
-
- // **************** resource => context ************************************
-
- @Override
- protected void initializeJoiningStrategies() {
- this.mappedByJoiningStrategy.initialize();
- this.joinTableJoiningStrategy.initialize();
- }
-
- @Override
- protected void updateJoiningStrategies() {
- this.mappedByJoiningStrategy.update();
- this.joinTableJoiningStrategy.update();
- }
-
-
- // **************** Validation *********************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.mappedByJoiningStrategy.validate(messages, reporter, astRoot);
- this.joinTableJoiningStrategy.validate(messages, reporter, astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaManyToOneRelationshipReference.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaManyToOneRelationshipReference.java
deleted file mode 100644
index bfa5d4fa87..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaManyToOneRelationshipReference.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.java.JavaJoinColumnJoiningStrategy;
-import org.eclipse.jpt.core.context.java.JavaManyToOneMapping;
-import org.eclipse.jpt.core.context.java.JavaManyToOneRelationshipReference;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaManyToOneRelationshipReference
- extends AbstractJavaRelationshipReference
- implements JavaManyToOneRelationshipReference
-{
- protected final JavaJoinColumnJoiningStrategy joinColumnJoiningStrategy;
-
-
- public GenericJavaManyToOneRelationshipReference(JavaManyToOneMapping parent) {
- super(parent);
- this.joinColumnJoiningStrategy = buildJoinColumnJoiningStrategy();
- }
-
-
- protected JavaJoinColumnJoiningStrategy buildJoinColumnJoiningStrategy() {
- return new GenericJavaJoinColumnJoiningStrategy(this);
- }
-
- @Override
- public JavaManyToOneMapping getRelationshipMapping() {
- return (JavaManyToOneMapping) getParent();
- }
-
- public boolean isRelationshipOwner() {
- return true;
- }
-
- public boolean isOwnedBy(RelationshipMapping mapping) {
- return false;
- }
-
- @Override
- protected JoiningStrategy calculatePredominantJoiningStrategy() {
- // the only joining strategy
- return this.joinColumnJoiningStrategy;
- }
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result == null) {
- result = this.joinColumnJoiningStrategy.javaCompletionProposals(pos, filter, astRoot);
- }
- return result;
- }
-
-
- // **************** join columns *******************************************
-
- public JavaJoinColumnJoiningStrategy getJoinColumnJoiningStrategy() {
- return this.joinColumnJoiningStrategy;
- }
-
- public boolean usesJoinColumnJoiningStrategy() {
- return getPredominantJoiningStrategy() == this.joinColumnJoiningStrategy;
- }
-
- public void setJoinColumnJoiningStrategy() {
- // join columns are default (and only, so far) strategy, so no need
- // to add to resource model
- }
-
- public void unsetJoinColumnJoiningStrategy() {
- this.joinColumnJoiningStrategy.removeStrategy();
- }
-
- public boolean mayHaveDefaultJoinColumn() {
- return true;
- }
-
-
- // **************** resource => context ************************************
-
- @Override
- protected void initializeJoiningStrategies() {
- // initialize join column strategy last, as the existence of a default
- // join column is dependent on the other mechanisms (join table) not
- // being specified
- this.joinColumnJoiningStrategy.initialize();
- }
-
- @Override
- protected void updateJoiningStrategies() {
- // update join column strategy last, as the existence of a default join
- // column is dependent on the other mechanisms (join table) not being
- // specified
- this.joinColumnJoiningStrategy.update();
- }
-
-
- // **************** Validation *********************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.joinColumnJoiningStrategy.validate(messages, reporter, astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaMappedByJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaMappedByJoiningStrategy.java
deleted file mode 100644
index 19527f7484..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaMappedByJoiningStrategy.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.java.JavaMappedByJoiningStrategy;
-import org.eclipse.jpt.core.context.java.JavaOwnableRelationshipReference;
-import org.eclipse.jpt.core.context.java.JavaRelationshipMapping;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.OwnableRelationshipMappingAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaMappedByJoiningStrategy
- extends AbstractJavaJpaContextNode
- implements JavaMappedByJoiningStrategy
-{
- protected OwnableRelationshipMappingAnnotation mappingAnnotation;
-
- protected String mappedByAttribute;
-
-
- public GenericJavaMappedByJoiningStrategy(JavaOwnableRelationshipReference parent) {
- super(parent);
- }
-
-
- @Override
- public JavaOwnableRelationshipReference getParent() {
- return (JavaOwnableRelationshipReference) super.getParent();
- }
-
- public JavaOwnableRelationshipReference getRelationshipReference() {
- return this.getParent();
- }
-
- public JavaRelationshipMapping getRelationshipMapping() {
- return getParent().getRelationshipMapping();
- }
-
- public boolean isOverridableAssociation() {
- return false;
- }
-
- public boolean relationshipIsOwnedBy(RelationshipMapping otherMapping) {
- String thisEntity =
- (getRelationshipReference().getEntity()) == null ?
- null : getRelationshipReference().getEntity().getName();
- String targetEntity =
- (getRelationshipMapping().getResolvedTargetEntity() == null) ?
- null : getRelationshipMapping().getResolvedTargetEntity().getName();
- return StringTools.stringsAreEqual(
- thisEntity,
- targetEntity)
- && StringTools.stringsAreEqual(
- getMappedByAttribute(),
- otherMapping.getName());
- }
-
- public String getMappedByAttribute() {
- return this.mappedByAttribute;
- }
-
- public void setMappedByAttribute(String newMappedByAttribute) {
- String oldMappedByAttribute = this.mappedByAttribute;
- this.mappedByAttribute = newMappedByAttribute;
- this.mappingAnnotation.setMappedBy(newMappedByAttribute);
- firePropertyChanged(MAPPED_BY_ATTRIBUTE_PROPERTY, oldMappedByAttribute, newMappedByAttribute);
- }
-
- protected void setMappedByAttribute_(String newMappedByAttribute) {
- String oldMappedByAttribute = this.mappedByAttribute;
- this.mappedByAttribute = newMappedByAttribute;
- firePropertyChanged(MAPPED_BY_ATTRIBUTE_PROPERTY, oldMappedByAttribute, newMappedByAttribute);
- }
-
- public void addStrategy() {
- if (this.mappedByAttribute == null) {
- setMappedByAttribute("");
- }
- }
-
- public void removeStrategy() {
- if (this.mappedByAttribute != null) {
- setMappedByAttribute(null);
- }
- }
-
- public void initialize() {
- this.mappingAnnotation = this.getRelationshipReference().getMappingAnnotation();
- this.mappedByAttribute = this.mappingAnnotation.getMappedBy();
- }
-
- public void update() {
- this.mappingAnnotation = this.getRelationshipReference().getMappingAnnotation();
- setMappedByAttribute_(this.mappingAnnotation.getMappedBy());
- }
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.mappingAnnotation.mappedByTouches(pos, astRoot)) {
- result = javaCandidateMappedByAttributeNames(filter);
- }
- return result;
- }
-
- public Iterator<String> candidateMappedByAttributeNames() {
- return getRelationshipMapping().allTargetEntityAttributeNames();
- }
-
- public Iterator<String> candidateMappedByAttributeNames(Filter<String> filter) {
- return new FilteringIterator<String, String>(this.candidateMappedByAttributeNames(), filter);
- }
-
- protected Iterator<String> javaCandidateMappedByAttributeNames(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.candidateMappedByAttributeNames(filter));
- }
-
-
- // **************** validation *********************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
-
- if (getMappedByAttribute() == 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(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.MAPPING_UNRESOLVED_MAPPED_BY,
- new String[] {this.mappedByAttribute},
- this,
- this.getValidationTextRange(astRoot)
- )
- );
- return;
- }
-
- if ( ! this.getRelationshipReference().mayBeMappedBy(mappedByMapping)) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.MAPPING_INVALID_MAPPED_BY,
- new String[] {this.mappedByAttribute},
- this,
- this.getValidationTextRange(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(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.MAPPING_MAPPED_BY_ON_BOTH_SIDES,
- this,
- this.getValidationTextRange(astRoot)
- )
- );
- }
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.mappingAnnotation.getMappedByTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaOneToOneRelationshipReference.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaOneToOneRelationshipReference.java
deleted file mode 100644
index 8df83efda7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaOneToOneRelationshipReference.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.java.JavaJoinColumnJoiningStrategy;
-import org.eclipse.jpt.core.context.java.JavaMappedByJoiningStrategy;
-import org.eclipse.jpt.core.context.java.JavaOneToOneMapping;
-import org.eclipse.jpt.core.context.java.JavaOneToOneRelationshipReference;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumnJoiningStrategy;
-import org.eclipse.jpt.core.resource.java.OwnableRelationshipMappingAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaOneToOneRelationshipReference
- extends AbstractJavaRelationshipReference
- implements JavaOneToOneRelationshipReference
-{
- protected final JavaMappedByJoiningStrategy mappedByJoiningStrategy;
-
- protected final JavaJoinColumnJoiningStrategy joinColumnJoiningStrategy;
-
- protected final JavaPrimaryKeyJoinColumnJoiningStrategy primaryKeyJoinColumnJoiningStrategy;
-
-
- public GenericJavaOneToOneRelationshipReference(JavaOneToOneMapping parent) {
- super(parent);
- this.mappedByJoiningStrategy = buildMappedByJoiningStrategy();
- this.joinColumnJoiningStrategy = buildJoinColumnJoiningStrategy();
- this.primaryKeyJoinColumnJoiningStrategy = buildPrimaryKeyJoinColumnJoiningStrategy();
- }
-
-
- protected JavaMappedByJoiningStrategy buildMappedByJoiningStrategy() {
- return new GenericJavaMappedByJoiningStrategy(this);
- }
-
- protected JavaJoinColumnJoiningStrategy buildJoinColumnJoiningStrategy() {
- return new GenericJavaJoinColumnJoiningStrategy(this);
- }
-
- protected JavaPrimaryKeyJoinColumnJoiningStrategy buildPrimaryKeyJoinColumnJoiningStrategy() {
- return new GenericJavaPrimaryKeyJoinColumnJoiningStrategy(this);
- }
-
- @Override
- public JavaOneToOneMapping getRelationshipMapping() {
- return (JavaOneToOneMapping) getParent();
- }
-
- public OwnableRelationshipMappingAnnotation getMappingAnnotation() {
- return getRelationshipMapping().getMappingAnnotation();
- }
-
- public boolean isRelationshipOwner() {
- return this.mappedByJoiningStrategy.getMappedByAttribute() == null;
- }
-
- public boolean isOwnedBy(RelationshipMapping mapping) {
- return this.mappedByJoiningStrategy.relationshipIsOwnedBy(mapping);
- }
-
- @Override
- protected JoiningStrategy calculatePredominantJoiningStrategy() {
- if (this.mappedByJoiningStrategy.getMappedByAttribute() != null) {
- return this.mappedByJoiningStrategy;
- }
- else if (this.primaryKeyJoinColumnJoiningStrategy.primaryKeyJoinColumnsSize() > 0) {
- return this.primaryKeyJoinColumnJoiningStrategy;
- }
- else {
- return this.joinColumnJoiningStrategy;
- }
- }
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result == null) {
- result = this.mappedByJoiningStrategy.javaCompletionProposals(pos, filter, astRoot);
- }
- if (result == null) {
- result = this.joinColumnJoiningStrategy.javaCompletionProposals(pos, filter, astRoot);
- }
- return result;
- }
-
-
- // **************** mapped by **********************************************
-
- public JavaMappedByJoiningStrategy getMappedByJoiningStrategy() {
- return this.mappedByJoiningStrategy;
- }
-
- public boolean usesMappedByJoiningStrategy() {
- return getPredominantJoiningStrategy() == this.mappedByJoiningStrategy;
- }
-
- public void setMappedByJoiningStrategy() {
- this.mappedByJoiningStrategy.addStrategy();
- this.joinColumnJoiningStrategy.removeStrategy();
- this.primaryKeyJoinColumnJoiningStrategy.removeStrategy();
- }
-
- public void unsetMappedByJoiningStrategy() {
- this.mappedByJoiningStrategy.removeStrategy();
- }
-
- public boolean mayBeMappedBy(AttributeMapping mappedByMapping) {
- return mappedByMapping.getKey() == MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
-
- // **************** join columns *******************************************
-
- public JavaJoinColumnJoiningStrategy getJoinColumnJoiningStrategy() {
- return this.joinColumnJoiningStrategy;
- }
-
- public boolean usesJoinColumnJoiningStrategy() {
- return getPredominantJoiningStrategy() == this.joinColumnJoiningStrategy;
- }
-
- public void setJoinColumnJoiningStrategy() {
- this.mappedByJoiningStrategy.removeStrategy();
- this.primaryKeyJoinColumnJoiningStrategy.removeStrategy();
- // join columns are default, so no need to add annotations
- }
-
- public void unsetJoinColumnJoiningStrategy() {
- this.joinColumnJoiningStrategy.removeStrategy();
- }
-
- public boolean mayHaveDefaultJoinColumn() {
- return this.getMappedByJoiningStrategy().getMappedByAttribute() == null
- && this.getPrimaryKeyJoinColumnJoiningStrategy().primaryKeyJoinColumnsSize() == 0;
- }
-
-
- // **************** primary key join columns *******************************
-
- public JavaPrimaryKeyJoinColumnJoiningStrategy getPrimaryKeyJoinColumnJoiningStrategy() {
- return this.primaryKeyJoinColumnJoiningStrategy;
- }
-
- public boolean usesPrimaryKeyJoinColumnJoiningStrategy() {
- return getPredominantJoiningStrategy() == this.primaryKeyJoinColumnJoiningStrategy;
- }
-
- public void setPrimaryKeyJoinColumnJoiningStrategy() {
- this.primaryKeyJoinColumnJoiningStrategy.addStrategy();
- this.mappedByJoiningStrategy.removeStrategy();
- this.joinColumnJoiningStrategy.removeStrategy();
- }
-
- public void unsetPrimaryKeyJoinColumnJoiningStrategy() {
- this.primaryKeyJoinColumnJoiningStrategy.removeStrategy();
- }
-
- public boolean mayHaveDefaultPrimaryKeyJoinColumn() {
- return false;
- }
-
-
- // **************** resource => context ************************************
-
- @Override
- protected void initializeJoiningStrategies() {
- this.mappedByJoiningStrategy.initialize();
- this.primaryKeyJoinColumnJoiningStrategy.initialize();
-
- // initialize join columns last, as the existence of a default join
- // column is dependent on the other mechanisms (mappedBy, join table)
- // not being specified
- this.joinColumnJoiningStrategy.initialize();
- }
-
- @Override
- protected void updateJoiningStrategies() {
- this.mappedByJoiningStrategy.update();
- this.primaryKeyJoinColumnJoiningStrategy.update();
-
- // update join columns last, as the existence of a default join
- // column is dependent on the other mechanisms (mappedBy, join table)
- // not being specified
- this.joinColumnJoiningStrategy.update();
- }
-
-
- // **************** Validation *********************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.mappedByJoiningStrategy.validate(messages, reporter, astRoot);
- this.primaryKeyJoinColumnJoiningStrategy.validate(messages, reporter, astRoot);
- this.joinColumnJoiningStrategy.validate(messages, reporter, astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnJoiningStrategy.java
deleted file mode 100644
index cb7fa70263..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnJoiningStrategy.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumnEnabledRelationshipReference;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumnJoiningStrategy;
-import org.eclipse.jpt.core.context.java.JavaRelationshipMapping;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-public class GenericJavaPrimaryKeyJoinColumnJoiningStrategy
- extends AbstractJavaJpaContextNode
- implements JavaPrimaryKeyJoinColumnJoiningStrategy
-{
- protected JavaResourcePersistentAttribute resourcePersistentAttribute;
-
- protected final Vector<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns = new Vector<JavaPrimaryKeyJoinColumn>();
- protected final JavaJoinColumn.Owner joinColumnOwner;
-
-
- public GenericJavaPrimaryKeyJoinColumnJoiningStrategy(
- JavaPrimaryKeyJoinColumnEnabledRelationshipReference parent) {
- super(parent);
- this.joinColumnOwner = this.buildJoinColumnOwner();
- }
-
- protected JavaJoinColumn.Owner buildJoinColumnOwner() {
- return new JoinColumnOwner();
- }
-
- @Override
- public JavaPrimaryKeyJoinColumnEnabledRelationshipReference getParent() {
- return (JavaPrimaryKeyJoinColumnEnabledRelationshipReference) super.getParent();
- }
-
- public JavaPrimaryKeyJoinColumnEnabledRelationshipReference getRelationshipReference() {
- return getParent();
- }
-
- public JavaRelationshipMapping getRelationshipMapping() {
- return this.getRelationshipReference().getRelationshipMapping();
- }
-
- public boolean isOverridableAssociation() {
- return false;
- }
-
- // **************** primary key join columns *******************************
-
- public ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
- return new CloneListIterator<JavaPrimaryKeyJoinColumn>(this.primaryKeyJoinColumns);
- }
-
- public int primaryKeyJoinColumnsSize() {
- return this.primaryKeyJoinColumns.size();
- }
-
- public boolean hasPrimaryKeyJoinColumns() {
- return ! this.primaryKeyJoinColumns.isEmpty();
- }
-
- public JavaPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(int index) {
- JavaPrimaryKeyJoinColumn pkJoinColumn =
- getJpaFactory().buildJavaPrimaryKeyJoinColumn(this, this.joinColumnOwner);
- this.primaryKeyJoinColumns.add(index, pkJoinColumn);
- PrimaryKeyJoinColumnAnnotation pkJoinColumnAnnotation = addAnnotation(index);
- pkJoinColumn.initialize(pkJoinColumnAnnotation);
- fireItemAdded(PRIMARY_KEY_JOIN_COLUMNS_LIST, index, pkJoinColumn);
- return pkJoinColumn;
- }
-
- protected void addPrimaryKeyJoinColumn(int index, JavaPrimaryKeyJoinColumn joinColumn) {
- addItemToList(index, joinColumn, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- protected void addPrimaryKeyJoinColumn(JavaPrimaryKeyJoinColumn joinColumn) {
- addPrimaryKeyJoinColumn(this.primaryKeyJoinColumns.size(), joinColumn);
- }
-
- public void removePrimaryKeyJoinColumn(PrimaryKeyJoinColumn pkJoinColumn) {
- removePrimaryKeyJoinColumn(this.primaryKeyJoinColumns.indexOf(pkJoinColumn));
- }
-
- public void removePrimaryKeyJoinColumn(int index) {
- JavaPrimaryKeyJoinColumn pkJoinColumn = this.primaryKeyJoinColumns.remove(index);
- removeAnnotation(index);
- fireItemRemoved(PRIMARY_KEY_JOIN_COLUMNS_LIST, index, pkJoinColumn);
- }
-
- protected void removePrimaryKeyJoinColumn_(JavaPrimaryKeyJoinColumn joinColumn) {
- removeItemFromList(joinColumn, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- public void movePrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.primaryKeyJoinColumns, targetIndex, sourceIndex);
- moveAnnotation(targetIndex, sourceIndex);
- fireItemMoved(PRIMARY_KEY_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
- }
-
- protected PrimaryKeyJoinColumnAnnotation addAnnotation(int index) {
- return (PrimaryKeyJoinColumnAnnotation) this.resourcePersistentAttribute.
- addAnnotation(
- index,
- PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME,
- PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- }
-
- protected void removeAnnotation(int index) {
- this.resourcePersistentAttribute.
- removeAnnotation(
- index,
- PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME,
- PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- }
-
- protected void moveAnnotation(int targetIndex, int sourceIndex) {
- this.resourcePersistentAttribute.
- moveAnnotation(
- targetIndex,
- sourceIndex,
- PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- }
-
- public void addStrategy() {
- if (primaryKeyJoinColumnsSize() == 0) {
- addPrimaryKeyJoinColumn(0);
- }
- }
-
- public void removeStrategy() {
- for (PrimaryKeyJoinColumn each : CollectionTools.iterable(primaryKeyJoinColumns())) {
- removePrimaryKeyJoinColumn(each);
- }
- }
-
-
- // **************** resource -> context ************************************
-
- public void initialize() {
- this.resourcePersistentAttribute =
- getRelationshipReference().getRelationshipMapping().
- getPersistentAttribute().getResourcePersistentAttribute();
- initializePrimaryKeyJoinColumns();
- }
-
- protected void initializePrimaryKeyJoinColumns() {
- Iterator<NestableAnnotation> annotations =
- this.resourcePersistentAttribute.annotations(
- PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME,
- PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
-
- while (annotations.hasNext()) {
- this.primaryKeyJoinColumns.add(
- buildPrimaryKeyJoinColumn(
- (PrimaryKeyJoinColumnAnnotation) annotations.next()));
- }
- }
-
- public void update() {
- this.resourcePersistentAttribute =
- getRelationshipReference().getRelationshipMapping().
- getPersistentAttribute().getResourcePersistentAttribute();
- updatePrimaryKeyJoinColumns();
- }
-
- protected void updatePrimaryKeyJoinColumns() {
- ListIterator<JavaPrimaryKeyJoinColumn> joinColumns = primaryKeyJoinColumns();
- Iterator<NestableAnnotation> annotations =
- this.resourcePersistentAttribute.annotations(
- PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME,
- PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
-
- while (joinColumns.hasNext()) {
- JavaPrimaryKeyJoinColumn joinColumn = joinColumns.next();
- if (annotations.hasNext()) {
- joinColumn.update(
- (PrimaryKeyJoinColumnAnnotation) annotations.next());
- }
- else {
- removePrimaryKeyJoinColumn_(joinColumn);
- }
- }
-
- while (annotations.hasNext()) {
- addPrimaryKeyJoinColumn(
- buildPrimaryKeyJoinColumn(
- (PrimaryKeyJoinColumnAnnotation) annotations.next()));
- }
- }
-
- protected JavaPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(
- PrimaryKeyJoinColumnAnnotation annotation) {
- JavaPrimaryKeyJoinColumn joinColumn =
- getJpaFactory().buildJavaPrimaryKeyJoinColumn(this, this.joinColumnOwner);
- joinColumn.initialize(annotation);
- return joinColumn;
- }
-
-
- // **************** Java completion proposals ******************************
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (JavaPrimaryKeyJoinColumn column : CollectionTools.iterable(this.primaryKeyJoinColumns())) {
- result = column.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
-
- // **************** validation *********************************************
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getRelationshipReference().getValidationTextRange(astRoot);
- }
-
-
- // ********** join column owner adapter **********
-
- protected class JoinColumnOwner
- implements JavaJoinColumn.Owner
- {
- protected JoinColumnOwner() {
- super();
- }
-
-
- /**
- * by default, the join column is in the type mapping's primary table
- */
- public String getDefaultTableName() {
- return getTypeMapping().getPrimaryTableName();
- }
-
- public Entity getTargetEntity() {
- return getRelationshipMapping().getResolvedTargetEntity();
- }
-
- public String getAttributeName() {
- return getRelationshipMapping().getName();
- }
-
- public RelationshipMapping getRelationshipMapping() {
- return GenericJavaPrimaryKeyJoinColumnJoiningStrategy.this.getRelationshipMapping();
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return getTypeMapping().tableNameIsInvalid(tableName);
- }
-
- /**
- * the join column can be on a secondary table
- */
- public boolean tableIsAllowed() {
- return true;
- }
-
- public TypeMapping getTypeMapping() {
- return getRelationshipMapping().getTypeMapping();
- }
-
- public Table getDbTable(String tableName) {
- return getTypeMapping().getDbTable(tableName);
- }
-
- public Table getReferencedColumnDbTable() {
- Entity targetEntity = getTargetEntity();
- return (targetEntity == null) ? null : targetEntity.getPrimaryDbTable();
- }
-
- public boolean isVirtual(BaseJoinColumn joinColumn) {
- return false;
- }
-
- public String getDefaultColumnName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return GenericJavaPrimaryKeyJoinColumnJoiningStrategy.this.getValidationTextRange(astRoot);
- }
-
- public int joinColumnsSize() {
- return GenericJavaPrimaryKeyJoinColumnJoiningStrategy.this.primaryKeyJoinColumnsSize();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMappingDefinition.java
deleted file mode 100644
index a530ad632a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMappingDefinition.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-
-public class JavaBasicMappingDefinition
- extends AbstractJavaAttributeMappingDefinition
-{
- // singleton
- private static final JavaBasicMappingDefinition INSTANCE =
- new JavaBasicMappingDefinition();
-
-
- /**
- * Return the singleton.
- */
- public static JavaAttributeMappingDefinition 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 JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) {
- return factory.buildJavaBasicMapping(parent);
- }
-
- @Override
- public boolean testDefault(JavaPersistentAttribute persistentAttribute) {
- return persistentAttribute.typeIsBasic();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddableDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddableDefinition.java
deleted file mode 100644
index 2a94eab3b8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddableDefinition.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaEmbeddable;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation;
-
-public class JavaEmbeddableDefinition
- extends AbstractJavaTypeMappingDefinition
-{
- // 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 JavaEmbeddable buildMapping(JavaPersistentType parent, JpaFactory factory) {
- return factory.buildJavaEmbeddable(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java
deleted file mode 100644
index fe78cadb6a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.EmbeddedIdAnnotation;
-
-public class JavaEmbeddedIdMappingDefinition
- extends AbstractJavaAttributeMappingDefinition
-{
- // singleton
- private static final JavaEmbeddedIdMappingDefinition 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 JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) {
- return factory.buildJavaEmbeddedIdMapping(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedMappingDefinition.java
deleted file mode 100644
index 5910a5327e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedMappingDefinition.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
-
-public class JavaEmbeddedMappingDefinition
- extends AbstractJavaAttributeMappingDefinition
-{
- // singleton
- private static final JavaEmbeddedMappingDefinition INSTANCE =
- new JavaEmbeddedMappingDefinition();
-
-
- /**
- * Return the singleton.
- */
- public static JavaAttributeMappingDefinition 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 JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) {
- return factory.buildJavaEmbeddedMapping(parent);
- }
-
- @Override
- public boolean testDefault(JavaPersistentAttribute persistentAttribute) {
- return persistentAttribute.getEmbeddable() != null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntityDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntityDefinition.java
deleted file mode 100644
index 58df102ce8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntityDefinition.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.core.resource.java.EntityAnnotation;
-
-public class JavaEntityDefinition
- extends AbstractJavaTypeMappingDefinition
-{
- // 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 JavaEntity buildMapping(JavaPersistentType parent, JpaFactory factory) {
- return factory.buildJavaEntity(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMappingDefinition.java
deleted file mode 100644
index 27f6bbe4eb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMappingDefinition.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-
-public class JavaIdMappingDefinition
- extends AbstractJavaIdMappingDefinition
-{
- // singleton
- private static final JavaIdMappingDefinition INSTANCE =
- new JavaIdMappingDefinition();
-
-
- /**
- * Return the singleton.
- */
- public static JavaAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private JavaIdMappingDefinition() {
- super();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToManyMappingDefinition.java
deleted file mode 100644
index aec9281f56..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToManyMappingDefinition.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.ManyToManyAnnotation;
-
-public class JavaManyToManyMappingDefinition
- extends AbstractJavaAttributeMappingDefinition
-{
- // singleton
- private static final JavaManyToManyMappingDefinition 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 JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) {
- return factory.buildJavaManyToManyMapping(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToOneMappingDefinition.java
deleted file mode 100644
index 905cf786e3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToOneMappingDefinition.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.ManyToOneAnnotation;
-
-public class JavaManyToOneMappingDefinition
- extends AbstractJavaAttributeMappingDefinition
-{
- // singleton
- private static final JavaManyToOneMappingDefinition 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 JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) {
- return factory.buildJavaManyToOneMapping(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclassDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclassDefinition.java
deleted file mode 100644
index d14c61cb57..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclassDefinition.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaMappedSuperclass;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.core.resource.java.MappedSuperclassAnnotation;
-
-public class JavaMappedSuperclassDefinition
- extends AbstractJavaTypeMappingDefinition
-{
- // 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 JavaMappedSuperclass buildMapping(JavaPersistentType parent, JpaFactory factory) {
- return factory.buildJavaMappedSuperclass(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullTypeMapping.java
deleted file mode 100644
index cbb5e22867..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullTypeMapping.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.List;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-
-public class JavaNullTypeMapping extends AbstractJavaTypeMapping
-{
- public JavaNullTypeMapping(JavaPersistentType parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return null;
- }
-
- public String getKey() {
- return MappingKeys.NULL_TYPE_MAPPING_KEY;
- }
-
- public boolean isMapped() {
- return false;
- }
-
- public Iterable<String> getSupportingAnnotationNames() {
- return EmptyIterable.instance();
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return false;
- }
-
- @Override
- public boolean shouldValidateAgainstDatabase() {
- return false;
- }
-
- /**
- * 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 TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getPersistentType().getValidationTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToManyMappingDefinition.java
deleted file mode 100644
index 63a93ae3c1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToManyMappingDefinition.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-
-public class JavaOneToManyMappingDefinition
- extends AbstractJavaAttributeMappingDefinition
-{
- // singleton
- private static final JavaOneToManyMappingDefinition 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 JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) {
- return factory.buildJavaOneToManyMapping(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToOneMappingDefinition.java
deleted file mode 100644
index b90bdc2787..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToOneMappingDefinition.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
-
-public class JavaOneToOneMappingDefinition
- extends AbstractJavaAttributeMappingDefinition
-{
- // singleton
- private static final JavaOneToOneMappingDefinition 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 JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) {
- return factory.buildJavaOneToOneMapping(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTransientMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTransientMappingDefinition.java
deleted file mode 100644
index 18a68cc456..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTransientMappingDefinition.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.TransientAnnotation;
-
-public class JavaTransientMappingDefinition
- extends AbstractJavaAttributeMappingDefinition
-{
- // singleton
- private static final JavaTransientMappingDefinition 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 JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) {
- return factory.buildJavaTransientMapping(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaVersionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaVersionMappingDefinition.java
deleted file mode 100644
index 6442ac664d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaVersionMappingDefinition.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.VersionAnnotation;
-
-public class JavaVersionMappingDefinition
- extends AbstractJavaAttributeMappingDefinition
-{
- // singleton
- private static final JavaVersionMappingDefinition 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 JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) {
- return factory.buildJavaVersionMapping(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAssociationOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAssociationOverrideAnnotation.java
deleted file mode 100644
index 827b7b1980..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAssociationOverrideAnnotation.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinColumnJoiningStrategy;
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-/**
- * javax.persistence.AssociationOverride
- */
-public abstract class VirtualAssociationOverrideAnnotation
- extends VirtualOverrideAnnotation
- implements AssociationOverrideAnnotation
-{
- protected JoiningStrategy joiningStrategy;
-
- private final Vector<JoinColumnAnnotation> joinColumns;
-
- protected VirtualAssociationOverrideAnnotation(JavaResourcePersistentMember parent, String name, JoiningStrategy joiningStrategy) {
- super(parent, name);
- this.joiningStrategy = joiningStrategy;
- this.joinColumns = this.buildJoinColumns();
- }
-
- protected Vector<JoinColumnAnnotation> buildJoinColumns() {
- if (this.joiningStrategy instanceof JoinColumnJoiningStrategy) {
- Vector<JoinColumnAnnotation> result = new Vector<JoinColumnAnnotation>(((JoinColumnJoiningStrategy) this.joiningStrategy).joinColumnsSize());
- for (JoinColumn joinColumn : CollectionTools.iterable(((JoinColumnJoiningStrategy) this.joiningStrategy).joinColumns())) {
- result.add(new VirtualAssociationOverrideJoinColumnAnnotation(this, joinColumn));
- }
- return result;
- }
- return new Vector<JoinColumnAnnotation>();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- protected AssociationOverrideAnnotation addAnnotation() {
- return (AssociationOverrideAnnotation) super.addAnnotation();
- }
-
- // ***** join columns
- public ListIterator<JoinColumnAnnotation> joinColumns() {
- return this.joinColumns.listIterator();
- }
-
- public JoinColumnAnnotation joinColumnAt(int index) {
- return this.joinColumns.elementAt(index);
- }
-
- public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
- return this.joinColumns.indexOf(joinColumn);
- }
-
- public int joinColumnsSize() {
- return this.joinColumns.size();
- }
-
- public JoinColumnAnnotation addJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- public void removeJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- public void moveJoinColumn(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
- //Rebuilt every time so no need to implement update()
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAssociationOverrideJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAssociationOverrideJoinColumnAnnotation.java
deleted file mode 100644
index b782216bfb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAssociationOverrideJoinColumnAnnotation.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.internal.resource.java.NullBaseColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.Column
- */
-public final class VirtualAssociationOverrideJoinColumnAnnotation extends NullBaseColumnAnnotation
- implements JoinColumnAnnotation
-{
- private JoinColumn joinColumn;
-
- public VirtualAssociationOverrideJoinColumnAnnotation(Annotation parent, JoinColumn joinColumn) {
- super(parent);
- this.joinColumn = joinColumn;
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- protected JoinColumnAnnotation addAnnotation() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getName() {
- return this.joinColumn.getSpecifiedName();
- }
-
- @Override
- public void setName(String name) {
- throw new UnsupportedOperationException();
- }
-
- public String getReferencedColumnName() {
- return this.joinColumn.getSpecifiedReferencedColumnName();
- }
-
- public void setReferencedColumnName(String referencedColumnName) {
- throw new UnsupportedOperationException();
- }
-
- public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
- return false;
- }
-
- @Override
- public String getColumnDefinition() {
- return this.joinColumn.getColumnDefinition();
- }
-
- @Override
- public void setColumnDefinition(String columnDefinition) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getTable() {
- return this.joinColumn.getSpecifiedTable();
- }
-
- @Override
- public void setTable(String table) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Boolean getInsertable() {
- return this.joinColumn.getSpecifiedInsertable();
- }
-
- @Override
- public void setInsertable(Boolean insertable) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Boolean getUpdatable() {
- return this.joinColumn.getSpecifiedUpdatable();
- }
-
- @Override
- public void setUpdatable(Boolean updatable) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Boolean getNullable() {
- return this.joinColumn.getSpecifiedNullable();
- }
-
- @Override
- public void setNullable(Boolean nullable) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Boolean getUnique() {
- return this.joinColumn.getSpecifiedUnique();
- }
-
- @Override
- public void setUnique(Boolean unique) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAttributeOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAttributeOverrideAnnotation.java
deleted file mode 100644
index 25e71fa18e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAttributeOverrideAnnotation.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-
-/**
- * javax.persistence.AssociationOverride
- */
-public class VirtualAttributeOverrideAnnotation
- extends VirtualOverrideAnnotation
- implements AttributeOverrideAnnotation
-{
- private final VirtualAttributeOverrideColumnAnnotation column;
-
-
- public VirtualAttributeOverrideAnnotation(JavaResourcePersistentMember parent, String name, Column column) {
- super(parent, name);
- this.column = new VirtualAttributeOverrideColumnAnnotation(this, column);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- protected AttributeOverrideAnnotation addAnnotation() {
- return (AttributeOverrideAnnotation) super.addAnnotation();
- }
-
- // ****** column
- public ColumnAnnotation getColumn() {
- return this.column;
- }
-
- public ColumnAnnotation getNonNullColumn() {
- return this.getColumn();
- }
-
- public ColumnAnnotation addColumn() {
- throw new UnsupportedOperationException();
- }
-
- public void removeColumn() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAttributeOverrideColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAttributeOverrideColumnAnnotation.java
deleted file mode 100644
index 89ebcab07c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualAttributeOverrideColumnAnnotation.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.internal.resource.java.NullAttributeOverrideColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-
-/**
- * javax.persistence.Column
- */
-public class VirtualAttributeOverrideColumnAnnotation
- extends NullAttributeOverrideColumnAnnotation
-{
- private Column column;
-
- public VirtualAttributeOverrideColumnAnnotation(AttributeOverrideAnnotation parent, Column column) {
- super(parent);
- this.column = column;
- }
-
- @Override
- public String getName() {
- return this.column.getSpecifiedName();
- }
-
- @Override
- public String getColumnDefinition() {
- return this.column.getColumnDefinition();
- }
-
- @Override
- public String getTable() {
- return this.column.getSpecifiedTable();
- }
-
- @Override
- public Boolean getInsertable() {
- return this.column.getSpecifiedInsertable();
- }
-
- @Override
- public Boolean getUpdatable() {
- return this.column.getSpecifiedUpdatable();
- }
-
- @Override
- public Boolean getNullable() {
- return this.column.getSpecifiedNullable();
- }
-
- @Override
- public Boolean getUnique() {
- return this.column.getSpecifiedUnique();
- }
-
- @Override
- public Integer getLength() {
- return this.column.getSpecifiedLength();
- }
-
- @Override
- public Integer getScale() {
- return this.column.getSpecifiedScale();
- }
-
- @Override
- public Integer getPrecision() {
- return this.column.getSpecifiedPrecision();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualOverrideAnnotation.java
deleted file mode 100644
index 01f16152ed..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/VirtualOverrideAnnotation.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.NullAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.OverrideAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * Common behavior for virtual versions of
- * javax.persistence.AttributeOverride
- * and
- * javax.persistence.AssociationOverride
- */
-public abstract class VirtualOverrideAnnotation
- extends NullAnnotation
- implements OverrideAnnotation
-{
- private final String name;
-
- public VirtualOverrideAnnotation(JavaResourcePersistentMember parent, String name) {
- super(parent);
- this.name = name;
- }
-
- @Override
- protected OverrideAnnotation addAnnotation() {
- return (OverrideAnnotation) super.addAnnotation();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- 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;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractEntityMappings.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractEntityMappings.java
deleted file mode 100644
index 34491b03b2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractEntityMappings.java
+++ /dev/null
@@ -1,786 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.Generator;
-import org.eclipse.jpt.core.context.MappingFileRoot;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.orm.EntityMappings;
-import org.eclipse.jpt.core.context.orm.OrmGenerator;
-import org.eclipse.jpt.core.context.orm.OrmPersistenceUnitDefaults;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmQueryContainer;
-import org.eclipse.jpt.core.context.orm.OrmSequenceGenerator;
-import org.eclipse.jpt.core.context.orm.OrmStructureNodes;
-import org.eclipse.jpt.core.context.orm.OrmTableGenerator;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmXml;
-import org.eclipse.jpt.core.context.orm.PersistenceUnitMetadata;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.core.resource.orm.XmlSequenceGenerator;
-import org.eclipse.jpt.core.resource.orm.XmlTableGenerator;
-import org.eclipse.jpt.core.resource.orm.XmlTypeMapping;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.SchemaContainer;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractEntityMappings
- extends AbstractOrmXmlContextNode
- implements EntityMappings
-{
- protected final XmlEntityMappings xmlEntityMappings;
-
- protected String description;
-
- protected String package_;
-
- protected AccessType specifiedAccess;
- protected AccessType defaultAccess;
-
- protected String specifiedCatalog;
- protected String defaultCatalog;
-
- protected String specifiedSchema;
- protected String defaultSchema;
-
- protected /*final*/ PersistenceUnitMetadata persistenceUnitMetadata;
-
- protected final List<OrmPersistentType> persistentTypes;
-
- protected final List<OrmSequenceGenerator> sequenceGenerators;
-
- protected final List<OrmTableGenerator> tableGenerators;
-
- protected final OrmQueryContainer queryContainer;
-
-
- protected AbstractEntityMappings(OrmXml parent, XmlEntityMappings xmlEntityMappings) {
- super(parent);
- this.xmlEntityMappings = xmlEntityMappings;
- this.persistentTypes = new ArrayList<OrmPersistentType>();
- this.sequenceGenerators = new ArrayList<OrmSequenceGenerator>();
- this.tableGenerators = new ArrayList<OrmTableGenerator>();
- this.queryContainer = getXmlContextNodeFactory().buildOrmQueryContainer(this, xmlEntityMappings);
-
- this.persistenceUnitMetadata = buildPersistenceUnitMetadata();
- this.description = this.xmlEntityMappings.getDescription();
- this.package_ = this.xmlEntityMappings.getPackage();
-
- this.defaultAccess = this.getPersistenceUnit().getDefaultAccess();
- this.specifiedAccess = this.getResourceAccess();
-
- this.defaultCatalog = this.getPersistenceUnit().getDefaultCatalog();
- this.specifiedCatalog = this.xmlEntityMappings.getCatalog();
-
- this.defaultSchema = this.getPersistenceUnit().getDefaultSchema();
- this.specifiedSchema = this.xmlEntityMappings.getSchema();
-
- this.initializePersistentTypes();
- this.initializeTableGenerators();
- this.initializeSequenceGenerators();
- }
-
- protected PersistenceUnitMetadata buildPersistenceUnitMetadata() {
- return getXmlContextNodeFactory().buildPersistenceUnitMetadata(this, this.xmlEntityMappings);
- }
-
- protected OrmPersistentType buildPersistentType(XmlTypeMapping resourceMapping) {
- return getXmlContextNodeFactory().buildOrmPersistentType(this, resourceMapping);
- }
-
- // **************** JpaNode impl *******************************************
-
- @Override
- public OrmXml getParent() {
- return (OrmXml) super.getParent();
- }
-
- protected OrmXml getOrmXml() {
- return this.getParent();
- }
-
-
- // **************** JpaContextNode impl ************************************
-
- @Override
- public MappingFileRoot getMappingFileRoot() {
- return this;
- }
-
-
- // **************** JpaStructureNode impl **********************************
-
- public String getId() {
- return OrmStructureNodes.ENTITY_MAPPINGS_ID;
- }
-
-
- // ********** PersistentType.Owner implementation **********
-
- public AccessType getOverridePersistentTypeAccess() {
- return this.isXmlMappingMetadataComplete() ? this.getSpecifiedAccess() : null;
- }
-
- public AccessType getDefaultPersistentTypeAccess() {
- return getAccess();
- }
-
- public String getDefaultPersistentTypePackage() {
- return getPackage();
- }
-
- protected boolean isXmlMappingMetadataComplete() {
- return this.getPersistenceUnitMetadata().isXmlMappingMetadataComplete();
- }
-
- public boolean isDefaultPersistentTypeMetadataComplete() {
- return this.isXmlMappingMetadataComplete();
- }
-
-
- // **************** EntityMappings impl ************************************
-
- public XmlEntityMappings getXmlEntityMappings() {
- return this.xmlEntityMappings;
- }
-
- public void changeMapping(OrmPersistentType ormPersistentType, OrmTypeMapping oldMapping, OrmTypeMapping newMapping) {
- AccessType savedAccess = ormPersistentType.getSpecifiedAccess();
- ormPersistentType.dispose();
- int sourceIndex = this.persistentTypes.indexOf(ormPersistentType);
- this.persistentTypes.remove(sourceIndex);
- oldMapping.removeFromResourceModel(this.xmlEntityMappings);
- int targetIndex = insertionIndex(ormPersistentType);
- this.persistentTypes.add(targetIndex, ormPersistentType);
- newMapping.addToResourceModel(this.xmlEntityMappings);
-
- newMapping.initializeFrom(oldMapping);
- //not sure where else to put this, need to set the access on the resource model
- ormPersistentType.setSpecifiedAccess(savedAccess);
- fireItemMoved(PERSISTENT_TYPES_LIST, targetIndex, sourceIndex);
- }
-
- public OrmPersistentType getPersistentType(String fullyQualifiedTypeName) {
- for (OrmPersistentType ormPersistentType : this.getPersistentTypes()) {
- if (ormPersistentType.isFor(fullyQualifiedTypeName)) {
- return ormPersistentType;
- }
- }
- return null;
- }
-
- public PersistenceUnitMetadata getPersistenceUnitMetadata() {
- return this.persistenceUnitMetadata;
- }
-
- public String getPackage() {
- return this.package_;
- }
-
- public void setPackage(String newPackage) {
- String oldPackage = this.package_;
- this.package_ = newPackage;
- this.xmlEntityMappings.setPackage(newPackage);
- firePropertyChanged(PACKAGE_PROPERTY, oldPackage, newPackage);
- }
-
- public String getVersion() {
- return this.xmlEntityMappings.getVersion();
- }
-
- public String getDescription() {
- return this.description;
- }
-
- public void setDescription(String newDescription) {
- String oldDescription = this.description;
- this.description = newDescription;
- this.xmlEntityMappings.setDescription(newDescription);
- firePropertyChanged(DESCRIPTION_PROPERTY, oldDescription, newDescription);
- }
-
-
- // ********** access **********
-
- public AccessType getAccess() {
- return (this.specifiedAccess != null) ? this.specifiedAccess : this.defaultAccess;
- }
-
- public AccessType getSpecifiedAccess() {
- return this.specifiedAccess;
- }
-
- public void setSpecifiedAccess(AccessType access) {
- AccessType old = this.specifiedAccess;
- this.specifiedAccess = access;
- this.xmlEntityMappings.setAccess(AccessType.toOrmResourceModel(access));
- this.firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, old, access);
- }
-
- 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);
- }
-
-
- // ********** schema **********
-
- public String getSchema() {
- return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema;
- }
-
- public String getSpecifiedSchema() {
- return this.specifiedSchema;
- }
-
- public void setSpecifiedSchema(String schema) {
- String old = this.specifiedSchema;
- this.specifiedSchema = schema;
- this.xmlEntityMappings.setSchema(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);
- }
-
- public Schema getDbSchema() {
- SchemaContainer dbSchemaContainer = this.getDbSchemaContainer();
- return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema());
- }
-
-
- // ********** catalog **********
-
- public String getCatalog() {
- return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog;
- }
-
- public String getSpecifiedCatalog() {
- return this.specifiedCatalog;
- }
-
- public void setSpecifiedCatalog(String catalog) {
- String old = this.specifiedCatalog;
- this.specifiedCatalog = catalog;
- this.xmlEntityMappings.setCatalog(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);
- }
-
- /**
- * 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.getDbCatalog(catalog);
- }
-
-
- // ********** 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.getDbCatalog(catalog) : this.getDatabase();
- }
-
-
- // ********** ORM persistent types **********
-
- public ListIterator<OrmPersistentType> persistentTypes() {
- return new CloneListIterator<OrmPersistentType>(this.persistentTypes);
- }
-
- public Iterable<OrmPersistentType> getPersistentTypes() {
- return new LiveCloneIterable<OrmPersistentType>(this.persistentTypes);
- }
-
- public int persistentTypesSize() {
- return this.persistentTypes.size();
- }
-
- public OrmPersistentType addPersistentType(String mappingKey, String className) {
- OrmTypeMappingDefinition mappingDefinition =
- getMappingFileDefinition().getOrmTypeMappingDefinition(mappingKey);
- XmlTypeMapping typeMapping =
- mappingDefinition.buildResourceMapping(getResourceNodeFactory());
- OrmPersistentType persistentType = buildPersistentType(typeMapping);
- int index = insertionIndex(persistentType);
- this.persistentTypes.add(index, persistentType);
- if (className.startsWith(getPackage() + '.')) {
- // adds short name if package name is specified
- className = className.substring(getPackage().length() + 1);
- }
- persistentType.getMapping().addToResourceModel(this.xmlEntityMappings);
- typeMapping.setClassName(className);
- fireItemAdded(PERSISTENT_TYPES_LIST, index, persistentType);
- return persistentType;
- }
-
- protected int insertionIndex(OrmPersistentType ormPersistentType) {
- return CollectionTools.insertionIndexOf(
- this.persistentTypes, ormPersistentType, buildMappingComparator());
- }
-
- private Comparator<OrmPersistentType> buildMappingComparator() {
- return 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.persistentTypes.get(index);
- persistentType.dispose();
- this.persistentTypes.remove(index);
- persistentType.getMapping().removeFromResourceModel(this.xmlEntityMappings);
- fireItemRemoved(PERSISTENT_TYPES_LIST, index, persistentType);
- }
-
- public void removePersistentType(OrmPersistentType persistentType) {
- removePersistentType(this.persistentTypes.indexOf(persistentType));
- }
-
- protected void removePersistentType_(OrmPersistentType persistentType) {
- persistentType.dispose();
- removeItemFromList(persistentType, this.persistentTypes, PERSISTENT_TYPES_LIST);
- }
-
- protected void movePersistentType_(int index, OrmPersistentType persistentType) {
- moveItemInList(index, this.persistentTypes.indexOf(persistentType), this.persistentTypes, PERSISTENT_TYPES_LIST);
- }
-
-
- // ********** sequence generators **********
-
- public ListIterator<OrmSequenceGenerator> sequenceGenerators() {
- return new CloneListIterator<OrmSequenceGenerator>(this.sequenceGenerators);
- }
-
- public int sequenceGeneratorsSize() {
- return this.sequenceGenerators.size();
- }
-
- public OrmSequenceGenerator addSequenceGenerator(int index) {
- XmlSequenceGenerator resourceSequenceGenerator = this.buildResourceSequenceGenerator();
- OrmSequenceGenerator contextSequenceGenerator = this.buildSequenceGenerator(resourceSequenceGenerator);
- this.sequenceGenerators.add(index, contextSequenceGenerator);
- this.xmlEntityMappings.getSequenceGenerators().add(index, resourceSequenceGenerator);
- fireItemAdded(SEQUENCE_GENERATORS_LIST, index, contextSequenceGenerator);
- return contextSequenceGenerator;
- }
-
- protected void addSequenceGenerator(int index, OrmSequenceGenerator sequenceGenerator) {
- addItemToList(index, sequenceGenerator, this.sequenceGenerators, EntityMappings.SEQUENCE_GENERATORS_LIST);
- }
-
- protected void addSequenceGenerator(OrmSequenceGenerator sequenceGenerator) {
- this.addSequenceGenerator(this.sequenceGenerators.size(), sequenceGenerator);
- }
-
- public void removeSequenceGenerator(OrmSequenceGenerator sequenceGenerator) {
- removeSequenceGenerator(this.sequenceGenerators.indexOf(sequenceGenerator));
- }
-
- public void removeSequenceGenerator(int index) {
- OrmSequenceGenerator removedSequenceGenerator = this.sequenceGenerators.remove(index);
- fireItemRemoved(SEQUENCE_GENERATORS_LIST, index, removedSequenceGenerator);
- this.xmlEntityMappings.getSequenceGenerators().remove(index);
- }
-
- protected void removeSequenceGenerator_(OrmSequenceGenerator sequenceGenerator) {
- removeItemFromList(sequenceGenerator, this.sequenceGenerators, EntityMappings.SEQUENCE_GENERATORS_LIST);
- }
-
- public void moveSequenceGenerator(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.sequenceGenerators, targetIndex, sourceIndex);
- this.xmlEntityMappings.getSequenceGenerators().move(targetIndex, sourceIndex);
- fireItemMoved(EntityMappings.SEQUENCE_GENERATORS_LIST, targetIndex, sourceIndex);
- }
-
- protected XmlSequenceGenerator buildResourceSequenceGenerator() {
- return OrmFactory.eINSTANCE.createXmlSequenceGenerator();
- }
-
- // ********** table generators **********
-
- public ListIterator<OrmTableGenerator> tableGenerators() {
- return new CloneListIterator<OrmTableGenerator>(this.tableGenerators);
- }
-
- public int tableGeneratorsSize() {
- return this.tableGenerators.size();
- }
-
- public OrmTableGenerator addTableGenerator(int index) {
- XmlTableGenerator resourceTableGenerator = buildResourceTableGenerator();
- OrmTableGenerator contextTableGenerator = buildTableGenerator(resourceTableGenerator);
- this.tableGenerators.add(index, contextTableGenerator);
- this.xmlEntityMappings.getTableGenerators().add(index, resourceTableGenerator);
- fireItemAdded(TABLE_GENERATORS_LIST, index, contextTableGenerator);
- return contextTableGenerator;
- }
-
- protected void addTableGenerator(int index, OrmTableGenerator tableGenerator) {
- addItemToList(index, tableGenerator, this.tableGenerators, EntityMappings.TABLE_GENERATORS_LIST);
- }
-
- protected void addTableGenerator(OrmTableGenerator tableGenerator) {
- this.addTableGenerator(this.tableGenerators.size(), tableGenerator);
- }
-
- public void removeTableGenerator(OrmTableGenerator tableGenerator) {
- removeTableGenerator(this.tableGenerators.indexOf(tableGenerator));
- }
-
- public void removeTableGenerator(int index) {
- OrmTableGenerator removedTableGenerator = this.tableGenerators.remove(index);
- this.xmlEntityMappings.getTableGenerators().remove(index);
- fireItemRemoved(TABLE_GENERATORS_LIST, index, removedTableGenerator);
- }
-
- protected void removeTableGenerator_(OrmTableGenerator tableGenerator) {
- removeItemFromList(tableGenerator, this.tableGenerators, EntityMappings.TABLE_GENERATORS_LIST);
- }
-
- public void moveTableGenerator(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.tableGenerators, targetIndex, sourceIndex);
- this.xmlEntityMappings.getTableGenerators().move(targetIndex, sourceIndex);
- fireItemMoved(EntityMappings.TABLE_GENERATORS_LIST, targetIndex, sourceIndex);
- }
-
- protected XmlTableGenerator buildResourceTableGenerator() {
- return OrmFactory.eINSTANCE.createXmlTableGenerator();
- }
-
-
- // ********** named queries **********
- public OrmQueryContainer getQueryContainer() {
- return this.queryContainer;
- }
-
-
- // ********** misc **********
-
- //TODO what about qualified name? package + class
- //this needs to be handled both for className and persistentType.getName().
- //moving on for now since I am just trying to get the ui compiled! just a warning that this isn't good api
- public boolean containsPersistentType(String className) {
- for (OrmPersistentType persistentType : this.getPersistentTypes()) {
- if (persistentType.getName().equals(className)) {
- return true;
- }
- }
- return false;
- }
-
- public OrmPersistenceUnitDefaults getPersistenceUnitDefaults() {
- return getPersistenceUnitMetadata().getPersistenceUnitDefaults();
- }
-
-
- // ********** initialization **********
-
- protected void initializePersistentTypes() {
- for (XmlTypeMapping typeMapping : this.xmlEntityMappings.getTypeMappings()) {
- addPersistentType(typeMapping);
- }
- }
-
- protected void initializeTableGenerators() {
- for (XmlTableGenerator tableGenerator : this.xmlEntityMappings.getTableGenerators()) {
- this.tableGenerators.add(buildTableGenerator(tableGenerator));
- }
- }
-
- protected void initializeSequenceGenerators() {
- for (XmlSequenceGenerator sequenceGenerator : this.xmlEntityMappings.getSequenceGenerators()) {
- this.sequenceGenerators.add(buildSequenceGenerator(sequenceGenerator));
- }
- }
-
-
- // ********** update **********
-
- public void update() {
- this.setDescription(this.xmlEntityMappings.getDescription());
- this.setPackage(this.xmlEntityMappings.getPackage());
-
- this.setDefaultAccess(this.getPersistenceUnit().getDefaultAccess());
- this.setSpecifiedAccess(this.getResourceAccess());
-
- this.setDefaultCatalog(this.getPersistenceUnit().getDefaultCatalog());
- this.setSpecifiedCatalog(this.xmlEntityMappings.getCatalog());
-
- this.setDefaultSchema(this.getPersistenceUnit().getDefaultSchema());
- this.setSpecifiedSchema(this.xmlEntityMappings.getSchema());
-
- this.persistenceUnitMetadata.update();
- this.updatePersistentTypes();
- this.updateTableGenerators();
- this.updateSequenceGenerators();
- getQueryContainer().update();
- }
-
- protected AccessType getResourceAccess() {
- return AccessType.fromOrmResourceModel(this.xmlEntityMappings.getAccess());
- }
-
- protected void updatePersistentTypes() {
- Collection<OrmPersistentType> contextTypesToRemove = CollectionTools.collection(persistentTypes());
- Collection<OrmPersistentType> contextTypesToUpdate = new ArrayList<OrmPersistentType>();
- int resourceIndex = 0;
-
- List<XmlTypeMapping> xmlTypeMappings = this.xmlEntityMappings.getTypeMappings();
- for (XmlTypeMapping xmlTypeMapping : xmlTypeMappings.toArray(new XmlTypeMapping[xmlTypeMappings.size()])) {
- boolean contextAttributeFound = false;
- for (OrmPersistentType contextType : contextTypesToRemove) {
- if (contextType.getMapping().getResourceTypeMapping() == xmlTypeMapping) {
- movePersistentType_(resourceIndex, contextType);
- contextTypesToRemove.remove(contextType);
- contextTypesToUpdate.add(contextType);
- contextAttributeFound = true;
- break;
- }
- }
- if (!contextAttributeFound) {
- OrmPersistentType ormPersistentType = addPersistentType(xmlTypeMapping);
- fireItemAdded(PERSISTENT_TYPES_LIST, persistentTypesSize(), ormPersistentType);
- }
- resourceIndex++;
- }
- for (OrmPersistentType contextType : contextTypesToRemove) {
- removePersistentType_(contextType);
- }
- //first handle adding/removing of the persistent types, then update the others last,
- //this causes less churn in the update process
- for (OrmPersistentType contextType : contextTypesToUpdate) {
- contextType.update();
- }
- }
-
- //not firing change notification so this can be reused in initialize and update
- protected OrmPersistentType addPersistentType(XmlTypeMapping resourceMapping) {
- OrmPersistentType ormPersistentType = buildPersistentType(resourceMapping);
- this.persistentTypes.add(ormPersistentType);
- return ormPersistentType;
- }
-
- protected void updateTableGenerators() {
- // make a copy of the XML generators (to prevent ConcurrentModificationException)
- Iterator<XmlTableGenerator> xmlGenerators = new CloneIterator<XmlTableGenerator>(this.xmlEntityMappings.getTableGenerators());
-
- for (Iterator<OrmTableGenerator> contextGenerators = this.tableGenerators(); contextGenerators.hasNext(); ) {
- OrmTableGenerator contextGenerator = contextGenerators.next();
- if (xmlGenerators.hasNext()) {
- contextGenerator.update(xmlGenerators.next());
- }
- else {
- removeTableGenerator_(contextGenerator);
- }
- }
-
- while (xmlGenerators.hasNext()) {
- addTableGenerator(buildTableGenerator(xmlGenerators.next()));
- }
- }
-
- protected OrmTableGenerator buildTableGenerator(XmlTableGenerator resourceTableGenerator) {
- return getXmlContextNodeFactory().buildOrmTableGenerator(this, resourceTableGenerator);
- }
-
- protected void updateSequenceGenerators() {
- // make a copy of the XML sequence generators (to prevent ConcurrentModificationException)
- Iterator<XmlSequenceGenerator> xmlSequenceGenerators = new CloneIterator<XmlSequenceGenerator>(this.xmlEntityMappings.getSequenceGenerators());//prevent ConcurrentModificiationException
-
- for (Iterator<OrmSequenceGenerator> contextSequenceGenerators = this.sequenceGenerators(); contextSequenceGenerators.hasNext(); ) {
- OrmSequenceGenerator contextSequenceGenerator = contextSequenceGenerators.next();
- if (xmlSequenceGenerators.hasNext()) {
- contextSequenceGenerator.update(xmlSequenceGenerators.next());
- }
- else {
- removeSequenceGenerator_(contextSequenceGenerator);
- }
- }
-
- while (xmlSequenceGenerators.hasNext()) {
- addSequenceGenerator(buildSequenceGenerator(xmlSequenceGenerators.next()));
- }
- }
-
- protected OrmSequenceGenerator buildSequenceGenerator(XmlSequenceGenerator resourceSequenceGenerator) {
- return getXmlContextNodeFactory().buildOrmSequenceGenerator(this, resourceSequenceGenerator);
- }
-
- @Override
- public void postUpdate() {
- super.postUpdate();
- for (PersistentType persistentType : this.getPersistentTypes()) {
- persistentType.postUpdate();
- }
- }
-
- // ********** text **********
-
- public JpaStructureNode getStructureNode(int textOffset) {
- for (OrmPersistentType persistentType: this.getPersistentTypes()) {
- if (persistentType.contains(textOffset)) {
- return persistentType.getStructureNode(textOffset);
- }
- }
- return this;
- }
-
- public boolean containsOffset(int textOffset) {
- return (this.xmlEntityMappings != null) && this.xmlEntityMappings.containsOffset(textOffset);
- }
-
- public TextRange getSelectionTextRange() {
- return this.xmlEntityMappings.getSelectionTextRange();
- }
-
- public TextRange getValidationTextRange() {
- return null;
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.validateVersion(messages);
- this.validateGenerators(messages);
- this.queryContainer.validate(messages, reporter);
- for (OrmPersistentType ormPersistentType : this.getPersistentTypes()) {
- this.validatePersistentType(ormPersistentType, messages, reporter);
- }
- }
-
- protected void validateVersion(List<IMessage> messages) {
- if (! latestDocumentVersion().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 abstract String latestDocumentVersion();
-
- protected void validateGenerators(List<IMessage> messages) {
- for (Iterator<OrmGenerator> localGenerators = this.generators(); localGenerators.hasNext(); ) {
- OrmGenerator localGenerator = localGenerators.next();
- for (Iterator<Generator> globalGenerators = this.getPersistenceUnit().generators(); globalGenerators.hasNext(); ) {
- if (localGenerator.duplicates(globalGenerators.next())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.GENERATOR_DUPLICATE_NAME,
- new String[] {localGenerator.getName()},
- localGenerator,
- localGenerator.getNameTextRange()
- )
- );
- }
- }
- }
- }
-
- /**
- * Return all the generators, table and sequence.
- */
- @SuppressWarnings("unchecked")
- public Iterator<OrmGenerator> generators() {
- return new CompositeIterator<OrmGenerator>(
- this.tableGenerators(),
- this.sequenceGenerators()
- );
- }
-
-
- protected void validatePersistentType(OrmPersistentType persistentType, List<IMessage> messages, IReporter reporter) {
- try {
- persistentType.validate(messages, reporter);
- } catch (Throwable exception) {
- JptCorePlugin.log(exception);
- }
- }
-
-
- // ********** dispose **********
-
- public void dispose() {
- for (OrmPersistentType ormPersistentType : this.getPersistentTypes()) {
- ormPersistentType.dispose();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmAssociationOverrideRelationshipReference.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmAssociationOverrideRelationshipReference.java
deleted file mode 100644
index 98c62d11d7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmAssociationOverrideRelationshipReference.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.AssociationOverrideRelationshipReference;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumnInAssociationOverrideJoiningStrategy;
-import org.eclipse.jpt.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public abstract class AbstractOrmAssociationOverrideRelationshipReference extends AbstractOrmXmlContextNode
- implements OrmAssociationOverrideRelationshipReference
-{
-
- // cache the strategy for property change notification
- protected JoiningStrategy cachedPredominantJoiningStrategy;
-
- protected OrmJoinColumnInAssociationOverrideJoiningStrategy joinColumnJoiningStrategy;
-
- protected AbstractOrmAssociationOverrideRelationshipReference(OrmAssociationOverride parent, XmlAssociationOverride xao) {
- super(parent);
- this.initializeJoiningStrategies(xao);
- }
-
- protected OrmJoinColumnInAssociationOverrideJoiningStrategy buildJoinColumnJoiningStrategy(XmlAssociationOverride xao) {
- return new GenericOrmJoinColumnInAssociationOverrideJoiningStrategy(this, xao);
- }
-
- public void initializeFrom(AssociationOverrideRelationshipReference oldAssociationOverride) {
- if (oldAssociationOverride.getJoinColumnJoiningStrategy().hasSpecifiedJoinColumns()) {
- getJoinColumnJoiningStrategy().initializeFrom(oldAssociationOverride.getJoinColumnJoiningStrategy());
- }
- }
-
- @Override
- public OrmAssociationOverride getParent() {
- return (OrmAssociationOverride) super.getParent();
- }
-
- public OrmAssociationOverride getAssociationOverride() {
- return getParent();
- }
-
- public TypeMapping getTypeMapping() {
- return getAssociationOverride().getOwner().getTypeMapping();
- }
-
- public Entity getEntity() {
- TypeMapping typeMapping = getTypeMapping();
- return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
- }
-
- public boolean isOverridableAssociation() {
- return false;
- }
-
- public boolean isParentVirtual() {
- return getAssociationOverride().isVirtual();
- }
-
- // **************** predominant joining strategy ***************************
-
- public JoiningStrategy getPredominantJoiningStrategy() {
- return this.cachedPredominantJoiningStrategy;
- }
-
- protected void setPredominantJoiningStrategy(JoiningStrategy newJoiningStrategy) {
- JoiningStrategy oldJoiningStrategy = this.cachedPredominantJoiningStrategy;
- this.cachedPredominantJoiningStrategy = newJoiningStrategy;
- firePropertyChanged(PREDOMINANT_JOINING_STRATEGY_PROPERTY, oldJoiningStrategy, newJoiningStrategy);
- }
-
- protected void initialize(XmlAssociationOverride associationOverride) {
- initializeJoiningStrategies(associationOverride);
- this.cachedPredominantJoiningStrategy = calculatePredominantJoiningStrategy();
- }
-
- protected void initializeJoiningStrategies(XmlAssociationOverride xao) {
- this.joinColumnJoiningStrategy = buildJoinColumnJoiningStrategy(xao);
- }
-
- public void update(XmlAssociationOverride associationOverride) {
- updateJoiningStrategies(associationOverride);
- setPredominantJoiningStrategy(calculatePredominantJoiningStrategy());
- }
-
- protected void updateJoiningStrategies(XmlAssociationOverride associationOverride) {
- this.joinColumnJoiningStrategy.update(associationOverride);
- }
-
- protected abstract JoiningStrategy calculatePredominantJoiningStrategy();
-
- // **************** join columns *******************************************
-
-
- public OrmJoinColumnInAssociationOverrideJoiningStrategy getJoinColumnJoiningStrategy() {
- return this.joinColumnJoiningStrategy;
- }
-
- public boolean usesJoinColumnJoiningStrategy() {
- return getPredominantJoiningStrategy() == this.joinColumnJoiningStrategy;
- }
-
- public void setJoinColumnJoiningStrategy() {
- this.joinColumnJoiningStrategy.addStrategy();
- }
-
- public void unsetJoinColumnJoiningStrategy() {
- this.joinColumnJoiningStrategy.removeStrategy();
- }
-
- public boolean mayHaveDefaultJoinColumn() {
- return false;
- }
-
- public RelationshipMapping getRelationshipMapping() {
- return getAssociationOverride().getOwner().getRelationshipMapping(getAssociationOverride().getName());
- }
-
- public boolean isOwnedBy(RelationshipMapping mapping) {
- return getRelationshipMapping().isOwnedBy(mapping);
- }
-
- public boolean isRelationshipOwner() {
- return getRelationshipMapping().isRelationshipOwner();
- }
-
- // ********** validation **********
-
-
- public TextRange getValidationTextRange() {
- return getAssociationOverride().getValidationTextRange();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmAttributeMapping.java
deleted file mode 100644
index 1eeb6a1e72..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmAttributeMapping.java
+++ /dev/null
@@ -1,373 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.ColumnMapping;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.RelationshipReference;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmBaseEmbeddedMapping;
-import org.eclipse.jpt.core.context.orm.OrmBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmColumnMapping;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddedIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddedMapping;
-import org.eclipse.jpt.core.context.orm.OrmIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmManyToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmManyToOneMapping;
-import org.eclipse.jpt.core.context.orm.OrmMultiRelationshipMapping;
-import org.eclipse.jpt.core.context.orm.OrmOneToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmOneToOneMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipMapping;
-import org.eclipse.jpt.core.context.orm.OrmSingleRelationshipMapping;
-import org.eclipse.jpt.core.context.orm.OrmTransientMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmVersionMapping;
-import org.eclipse.jpt.core.internal.jpa2.context.SimpleMetamodelField;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.AttributeMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.jpa2.context.java.JavaPersistentAttribute2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.SingleElementIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractOrmAttributeMapping<T extends XmlAttributeMapping>
- extends AbstractOrmXmlContextNode
- implements OrmAttributeMapping, AttributeMapping2_0
-{
- protected String name;
-
- protected final T resourceAttributeMapping;
-
- protected AbstractOrmAttributeMapping(OrmPersistentAttribute parent, T resourceAttributeMapping) {
- super(parent);
- this.resourceAttributeMapping = resourceAttributeMapping;
- this.name = this.getResourceMappingName();
- }
-
- protected JavaPersistentAttribute getJavaPersistentAttribute() {
- return this.getPersistentAttribute().getJavaPersistentAttribute();
- }
-
- protected JavaResourcePersistentAttribute getJavaResourcePersistentAttribute() {
- return this.getJavaPersistentAttribute().getResourcePersistentAttribute();
- }
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- String old = this.name;
- this.name = name;
- this.resourceAttributeMapping.setName(name);
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- this.getPersistentAttribute().nameChanged(old, name);
- }
-
- protected void setName_(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- this.getPersistentAttribute().nameChanged(old, name);
- }
-
- public OrmPersistentAttribute getPersistentAttribute() {
- return (OrmPersistentAttribute) getParent();
- }
-
- public boolean isDefault() {
- return false;
- }
-
- public void initializeFromOrmAttributeMapping(OrmAttributeMapping oldMapping) {
- setName(oldMapping.getName());
- }
-
- public void initializeFromOrmColumnMapping(OrmColumnMapping oldMapping) {
- initializeFromOrmAttributeMapping((OrmAttributeMapping) oldMapping);
- }
-
- public void initializeFromOrmBasicMapping(OrmBasicMapping oldMapping) {
- initializeFromOrmColumnMapping(oldMapping);
- }
-
- public void initializeFromOrmIdMapping(OrmIdMapping oldMapping) {
- initializeFromOrmColumnMapping(oldMapping);
- }
-
- public void initializeFromOrmTransientMapping(OrmTransientMapping oldMapping) {
- initializeFromOrmAttributeMapping(oldMapping);
- }
-
- public void initializeFromOrmBaseEmbeddedMapping(OrmBaseEmbeddedMapping oldMapping) {
- initializeFromOrmAttributeMapping(oldMapping);
- }
-
- public void initializeFromOrmEmbeddedMapping(OrmEmbeddedMapping oldMapping) {
- initializeFromOrmBaseEmbeddedMapping(oldMapping);
- }
-
- public void initializeFromOrmEmbeddedIdMapping(OrmEmbeddedIdMapping oldMapping) {
- initializeFromOrmBaseEmbeddedMapping(oldMapping);
- }
-
- public void initializeFromOrmVersionMapping(OrmVersionMapping oldMapping) {
- initializeFromOrmColumnMapping(oldMapping);
- }
-
- public void initializeFromOrmRelationshipMapping(OrmRelationshipMapping oldMapping) {
- initializeFromOrmAttributeMapping(oldMapping);
- }
-
- public void initializeFromOrmMultiRelationshipMapping(OrmMultiRelationshipMapping oldMapping) {
- initializeFromOrmRelationshipMapping(oldMapping);
- }
-
- public void initializeFromOrmSingleRelationshipMapping(OrmSingleRelationshipMapping oldMapping) {
- initializeFromOrmRelationshipMapping(oldMapping);
- }
-
- public void initializeFromOrmOneToManyMapping(OrmOneToManyMapping oldMapping) {
- initializeFromOrmMultiRelationshipMapping(oldMapping);
- }
-
- public void initializeFromOrmManyToOneMapping(OrmManyToOneMapping oldMapping) {
- initializeFromOrmSingleRelationshipMapping(oldMapping);
- }
-
- public void initializeFromOrmOneToOneMapping(OrmOneToOneMapping oldMapping) {
- initializeFromOrmSingleRelationshipMapping(oldMapping);
- }
-
- public void initializeFromOrmManyToManyMapping(OrmManyToManyMapping oldMapping) {
- initializeFromOrmMultiRelationshipMapping(oldMapping);
- }
-
- public String getPrimaryKeyColumnName() {
- return null;
- }
-
- public OrmTypeMapping getTypeMapping() {
- return this.getPersistentAttribute().getTypeMapping();
- }
-
-
- public boolean isOverridableAttributeMapping() {
- return false;
- }
-
- public boolean isOverridableAssociationMapping() {
- return false;
- }
-
- public boolean isIdMapping() {
- return false;
- }
-
- public boolean isOwnedBy(RelationshipMapping mapping) {
- // Default implementation - override where needed
- return false;
- }
-
- public Iterator<String> allMappingNames() {
- return getName() == null ? EmptyIterator.<String> instance() : new SingleElementIterator<String>(getName());
- }
-
- public AttributeMapping resolveAttributeMapping(String attributeName) {
- if (getName() != null && getName().equals(attributeName)) {
- return this;
- }
- return null;
- }
-
- public Iterator<String> allOverrideableAttributeMappingNames() {
- if (isOverridableAttributeMapping()) {
- return allMappingNames();
- }
- return EmptyIterator.<String> instance();
- }
-
- public Iterator<String> allOverrideableAssociationMappingNames() {
- if (isOverridableAssociationMapping()) {
- return allMappingNames();
- }
- return EmptyIterator.<String> instance();
- }
-
- public Column resolveOverridenColumn(String attributeName) {
- ColumnMapping columnMapping = this.resolveColumnMapping(attributeName);
- return columnMapping == null ? null : columnMapping.getColumn();
- }
-
- protected ColumnMapping resolveColumnMapping(String attributeName) {
- AttributeMapping attributeMapping = resolveAttributeMapping(attributeName);
- if (attributeMapping != null && attributeMapping.isOverridableAttributeMapping()) {
- return (ColumnMapping) attributeMapping;
- }
- return null;
- }
-
- public RelationshipReference resolveRelationshipReference(String attributeName) {
- RelationshipMapping relationshipMapping = this.resolveRelationshipMapping(attributeName);
- return relationshipMapping == null ? null : relationshipMapping.getRelationshipReference();
- }
-
- protected RelationshipMapping resolveRelationshipMapping(String attributeName) {
- AttributeMapping attributeMapping = resolveAttributeMapping(attributeName);
- if (attributeMapping != null && attributeMapping.isOverridableAssociationMapping()) {
- return (RelationshipMapping) attributeMapping;
- }
- return null;
- }
-
- public T getResourceAttributeMapping() {
- return this.resourceAttributeMapping;
- }
-
- public void update() {
- this.setName_(this.getResourceMappingName());
- }
-
- protected String getResourceMappingName() {
- return this.resourceAttributeMapping.getName();
- }
-
- public boolean shouldValidateAgainstDatabase() {
- return this.getTypeMapping().shouldValidateAgainstDatabase();
- }
-
- public boolean contains(int textOffset) {
- return this.resourceAttributeMapping.containsOffset(textOffset);
- }
-
- public TextRange getSelectionTextRange() {
- return this.resourceAttributeMapping.getSelectionTextRange();
- }
-
- public TextRange getValidationTextRange() {
- return (this.getPersistentAttribute().isVirtual()) ? this.getTypeMapping().getAttributesTextRange() : this.resourceAttributeMapping.getValidationTextRange();
- }
-
- public TextRange getNameTextRange() {
- return this.resourceAttributeMapping.getNameTextRange();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getName());
- }
-
-
- // ********** 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() {
- JavaPersistentAttribute2_0 jpa = (JavaPersistentAttribute2_0) this.getPersistentAttribute().getJavaPersistentAttribute();
- return (jpa == null) ? MetamodelField.DEFAULT_TYPE_NAME : jpa.getMetamodelTypeName();
- }
-
- protected String getMetamodelFieldName() {
- return this.getName();
- }
-
-
- // ********** 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()
- )
- );
- return;
- }
- }
-
- //TODO validation message - i think more info is needed in this message. include type mapping type?
- protected void validateMapping(List<IMessage> messages) {
- if ( ! this.getTypeMapping().attributeMappingKeyAllowed(this.getKey())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_MAPPING,
- new String[] {this.name},
- this,
- this.getValidationTextRange()
- )
- );
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseColumn.java
deleted file mode 100644
index 6a6e880986..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseColumn.java
+++ /dev/null
@@ -1,302 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmBaseColumn;
-import org.eclipse.jpt.core.resource.orm.AbstractXmlColumn;
-import org.eclipse.jpt.core.utility.TextRange;
-
-
-public abstract class AbstractOrmBaseColumn<T extends AbstractXmlColumn> extends AbstractOrmNamedColumn<T>
- implements OrmBaseColumn
-{
- protected String specifiedTable;
-
- protected String defaultTable;
-
- protected Boolean specifiedUnique;
-
- protected Boolean specifiedNullable;
-
- protected Boolean specifiedInsertable;
-
- protected Boolean specifiedUpdatable;
-
- protected AbstractOrmBaseColumn(XmlContextNode parent, OrmBaseColumn.Owner owner) {
- super(parent, owner);
- }
-
- public void initializeFrom(BaseColumn oldColumn) {
- super.initializeFrom(oldColumn);
- setSpecifiedTable(oldColumn.getSpecifiedTable());
- setSpecifiedUnique(oldColumn.getSpecifiedUnique());
- setSpecifiedNullable(oldColumn.getSpecifiedNullable());
- setSpecifiedInsertable(oldColumn.getSpecifiedInsertable());
- setSpecifiedUpdatable(oldColumn.getSpecifiedUpdatable());
- }
-
- @Override
- public OrmBaseColumn.Owner getOwner() {
- return (OrmBaseColumn.Owner) super.getOwner();
- }
-
-// @Override
-// protected void addInsignificantXmlFeatureIdsTo(Set<Integer> insignificantXmlFeatureIds) {
-// super.addInsignificantXmlFeatureIdsTo(insignificantXmlFeatureIds);
-// insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.IABSTRACT_COLUMN__DEFAULT_TABLE);
-// insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.IABSTRACT_COLUMN__TABLE);
-// }
-
- public String getTable() {
- return (this.getSpecifiedTable() == null) ? getDefaultTable() : this.getSpecifiedTable();
- }
-
- public String getSpecifiedTable() {
- return this.specifiedTable;
- }
-
- public void setSpecifiedTable(String newSpecifiedTable) {
- String oldSpecifiedTable = this.specifiedTable;
- this.specifiedTable = newSpecifiedTable;
- if (this.valuesAreDifferent(oldSpecifiedTable, newSpecifiedTable)) {
- if (this.getResourceColumn() != null) {
- this.getResourceColumn().setTable(newSpecifiedTable);
- this.removeResourceColumnIfFeaturesUnset();
- }
- else if (newSpecifiedTable != null) {
- addResourceColumn();
- getResourceColumn().setTable(newSpecifiedTable);
- }
- }
- firePropertyChanged(BaseColumn.SPECIFIED_TABLE_PROPERTY, oldSpecifiedTable, newSpecifiedTable);
- }
-
- protected void setSpecifiedTable_(String newSpecifiedTable) {
- String oldSpecifiedTable = this.specifiedTable;
- this.specifiedTable = newSpecifiedTable;
- firePropertyChanged(BaseColumn.SPECIFIED_TABLE_PROPERTY, oldSpecifiedTable, newSpecifiedTable);
- }
-
- public String getDefaultTable() {
- return this.defaultTable;
- }
-
- protected void setDefaultTable(String newDefaultTable) {
- String oldDefaultTable = this.defaultTable;
- this.defaultTable = newDefaultTable;
- firePropertyChanged(BaseColumn.DEFAULT_TABLE_PROPERTY, oldDefaultTable, newDefaultTable);
- }
-
- public boolean isUnique() {
- return (this.getSpecifiedUnique() == null) ? this.isDefaultUnique() : this.getSpecifiedUnique().booleanValue();
- }
-
- public boolean isDefaultUnique() {
- return BaseColumn.DEFAULT_UNIQUE;
- }
-
- public Boolean getSpecifiedUnique() {
- return this.specifiedUnique;
- }
-
- public void setSpecifiedUnique(Boolean newSpecifiedUnique) {
- Boolean oldSpecifiedUnique = this.specifiedUnique;
- this.specifiedUnique = newSpecifiedUnique;
- if (this.valuesAreDifferent(oldSpecifiedUnique, newSpecifiedUnique)) {
- if (this.getResourceColumn() != null) {
- this.getResourceColumn().setUnique(newSpecifiedUnique);
- if (this.getResourceColumn().isUnset()) {
- removeResourceColumn();
- }
- }
- else if (newSpecifiedUnique != null) {
- addResourceColumn();
- getResourceColumn().setUnique(newSpecifiedUnique);
- }
- }
- firePropertyChanged(BaseColumn.SPECIFIED_UNIQUE_PROPERTY, oldSpecifiedUnique, newSpecifiedUnique);
- }
-
- protected void setSpecifiedUnique_(Boolean newSpecifiedUnique) {
- Boolean oldSpecifiedUnique = this.specifiedUnique;
- this.specifiedUnique = newSpecifiedUnique;
- firePropertyChanged(BaseColumn.SPECIFIED_UNIQUE_PROPERTY, oldSpecifiedUnique, newSpecifiedUnique);
- }
-
- public boolean isNullable() {
- return (this.getSpecifiedNullable() == null) ? this.isDefaultNullable() : this.getSpecifiedNullable().booleanValue();
- }
-
- public boolean isDefaultNullable() {
- return BaseColumn.DEFAULT_NULLABLE;
- }
-
- public Boolean getSpecifiedNullable() {
- return this.specifiedNullable;
- }
-
- public void setSpecifiedNullable(Boolean newSpecifiedNullable) {
- Boolean oldSpecifiedNullable = this.specifiedNullable;
- this.specifiedNullable = newSpecifiedNullable;
- if (this.valuesAreDifferent(oldSpecifiedNullable, newSpecifiedNullable)) {
- if (this.getResourceColumn() != null) {
- this.getResourceColumn().setNullable(newSpecifiedNullable);
- this.removeResourceColumnIfFeaturesUnset();
- }
- else if (newSpecifiedNullable != null) {
- addResourceColumn();
- getResourceColumn().setNullable(newSpecifiedNullable);
- }
- }
- firePropertyChanged(BaseColumn.SPECIFIED_NULLABLE_PROPERTY, oldSpecifiedNullable, newSpecifiedNullable);
- }
-
- protected void setSpecifiedNullable_(Boolean newSpecifiedNullable) {
- Boolean oldSpecifiedNullable = this.specifiedNullable;
- this.specifiedNullable = newSpecifiedNullable;
- firePropertyChanged(BaseColumn.SPECIFIED_NULLABLE_PROPERTY, oldSpecifiedNullable, newSpecifiedNullable);
- }
-
- public boolean isInsertable() {
- return (this.getSpecifiedInsertable() == null) ? this.isDefaultInsertable() : this.getSpecifiedInsertable().booleanValue();
- }
-
- public boolean isDefaultInsertable() {
- return BaseColumn.DEFAULT_INSERTABLE;
- }
-
- public Boolean getSpecifiedInsertable() {
- return this.specifiedInsertable;
- }
-
- public void setSpecifiedInsertable(Boolean newSpecifiedInsertable) {
- Boolean oldSpecifiedInsertable = this.specifiedInsertable;
- this.specifiedInsertable = newSpecifiedInsertable;
- if (this.valuesAreDifferent(oldSpecifiedInsertable, newSpecifiedInsertable)) {
- if (this.getResourceColumn() != null) {
- this.getResourceColumn().setInsertable(newSpecifiedInsertable);
- this.removeResourceColumnIfFeaturesUnset();
- }
- else if (newSpecifiedInsertable != null) {
- addResourceColumn();
- getResourceColumn().setInsertable(newSpecifiedInsertable);
- }
- }
- firePropertyChanged(BaseColumn.SPECIFIED_INSERTABLE_PROPERTY, oldSpecifiedInsertable, newSpecifiedInsertable);
- }
-
- protected void setSpecifiedInsertable_(Boolean newSpecifiedInsertable) {
- Boolean oldSpecifiedInsertable = this.specifiedInsertable;
- this.specifiedInsertable = newSpecifiedInsertable;
- firePropertyChanged(BaseColumn.SPECIFIED_INSERTABLE_PROPERTY, oldSpecifiedInsertable, newSpecifiedInsertable);
- }
-
- public boolean isUpdatable() {
- return (this.getSpecifiedUpdatable() == null) ? this.isDefaultUpdatable() : this.getSpecifiedUpdatable().booleanValue();
- }
-
- public boolean isDefaultUpdatable() {
- return BaseColumn.DEFAULT_UPDATABLE;
- }
-
- public Boolean getSpecifiedUpdatable() {
- return this.specifiedUpdatable;
- }
-
- public void setSpecifiedUpdatable(Boolean newSpecifiedUpdatable) {
- Boolean oldSpecifiedUpdatable = this.specifiedUpdatable;
- this.specifiedUpdatable = newSpecifiedUpdatable;
- if (this.valuesAreDifferent(oldSpecifiedUpdatable, newSpecifiedUpdatable)) {
- if (this.getResourceColumn() != null) {
- this.getResourceColumn().setUpdatable(newSpecifiedUpdatable);
- if (this.getResourceColumn().isUnset()) {
- removeResourceColumn();
- }
- }
- else if (newSpecifiedUpdatable != null) {
- addResourceColumn();
- getResourceColumn().setUpdatable(newSpecifiedUpdatable);
- }
- }
- firePropertyChanged(BaseColumn.SPECIFIED_UPDATABLE_PROPERTY, oldSpecifiedUpdatable, newSpecifiedUpdatable);
- }
-
- protected void setSpecifiedUpdatable_(Boolean newSpecifiedUpdatable) {
- Boolean oldSpecifiedUpdatable = this.specifiedUpdatable;
- this.specifiedUpdatable = newSpecifiedUpdatable;
- firePropertyChanged(BaseColumn.SPECIFIED_UPDATABLE_PROPERTY, oldSpecifiedUpdatable, newSpecifiedUpdatable);
- }
-
- @Override
- protected String getOwningTableName() {
- return this.getTable();
- }
-
-
- public TextRange getTableTextRange() {
- if (getResourceColumn() != null) {
- TextRange textRange = getResourceColumn().getTableTextRange();
- if (textRange != null) {
- return textRange;
- }
- }
- return this.getParent().getValidationTextRange();
- }
-
- @Override
- protected void initialize(T column) {
- super.initialize(column);
- this.specifiedTable = this.getResourceTable(column);
- this.defaultTable = this.buildDefaultTableName();
- //TODO default from java for all of these settings
- this.specifiedNullable = this.getResourceNullable(column);
- this.specifiedUpdatable = this.getResourceUpdatable(column);
- this.specifiedUnique = this.getResourceUnique(column);
- this.specifiedInsertable = this.getResourceInsertable(column);
- }
-
- @Override
- protected void update(T column) {
- super.update(column);
- setSpecifiedTable_(this.getResourceTable(column));
- setDefaultTable(this.buildDefaultTableName());
- setSpecifiedNullable_(this.getResourceNullable(column));
- setSpecifiedUpdatable_(this.getResourceUpdatable(column));
- setSpecifiedUnique_(this.getResourceUnique(column));
- setSpecifiedInsertable_(this.getResourceInsertable(column));
- }
-
- protected String getResourceTable(T column) {
- return column == null ? null : column.getTable();
- }
-
- protected Boolean getResourceNullable(T column) {
- return column == null ? null : column.getNullable();
- }
-
- protected Boolean getResourceUpdatable(T column) {
- return column == null ? null : column.getUpdatable();
- }
-
- protected Boolean getResourceUnique(T column) {
- return column == null ? null : column.getUnique();
- }
-
- protected Boolean getResourceInsertable(T column) {
- return column == null ? null : column.getInsertable();
- }
-
- protected String buildDefaultTableName() {
- return getOwner().getDefaultTableName();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java
deleted file mode 100644
index 12b0e1e56d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.Iterator;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.Embeddable;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverride;
-import org.eclipse.jpt.core.context.java.JavaBaseEmbeddedMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmBaseEmbeddedMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.resource.orm.AbstractXmlEmbedded;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-
-public abstract class AbstractOrmBaseEmbeddedMapping<T extends AbstractXmlEmbedded> extends AbstractOrmAttributeMapping<T> implements OrmBaseEmbeddedMapping
-{
- protected OrmAttributeOverrideContainer attributeOverrideContainer;
-
- private Embeddable embeddable;//TODO hmm, why no property change notification for setting this??
-
- protected AbstractOrmBaseEmbeddedMapping(OrmPersistentAttribute parent, T resourceMapping) {
- super(parent, resourceMapping);
- this.embeddable = embeddableFor(this.getJavaPersistentAttribute());
- this.attributeOverrideContainer = getXmlContextNodeFactory().buildOrmAttributeOverrideContainer(this, new AttributeOverrideContainerOwner(), this.resourceAttributeMapping);
- }
-
- @Override
- public void initializeFromOrmBaseEmbeddedMapping(OrmBaseEmbeddedMapping oldMapping) {
- super.initializeFromOrmBaseEmbeddedMapping(oldMapping);
- this.attributeOverrideContainer.initializeFromAttributeOverrideContainer(oldMapping.getAttributeOverrideContainer());
- }
-
- public OrmAttributeOverrideContainer getAttributeOverrideContainer() {
- return this.attributeOverrideContainer;
- }
-
- protected JavaAttributeOverride getJavaAttributeOverrideNamed(String attributeName) {
- if (getJavaEmbeddedMapping() != null) {
- return getJavaEmbeddedMapping().getAttributeOverrideContainer().getAttributeOverrideNamed(attributeName);
- }
- return null;
- }
-
- public Embeddable getEmbeddable() {
- return this.embeddable;
- }
-
- protected Iterator<AttributeMapping> embeddableAttributeMappings() {
- if (this.getEmbeddable() == null) {
- return EmptyIterator.instance();
- }
- return this.getEmbeddable().attributeMappings();
- }
-
- @Override
- public Iterator<String> allOverrideableAttributeMappingNames() {
- if (getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
- return embeddableOverrideableAttributeMappingNames();
- }
- return super.allOverrideableAttributeMappingNames();
- }
-
- protected Iterator<String> embeddableOverrideableAttributeMappingNames() {
- return new TransformationIterator<String, String>(
- new CompositeIterator<String>(
- new TransformationIterator<AttributeMapping, Iterator<String>>(this.embeddableAttributeMappings()) {
- @Override
- protected Iterator<String> transform(AttributeMapping mapping) {
- return mapping.allOverrideableAttributeMappingNames();
- }
- }
- )
- ) {
- @Override
- protected String transform(String next) {
- return getName() + '.' + next;
- }
- };
- }
-
- @Override
- public Iterator<String> allOverrideableAssociationMappingNames() {
- if (getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
- return embeddableOverrideableAssociationMappingNames();
- }
- return super.allOverrideableAssociationMappingNames();
- }
-
- protected Iterator<String> embeddableOverrideableAssociationMappingNames() {
- return new TransformationIterator<String, String>(
- new CompositeIterator<String>(
- new TransformationIterator<AttributeMapping, Iterator<String>>(this.embeddableAttributeMappings()) {
- @Override
- protected Iterator<String> transform(AttributeMapping mapping) {
- return mapping.allOverrideableAssociationMappingNames();
- }
- }
- )
- ) {
- @Override
- protected String transform(String next) {
- return getName() + '.' + next;
- }
- };
- }
-
- @Override
- public Column resolveOverridenColumn(String attributeName) {
- if (getName() == null) {
- return null;
- }
- if (getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
- int dotIndex = attributeName.indexOf('.');
- if (dotIndex != -1) {
- if (getName().equals(attributeName.substring(0, dotIndex))) {
- attributeName = attributeName.substring(dotIndex + 1);
- AttributeOverride override = getAttributeOverrideContainer().getAttributeOverrideNamed(attributeName);
- if (override != null && !override.isVirtual()) {
- return override.getColumn();
- }
- if (this.getEmbeddable() == null) {
- return null;
- }
- return this.getEmbeddable().resolveOverridenColumn(attributeName);
- }
- }
- }
- return null;
- }
-
- public JavaBaseEmbeddedMapping getJavaEmbeddedMapping() {
- JavaPersistentAttribute jpa = this.getJavaPersistentAttribute();
- if ((jpa != null) && this.valuesAreEqual(jpa.getMappingKey(), this.getKey())) {
- return (JavaBaseEmbeddedMapping) jpa.getMapping();
- }
- return null;
- }
-
-
- @Override
- public void update() {
- super.update();
- this.embeddable = embeddableFor(this.getJavaPersistentAttribute());
- getAttributeOverrideContainer().update();
- }
-
- //************ static methods ************
-
- public static Embeddable embeddableFor(JavaPersistentAttribute javaPersistentAttribute) {
- return (javaPersistentAttribute == null) ? null : javaPersistentAttribute.getEmbeddable();
- }
-
-
- //********** AttributeOverrideContainer.Owner implementation *********
-
- class AttributeOverrideContainerOwner implements OrmAttributeOverrideContainer.Owner {
- public TypeMapping getOverridableTypeMapping() {
- return AbstractOrmBaseEmbeddedMapping.this.getEmbeddable();
- }
-
- public OrmTypeMapping getTypeMapping() {
- return AbstractOrmBaseEmbeddedMapping.this.getTypeMapping();
- }
-
- public Column resolveOverridenColumn(String attributeOverrideName) {
- if (getPersistentAttribute().isVirtual() && !getTypeMapping().isMetadataComplete()) {
- JavaAttributeOverride javaAttributeOverride = getJavaAttributeOverrideNamed(attributeOverrideName);
- if (javaAttributeOverride != null && !javaAttributeOverride.isVirtual()) {
- return javaAttributeOverride.getColumn();
- }
- }
- TypeMapping overridableTypeMapping = getOverridableTypeMapping();
- Column column = null;
- if (overridableTypeMapping != null) {
- for (TypeMapping typeMapping : CollectionTools.iterable(overridableTypeMapping.inheritanceHierarchy())) {
- column = typeMapping.resolveOverridenColumn(attributeOverrideName);
- if (column != null) {
- return column;
- }
- }
- }
- return column;
- }
-
- public XmlColumn buildVirtualXmlColumn(Column overridableColumn, String attributeName, boolean isMetadataComplete) {
- return new VirtualXmlAttributeOverrideColumn(overridableColumn);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBasicMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBasicMapping.java
deleted file mode 100644
index c48487dd8e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBasicMapping.java
+++ /dev/null
@@ -1,326 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.List;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.BasicMapping;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.Fetchable;
-import org.eclipse.jpt.core.context.Nullable;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmColumn;
-import org.eclipse.jpt.core.context.orm.OrmColumnMapping;
-import org.eclipse.jpt.core.context.orm.OrmConverter;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlBasic;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-
-public abstract class AbstractOrmBasicMapping<T extends XmlBasic>
- extends AbstractOrmAttributeMapping<T>
- implements OrmBasicMapping
-{
- protected final OrmColumn column;
-
- protected FetchType specifiedFetch;
-
- protected Boolean specifiedOptional;
-
- protected OrmConverter defaultConverter;
-
- protected OrmConverter specifiedConverter;
-
- protected AbstractOrmBasicMapping(OrmPersistentAttribute parent, T resourceMapping) {
- super(parent, resourceMapping);
- this.column = getXmlContextNodeFactory().buildOrmColumn(this, this);
- this.column.initialize(this.getResourceColumn());//TODO pass in to factory
- this.specifiedFetch = this.getResourceFetch();
- this.specifiedOptional = this.getResourceOptional();
- this.defaultConverter = getXmlContextNodeFactory().buildOrmNullConverter(this);
- this.specifiedConverter = this.buildSpecifiedConverter(this.getResourceConverterType());
- }
-
- public FetchType getFetch() {
- return (this.getSpecifiedFetch() == null) ? this.getDefaultFetch() : this.getSpecifiedFetch();
- }
-
- public FetchType getDefaultFetch() {
- return BasicMapping.DEFAULT_FETCH_TYPE;
- }
-
- public FetchType getSpecifiedFetch() {
- return this.specifiedFetch;
- }
-
- public void setSpecifiedFetch(FetchType newSpecifiedFetch) {
- FetchType oldFetch = this.specifiedFetch;
- this.specifiedFetch = newSpecifiedFetch;
- this.resourceAttributeMapping.setFetch(FetchType.toOrmResourceModel(newSpecifiedFetch));
- firePropertyChanged(Fetchable.SPECIFIED_FETCH_PROPERTY, oldFetch, newSpecifiedFetch);
- }
-
- protected void setSpecifiedFetch_(FetchType newSpecifiedFetch) {
- FetchType oldFetch = this.specifiedFetch;
- this.specifiedFetch = newSpecifiedFetch;
- firePropertyChanged(Fetchable.SPECIFIED_FETCH_PROPERTY, oldFetch, newSpecifiedFetch);
- }
-
- public boolean isOptional() {
- return (this.getSpecifiedOptional() == null) ? this.isDefaultOptional() : this.getSpecifiedOptional().booleanValue();
- }
-
- public boolean isDefaultOptional() {
- return Nullable.DEFAULT_OPTIONAL;
- }
-
- public Boolean getSpecifiedOptional() {
- return this.specifiedOptional;
- }
-
- public void setSpecifiedOptional(Boolean newSpecifiedOptional) {
- Boolean oldOptional = this.specifiedOptional;
- this.specifiedOptional = newSpecifiedOptional;
- this.resourceAttributeMapping.setOptional(newSpecifiedOptional);
- firePropertyChanged(Nullable.SPECIFIED_OPTIONAL_PROPERTY, oldOptional, newSpecifiedOptional);
- }
-
- protected void setSpecifiedOptional_(Boolean newSpecifiedOptional) {
- Boolean oldOptional = this.specifiedOptional;
- this.specifiedOptional = newSpecifiedOptional;
- firePropertyChanged(Nullable.SPECIFIED_OPTIONAL_PROPERTY, oldOptional, newSpecifiedOptional);
- }
-
- public OrmConverter getConverter() {
- return getSpecifiedConverter() == null ? getDefaultConverter() : getSpecifiedConverter();
- }
-
- public OrmConverter getDefaultConverter() {
- return this.defaultConverter;
- }
-
- public OrmConverter getSpecifiedConverter() {
- return this.specifiedConverter;
- }
-
- protected String getSpecifedConverterType() {
- if (this.specifiedConverter == null) {
- return Converter.NO_CONVERTER;
- }
- return this.specifiedConverter.getType();
- }
-
- public void setSpecifiedConverter(String converterType) {
- if (this.valuesAreEqual(getSpecifedConverterType(), converterType)) {
- return;
- }
- OrmConverter oldConverter = this.specifiedConverter;
- OrmConverter newConverter = buildSpecifiedConverter(converterType);
- this.specifiedConverter = null;
- if (oldConverter != null) {
- oldConverter.removeFromResourceModel();
- }
- this.specifiedConverter = newConverter;
- if (newConverter != null) {
- newConverter.addToResourceModel();
- }
- firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
- }
-
- protected void setSpecifiedConverter(OrmConverter newConverter) {
- OrmConverter oldConverter = this.specifiedConverter;
- this.specifiedConverter = newConverter;
- firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
- }
-
- public String getKey() {
- return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmBasicMapping(this);
- }
-
-
- @Override
- public void initializeFromOrmColumnMapping(OrmColumnMapping oldMapping) {
- super.initializeFromOrmColumnMapping(oldMapping);
- getColumn().initializeFrom(oldMapping.getColumn());
- }
-
- public int getXmlSequence() {
- return 20;
- }
-
- @Override
- public boolean isOverridableAttributeMapping() {
- return true;
- }
-
- public OrmColumn getColumn() {
- return this.column;
- }
-
- public String getDefaultColumnName() {
- return getName();
- }
-
- public String getDefaultTableName() {
- return getTypeMapping().getPrimaryTableName();
- }
-
- public Table getDbTable(String tableName) {
- return getTypeMapping().getDbTable(tableName);
- }
-
- @Override
- public void update() {
- super.update();
- this.setSpecifiedFetch_(this.getResourceFetch());
- this.setSpecifiedOptional_(this.getResourceOptional());
- this.column.update(this.getResourceColumn());
- if (this.valuesAreEqual(getResourceConverterType(), getSpecifedConverterType())) {
- getSpecifiedConverter().update();
- }
- else {
- setSpecifiedConverter(buildSpecifiedConverter(getResourceConverterType()));
- }
- }
-
- protected Boolean getResourceOptional() {
- return this.resourceAttributeMapping.getOptional();
- }
-
- protected FetchType getResourceFetch() {
- return FetchType.fromOrmResourceModel(this.resourceAttributeMapping.getFetch());
- }
-
- protected OrmConverter buildSpecifiedConverter(String converterType) {
- if (this.valuesAreEqual(converterType, Converter.ENUMERATED_CONVERTER)) {
- return getXmlContextNodeFactory().buildOrmEnumeratedConverter(this, this.resourceAttributeMapping);
- }
- if (this.valuesAreEqual(converterType, Converter.TEMPORAL_CONVERTER)) {
- return getXmlContextNodeFactory().buildOrmTemporalConverter(this, this.resourceAttributeMapping);
- }
- if (this.valuesAreEqual(converterType, Converter.LOB_CONVERTER)) {
- return getXmlContextNodeFactory().buildOrmLobConverter(this, this.resourceAttributeMapping);
- }
- return null;
- }
-
- protected String getResourceConverterType() {
- if (this.resourceAttributeMapping.getEnumerated() != null) {
- return Converter.ENUMERATED_CONVERTER;
- }
- else if (this.resourceAttributeMapping.getTemporal() != null) {
- return Converter.TEMPORAL_CONVERTER;
- }
- else if (this.resourceAttributeMapping.isLob()) {
- return Converter.LOB_CONVERTER;
- }
-
- return null;
- }
-
- public void addToResourceModel(Attributes resourceAttributes) {
- resourceAttributes.getBasics().add(this.resourceAttributeMapping);
- }
-
- public void removeFromResourceModel(Attributes resourceAttributes) {
- resourceAttributes.getBasics().remove(this.resourceAttributeMapping);
- }
-
- //***************** XmlColumn.Owner implementation ****************
-
- public XmlColumn getResourceColumn() {
- return this.resourceAttributeMapping.getColumn();
- }
-
- public void addResourceColumn() {
- this.resourceAttributeMapping.setColumn(OrmFactory.eINSTANCE.createXmlColumn());
- }
-
- public void removeResourceColumn() {
- this.resourceAttributeMapping.setColumn(null);
- }
-
- // ****************** validation ****************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- if (this.shouldValidateAgainstDatabase()) {
- this.validateColumn(messages);
- }
- }
-
- protected void validateColumn(List<IMessage> messages) {
- String tableName = this.column.getTable();
- if (this.getTypeMapping().tableNameIsInvalid(tableName)) {
- if (this.getPersistentAttribute().isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_TABLE,
- new String[] {this.getName(), tableName, this.column.getName()},
- this.column,
- this.column.getTableTextRange()
- )
- );
- } else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_TABLE,
- new String[] {tableName, this.column.getName()},
- this.column,
- this.column.getTableTextRange()
- )
- );
- }
- return;
- }
-
- if ( ! this.column.isResolved() && this.column.getDbTable() != null) {
- if (this.getPersistentAttribute().isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME,
- new String[] {this.getName(), this.column.getName()},
- this.column,
- this.column.getNameTextRange()
- )
- );
- } else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {this.column.getName()},
- this.column,
- this.column.getNameTextRange()
- )
- );
- }
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEmbeddable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEmbeddable.java
deleted file mode 100644
index 58c47e39cc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEmbeddable.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Oracle. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.Iterator;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.java.JavaEmbeddable;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddable;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddable;
-import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-
-
-public abstract class AbstractOrmEmbeddable extends AbstractOrmTypeMapping<XmlEmbeddable> implements OrmEmbeddable
-{
- protected AbstractOrmEmbeddable(OrmPersistentType parent, XmlEmbeddable resourceMapping) {
- super(parent, resourceMapping);
- }
-
- public String getKey() {
- return MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
- }
-
- public int getXmlSequence() {
- return 2;
- }
-
- public JavaEmbeddable getJavaEmbeddable() {
- JavaPersistentType javaPersistentType = this.getJavaPersistentType();
- if (javaPersistentType != null && javaPersistentType.getMappingKey() == MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY) {
- return (JavaEmbeddable) javaPersistentType.getMapping();
- }
- return null;
- }
-
- /**
- * This checks metaDataComplete before returning the JavaEmbeddable.
- * As far as defaults are concerned, if metadataComplete is true, the JavaEmbeddable is ignored.
- */
- protected JavaEmbeddable getJavaEmbeddableForDefaults() {
- if (isMetadataComplete()) {
- return null;
- }
- return getJavaEmbeddable();
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return false;
- }
-
- @Override
- public boolean shouldValidateAgainstDatabase() {
- return false;
- }
-
- public Iterator<String> associatedTableNamesIncludingInherited() {
- return EmptyIterator.instance();
- }
-
- public Iterator<Table> associatedTables() {
- return EmptyIterator.instance();
- }
-
- public Iterator<Table> associatedTablesIncludingInherited() {
- return EmptyIterator.instance();
- }
-
- public void addToResourceModel(XmlEntityMappings entityMappings) {
- entityMappings.getEmbeddables().add(this.resourceTypeMapping);
- }
-
- public void removeFromResourceModel(XmlEntityMappings entityMappings) {
- entityMappings.getEmbeddables().remove(this.resourceTypeMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEmbeddedMapping.java
deleted file mode 100644
index 8b7822610a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEmbeddedMapping.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.Iterator;
-
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.RelationshipReference;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.jpa2.context.java.JavaEmbeddedMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmEmbeddedMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.core.resource.orm.XmlEmbedded;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-
-public abstract class AbstractOrmEmbeddedMapping<T extends XmlEmbedded>
- extends AbstractOrmBaseEmbeddedMapping<T>
- implements OrmEmbeddedMapping2_0
-{
- protected OrmAssociationOverrideContainer associationOverrideContainer;
-
- protected AbstractOrmEmbeddedMapping(OrmPersistentAttribute parent, T resourceMapping) {
- super(parent, resourceMapping);
- this.associationOverrideContainer =
- ((OrmXml2_0ContextNodeFactory) getXmlContextNodeFactory()).
- buildOrmAssociationOverrideContainer(this, new AssociationOverrideContainerOwner(), this.resourceAttributeMapping);
- }
-
- @Override
- public void update() {
- super.update();
- getAssociationOverrideContainer().update();
- }
-
- @Override
- public void postUpdate() {
- super.postUpdate();
- getAssociationOverrideContainer().postUpdate();
- }
-
- @Override
- public JavaEmbeddedMapping2_0 getJavaEmbeddedMapping() {
- return (JavaEmbeddedMapping2_0) super.getJavaEmbeddedMapping();
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmEmbeddedMapping(this);
- }
-
- public int getXmlSequence() {
- return 80;
- }
-
- public String getKey() {
- return MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
- }
-
- public void addToResourceModel(Attributes resourceAttributes) {
- resourceAttributes.getEmbeddeds().add(this.resourceAttributeMapping);
- }
-
- public void removeFromResourceModel(Attributes resourceAttributes) {
- resourceAttributes.getEmbeddeds().remove(this.resourceAttributeMapping);
- }
-
- //only putting this in EmbeddedMapping since relationship mappings
- //defined within an embedded id class are not supported by the 2.0 spec.
- @Override
- public Iterator<String> allMappingNames() {
- if (getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
- return new CompositeIterator<String>(
- getName(),
- embeddableAttributeMappingNames()
- );
- }
- return super.allMappingNames();
- }
-
- protected Iterator<String> embeddableAttributeMappingNames() {
- return new TransformationIterator<String, String>(
- new CompositeIterator<String>(
- new TransformationIterator<AttributeMapping, Iterator<String>>(this.embeddableAttributeMappings()) {
- @Override
- protected Iterator<String> transform(AttributeMapping mapping) {
- return mapping.allMappingNames();
- }
- }
- )
- ) {
- @Override
- protected String transform(String next) {
- return getName() + '.' + next;
- }
- };
- }
-
- @Override
- public AttributeMapping resolveAttributeMapping(String name) {
- if (getName() == null) {
- return null;
- }
- AttributeMapping resolvedMapping = super.resolveAttributeMapping(name);
- if (resolvedMapping != null) {
- return resolvedMapping;
- }
- if (getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
- int dotIndex = name.indexOf('.');
- if (dotIndex != -1) {
- if (getName().equals(name.substring(0, dotIndex))) {
- for (AttributeMapping attributeMapping : CollectionTools.iterable(embeddableAttributeMappings())) {
- resolvedMapping = attributeMapping.resolveAttributeMapping(name.substring(dotIndex + 1));
- if (resolvedMapping != null) {
- return resolvedMapping;
- }
- }
- }
- }
- }
- return null;
- }
-
- @Override
- public RelationshipReference resolveRelationshipReference(String attributeName) {
- if (getName() == null) {
- return null;
- }
- if (getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
- int dotIndex = attributeName.indexOf('.');
- if (dotIndex != -1) {
- if (getName().equals(attributeName.substring(0, dotIndex))) {
- attributeName = attributeName.substring(dotIndex + 1);
- AssociationOverride override = getAssociationOverrideContainer().getAssociationOverrideNamed(attributeName);
- if (override != null && !override.isVirtual()) {
- return override.getRelationshipReference();
- }
- if (this.getEmbeddable() == null) {
- return null;
- }
- return this.getEmbeddable().resolveRelationshipReference(attributeName);
- }
- }
- }
- return null;
- }
-
- public OrmAssociationOverrideContainer getAssociationOverrideContainer() {
- return this.associationOverrideContainer;
- }
-
- protected JavaAssociationOverride getJavaAssociationOverrideNamed(String attributeName) {
- if (getJavaEmbeddedMapping() != null) {
- return getJavaEmbeddedMapping().getAssociationOverrideContainer().getAssociationOverrideNamed(attributeName);
- }
- return null;
- }
-
-
- //************* AttributeOverrideContainer.Owner implementation ********************
-
- public Iterator<String> allOverridableAssociationNames() {
- return new TransformationIterator<RelationshipMapping, String>(this.allOverridableAssociations()) {
- @Override
- protected String transform(RelationshipMapping overridableAssociation) {
- return overridableAssociation.getName();
- }
- };
- }
-
- public Iterator<RelationshipMapping> allOverridableAssociations() {
- if (this.getEmbeddable() == null) {
- return EmptyIterator.instance();
- }
- return new FilteringIterator<AttributeMapping, RelationshipMapping>(this.getEmbeddable().attributeMappings()) {
- @Override
- protected boolean accept(AttributeMapping o) {
- return o.isOverridableAssociationMapping();
- }
- };
- }
-
-
- //********** OrmAssociationOverrideContainer.Owner implementation *********
-
- class AssociationOverrideContainerOwner implements OrmAssociationOverrideContainer.Owner {
- public TypeMapping getOverridableTypeMapping() {
- return AbstractOrmEmbeddedMapping.this.getEmbeddable();
- }
-
- public OrmTypeMapping getTypeMapping() {
- return AbstractOrmEmbeddedMapping.this.getTypeMapping();
- }
-
- public RelationshipReference resolveRelationshipReference(String associationOverrideName) {
- RelationshipReference relationshipReference = null;
- if (getPersistentAttribute().isVirtual() && !getTypeMapping().isMetadataComplete()) {
- JavaAssociationOverride javaAssociationOverride = getJavaAssociationOverrideNamed(associationOverrideName);
- if (javaAssociationOverride != null && !javaAssociationOverride.isVirtual()) {
- return javaAssociationOverride.getRelationshipReference();
- }
- }
- TypeMapping overridableTypeMapping = getOverridableTypeMapping();
- if (overridableTypeMapping != null) {
- for (TypeMapping typeMapping : CollectionTools.iterable(overridableTypeMapping.inheritanceHierarchy())) {
- relationshipReference = typeMapping.resolveRelationshipReference(associationOverrideName);
- if (relationshipReference != null) {
- return relationshipReference;
- }
- }
- }
- return relationshipReference;
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java
deleted file mode 100644
index 1e4d6cb603..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java
+++ /dev/null
@@ -1,1888 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.JpaPlatformVariation.Supported;
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.DiscriminatorColumn;
-import org.eclipse.jpt.core.context.DiscriminatorType;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.InheritanceType;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.RelationshipReference;
-import org.eclipse.jpt.core.context.SecondaryTable;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverride;
-import org.eclipse.jpt.core.context.java.JavaColumn;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaSecondaryTable;
-import org.eclipse.jpt.core.context.java.JavaTable;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmBaseJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmDiscriminatorColumn;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmGeneratorContainer;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmQueryContainer;
-import org.eclipse.jpt.core.context.orm.OrmSecondaryTable;
-import org.eclipse.jpt.core.context.orm.OrmTable;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaEntity;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheableHolder2_0;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.orm.Inheritance;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.core.resource.orm.XmlIdClass;
-import org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlSecondaryTable;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.ClassTools;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractOrmEntity
- extends AbstractOrmTypeMapping<XmlEntity>
- implements OrmEntity, OrmCacheableHolder2_0
-{
- protected String specifiedName;
-
- protected String defaultName;
-
- protected String idClass;
-
- protected final OrmTable table;
-
- protected boolean specifiedTableIsAllowed;
-
- protected boolean tableIsUndefined;
-
- protected final List<OrmSecondaryTable> specifiedSecondaryTables;
-
- protected final List<OrmSecondaryTable> virtualSecondaryTables;
-
- protected final List<OrmPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns;
-
- protected final List<OrmPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns;
-
- protected InheritanceType specifiedInheritanceStrategy;
-
- protected InheritanceType defaultInheritanceStrategy;
-
- protected String defaultDiscriminatorValue;
-
- protected String specifiedDiscriminatorValue;
-
- protected boolean specifiedDiscriminatorValueIsAllowed;
-
- protected boolean discriminatorValueIsUndefined;
-
- protected final OrmDiscriminatorColumn discriminatorColumn;
-
- protected boolean specifiedDiscriminatorColumnIsAllowed;
-
- protected boolean discriminatorColumnIsUndefined;
-
- protected final OrmGeneratorContainer generatorContainer;
-
- protected final OrmAttributeOverrideContainer attributeOverrideContainer;
-
- protected final OrmAssociationOverrideContainer associationOverrideContainer;
-
- protected final OrmQueryContainer queryContainer;
-
- protected Entity rootEntity;
-
- protected AbstractOrmEntity(OrmPersistentType parent, XmlEntity resourceMapping) {
- super(parent, resourceMapping);
- this.table = getXmlContextNodeFactory().buildOrmTable(this);
- this.specifiedSecondaryTables = new ArrayList<OrmSecondaryTable>();
- this.virtualSecondaryTables = new ArrayList<OrmSecondaryTable>();
- this.discriminatorColumn = buildDiscriminatorColumn();
- this.specifiedPrimaryKeyJoinColumns = new ArrayList<OrmPrimaryKeyJoinColumn>();
- this.defaultPrimaryKeyJoinColumns = new ArrayList<OrmPrimaryKeyJoinColumn>();
- this.associationOverrideContainer = buildAssociationOverrideContainer();
- this.attributeOverrideContainer = buildAttributeOverrideContainer();
- this.queryContainer = this.buildQueryContainer();
- this.generatorContainer = this.buildGeneratorContainer();
- this.specifiedName = this.resourceTypeMapping.getName();
- this.defaultName = this.buildDefaultName();
- this.rootEntity = this.calculateRootEntity();
- this.initializeInheritance(this.getResourceInheritance());
- this.specifiedDiscriminatorColumnIsAllowed = this.buildSpecifiedDiscriminatorColumnIsAllowed();
- this.discriminatorColumnIsUndefined = this.buildDiscriminatorColumnIsUndefined();
- this.discriminatorColumn.initialize(this.resourceTypeMapping); //TODO pass in to constructor
- this.specifiedDiscriminatorValueIsAllowed = this.buildSpecifiedDiscriminatorValueIsAllowed();
- this.discriminatorValueIsUndefined = this.buildDiscriminatorValueIsUndefined();
- this.specifiedDiscriminatorValue = this.resourceTypeMapping.getDiscriminatorValue();
- this.defaultDiscriminatorValue = this.buildDefaultDiscriminatorValue();
- this.specifiedTableIsAllowed = this.buildSpecifiedTableIsAllowed();
- this.tableIsUndefined = this.buildTableIsUndefined();
- this.table.initialize(this.resourceTypeMapping);//TODO pass in to constructor
- this.initializeSpecifiedSecondaryTables();
- this.initializeVirtualSecondaryTables();
- this.initializeSpecifiedPrimaryKeyJoinColumns();
- this.initializeDefaultPrimaryKeyJoinColumns();
- this.initializeIdClass(this.getResourceIdClass());
- }
-
- protected OrmDiscriminatorColumn buildDiscriminatorColumn() {
- return getXmlContextNodeFactory().buildOrmDiscriminatorColumn(this, buildDiscriminatorColumnOwner());
- }
-
- protected OrmDiscriminatorColumn.Owner buildDiscriminatorColumnOwner() {
- return new OrmDiscriminatorColumn.Owner(){
- public org.eclipse.jpt.db.Table getDbTable(String tableName) {
- return AbstractOrmEntity.this.getDbTable(tableName);
- }
-
- public TypeMapping getTypeMapping() {
- return AbstractOrmEntity.this;
- }
-
- public String getDefaultColumnName() {
- if (getResourceTypeMapping().getDiscriminatorColumn() == null) {
- if (!isMetadataComplete()) {
- if (getJavaEntity() != null && getJavaEntity().getDiscriminatorColumn().getSpecifiedName() != null) {
- return getJavaEntity().getDiscriminatorColumn().getSpecifiedName();
- }
- }
- }
- return isDescendant() ?
- getRootEntity().getDiscriminatorColumn().getName()
- :
- isTablePerClass() ?
- null
- :
- DiscriminatorColumn.DEFAULT_NAME;
- }
-
- public int getDefaultLength() {
- if (getResourceTypeMapping().getDiscriminatorColumn() == null) {
- if (!isMetadataComplete()) {
- if (getJavaEntity() != null && getJavaEntity().getDiscriminatorColumn().getSpecifiedLength() != null) {
- return getJavaEntity().getDiscriminatorColumn().getSpecifiedLength().intValue();
- }
- }
- }
- return isDescendant() ?
- getRootEntity().getDiscriminatorColumn().getLength()
- :
- isTablePerClass() ?
- 0//TODO think i want to return null here
- :
- DiscriminatorColumn.DEFAULT_LENGTH;
- }
-
- public DiscriminatorType getDefaultDiscriminatorType() {
- if (getResourceTypeMapping().getDiscriminatorColumn() == null) {
- if (!isMetadataComplete()) {
- if (getJavaEntity() != null && getJavaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType() != null) {
- return getJavaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType();
- }
- }
- }
- return isDescendant() ?
- getRootEntity().getDiscriminatorColumn().getDiscriminatorType()
- :
- isTablePerClass() ?
- null
- :
- DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE;
- }
-
- public TextRange getValidationTextRange() {
- return AbstractOrmEntity.this.getValidationTextRange();
- }
- };
- }
-
- protected OrmAssociationOverrideContainer buildAssociationOverrideContainer() {
- return getXmlContextNodeFactory().buildOrmAssociationOverrideContainer(this, new AssociationOverrideContainerOwner(), this.resourceTypeMapping);
- }
-
- protected OrmAttributeOverrideContainer buildAttributeOverrideContainer() {
- return getXmlContextNodeFactory().buildOrmAttributeOverrideContainer(this, new AttributeOverrideContainerOwner(), this.resourceTypeMapping);
- }
-
- protected OrmGeneratorContainer buildGeneratorContainer() {
- return getXmlContextNodeFactory().buildOrmGeneratorContainer(this, this.resourceTypeMapping);
- }
-
- protected OrmQueryContainer buildQueryContainer() {
- return getXmlContextNodeFactory().buildOrmQueryContainer(this, this.resourceTypeMapping);
- }
-
-
- // ******************* TypeMapping implementation ********************
-
- public String getKey() {
- return MappingKeys.ENTITY_TYPE_MAPPING_KEY;
- }
-
- @Override
- public String getPrimaryTableName() {
- return this.table.getName();
- }
-
- @Override
- public org.eclipse.jpt.db.Table getPrimaryDbTable() {
- return this.table.getDbTable();
- }
-
- private static final org.eclipse.jpt.db.Table[] EMPTY_DB_TABLE_ARRAY = new org.eclipse.jpt.db.Table[0];
-
- @Override
- public org.eclipse.jpt.db.Table getDbTable(String tableName) {
- // the JPA platform searches database objects for us
- return this.getDataSource().selectDatabaseObjectForIdentifier(
- ArrayTools.array(this.associatedDbTablesIncludingInherited(), EMPTY_DB_TABLE_ARRAY),
- tableName
- );
- }
-
- private Iterator<org.eclipse.jpt.db.Table> associatedDbTablesIncludingInherited() {
- return new FilteringIterator<org.eclipse.jpt.db.Table, org.eclipse.jpt.db.Table>(this.associatedDbTablesIncludingInherited_()) {
- @Override
- protected boolean accept(org.eclipse.jpt.db.Table t) {
- return t != null;
- }
- };
- }
-
- private Iterator<org.eclipse.jpt.db.Table> associatedDbTablesIncludingInherited_() {
- return new TransformationIterator<Table, org.eclipse.jpt.db.Table>(this.associatedTablesIncludingInherited()) {
- @Override
- protected org.eclipse.jpt.db.Table transform(Table t) {
- return t.getDbTable();
- }
- };
- }
-
- @Override
- public Schema getDbSchema() {
- return this.table.getDbSchema();
- }
-
- public JavaEntity getJavaEntity() {
- JavaPersistentType javaPersistentType = this.getJavaPersistentType();
- if (javaPersistentType != null && javaPersistentType.getMappingKey() == MappingKeys.ENTITY_TYPE_MAPPING_KEY) {
- return (JavaEntity) javaPersistentType.getMapping();
- }
- return null;
- }
-
- /**
- * This checks metaDataComplete before returning the JavaEntity.
- * As far as defaults are concerned, if metadataComplete is true, the JavaEntity is ignored.
- */
- protected JavaEntity getJavaEntityForDefaults() {
- if (isMetadataComplete()) {
- return null;
- }
- return getJavaEntity();
- }
-
-
- //****************** OrmAttributeOverrideContainer.Owner implementation *******************
-
- public TypeMapping getOverridableTypeMapping() {
- PersistentType superPersistentType = getPersistentType().getSuperPersistentType();
- return superPersistentType == null ? null : superPersistentType.getMapping();
- }
-
- public OrmTypeMapping getTypeMapping() {
- return this;
- }
-
- protected JavaAttributeOverride getJavaAttributeOverrideNamed(String attributeName) {
- if (getJavaEntity() != null) {
- return getJavaEntity().getAttributeOverrideContainer().getAttributeOverrideNamed(attributeName);
- }
- return null;
- }
-
- @Override
- public RelationshipReference resolveRelationshipReference(String name) {
- if (getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
- int dotIndex = name.indexOf('.');
- if (dotIndex != -1) {
- AssociationOverride override = getAssociationOverrideContainer().getAssociationOverrideNamed(name.substring(dotIndex + 1));
- if (override != null && !override.isVirtual()) {
- return override.getRelationshipReference();
- }
- }
- }
- return super.resolveRelationshipReference(name);
- }
-
- protected JavaAssociationOverride getJavaAssociationOverrideNamed(String attributeName) {
- if (getJavaEntity() != null) {
- return getJavaEntity().getAssociationOverrideContainer().getAssociationOverrideNamed(attributeName);
- }
- return null;
- }
-
- public String getName() {
- return (this.getSpecifiedName() == null) ? getDefaultName() : this.getSpecifiedName();
- }
-
- public String getSpecifiedName() {
- return this.specifiedName;
- }
-
- public void setSpecifiedName(String newSpecifiedName) {
- String oldSpecifiedName = this.specifiedName;
- this.specifiedName = newSpecifiedName;
- this.resourceTypeMapping.setName(newSpecifiedName);
- firePropertyChanged(SPECIFIED_NAME_PROPERTY, oldSpecifiedName, newSpecifiedName);
- }
-
- public String getDefaultName() {
- return this.defaultName;
- }
-
- protected void setDefaultName(String newDefaultName) {
- String oldDefaultName = this.defaultName;
- this.defaultName = newDefaultName;
- firePropertyChanged(DEFAULT_NAME_PROPERTY, oldDefaultName, newDefaultName);
- }
-
- public OrmTable getTable() {
- return this.table;
- }
-
- public ListIterator<OrmSecondaryTable> secondaryTables() {
- if (specifiedSecondaryTablesSize() > 0) {
- return specifiedSecondaryTables();
- }
- return virtualSecondaryTables();
- }
-
- public int secondaryTablesSize() {
- if (specifiedSecondaryTablesSize() > 0) {
- return specifiedSecondaryTablesSize();
- }
- return virtualSecondaryTablesSize();
- }
-
- public ListIterator<OrmSecondaryTable> virtualSecondaryTables() {
- return new CloneListIterator<OrmSecondaryTable>(this.virtualSecondaryTables);
- }
-
- public int virtualSecondaryTablesSize() {
- return this.virtualSecondaryTables.size();
- }
-
- protected void addVirtualSecondaryTable(OrmSecondaryTable secondaryTable) {
- addItemToList(secondaryTable, this.virtualSecondaryTables, OrmEntity.VIRTUAL_SECONDARY_TABLES_LIST);
- }
-
- protected void removeVirtualSecondaryTable(OrmSecondaryTable secondaryTable) {
- removeItemFromList(secondaryTable, this.virtualSecondaryTables, OrmEntity.VIRTUAL_SECONDARY_TABLES_LIST);
- }
-
- public ListIterator<OrmSecondaryTable> specifiedSecondaryTables() {
- return new CloneListIterator<OrmSecondaryTable>(this.specifiedSecondaryTables);
- }
-
- public int specifiedSecondaryTablesSize() {
- return this.specifiedSecondaryTables.size();
- }
-
- public OrmSecondaryTable addSpecifiedSecondaryTable(int index) {
- if (!secondaryTablesDefinedInXml()) {
- throw new IllegalStateException("Virtual secondary tables exist, must first call setSecondaryTablesDefinedInXml(true)"); //$NON-NLS-1$
- }
- XmlSecondaryTable secondaryTableResource = OrmFactory.eINSTANCE.createXmlSecondaryTable();
- OrmSecondaryTable secondaryTable = buildSecondaryTable(secondaryTableResource);
- this.specifiedSecondaryTables.add(index, secondaryTable);
- this.resourceTypeMapping.getSecondaryTables().add(index, secondaryTableResource);
- fireItemAdded(Entity.SPECIFIED_SECONDARY_TABLES_LIST, index, secondaryTable);
- return secondaryTable;
- }
-
- public OrmSecondaryTable addSpecifiedSecondaryTable() {
- return this.addSpecifiedSecondaryTable(this.specifiedSecondaryTables.size());
- }
-
- protected void addSpecifiedSecondaryTable(int index, OrmSecondaryTable secondaryTable) {
- addItemToList(index, secondaryTable, this.specifiedSecondaryTables, Entity.SPECIFIED_SECONDARY_TABLES_LIST);
- }
-
- protected void addSpecifiedSecondaryTable(OrmSecondaryTable secondaryTable) {
- this.addSpecifiedSecondaryTable(this.specifiedSecondaryTables.size(), secondaryTable);
- }
-
- public void removeSpecifiedSecondaryTable(SecondaryTable secondaryTable) {
- this.removeSpecifiedSecondaryTable(this.specifiedSecondaryTables.indexOf(secondaryTable));
- }
-
- public void removeSpecifiedSecondaryTable(int index) {
- OrmSecondaryTable removedSecondaryTable = this.specifiedSecondaryTables.remove(index);
- this.resourceTypeMapping.getSecondaryTables().remove(index);
- fireItemRemoved(Entity.SPECIFIED_SECONDARY_TABLES_LIST, index, removedSecondaryTable);
- }
-
- protected void removeSpecifiedSecondaryTable_(OrmSecondaryTable secondaryTable) {
- removeItemFromList(secondaryTable, this.specifiedSecondaryTables, Entity.SPECIFIED_SECONDARY_TABLES_LIST);
- }
-
- public void moveSpecifiedSecondaryTable(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.specifiedSecondaryTables, targetIndex, sourceIndex);
- this.resourceTypeMapping.getSecondaryTables().move(targetIndex, sourceIndex);
- fireItemMoved(Entity.SPECIFIED_SECONDARY_TABLES_LIST, targetIndex, sourceIndex);
- }
-
- public boolean containsSecondaryTable(String name) {
- return containsSecondaryTable(name, secondaryTables());
- }
-
- public boolean containsSpecifiedSecondaryTable(String name) {
- return containsSecondaryTable(name, specifiedSecondaryTables());
- }
-
- public boolean containsVirtualSecondaryTable(String name) {
- return containsSecondaryTable(name, virtualSecondaryTables());
- }
-
- public boolean containsVirtualSecondaryTable(OrmSecondaryTable secondaryTable) {
- return this.virtualSecondaryTables.contains(secondaryTable);
- }
-
- protected boolean containsSecondaryTable(String name, ListIterator<OrmSecondaryTable> secondaryTables) {
- for (OrmSecondaryTable secondaryTable : CollectionTools.iterable(secondaryTables)) {
- String secondaryTableName = secondaryTable.getName();
- if (secondaryTableName != null && secondaryTableName.equals(name)) {
- return true;
- }
- }
- return false;
- }
-
- public boolean secondaryTablesDefinedInXml() {
- return virtualSecondaryTablesSize() == 0;
- }
-
- public void setSecondaryTablesDefinedInXml(boolean defineInXml) {
- if (defineInXml == secondaryTablesDefinedInXml()) {
- return;
- }
- if (defineInXml) {
- specifySecondaryTablesInXml();
- }
- else {
- removeSecondaryTablesFromXml();
- }
- }
-
- /**
- * This is used to take all the java secondary tables and specify them in the xml. You must
- * use setSecondaryTablesDefinedInXml(boolean) before calling addSpecifiedSecondaryTable().
- *
- * Yes this code looks odd, but be careful making changes to it
- */
- protected void specifySecondaryTablesInXml() {
- if (virtualSecondaryTablesSize() != 0) {
- List<OrmSecondaryTable> virtualSecondaryTables1 = CollectionTools.list(this.virtualSecondaryTables());
- List<OrmSecondaryTable> virtualSecondaryTables2 = CollectionTools.list(this.virtualSecondaryTables());
- //remove all the virtual secondary tables without firing change notification.
- for (OrmSecondaryTable virtualSecondaryTable : CollectionTools.iterable(virtualSecondaryTables())) {
- this.virtualSecondaryTables.remove(virtualSecondaryTable);
- }
- //add specified secondary tables for each virtual secondary table. If the virtual secondary tables
- //are not removed first, they will be removed as a side effect of adding the first specified secondary table.
- //This screws up the change notification to the UI, since that change notification is in a different thread
- for (OrmSecondaryTable virtualSecondaryTable : virtualSecondaryTables2) {
- XmlSecondaryTable secondaryTableResource = OrmFactory.eINSTANCE.createXmlSecondaryTable();
- OrmSecondaryTable specifiedSecondaryTable = buildSecondaryTable(secondaryTableResource);
- this.specifiedSecondaryTables.add(specifiedSecondaryTable);
- this.resourceTypeMapping.getSecondaryTables().add(secondaryTableResource);
- specifiedSecondaryTable.initializeFrom(virtualSecondaryTable);
- }
- //fire change notification at the end
- fireItemsRemoved(OrmEntity.VIRTUAL_SECONDARY_TABLES_LIST, 0, virtualSecondaryTables1);
- fireItemsAdded(Entity.SPECIFIED_SECONDARY_TABLES_LIST, 0, this.specifiedSecondaryTables);
- }
- }
-
- protected void removeSecondaryTablesFromXml() {
- if (specifiedSecondaryTablesSize() != 0) {
- List<OrmSecondaryTable> specifiedSecondaryTablesCopy = CollectionTools.list(this.specifiedSecondaryTables());
- for (OrmSecondaryTable specifiedSecondaryTable : CollectionTools.iterable(specifiedSecondaryTables())) {
- int index = this.specifiedSecondaryTables.indexOf(specifiedSecondaryTable);
- this.specifiedSecondaryTables.remove(specifiedSecondaryTable);
- if (this.specifiedSecondaryTables.size() == 0) {
- initializeVirtualSecondaryTables();
- }
- this.resourceTypeMapping.getSecondaryTables().remove(index);
- }
- fireItemsRemoved(Entity.SPECIFIED_SECONDARY_TABLES_LIST, 0, specifiedSecondaryTablesCopy);
- if (this.virtualSecondaryTables.size() != 0) {
- fireItemsAdded(OrmEntity.VIRTUAL_SECONDARY_TABLES_LIST, 0, this.virtualSecondaryTables);
- }
- }
- }
-
- protected Iterator<String> tableNames(Iterator<Table> tables) {
- return new TransformationIterator<Table, String>(tables) {
- @Override
- protected String transform(Table t) {
- return t.getName();
- }
- };
- }
-
- public Iterator<String> associatedTableNamesIncludingInherited() {
- return this.nonNullTableNames(this.associatedTablesIncludingInherited());
- }
-
- protected Iterator<String> nonNullTableNames(Iterator<Table> tables) {
- return new FilteringIterator<String, String>(this.tableNames(tables)) {
- @Override
- protected boolean accept(String o) {
- return o != null;
- }
- };
- }
-
- public Iterator<Table> associatedTables() {
- return new CompositeIterator<Table>(this.table, this.secondaryTables());
- }
-
- public Iterator<Table> associatedTablesIncludingInherited() {
- return new CompositeIterator<Table>(new TransformationIterator<TypeMapping, Iterator<Table>>(this.inheritanceHierarchy()) {
- @Override
- protected Iterator<Table> transform(TypeMapping mapping) {
- return new FilteringIterator<Table, Table>(mapping.associatedTables()) {
- @Override
- protected boolean accept(Table o) {
- return true;
- //TODO
- //filtering these out so as to avoid the duplicate table, root and children share the same table
- //return !(o instanceof SingleTableInheritanceChildTableImpl);
- }
- };
- }
- });
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return ! CollectionTools.contains(this.associatedTableNamesIncludingInherited(), tableName);
- }
-
- @Override
- public boolean shouldValidateAgainstDatabase() {
- return super.shouldValidateAgainstDatabase() && ! isAbstractTablePerClass();
- }
-
- public InheritanceType getInheritanceStrategy() {
- return (this.getSpecifiedInheritanceStrategy() == null) ? this.getDefaultInheritanceStrategy() : this.getSpecifiedInheritanceStrategy();
- }
-
- public InheritanceType getDefaultInheritanceStrategy() {
- return this.defaultInheritanceStrategy;
- }
-
- protected void setDefaultInheritanceStrategy(InheritanceType newInheritanceType) {
- InheritanceType oldInheritanceType = this.defaultInheritanceStrategy;
- this.defaultInheritanceStrategy = newInheritanceType;
- firePropertyChanged(DEFAULT_INHERITANCE_STRATEGY_PROPERTY, oldInheritanceType, newInheritanceType);
- }
-
- public InheritanceType getSpecifiedInheritanceStrategy() {
- return this.specifiedInheritanceStrategy;
- }
-
- public void setSpecifiedInheritanceStrategy(InheritanceType newInheritanceType) {
- InheritanceType oldInheritanceType = this.specifiedInheritanceStrategy;
- this.specifiedInheritanceStrategy = newInheritanceType;
- if (oldInheritanceType != newInheritanceType) {
- if (this.getResourceInheritance() != null) {
- this.getResourceInheritance().setStrategy(InheritanceType.toOrmResourceModel(newInheritanceType));
- if (this.getResourceInheritance().isUnset()) {
- removeResourceInheritance();
- }
- }
- else if (newInheritanceType != null) {
- addResourceInheritance();
- getResourceInheritance().setStrategy(InheritanceType.toOrmResourceModel(newInheritanceType));
- }
- }
- firePropertyChanged(SPECIFIED_INHERITANCE_STRATEGY_PROPERTY, oldInheritanceType, newInheritanceType);
- }
-
- protected void setSpecifiedInheritanceStrategy_(InheritanceType newInheritanceType) {
- InheritanceType oldInheritanceType = this.specifiedInheritanceStrategy;
- this.specifiedInheritanceStrategy = newInheritanceType;
- firePropertyChanged(SPECIFIED_INHERITANCE_STRATEGY_PROPERTY, oldInheritanceType, newInheritanceType);
- }
-
- protected Inheritance getResourceInheritance() {
- return this.resourceTypeMapping.getInheritance();
- }
-
- protected void addResourceInheritance() {
- this.resourceTypeMapping.setInheritance(OrmFactory.eINSTANCE.createInheritance());
- }
-
- protected void removeResourceInheritance() {
- this.resourceTypeMapping.setInheritance(null);
- }
-
- public OrmDiscriminatorColumn getDiscriminatorColumn() {
- return this.discriminatorColumn;
- }
-
- public OrmGeneratorContainer getGeneratorContainer() {
- return this.generatorContainer;
- }
-
- public String getDefaultDiscriminatorValue() {
- return this.defaultDiscriminatorValue;
- }
-
- protected void setDefaultDiscriminatorValue(String newDefaultDiscriminatorValue) {
- String oldDefaultDiscriminatorValue = this.defaultDiscriminatorValue;
- this.defaultDiscriminatorValue = newDefaultDiscriminatorValue;
- firePropertyChanged(DEFAULT_DISCRIMINATOR_VALUE_PROPERTY, oldDefaultDiscriminatorValue, newDefaultDiscriminatorValue);
- }
-
- public String getSpecifiedDiscriminatorValue() {
- return this.specifiedDiscriminatorValue;
- }
-
- public void setSpecifiedDiscriminatorValue(String newSpecifiedDiscriminatorValue) {
- String oldSpecifiedDiscriminatorValue = this.specifiedDiscriminatorValue;
- this.specifiedDiscriminatorValue = newSpecifiedDiscriminatorValue;
- this.resourceTypeMapping.setDiscriminatorValue(newSpecifiedDiscriminatorValue);
- firePropertyChanged(SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY, oldSpecifiedDiscriminatorValue, newSpecifiedDiscriminatorValue);
- }
-
- public String getDiscriminatorValue() {
- return (this.getSpecifiedDiscriminatorValue() == null) ? getDefaultDiscriminatorValue() : this.getSpecifiedDiscriminatorValue();
- }
-
- public boolean specifiedDiscriminatorValueIsAllowed() {
- return this.specifiedDiscriminatorValueIsAllowed;
- }
-
- protected void setSpecifiedDiscriminatorValueIsAllowed(boolean specifiedDiscriminatorValueIsAllowed) {
- boolean old = this.specifiedDiscriminatorValueIsAllowed;
- this.specifiedDiscriminatorValueIsAllowed = specifiedDiscriminatorValueIsAllowed;
- firePropertyChanged(Entity.SPECIFIED_DISCRIMINATOR_VALUE_IS_ALLOWED_PROPERTY, old, specifiedDiscriminatorValueIsAllowed);
- }
-
- public boolean discriminatorValueIsUndefined() {
- return this.discriminatorValueIsUndefined;
- }
-
- protected void setDiscriminatorValueIsUndefined(boolean discriminatorValueIsUndefined) {
- boolean old = this.discriminatorValueIsUndefined;
- this.discriminatorValueIsUndefined = discriminatorValueIsUndefined;
- firePropertyChanged(Entity.DISCRIMINATOR_VALUE_IS_UNDEFINED_PROPERTY, old, discriminatorValueIsUndefined);
- }
-
- public boolean specifiedDiscriminatorColumnIsAllowed() {
- return this.specifiedDiscriminatorColumnIsAllowed;
- }
-
- protected void setSpecifiedDiscriminatorColumnIsAllowed(boolean specifiedDiscriminatorColumnIsAllowed) {
- boolean old = this.specifiedDiscriminatorColumnIsAllowed;
- this.specifiedDiscriminatorColumnIsAllowed = specifiedDiscriminatorColumnIsAllowed;
- firePropertyChanged(Entity.SPECIFIED_DISCRIMINATOR_COLUMN_IS_ALLOWED_PROPERTY, old, specifiedDiscriminatorColumnIsAllowed);
- }
-
- public boolean discriminatorColumnIsUndefined() {
- return this.discriminatorColumnIsUndefined;
- }
-
- protected void setDiscriminatorColumnIsUndefined(boolean discriminatorColumnIsUndefined) {
- boolean old = this.discriminatorColumnIsUndefined;
- this.discriminatorColumnIsUndefined = discriminatorColumnIsUndefined;
- firePropertyChanged(Entity.DISCRIMINATOR_COLUMN_IS_UNDEFINED_PROPERTY, old, discriminatorColumnIsUndefined);
- }
-
-
- public boolean specifiedTableIsAllowed() {
- return this.specifiedTableIsAllowed;
- }
-
- protected void setSpecifiedTableIsAllowed(boolean specifiedTableIsAllowed) {
- boolean old = this.specifiedTableIsAllowed;
- this.specifiedTableIsAllowed = specifiedTableIsAllowed;
- firePropertyChanged(Entity.SPECIFIED_TABLE_IS_ALLOWED_PROPERTY, old, specifiedTableIsAllowed);
- }
-
- public boolean tableIsUndefined() {
- return this.tableIsUndefined;
- }
-
- protected void setTableIsUndefined(boolean tableIsUndefined) {
- boolean old = this.tableIsUndefined;
- this.tableIsUndefined = tableIsUndefined;
- firePropertyChanged(Entity.TABLE_IS_UNDEFINED_PROPERTY, old, tableIsUndefined);
- }
-
- public ListIterator<OrmPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns() {
- return new CloneListIterator<OrmPrimaryKeyJoinColumn>(this.defaultPrimaryKeyJoinColumns);
- }
-
- public int defaultPrimaryKeyJoinColumnsSize() {
- return this.defaultPrimaryKeyJoinColumns.size();
- }
-
- public OrmPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn() {
- throw new UnsupportedOperationException("use defaultPrimaryKeyJoinColumns() instead"); //$NON-NLS-1$
- }
-
- protected void addDefaultPrimaryKeyJoinColumn(OrmPrimaryKeyJoinColumn defaultPkJoinColumn) {
- addItemToList(defaultPkJoinColumn, this.defaultPrimaryKeyJoinColumns, OrmEntity.DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- protected void removeDefaultPrimaryKeyJoinColumn(PrimaryKeyJoinColumn defaultPkJoinColumn) {
- removeItemFromList(defaultPkJoinColumn, this.defaultPrimaryKeyJoinColumns, OrmEntity.DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- public ListIterator<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
- return this.specifiedPrimaryKeyJoinColumns.isEmpty() ? this.defaultPrimaryKeyJoinColumns() : this.specifiedPrimaryKeyJoinColumns();
- }
-
- public int primaryKeyJoinColumnsSize() {
- return this.specifiedPrimaryKeyJoinColumns.isEmpty() ? this.defaultPrimaryKeyJoinColumnsSize() : this.specifiedPrimaryKeyJoinColumnsSize();
- }
-
- public ListIterator<OrmPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns() {
- return new CloneListIterator<OrmPrimaryKeyJoinColumn>(this.specifiedPrimaryKeyJoinColumns);
- }
-
- public int specifiedPrimaryKeyJoinColumnsSize() {
- return this.specifiedPrimaryKeyJoinColumns.size();
- }
-
- public boolean containsSpecifiedPrimaryKeyJoinColumns() {
- return !this.specifiedPrimaryKeyJoinColumns.isEmpty();
- }
-
- public OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
- if (!this.defaultPrimaryKeyJoinColumns.isEmpty()) {
- this.defaultPrimaryKeyJoinColumns.clear();
- }
- XmlPrimaryKeyJoinColumn resourcePkJoinColumn = OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumn();
- OrmPrimaryKeyJoinColumn contextPkJoinColumn = buildPrimaryKeyJoinColumn(resourcePkJoinColumn);
- this.specifiedPrimaryKeyJoinColumns.add(index, contextPkJoinColumn);
- this.resourceTypeMapping.getPrimaryKeyJoinColumns().add(index, resourcePkJoinColumn);
-
- this.fireItemAdded(Entity.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, contextPkJoinColumn);
- this.fireListCleared(OrmEntity.DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- return contextPkJoinColumn;
- }
-
- protected OrmBaseJoinColumn.Owner createPrimaryKeyJoinColumnOwner() {
- return new PrimaryKeyJoinColumnOwner();
- }
-
- protected void addSpecifiedPrimaryKeyJoinColumn(int index, OrmPrimaryKeyJoinColumn primaryKeyJoinColumn) {
- addItemToList(index, primaryKeyJoinColumn, this.specifiedPrimaryKeyJoinColumns, Entity.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- protected void addSpecifiedPrimaryKeyJoinColumn(OrmPrimaryKeyJoinColumn primaryKeyJoinColumn) {
- this.addSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.size(), primaryKeyJoinColumn);
- }
-
- public void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn primaryKeyJoinColumn) {
- this.removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.indexOf(primaryKeyJoinColumn));
- }
-
- public void removeSpecifiedPrimaryKeyJoinColumn(int index) {
- OrmPrimaryKeyJoinColumn removedPrimaryKeyJoinColumn = this.specifiedPrimaryKeyJoinColumns.remove(index);
- if (!containsSpecifiedPrimaryKeyJoinColumns()) {
- //create the defaultJoinColumn now or this will happen during project update
- //after removing the join column from the resource model. That causes problems
- //in the UI because the change notifications end up in the wrong order.
- initializeDefaultPrimaryKeyJoinColumns();
- }
- this.resourceTypeMapping.getPrimaryKeyJoinColumns().remove(index);
- fireItemRemoved(Entity.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, removedPrimaryKeyJoinColumn);
- if (!this.defaultPrimaryKeyJoinColumns.isEmpty()) {
- fireListChanged(OrmEntity.DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST, this.defaultPrimaryKeyJoinColumns);
- }
- }
-
- protected void removeSpecifiedPrimaryKeyJoinColumn_(OrmPrimaryKeyJoinColumn primaryKeyJoinColumn) {
- removeItemFromList(primaryKeyJoinColumn, this.specifiedPrimaryKeyJoinColumns, Entity.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.specifiedPrimaryKeyJoinColumns, targetIndex, sourceIndex);
- this.resourceTypeMapping.getPrimaryKeyJoinColumns().move(targetIndex, sourceIndex);
- fireItemMoved(Entity.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
- }
-
- public OrmAttributeOverrideContainer getAttributeOverrideContainer() {
- return this.attributeOverrideContainer;
- }
-
- public OrmAssociationOverrideContainer getAssociationOverrideContainer() {
- return this.associationOverrideContainer;
- }
-
- public OrmQueryContainer getQueryContainer() {
- return this.queryContainer;
- }
-
- public char getIdClassEnclosingTypeSeparator() {
- return '$';
- }
-
- public String getIdClass() {
- return this.idClass;
- }
-
- public void setIdClass(String newIdClass) {
- String oldIdClass = this.idClass;
- this.idClass = newIdClass;
- if (this.attributeValueHasChanged(oldIdClass, newIdClass)) {
- if (this.getResourceIdClass() != null) {
- this.getResourceIdClass().setClassName(newIdClass);
- if (this.getResourceIdClass().isUnset()) {
- removeResourceIdClass();
- }
- }
- else if (newIdClass != null) {
- addResourceIdClass();
- getResourceIdClass().setClassName(newIdClass);
- }
- }
- firePropertyChanged(ID_CLASS_PROPERTY, oldIdClass, newIdClass);
- }
-
- protected void setIdClass_(String newIdClass) {
- String oldIdClass = this.idClass;
- this.idClass = newIdClass;
- firePropertyChanged(ID_CLASS_PROPERTY, oldIdClass, newIdClass);
- }
-
- protected XmlIdClass getResourceIdClass() {
- return this.resourceTypeMapping.getIdClass();
- }
-
- protected void addResourceIdClass() {
- this.resourceTypeMapping.setIdClass(OrmFactory.eINSTANCE.createXmlIdClass());
- }
-
- protected void removeResourceIdClass() {
- this.resourceTypeMapping.setIdClass(null);
- }
-
- public Entity getParentEntity() {
- for (Iterator<PersistentType> stream = getPersistentType().ancestors(); stream.hasNext();) {
- TypeMapping tm = stream.next().getMapping();
- if (tm instanceof Entity) {
- return (Entity) tm;
- }
- }
- return null;
- }
-
- /**
- * Return the ultimate top of the inheritance hierarchy
- * This method should never return null. The root
- * is defined as the persistent type in the inheritance hierarchy
- * that has no parent. The root should be an entity
- *
- * Non-entities in the hierarchy should be ignored, ie skip
- * over them in the search for the root.
- */
- protected Entity getRootEntity() {
- return this.rootEntity;
- }
-
- public String getDefaultTableName() {
- JavaEntity javaEntity = this.getJavaEntity();
- if (javaEntity != null) {
- JavaTable javaTable = javaEntity.getTable();
- if ( ! this.isMetadataComplete()
- && ! this.table.isResourceSpecified()
- && javaTable.getSpecifiedName() != null) {
- return javaTable.getSpecifiedName();
- }
- }
- return this.isSingleTableDescendant() ?
- this.getRootEntity().getTable().getName()
- :
- this.isAbstractTablePerClass() ?
- null
- :
- this.getName();
- }
-
- public String getDefaultSchema() {
- JavaEntity javaEntity = this.getJavaEntity();
- if (javaEntity != null) {
- JavaTable javaTable = javaEntity.getTable();
- if ( ! this.isMetadataComplete()
- && ! this.table.isResourceSpecified()
- && javaTable.getSpecifiedSchema() != null) {
- return javaTable.getSpecifiedSchema();
- }
- }
-
- return this.isSingleTableDescendant() ?
- this.getRootEntity().getTable().getSchema()
- :
- this.isAbstractTablePerClass() ?
- null
- :
- this.getContextDefaultSchema();
- }
-
- public String getDefaultCatalog() {
- JavaEntity javaEntity = this.getJavaEntity();
- if (javaEntity != null) {
- JavaTable javaTable = javaEntity.getTable();
- if ( ! this.isMetadataComplete()
- && ! this.table.isResourceSpecified()
- && javaTable.getSpecifiedCatalog() != null) {
- return javaTable.getSpecifiedCatalog();
- }
- }
-
- return this.isSingleTableDescendant() ?
- this.getRootEntity().getTable().getCatalog()
- :
- this.isAbstractTablePerClass() ?
- null
- :
- this.getContextDefaultCatalog();
- }
-
- /**
- * 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 a descendant in (as opposed to the root of)
- * an inheritance hierarchy.
- */
- protected boolean isDescendant() {
- return ! this.isRoot();
- }
-
- /**
- * Return whether the entity is the top of an inheritance hierarchy.
- */
- protected boolean isRoot() {
- return this == this.getRootEntity();
- }
-
- /**
- * 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 isRoot() && !getPersistenceUnit().entityIsRootWithSubEntities(this.getName()) && getSpecifiedInheritanceStrategy() == null;
- }
-
- /**
- * Return whether the entity is abstract and is a part of a
- * "table per class" inheritance hierarchy.
- */
- protected boolean isAbstractTablePerClass() {
- return isAbstract() && 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 type is abstract, false if no java type exists.
- */
- protected boolean isAbstract() {
- JavaResourcePersistentType javaResourcePersistentType = getJavaResourcePersistentType();
- return javaResourcePersistentType == null ? false : javaResourcePersistentType.isAbstract();
- }
-
-// public String primaryKeyColumnName() {
-// String pkColumnName = null;
-// for (Iterator<IPersistentAttribute> stream = getPersistentType().allAttributes(); stream.hasNext();) {
-// IPersistentAttribute attribute = stream.next();
-// String name = attribute.primaryKeyColumnName();
-// if (pkColumnName == null) {
-// pkColumnName = name;
-// }
-// else if (name != null) {
-// // if we encounter a composite primary key, return null
-// return null;
-// }
-// }
-// // if we encounter only a single primary key column name, return it
-// return pkColumnName;
-// }
-//
-// public String primaryKeyAttributeName() {
-// String pkColumnName = null;
-// String pkAttributeName = null;
-// for (Iterator<IPersistentAttribute> stream = getPersistentType().allAttributes(); stream.hasNext();) {
-// IPersistentAttribute attribute = stream.next();
-// String name = attribute.primaryKeyColumnName();
-// if (pkColumnName == null) {
-// pkColumnName = name;
-// pkAttributeName = attribute.getName();
-// }
-// else if (name != null) {
-// // if we encounter a composite primary key, return null
-// return null;
-// }
-// }
-// // if we encounter only a single primary key column name, return it
-// return pkAttributeName;
-// }
-//
-
-
- public int getXmlSequence() {
- return 1;
- }
-
- /**
- * Return an iterator of Entities, each which inherits from the one before,
- * and terminates at the root entity (or at the point of cyclicity).
- */
- protected Iterator<TypeMapping> ancestors() {
- return new TransformationIterator<PersistentType, TypeMapping>(getPersistentType().ancestors()) {
- @Override
- protected TypeMapping transform(PersistentType type) {
- return type.getMapping();
- }
- };
- }
-
- @Override
- public Iterator<String> overridableAttributeNames() {
- if (!isTablePerClass()) {
- return EmptyIterator.instance();
- }
- return super.overridableAttributeNames();
- }
-
- @Override
- public Column resolveOverridenColumn(String attributeName) {
- if (getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
- int dotIndex = attributeName.indexOf('.');
- if (dotIndex != -1) {
- AttributeOverride override = getAttributeOverrideContainer().getAttributeOverrideNamed(attributeName.substring(dotIndex + 1));
- if (override != null && !override.isVirtual()) {
- return override.getColumn();
- }
- }
- }
- return super.resolveOverridenColumn(attributeName);
- }
-
- @Override
- public Iterator<String> overridableAssociationNames() {
- if (!isTablePerClass()) {
- return EmptyIterator.instance();
- }
- return super.overridableAssociationNames();
- }
-
- public AttributeMapping resolveAttributeMapping(String name) {
- for (AttributeMapping attributeMapping : CollectionTools.iterable(this.allAttributeMappings())) {
- AttributeMapping resolvedMapping = attributeMapping.resolveAttributeMapping(name);
- if (resolvedMapping != null) {
- return resolvedMapping;
- }
- }
- return null;
- }
-
-//
-// public IAttributeOverride createAttributeOverride(int index) {
-// return OrmFactory.eINSTANCE.createXmlAttributeOverride(new IEntity.AttributeOverrideOwner(this));
-// }
-//
-// public IAssociationOverride createAssociationOverride(int index) {
-// return OrmFactory.eINSTANCE.createXmlAssociationOverride(new IEntity.AssociationOverrideOwner(this));
-// }
-//
-// public IAttributeOverride attributeOverrideNamed(String name) {
-// return (IAttributeOverride) overrideNamed(name, getAttributeOverrides());
-// }
-//
-// public boolean containsAttributeOverride(String name) {
-// return containsOverride(name, getAttributeOverrides());
-// }
-//
-// public boolean containsSpecifiedAttributeOverride(String name) {
-// return containsOverride(name, getSpecifiedAttributeOverrides());
-// }
-//
-// public boolean containsAssociationOverride(String name) {
-// return containsOverride(name, getAssociationOverrides());
-// }
-//
-// public boolean containsSpecifiedAssociationOverride(String name) {
-// return containsOverride(name, getSpecifiedAssociationOverrides());
-// }
-//
-// private IOverride overrideNamed(String name, List<? extends IOverride> overrides) {
-// for (IOverride override : overrides) {
-// String overrideName = override.getName();
-// if (overrideName == null && name == null) {
-// return override;
-// }
-// if (overrideName != null && overrideName.equals(name)) {
-// return override;
-// }
-// }
-// return null;
-// }
-//
-// private boolean containsOverride(String name, List<? extends IOverride> overrides) {
-// return overrideNamed(name, overrides) != null;
-// }
-//
-// public boolean containsSpecifiedPrimaryKeyJoinColumns() {
-// return !this.getSpecifiedPrimaryKeyJoinColumns().isEmpty();
-// }
-
- protected void initializeInheritance(Inheritance inheritanceResource) {
- this.specifiedInheritanceStrategy = this.getResourceInheritanceStrategy(inheritanceResource);
- //no need to initialize defaultInheritanceStrategy, need to get all the persistentTypes in the model first
- }
-
- protected void initializeSpecifiedSecondaryTables() {
- for (XmlSecondaryTable secondaryTable : this.resourceTypeMapping.getSecondaryTables()) {
- this.specifiedSecondaryTables.add(buildSecondaryTable(secondaryTable));
- }
- }
-
- protected void initializeVirtualSecondaryTables() {
- if (isMetadataComplete()) {
- return;
- }
- if (getJavaEntity() == null) {
- return;
- }
- if (specifiedSecondaryTablesSize() > 0) {
- return;
- }
- ListIterator<JavaSecondaryTable> javaSecondaryTables = getJavaEntity().secondaryTables();
- while(javaSecondaryTables.hasNext()) {
- JavaSecondaryTable javaSecondaryTable = javaSecondaryTables.next();
- if (javaSecondaryTable.getName() != null) {
- this.virtualSecondaryTables.add(buildVirtualSecondaryTable(javaSecondaryTable));
- }
- }
- }
-
- protected void initializeDefaultPrimaryKeyJoinColumns() {
- if (isMetadataComplete()) {
- return;
- }
- if (getJavaEntity() == null) {
- this.defaultPrimaryKeyJoinColumns.add(buildPrimaryKeyJoinColumn(null));
- return;
- }
- if (specifiedPrimaryKeyJoinColumnsSize() > 0) {
- return;
- }
- ListIterator<JavaPrimaryKeyJoinColumn> javaPkJoinColumns = getJavaEntity().primaryKeyJoinColumns();
- while(javaPkJoinColumns.hasNext()) {
- JavaPrimaryKeyJoinColumn javaPkJoinColumn = javaPkJoinColumns.next();
- if (javaPkJoinColumn.getName() != null) {
- this.defaultPrimaryKeyJoinColumns.add(buildVirtualPrimaryKeyJoinColumn(javaPkJoinColumn));
- }
- }
- }
-
- protected void initializeSpecifiedPrimaryKeyJoinColumns() {
- for (XmlPrimaryKeyJoinColumn resourcePkJoinColumn : this.resourceTypeMapping.getPrimaryKeyJoinColumns()) {
- this.specifiedPrimaryKeyJoinColumns.add(buildPrimaryKeyJoinColumn(resourcePkJoinColumn));
- }
- }
-
- protected void initializeIdClass(XmlIdClass idClassResource) {
- this.idClass = this.getResourceIdClass(idClassResource);
- }
-
- protected String getResourceIdClass(XmlIdClass idClassResource) {
- return idClassResource == null ? null : idClassResource.getClassName();
- }
-
- @Override
- public void update() {
- super.update();
- this.setSpecifiedName(this.resourceTypeMapping.getName());
- this.setDefaultName(this.buildDefaultName());
- this.updateInheritance(this.getResourceInheritance());
- this.updateRootEntity();
- this.updateDiscriminatorColumn();
- this.updateDiscriminatorValue();
- this.setSpecifiedTableIsAllowed(this.buildSpecifiedTableIsAllowed());
- this.setTableIsUndefined(this.buildTableIsUndefined());
- this.table.update(this.resourceTypeMapping);
- this.updateSpecifiedSecondaryTables();
- this.updateVirtualSecondaryTables();
- this.generatorContainer.update();
- this.updateSpecifiedPrimaryKeyJoinColumns();
- this.updateDefaultPrimaryKeyJoinColumns();
- getAttributeOverrideContainer().update();
- getAssociationOverrideContainer().update();
- getQueryContainer().update();
- this.updateIdClass(this.getResourceIdClass());
- }
-
- @Override
- public void postUpdate() {
- super.postUpdate();
- this.postUpdateDiscriminatorColumn();
- this.postUpdateDiscriminatorValue();
- }
-
- protected String buildDefaultName() {
- if (!isMetadataComplete()) {
- JavaEntity javaEntity = getJavaEntity();
- if (javaEntity != null) {
- return javaEntity.getName();
- }
- }
- String className = getClass_();
- if (className != null) {
- return ClassTools.shortNameForClassNamed(className);
- }
- return null;
- }
-
- protected void updateDiscriminatorColumn() {
- this.setSpecifiedDiscriminatorColumnIsAllowed(this.buildSpecifiedDiscriminatorColumnIsAllowed());
- getDiscriminatorColumn().update(this.resourceTypeMapping);
- }
-
- protected void postUpdateDiscriminatorColumn() {
- this.setDiscriminatorColumnIsUndefined(this.buildDiscriminatorColumnIsUndefined());
- this.getDiscriminatorColumn().postUpdate();
- }
-
- protected void updateDiscriminatorValue() {
- this.setSpecifiedDiscriminatorValueIsAllowed(this.buildSpecifiedDiscriminatorValueIsAllowed());
- this.setSpecifiedDiscriminatorValue(this.resourceTypeMapping.getDiscriminatorValue());
- }
-
- protected void postUpdateDiscriminatorValue() {
- this.setDiscriminatorValueIsUndefined(this.buildDiscriminatorValueIsUndefined());
- this.setDefaultDiscriminatorValue(this.buildDefaultDiscriminatorValue());
- }
-
- /**
- * 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 (!isMetadataComplete() && getJavaEntity() != null) {
- return getJavaEntity().getDiscriminatorValue();
- }
- if (discriminatorValueIsUndefined()) {
- return null;
- }
- if (this.getDiscriminatorType() != DiscriminatorType.STRING) {
- return null;
- }
- return this.getName();
- }
-
- protected DiscriminatorType getDiscriminatorType() {
- return this.getDiscriminatorColumn().getDiscriminatorType();
- }
-
- protected JavaResourcePersistentType getJavaResourcePersistentType() {
- if (getPersistentType().getJavaPersistentType() != null) {
- return getPersistentType().getJavaPersistentType().getResourcePersistentType();
- }
- return null;
- }
-
- protected boolean buildSpecifiedDiscriminatorValueIsAllowed() {
- return !isTablePerClass() && !isAbstract();
- }
-
- protected boolean buildDiscriminatorValueIsUndefined() {
- return isTablePerClass() || isAbstract() || isRootNoDescendantsNoStrategyDefined();
- }
-
- protected boolean buildSpecifiedDiscriminatorColumnIsAllowed() {
- return !isTablePerClass() && isRoot();
- }
-
- protected boolean buildDiscriminatorColumnIsUndefined() {
- return isTablePerClass() || isRootNoDescendantsNoStrategyDefined();
- }
-
- protected boolean buildSpecifiedTableIsAllowed() {
- return !isAbstractTablePerClass() && !isSingleTableDescendant();
- }
-
- protected boolean buildTableIsUndefined() {
- return isAbstractTablePerClass();
- }
-
-
- protected void updateInheritance(Inheritance inheritanceResource) {
- this.setSpecifiedInheritanceStrategy_(this.getResourceInheritanceStrategy(inheritanceResource));
- this.setDefaultInheritanceStrategy(this.buildDefaultInheritanceStrategy());
- }
-
- protected void updateRootEntity() {
- //I am making an assumption here that we don't need property change notification for rootEntity, this might be wrong
- this.rootEntity = calculateRootEntity();
- if (this.rootEntity != this) {
- this.rootEntity.addSubEntity(this);
- }
- }
-
- protected Entity calculateRootEntity() {
- Entity root = this;
- for (Iterator<TypeMapping> stream = inheritanceHierarchy(); stream.hasNext();) {
- TypeMapping typeMapping = stream.next();
- if (typeMapping instanceof Entity) {
- root = (Entity) typeMapping;
- }
- }
- return root;
- }
-
- public void addSubEntity(Entity subEntity) {
- getPersistenceUnit().addRootEntityWithSubEntities(getName());
- }
-
- protected void updateSpecifiedSecondaryTables() {
- // make a copy of the XML tables (to prevent ConcurrentModificationException)
- Iterator<XmlSecondaryTable> xmlTables = new CloneIterator<XmlSecondaryTable>(this.resourceTypeMapping.getSecondaryTables());
-
- for (Iterator<OrmSecondaryTable> contextTables = this.specifiedSecondaryTables(); contextTables.hasNext(); ) {
- OrmSecondaryTable contextTable = contextTables.next();
- if (xmlTables.hasNext()) {
- contextTable.update(xmlTables.next());
- }
- else {
- removeSpecifiedSecondaryTable_(contextTable);
- }
- }
-
- while (xmlTables.hasNext()) {
- addSpecifiedSecondaryTable(buildSecondaryTable(xmlTables.next()));
- }
- }
-
- //if any secondary-tables are specified in the xml file, then all of the java secondaryTables are overriden
- protected void updateVirtualSecondaryTables() {
- ListIterator<OrmSecondaryTable> secondaryTables = virtualSecondaryTables();
- ListIterator<JavaSecondaryTable> javaSecondaryTables = EmptyListIterator.instance();
-
- if (getJavaEntity() != null && !isMetadataComplete() && specifiedSecondaryTablesSize() == 0) {
- javaSecondaryTables = getJavaEntity().secondaryTables();
- }
- while (secondaryTables.hasNext()) {
- OrmSecondaryTable virtualSecondaryTable = secondaryTables.next();
- if (javaSecondaryTables.hasNext()) {
- JavaSecondaryTable javaSecondaryTable = javaSecondaryTables.next();
- virtualSecondaryTable.update(new VirtualXmlSecondaryTable(javaSecondaryTable));
- }
- else {
- removeVirtualSecondaryTable(virtualSecondaryTable);
- }
- }
-
- while (javaSecondaryTables.hasNext()) {
- JavaSecondaryTable javaSecondaryTable = javaSecondaryTables.next();
- addVirtualSecondaryTable(buildVirtualSecondaryTable(javaSecondaryTable));
- }
- }
-
- protected OrmSecondaryTable buildSecondaryTable(XmlSecondaryTable xmlSecondaryTable) {
- return getXmlContextNodeFactory().buildOrmSecondaryTable(this, xmlSecondaryTable);
- }
-
- protected OrmSecondaryTable buildVirtualSecondaryTable(JavaSecondaryTable javaSecondaryTable) {
- return buildSecondaryTable(new VirtualXmlSecondaryTable(javaSecondaryTable));
- }
-
- protected InheritanceType getResourceInheritanceStrategy(Inheritance inheritanceResource) {
- if (inheritanceResource == null) {
- return null;
- }
- return InheritanceType.fromOrmResourceModel(inheritanceResource.getStrategy());
- }
-
- protected InheritanceType buildDefaultInheritanceStrategy() {
- if ((this.getResourceInheritance() == null)
- && ! this.isMetadataComplete()
- && (this.getJavaEntity() != null)) {
- return this.getJavaEntity().getInheritanceStrategy();
- }
- return this.isRoot() ? InheritanceType.SINGLE_TABLE : this.getRootEntity().getInheritanceStrategy();
- }
-
- protected void updateSpecifiedPrimaryKeyJoinColumns() {
- // make a copy of the XML join columns (to prevent ConcurrentModificationException)
- Iterator<XmlPrimaryKeyJoinColumn> xmlPkJoinColumns = new CloneIterator<XmlPrimaryKeyJoinColumn>(this.resourceTypeMapping.getPrimaryKeyJoinColumns());
-
- for (Iterator<OrmPrimaryKeyJoinColumn> contextPkJoinColumns = this.specifiedPrimaryKeyJoinColumns(); contextPkJoinColumns.hasNext(); ) {
- OrmPrimaryKeyJoinColumn contextPkJoinColumn = contextPkJoinColumns.next();
- if (xmlPkJoinColumns.hasNext()) {
- contextPkJoinColumn.update(xmlPkJoinColumns.next());
- }
- else {
- removeSpecifiedPrimaryKeyJoinColumn_(contextPkJoinColumn);
- }
- }
-
- while (xmlPkJoinColumns.hasNext()) {
- addSpecifiedPrimaryKeyJoinColumn(buildPrimaryKeyJoinColumn(xmlPkJoinColumns.next()));
- }
- }
-
- //if there are any specified pkJoinColumns, then no default pkJoinColumns
- //if the java has specified pkJoinColumns, then those are the default pkJoinColumns
- //otherwise, just 1 pkJoinColumn, defaults being null if multiple primaryKey columns
- protected void updateDefaultPrimaryKeyJoinColumns() {
- ListIterator<OrmPrimaryKeyJoinColumn> defaultPkJoinColumns = defaultPrimaryKeyJoinColumns();
- ListIterator<JavaPrimaryKeyJoinColumn> javaPkJoinColumns = EmptyListIterator.instance();
-
- if (getJavaEntity() != null && !isMetadataComplete() && specifiedPrimaryKeyJoinColumnsSize() == 0) {
- javaPkJoinColumns = getJavaEntity().primaryKeyJoinColumns();
- }
- while (defaultPkJoinColumns.hasNext()) {
- OrmPrimaryKeyJoinColumn defaultPkJoinColumn = defaultPkJoinColumns.next();
- if (javaPkJoinColumns.hasNext()) {
- JavaPrimaryKeyJoinColumn javaPkJoinColumn = javaPkJoinColumns.next();
- defaultPkJoinColumn.update(new VirtualXmlPrimaryKeyJoinColumn(javaPkJoinColumn));
- }
- else {
- if (defaultPrimaryKeyJoinColumnsSize() == 1) {
- defaultPkJoinColumn.update(null);
- }
- else {
- removeDefaultPrimaryKeyJoinColumn(defaultPkJoinColumn);
- }
- }
- }
-
- while (javaPkJoinColumns.hasNext()) {
- JavaPrimaryKeyJoinColumn javaPkJoinColumn = javaPkJoinColumns.next();
- addDefaultPrimaryKeyJoinColumn(buildVirtualPrimaryKeyJoinColumn(javaPkJoinColumn));
- }
-
- if (defaultPrimaryKeyJoinColumnsSize() == 0 && specifiedPrimaryKeyJoinColumnsSize() == 0) {
- addDefaultPrimaryKeyJoinColumn(buildPrimaryKeyJoinColumn(null));
- }
- }
-
- protected OrmPrimaryKeyJoinColumn buildVirtualPrimaryKeyJoinColumn(JavaPrimaryKeyJoinColumn javaSecondaryTable) {
- return buildPrimaryKeyJoinColumn(new VirtualXmlPrimaryKeyJoinColumn(javaSecondaryTable));
- }
-
- protected OrmPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(XmlPrimaryKeyJoinColumn resourcePkJoinColumn) {
- return getXmlContextNodeFactory().buildOrmPrimaryKeyJoinColumn(this, createPrimaryKeyJoinColumnOwner(), resourcePkJoinColumn);
- }
-
- protected void updateIdClass(XmlIdClass idClassResource) {
- this.setIdClass_(this.getResourceIdClass(idClassResource));
- }
-
-
- // *************************************************************************
-
- public String getPrimaryKeyColumnName() {
- return AbstractJavaEntity.getPrimaryKeyColumnName(this);
- }
-
- public PersistentAttribute getIdAttribute() {
- Iterator<PersistentAttribute> stream = this.allIdAttributes();
- if (stream.hasNext()) {
- PersistentAttribute attribute = stream.next();
- return stream.hasNext() ? null /*more than one*/: attribute;
- }
- return null;
- }
-
- protected Iterator<PersistentAttribute> allIdAttributes() {
- return new FilteringIterator<PersistentAttribute, PersistentAttribute>(this.getPersistentType().allAttributes()) {
- @Override
- protected boolean accept(PersistentAttribute pa) {
- return pa.isIdAttribute();
- }
- };
- }
-
- public void addToResourceModel(XmlEntityMappings entityMappings) {
- entityMappings.getEntities().add(this.resourceTypeMapping);
- }
-
- public void removeFromResourceModel(XmlEntityMappings entityMappings) {
- entityMappings.getEntities().remove(this.resourceTypeMapping);
- }
-
-
- // **************** validation *********************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
-
- this.validateTable(messages, reporter);
- this.validateId(messages);
- this.validateInheritance(messages, reporter);
- this.generatorContainer.validate(messages, reporter);
- this.queryContainer.validate(messages, reporter);
- this.attributeOverrideContainer.validate(messages, reporter);
- this.associationOverrideContainer.validate(messages, reporter);
-
- for (Iterator<OrmSecondaryTable> stream = this.secondaryTables(); stream.hasNext(); ) {
- stream.next().validate(messages, reporter);
- }
- }
-
- protected void validateTable(List<IMessage> messages, IReporter reporter) {
- if (isAbstractTablePerClass()) {
- if (this.table.isResourceSpecified()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ENTITY_ABSTRACT_TABLE_PER_CLASS_DEFINES_TABLE,
- new String[] {this.getName()},
- this,
- this.getTable().getValidationTextRange()
- )
- );
- }
- return;
- }
- if (isSingleTableDescendant()) {
- if (this.table.isResourceSpecified()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ENTITY_SINGLE_TABLE_DESCENDANT_DEFINES_TABLE,
- new String[] {this.getName()},
- this,
- this.getTable().getValidationTextRange()
- )
- );
- }
- return;
- }
- this.table.validate(messages, reporter);
- }
-
- protected void validateId(List<IMessage> messages) {
- if (this.hasNoIdMapping()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ENTITY_NO_ID,
- new String[] {this.getName()},
- this,
- this.getValidationTextRange()
- )
- );
- }
- }
-
- protected void validateInheritance(List<IMessage> messages, IReporter reporter) {
- validateInheritanceStrategy(messages);
- validateDiscriminatorColumn(messages, reporter);
- validateDiscriminatorValue(messages);
- }
-
- protected void validateDiscriminatorColumn(List<IMessage> messages, IReporter reporter) {
- if (specifiedDiscriminatorColumnIsAllowed() && !discriminatorColumnIsUndefined()) {
- getDiscriminatorColumn().validate(messages, reporter);
- }
- else if (getDiscriminatorColumn().isResourceSpecified()) {
- if (!isRoot()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ENTITY_NON_ROOT_DISCRIMINATOR_COLUMN_DEFINED,
- new String[] {this.getName()},
- this,
- this.getDiscriminatorColumnTextRange()
- )
- );
- }
- else if (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 (discriminatorValueIsUndefined() && getSpecifiedDiscriminatorValue() != null) {
- if (isAbstract()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.NORMAL_SEVERITY,
- JpaValidationMessages.ENTITY_ABSTRACT_DISCRIMINATOR_VALUE_DEFINED,
- new String[] {this.getName()},
- this,
- this.getDiscriminatorValueTextRange()
- )
- );
- }
- else if (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 = getJpaPlatformVariation().getTablePerConcreteClassInheritanceIsSupported();
- if (tablePerConcreteClassInheritanceIsSupported == Supported.YES) {
- return;
- }
- if ((getInheritanceStrategy() == InheritanceType.TABLE_PER_CLASS) && 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.resourceTypeMapping.getDiscriminatorValueTextRange();
- }
-
- protected TextRange getDiscriminatorColumnTextRange() {
- return this.resourceTypeMapping.getDiscriminatorColumn().getValidationTextRange();
- }
-
- protected TextRange getInheritanceStrategyTextRange() {
- return this.resourceTypeMapping.getInheritanceStrategyTextRange();
- }
-
- private boolean hasNoIdMapping() {
- return ! this.hasIdMapping();
- }
-
- private boolean hasIdMapping() {
- for (Iterator<PersistentAttribute> stream = this.getPersistentType().allAttributes(); stream.hasNext(); ) {
- if (stream.next().isIdAttribute()) {
- return true;
- }
- }
- return false;
- }
-
-
- class AssociationOverrideContainerOwner implements OrmAssociationOverrideContainer.Owner {
- public TypeMapping getOverridableTypeMapping() {
- return AbstractOrmEntity.this.getOverridableTypeMapping();
- }
-
- public OrmTypeMapping getTypeMapping() {
- return AbstractOrmEntity.this.getTypeMapping();
- }
-
- public RelationshipReference resolveRelationshipReference(String associationOverrideName) {
- if (!isMetadataComplete()) {
- JavaPersistentType javaPersistentType = getPersistentType().getJavaPersistentType();
- if (javaPersistentType != null) {
- RelationshipReference relationshipReference = javaPersistentType.getMapping().resolveRelationshipReference(associationOverrideName);
- if (relationshipReference != null) {
- return relationshipReference;
- }
- }
- }
- TypeMapping overridableTypeMapping = getOverridableTypeMapping();
- if (overridableTypeMapping != null) {
- for (TypeMapping typeMapping : CollectionTools.iterable(overridableTypeMapping.inheritanceHierarchy())) {
- RelationshipReference relationshipReference = typeMapping.resolveRelationshipReference(associationOverrideName);
- if (relationshipReference != null) {
- return relationshipReference;
- }
- }
- }
- return null;
- }
- }
-
- //********** OrmAttributeOverrideContainer.Owner implementation *********
-
- class AttributeOverrideContainerOwner implements OrmAttributeOverrideContainer.Owner {
- public TypeMapping getOverridableTypeMapping() {
- return AbstractOrmEntity.this.getOverridableTypeMapping();
- }
-
- public OrmTypeMapping getTypeMapping() {
- return AbstractOrmEntity.this.getTypeMapping();
- }
-
- public Column resolveOverridenColumn(String attributeOverrideName) {
- if (!isMetadataComplete()) {
- JavaPersistentType javaPersistentType = getPersistentType().getJavaPersistentType();
- if (javaPersistentType != null) {
- Column column = javaPersistentType.getMapping().resolveOverridenColumn(attributeOverrideName);
- if (column != null) {
- return column;
- }
- }
- }
- TypeMapping overridableTypeMapping = getOverridableTypeMapping();
- if (overridableTypeMapping != null) {
- for (TypeMapping typeMapping : CollectionTools.iterable(overridableTypeMapping.inheritanceHierarchy())) {
- Column column = typeMapping.resolveOverridenColumn(attributeOverrideName);
- if (column != null) {
- return column;
- }
- }
- }
- return null;
- }
-
- public XmlColumn buildVirtualXmlColumn(Column overridableColumn, String attributeName, boolean isMetadataComplete) {
- JavaAttributeOverride javaAttributeOverride = null;
- if (!isMetadataComplete) {
- javaAttributeOverride = getJavaAttributeOverrideNamed(attributeName);
- }
- if (javaAttributeOverride == null) {
- //TODO not the greatest solution here, but things seems to work, so I'm stepping away slowly
- if (overridableColumn instanceof JavaColumn) {
- return new VirtualXmlColumn(AbstractOrmEntity.this, overridableColumn);
- }
- return new VirtualXmlAttributeOverrideColumn(overridableColumn);
- }
- return new VirtualXmlColumn(AbstractOrmEntity.this, javaAttributeOverride.getColumn());
- }
- }
-
- class PrimaryKeyJoinColumnOwner implements OrmBaseJoinColumn.Owner
- {
- public TypeMapping getTypeMapping() {
- return AbstractOrmEntity.this;
- }
-
- public org.eclipse.jpt.db.Table getDbTable(String tableName) {
- return AbstractOrmEntity.this.getDbTable(tableName);
- }
-
- public org.eclipse.jpt.db.Table getReferencedColumnDbTable() {
- Entity parentEntity = AbstractOrmEntity.this.getParentEntity();
- return (parentEntity == null) ? null : parentEntity.getPrimaryDbTable();
- }
-
- public int joinColumnsSize() {
- return AbstractOrmEntity.this.primaryKeyJoinColumnsSize();
- }
-
- public boolean isVirtual(BaseJoinColumn joinColumn) {
- return AbstractOrmEntity.this.defaultPrimaryKeyJoinColumns.contains(joinColumn);
- }
-
- public String getDefaultColumnName() {
- if (joinColumnsSize() != 1) {
- return null;
- }
- Entity parentEntity = AbstractOrmEntity.this.getParentEntity();
- return (parentEntity == null) ? getPrimaryKeyColumnName() : parentEntity.getPrimaryKeyColumnName();
- }
-
- public TextRange getValidationTextRange() {
- // TODO Auto-generated method stub
- return null;
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmGenerator.java
deleted file mode 100644
index 25bcbf709c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmGenerator.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.Generator;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.java.JavaGenerator;
-import org.eclipse.jpt.core.context.orm.OrmGenerator;
-import org.eclipse.jpt.core.resource.orm.XmlGenerator;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.SchemaContainer;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- *
- */
-public abstract class AbstractOrmGenerator<T extends XmlGenerator>
- extends AbstractOrmXmlContextNode
- implements OrmGenerator
-{
-
- protected String name;
-
- protected Integer specifiedInitialValue;
- protected int defaultInitialValue;
-
- protected Integer specifiedAllocationSize;
- protected int defaultAllocationSize;
-
- protected T resourceGenerator;
-
-
- protected AbstractOrmGenerator(XmlContextNode parent) {
- super(parent);
- }
-
- protected T getResourceGenerator() {
- return this.resourceGenerator;
- }
-
-
- // ********** name **********
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- String old = this.name;
- this.name = name;
- this.getResourceGenerator().setName(name);
- this.firePropertyChanged(NAME_PROPERTY, old, 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) {
- Integer old = this.specifiedInitialValue;
- this.specifiedInitialValue = specifiedInitialValue;
- this.getResourceGenerator().setInitialValue(specifiedInitialValue);
- this.firePropertyChanged(SPECIFIED_INITIAL_VALUE_PROPERTY, old, 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);
- }
-
-
- // ********** 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) {
- Integer old = this.specifiedAllocationSize;
- this.specifiedAllocationSize = specifiedAllocationSize;
- this.getResourceGenerator().setAllocationSize(specifiedAllocationSize);
- this.firePropertyChanged(SPECIFIED_ALLOCATION_SIZE_PROPERTY, old, 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 Generator.DEFAULT_ALLOCATION_SIZE;
- }
-
- protected void setDefaultAllocationSize(int defaultAllocationSize) {
- int old = this.defaultAllocationSize;
- this.defaultAllocationSize = defaultAllocationSize;
- this.firePropertyChanged(DEFAULT_ALLOCATION_SIZE_PROPERTY, old, defaultAllocationSize);
- }
-
-
- // ********** text ranges **********
-
- public TextRange getValidationTextRange() {
- TextRange validationTextRange = this.getResourceGenerator().getValidationTextRange();
- return validationTextRange != null ? validationTextRange : getParent().getValidationTextRange();
- }
-
- public TextRange getNameTextRange() {
- TextRange nameTextRange = this.getResourceGenerator().getNameTextRange();
- return nameTextRange != null ? nameTextRange : getValidationTextRange();
- }
-
-
- // ********** resource => context **********
-
- protected void initialize(T xmlResourceGenerator) {
- this.resourceGenerator = xmlResourceGenerator;
- this.name = xmlResourceGenerator.getName();
- this.specifiedInitialValue = xmlResourceGenerator.getInitialValue();
- this.specifiedAllocationSize = xmlResourceGenerator.getAllocationSize();
- //TODO defaults
- }
-
- protected void update(T xmlResourceGenerator) {
- this.resourceGenerator = xmlResourceGenerator;
- this.setName_(xmlResourceGenerator.getName());
- this.setSpecifiedInitialValue_(xmlResourceGenerator.getInitialValue());
- this.setSpecifiedAllocationSize_(xmlResourceGenerator.getAllocationSize());
- getPersistenceUnit().addGenerator(this);
- //TODO defaults
- }
-
-
- // ********** 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.getDbCatalog(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.getDbCatalog(catalog);
- }
-
- protected abstract String getCatalog();
-
-
- // ********** misc **********
-
- public boolean isVirtual() {
- return getResourceGenerator().isVirtual();
- }
-
- @Override
- public XmlContextNode getParent() {
- return (XmlContextNode) super.getParent();
- }
-
- public boolean overrides(Generator generator) {
- if (getName() == null) {
- return false;
- }
- // this isn't ideal, but it will have to do until we have further adopter input
- return this.getName().equals(generator.getName()) && generator instanceof JavaGenerator;
- }
-
- public boolean duplicates(Generator other) {
- return (this != other)
- && ! StringTools.stringIsEmpty(this.name)
- && this.name.equals(other.getName())
- && ! this.overrides(other)
- && ! other.overrides(this);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- super.toString(sb);
- sb.append(this.name);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmIdMapping.java
deleted file mode 100644
index 42482043d8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmIdMapping.java
+++ /dev/null
@@ -1,337 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.List;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmColumn;
-import org.eclipse.jpt.core.context.orm.OrmColumnMapping;
-import org.eclipse.jpt.core.context.orm.OrmConverter;
-import org.eclipse.jpt.core.context.orm.OrmGeneratedValue;
-import org.eclipse.jpt.core.context.orm.OrmGeneratorContainer;
-import org.eclipse.jpt.core.context.orm.OrmIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.core.resource.orm.XmlGeneratedValue;
-import org.eclipse.jpt.core.resource.orm.XmlId;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractOrmIdMapping<T extends XmlId>
- extends AbstractOrmAttributeMapping<T>
- implements OrmIdMapping
-{
- protected final OrmColumn column;
-
- protected OrmGeneratedValue generatedValue;
-
- protected OrmConverter defaultConverter;
- protected OrmConverter specifiedConverter;
-
- protected final OrmGeneratorContainer generatorContainer;
-
-
- protected AbstractOrmIdMapping(OrmPersistentAttribute parent, T resourceMapping) {
- super(parent, resourceMapping);
- this.column = getXmlContextNodeFactory().buildOrmColumn(this, this);
- this.column.initialize(this.resourceAttributeMapping.getColumn());//TODO pass in to constructor
- this.generatorContainer = buildGeneratorContainer();
- this.initializeGeneratedValue();
- this.defaultConverter = getXmlContextNodeFactory().buildOrmNullConverter(this);
- this.specifiedConverter = this.buildSpecifiedConverter(this.getResourceConverterType());
- }
-
- protected OrmGeneratorContainer buildGeneratorContainer() {
- return getXmlContextNodeFactory().buildOrmGeneratorContainer(this, this.resourceAttributeMapping);
- }
-
- public String getKey() {
- return MappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
- }
-
- public int getXmlSequence() {
- return 0;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmIdMapping(this);
- }
-
- @Override
- public void initializeFromOrmColumnMapping(OrmColumnMapping oldMapping) {
- super.initializeFromOrmColumnMapping(oldMapping);
- getColumn().initializeFrom(oldMapping.getColumn());
- }
-
-
- public OrmColumn getColumn() {
- return this.column;
- }
-
- public OrmConverter getConverter() {
- return getSpecifiedConverter() == null ? getDefaultConverter() : getSpecifiedConverter();
- }
-
- public OrmConverter getDefaultConverter() {
- return this.defaultConverter;
- }
-
- public OrmConverter getSpecifiedConverter() {
- return this.specifiedConverter;
- }
-
- protected String getSpecifedConverterType() {
- if (this.specifiedConverter == null) {
- return Converter.NO_CONVERTER;
- }
- return this.specifiedConverter.getType();
- }
-
- public void setSpecifiedConverter(String converterType) {
- if (this.valuesAreEqual(getSpecifedConverterType(), converterType)) {
- return;
- }
- OrmConverter oldConverter = this.specifiedConverter;
- OrmConverter newConverter = buildSpecifiedConverter(converterType);
- this.specifiedConverter = null;
- if (oldConverter != null) {
- oldConverter.removeFromResourceModel();
- }
- this.specifiedConverter = newConverter;
- if (newConverter != null) {
- newConverter.addToResourceModel();
- }
- firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
- }
-
- protected void setSpecifiedConverter(OrmConverter newConverter) {
- OrmConverter oldConverter = this.specifiedConverter;
- this.specifiedConverter = newConverter;
- firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
- }
-
- public OrmGeneratedValue addGeneratedValue() {
- if (getGeneratedValue() != null) {
- throw new IllegalStateException("gemeratedValue already exists"); //$NON-NLS-1$
- }
- XmlGeneratedValue resourceGeneratedValue = OrmFactory.eINSTANCE.createXmlGeneratedValue();
- this.generatedValue = buildGeneratedValue(resourceGeneratedValue);
- this.resourceAttributeMapping.setGeneratedValue(resourceGeneratedValue);
- firePropertyChanged(GENERATED_VALUE_PROPERTY, null, this.generatedValue);
- return this.generatedValue;
- }
-
- public void removeGeneratedValue() {
- if (getGeneratedValue() == null) {
- throw new IllegalStateException("gemeratedValue does not exist, cannot be removed"); //$NON-NLS-1$
- }
- OrmGeneratedValue oldGeneratedValue = this.generatedValue;
- this.generatedValue = null;
- this.resourceAttributeMapping.setGeneratedValue(null);
- firePropertyChanged(GENERATED_VALUE_PROPERTY, oldGeneratedValue, null);
- }
-
- public OrmGeneratedValue getGeneratedValue() {
- return this.generatedValue;
- }
-
- protected void setGeneratedValue(OrmGeneratedValue newGeneratedValue) {
- OrmGeneratedValue oldGeneratedValue = this.generatedValue;
- this.generatedValue = newGeneratedValue;
- firePropertyChanged(GENERATED_VALUE_PROPERTY, oldGeneratedValue, newGeneratedValue);
- }
-
- public OrmGeneratorContainer getGeneratorContainer() {
- return this.generatorContainer;
- }
-
- @Override
- public String getPrimaryKeyColumnName() {
- return this.getColumn().getName();
- }
-
- @Override
- public boolean isOverridableAttributeMapping() {
- return true;
- }
-
- @Override
- public boolean isIdMapping() {
- return true;
- }
-
- public void addToResourceModel(Attributes resourceAttributes) {
- resourceAttributes.getIds().add(this.resourceAttributeMapping);
- }
-
- public void removeFromResourceModel(Attributes resourceAttributes) {
- resourceAttributes.getIds().remove(this.resourceAttributeMapping);
- }
-
- public Table getDbTable(String tableName) {
- return getTypeMapping().getDbTable(tableName);
- }
-
- public String getDefaultColumnName() {
- return getName();
- }
-
- public String getDefaultTableName() {
- return getTypeMapping().getPrimaryTableName();
- }
-
-
- protected void initializeGeneratedValue() {
- if (this.resourceAttributeMapping.getGeneratedValue() != null) {
- this.generatedValue = buildGeneratedValue(this.resourceAttributeMapping.getGeneratedValue());
- }
- }
-
- protected OrmGeneratedValue buildGeneratedValue(XmlGeneratedValue resourceGeneratedValue) {
- return getXmlContextNodeFactory().buildOrmGeneratedValue(this, resourceGeneratedValue);
- }
-
- @Override
- public void update() {
- super.update();
- this.column.update(getResourceColumn());
- this.generatorContainer.update();
- this.updateGeneratedValue();
- if (this.valuesAreEqual(getResourceConverterType(), getSpecifedConverterType())) {
- getSpecifiedConverter().update();
- }
- else {
- setSpecifiedConverter(buildSpecifiedConverter(getResourceConverterType()));
- }
- }
-
-
- protected void updateGeneratedValue() {
- if (this.resourceAttributeMapping.getGeneratedValue() == null) {
- if (getGeneratedValue() != null) {
- setGeneratedValue(null);
- }
- }
- else {
- if (getGeneratedValue() == null) {
- setGeneratedValue(buildGeneratedValue(this.resourceAttributeMapping.getGeneratedValue()));
- }
- else {
- getGeneratedValue().update(this.resourceAttributeMapping.getGeneratedValue());
- }
- }
- }
-
- protected OrmConverter buildSpecifiedConverter(String converterType) {
- if (this.valuesAreEqual(converterType, Converter.TEMPORAL_CONVERTER)) {
- return getXmlContextNodeFactory().buildOrmTemporalConverter(this, this.resourceAttributeMapping);
- }
- return null;
- }
-
- protected String getResourceConverterType() {
- if (this.resourceAttributeMapping.getTemporal() != null) {
- return Converter.TEMPORAL_CONVERTER;
- }
-
- return null;
- }
-
- //***************** XmlColumn.Owner implementation ****************
-
- public XmlColumn getResourceColumn() {
- return this.resourceAttributeMapping.getColumn();
- }
-
- public void addResourceColumn() {
- this.resourceAttributeMapping.setColumn(OrmFactory.eINSTANCE.createXmlColumn());
- }
-
- public void removeResourceColumn() {
- this.resourceAttributeMapping.setColumn(null);
- }
-
- // ****************** validation ****************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
-
- if (this.shouldValidateAgainstDatabase()) {
- this.validateColumn(messages);
- }
- if (this.generatedValue != null) {
- this.generatedValue.validate(messages, reporter);
- }
- this.generatorContainer.validate(messages, reporter);
- }
-
- protected void validateColumn(List<IMessage> messages) {
- OrmPersistentAttribute pa = this.getPersistentAttribute();
- String tableName = this.column.getTable();
- if (this.getTypeMapping().tableNameIsInvalid(tableName)) {
- if (pa.isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_TABLE,
- new String[] {pa.getName(), tableName, this.column.getName()},
- this.column,
- this.column.getTableTextRange()
- )
- );
- } else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_TABLE,
- new String[] {tableName, this.column.getName()},
- this.column,
- this.column.getTableTextRange()
- )
- );
- }
- return;
- }
-
- if ( ! this.column.isResolved() && this.column.getDbTable() != null) {
- if (pa.isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME,
- new String[] {pa.getName(), this.column.getName()},
- this.column,
- this.column.getNameTextRange()
- )
- );
- } else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {this.column.getName()},
- this.column,
- this.column.getNameTextRange()
- )
- );
- }
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinColumnJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinColumnJoiningStrategy.java
deleted file mode 100644
index c9b24e8b2f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinColumnJoiningStrategy.java
+++ /dev/null
@@ -1,409 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinColumnEnabledRelationshipReference;
-import org.eclipse.jpt.core.context.JoinColumnJoiningStrategy;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumnJoiningStrategy;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumnsMapping;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-import org.eclipse.jpt.utility.internal.iterators.SingleElementListIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractOrmJoinColumnJoiningStrategy
- extends AbstractOrmXmlContextNode
- implements OrmJoinColumnJoiningStrategy
-{
- protected OrmJoinColumn defaultJoinColumn;
-
- protected final Vector<OrmJoinColumn> specifiedJoinColumns = new Vector<OrmJoinColumn>();
-
- protected final OrmJoinColumn.Owner joinColumnOwner;
-
- protected XmlJoinColumnsMapping resource;
-
-
- protected AbstractOrmJoinColumnJoiningStrategy(
- JoinColumnEnabledRelationshipReference parent,
- XmlJoinColumnsMapping resource) {
- super(parent);
- this.resource = resource;
- this.joinColumnOwner = this.buildJoinColumnOwner();
- this.initializeSpecifiedJoinColumns();
- this.initializeDefaultJoinColumn();
- }
-
- public void initializeFrom(JoinColumnJoiningStrategy oldStrategy) {
- for (JoinColumn joinColumn : CollectionTools.iterable(oldStrategy.joinColumns())) {
- JoinColumn newJoinColumn = this.addSpecifiedJoinColumn(this.specifiedJoinColumnsSize());
- newJoinColumn.setSpecifiedName(joinColumn.getName());
- newJoinColumn.setSpecifiedReferencedColumnName(joinColumn.getReferencedColumnName());
- }
- }
-
- protected abstract OrmJoinColumn.Owner buildJoinColumnOwner();
-
- protected void initializeSpecifiedJoinColumns() {
- for (XmlJoinColumn resourceJoinColumn : this.resource.getJoinColumns()) {
- this.specifiedJoinColumns.add(buildJoinColumn(resourceJoinColumn));
- }
- }
-
- protected void initializeDefaultJoinColumn() {
- if (mayHaveDefaultJoinColumn()) {
- this.defaultJoinColumn = this.buildJoinColumn(null);
- }
- }
-
- @Override
- public JoinColumnEnabledRelationshipReference getParent() {
- return (JoinColumnEnabledRelationshipReference) super.getParent();
- }
-
- public JoinColumnEnabledRelationshipReference getRelationshipReference() {
- return this.getParent();
- }
-
- public RelationshipMapping getRelationshipMapping() {
- return this.getRelationshipReference().getRelationshipMapping();
- }
-
- public void addStrategy() {
- if (specifiedJoinColumnsSize() == 0) {
- addSpecifiedJoinColumn(0);
- }
- }
-
- public void removeStrategy() {
- for (JoinColumn each : CollectionTools.iterable(specifiedJoinColumns())) {
- removeSpecifiedJoinColumn(each);
- }
- }
-
-
- // **************** join columns *******************************************
-
- public ListIterator<OrmJoinColumn> joinColumns() {
- return this.hasSpecifiedJoinColumns() ?
- this.specifiedJoinColumns() : this.defaultJoinColumns();
- }
-
- public int joinColumnsSize() {
- return this.hasSpecifiedJoinColumns() ?
- this.specifiedJoinColumnsSize() : this.defaultJoinColumnsSize();
- }
-
-
- // **************** 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 ListIterator<OrmJoinColumn> defaultJoinColumns() {
- if (this.defaultJoinColumn != null) {
- return new SingleElementListIterator<OrmJoinColumn>(this.defaultJoinColumn);
- }
- return EmptyListIterator.instance();
- }
-
- protected int defaultJoinColumnsSize() {
- return (this.defaultJoinColumn == null) ? 0 : 1;
- }
-
-
- // **************** specified join columns *********************************
-
- public ListIterator<OrmJoinColumn> specifiedJoinColumns() {
- return new CloneListIterator<OrmJoinColumn>(this.specifiedJoinColumns);
- }
-
- public int specifiedJoinColumnsSize() {
- return this.specifiedJoinColumns.size();
- }
-
- public boolean hasSpecifiedJoinColumns() {
- return ! this.specifiedJoinColumns.isEmpty();
- }
-
- public OrmJoinColumn addSpecifiedJoinColumn(int index) {
- OrmJoinColumn oldDefaultJoinColumn = this.defaultJoinColumn;
- if (oldDefaultJoinColumn != null) {
- //null the default join column now if one already exists.
- //if one does not exist, there is already a specified join column.
- //Remove it now so that it doesn't get removed during an update and
- //cause change notifications to be sent to the UI in the wrong order
- this.defaultJoinColumn = null;
- }
- XmlJoinColumn resourceJoinColumn = OrmFactory.eINSTANCE.createXmlJoinColumn();
- OrmJoinColumn contextJoinColumn = this.buildJoinColumn(resourceJoinColumn);
- this.specifiedJoinColumns.add(index, contextJoinColumn);
- this.resource.getJoinColumns().add(index, resourceJoinColumn);
- this.fireItemAdded(SPECIFIED_JOIN_COLUMNS_LIST, index, contextJoinColumn);
- if (oldDefaultJoinColumn != null) {
- this.firePropertyChanged(DEFAULT_JOIN_COLUMN_PROPERTY, oldDefaultJoinColumn, null);
- }
- return contextJoinColumn;
- }
-
- protected void addSpecifiedJoinColumn(int index, OrmJoinColumn joinColumn) {
- this.addItemToList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- }
-
- protected void addSpecifiedJoinColumn(OrmJoinColumn joinColumn) {
- this.addSpecifiedJoinColumn(this.specifiedJoinColumns.size(), joinColumn);
- }
-
- public void removeSpecifiedJoinColumn(JoinColumn joinColumn) {
- this.removeSpecifiedJoinColumn(this.specifiedJoinColumns.indexOf(joinColumn));
- }
-
- public void removeSpecifiedJoinColumn(int index) {
- OrmJoinColumn removedJoinColumn = this.specifiedJoinColumns.remove(index);
- if (this.specifiedJoinColumns.isEmpty()) {
- //create the defaultJoinColumn now or this will happen during project update
- //after removing the join column from the resource model. That causes problems
- //in the UI because the change notifications end up in the wrong order.
- this.defaultJoinColumn = this.buildJoinColumn(null);
- }
- this.resource.getJoinColumns().remove(index);
- this.fireItemRemoved(SPECIFIED_JOIN_COLUMNS_LIST, index, removedJoinColumn);
- if (this.defaultJoinColumn != null) {
- //fire change notification if a defaultJoinColumn was created above
- this.firePropertyChanged(DEFAULT_JOIN_COLUMN_PROPERTY, null, this.defaultJoinColumn);
- }
- }
-
- protected void removeSpecifiedJoinColumn_(OrmJoinColumn joinColumn) {
- removeItemFromList(joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- }
-
- public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.specifiedJoinColumns, targetIndex, sourceIndex);
- this.resource.getJoinColumns().move(targetIndex, sourceIndex);
- fireItemMoved(SPECIFIED_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
- }
-
- protected OrmJoinColumn buildJoinColumn(XmlJoinColumn resourceJoinColumn) {
- return this.getXmlContextNodeFactory().buildOrmJoinColumn(this, this.joinColumnOwner, resourceJoinColumn);
- }
-
- // **************** resource => context ************************************
-
- public void update() {
- updateSpecifiedJoinColumns();
- updateDefaultJoinColumn();
- }
-
- protected void updateSpecifiedJoinColumns() {
- // make a copy of the XML join columns (to prevent ConcurrentModificationException)
- Iterator<XmlJoinColumn> xmlJoinColumns =
- new CloneIterator<XmlJoinColumn>(this.resource.getJoinColumns());
-
- for (Iterator<OrmJoinColumn> contextJoinColumns = this.specifiedJoinColumns();
- contextJoinColumns.hasNext(); ) {
- OrmJoinColumn contextJoinColumn = contextJoinColumns.next();
- if (xmlJoinColumns.hasNext()) {
- contextJoinColumn.update(xmlJoinColumns.next());
- }
- else {
- removeSpecifiedJoinColumn_(contextJoinColumn);
- }
- }
-
- while (xmlJoinColumns.hasNext()) {
- addSpecifiedJoinColumn(buildJoinColumn(xmlJoinColumns.next()));
- }
- }
-
- protected void updateDefaultJoinColumn() {
- if (mayHaveDefaultJoinColumn()) {
- if (this.defaultJoinColumn == null) {
- this.setDefaultJoinColumn(this.buildJoinColumn(null));
- } else {
- this.defaultJoinColumn.update(null);
- }
- } else {
- this.setDefaultJoinColumn(null);
- }
- }
-
- protected boolean mayHaveDefaultJoinColumn() {
- return getRelationshipReference().mayHaveDefaultJoinColumn()
- && ! hasSpecifiedJoinColumns();
- }
-
-
- // **************** validation *********************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- if (getRelationshipMapping().shouldValidateAgainstDatabase()) {
- for (Iterator<OrmJoinColumn> stream = this.joinColumns(); stream.hasNext(); ) {
- this.validateJoinColumn(stream.next(), messages);
- }
- }
- }
-
- protected void validateJoinColumn(OrmJoinColumn joinColumn, List<IMessage> messages) {
- if (getRelationshipMapping().getTypeMapping().tableNameIsInvalid(joinColumn.getTable())) {
- if (this.getRelationshipMapping().getPersistentAttribute().isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_TABLE,
- new String[] {getRelationshipMapping().getName(), joinColumn.getTable(), joinColumn.getName()},
- joinColumn,
- joinColumn.getTableTextRange()
- )
- );
- }
- else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_TABLE,
- new String[] {joinColumn.getTable(), joinColumn.getName()},
- joinColumn,
- joinColumn.getTableTextRange()
- )
- );
- }
- return;
- }
- validateJoinColumnName(joinColumn, messages);
- validationJoinColumnReferencedColumnName(joinColumn, messages);
- }
-
- protected void validateJoinColumnName(OrmJoinColumn joinColumn, List<IMessage> messages) {
- if ( ! joinColumn.isResolved() && joinColumn.getDbTable() != null) {
- if (joinColumn.getName() != null) {
- if (getRelationshipMapping().getPersistentAttribute().isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {getRelationshipMapping().getName(), joinColumn.getName()},
- joinColumn,
- joinColumn.getNameTextRange()
- )
- );
- } else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {joinColumn.getName()},
- joinColumn,
- joinColumn.getNameTextRange()
- )
- );
- }
- }
- else if (joinColumn.getOwner().joinColumnsSize() > 1) {
- if (getRelationshipMapping().getPersistentAttribute().isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_NAME_MULTIPLE_JOIN_COLUMNS,
- new String[] {getRelationshipMapping().getName()},
- joinColumn,
- joinColumn.getNameTextRange()
- )
- );
- }
- else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME_MULTIPLE_JOIN_COLUMNS,
- joinColumn,
- joinColumn.getNameTextRange()
- )
- );
- }
- }
- }
- }
-
- protected void validationJoinColumnReferencedColumnName(OrmJoinColumn joinColumn, List<IMessage> messages) {
- if ( ! joinColumn.isReferencedColumnResolved() && joinColumn.getReferencedColumnDbTable() != null) {
- if (joinColumn.getReferencedColumnName() != null) {
- if (getRelationshipMapping().getPersistentAttribute().isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME,
- new String[] {getRelationshipMapping().getName(), joinColumn.getReferencedColumnName(), joinColumn.getName()},
- joinColumn,
- joinColumn.getReferencedColumnNameTextRange()
- )
- );
- } else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME,
- new String[] {joinColumn.getReferencedColumnName(), joinColumn.getName()},
- joinColumn,
- joinColumn.getReferencedColumnNameTextRange()
- )
- );
- }
- }
- else if (joinColumn.getOwner().joinColumnsSize() > 1) {
- if (getRelationshipMapping().getPersistentAttribute().isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME_MULTIPLE_JOIN_COLUMNS,
- new String[] {getRelationshipMapping().getName(), joinColumn.getName()},
- joinColumn,
- joinColumn.getReferencedColumnNameTextRange()
- )
- );
- }
- else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME_MULTIPLE_JOIN_COLUMNS,
- joinColumn,
- joinColumn.getReferencedColumnNameTextRange()
- )
- );
- }
- }
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinTableJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinTableJoiningStrategy.java
deleted file mode 100644
index 8187e411d6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinTableJoiningStrategy.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.JoinTableEnabledRelationshipReference;
-import org.eclipse.jpt.core.context.JoinTableJoiningStrategy;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.orm.OrmJoinTable;
-import org.eclipse.jpt.core.context.orm.OrmJoinTableJoiningStrategy;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractOrmJoinTableJoiningStrategy
- extends AbstractOrmXmlContextNode
- implements OrmJoinTableJoiningStrategy
-{
- protected OrmJoinTable joinTable;
-
-
- protected AbstractOrmJoinTableJoiningStrategy(
- JoinTableEnabledRelationshipReference parent) {
- super(parent);
- }
-
- public void initializeFrom(JoinTableJoiningStrategy oldStrategy) {
- JoinTable oldJoinTable = (oldStrategy.getJoinTable());
- if (oldJoinTable != null) {
- this.addStrategy();
- this.getJoinTable().setSpecifiedCatalog(oldJoinTable.getSpecifiedCatalog());
- this.getJoinTable().setSpecifiedSchema(oldJoinTable.getSpecifiedSchema());
- this.getJoinTable().setSpecifiedName(oldJoinTable.getSpecifiedName());
- }
- }
-
- @Override
- public JoinTableEnabledRelationshipReference getParent() {
- return (JoinTableEnabledRelationshipReference) super.getParent();
- }
-
- public JoinTableEnabledRelationshipReference getRelationshipReference() {
- return this.getParent();
- }
-
- public RelationshipMapping getRelationshipMapping() {
- return this.getRelationshipReference().getRelationshipMapping();
- }
-
- public String getJoinTableDefaultName() {
- return MappingTools.buildJoinTableDefaultName(this.getRelationshipReference());
- }
-
- public void addStrategy() {
- if (this.joinTable == null) {
- XmlJoinTable resourceJoinTable = OrmFactory.eINSTANCE.createXmlJoinTable();
- this.joinTable = getXmlContextNodeFactory().buildOrmJoinTable(this, resourceJoinTable);
- setResourceJoinTable(resourceJoinTable);
- this.firePropertyChanged(JOIN_TABLE_PROPERTY, null, this.joinTable);
- }
- }
-
- public void removeStrategy() {
- if (this.joinTable != null) {
- OrmJoinTable oldJoinTable = this.joinTable;
- this.joinTable = null;
- removeResourceJoinTable();
- this.firePropertyChanged(JOIN_TABLE_PROPERTY, oldJoinTable, null);
- }
- }
-
- protected abstract void setResourceJoinTable(XmlJoinTable resourceJoinTable);
-
-
- // **************** join table *********************************************
-
- public OrmJoinTable getJoinTable() {
- return this.joinTable;
- }
-
- public OrmJoinTable addJoinTable() {
- addStrategy();
- return this.joinTable;
- }
-
- protected void setJoinTable_(OrmJoinTable newJoinTable) {
- OrmJoinTable oldJoinTable = this.joinTable;
- this.joinTable = newJoinTable;
- this.firePropertyChanged(JOIN_TABLE_PROPERTY, oldJoinTable, newJoinTable);
- }
-
- public XmlJoinTable addResourceJoinTable() {
- XmlJoinTable resourceJoinTable = OrmFactory.eINSTANCE.createXmlJoinTable();
- setResourceJoinTable(resourceJoinTable);
- return resourceJoinTable;
- }
-
- protected boolean mayHaveJoinTable() {
- return getResourceJoinTable() != null
- || getRelationshipReference().mayHaveDefaultJoinTable();
- }
-
-
- // **************** resource -> context ************************************
-
- protected void initialize() {
- if (mayHaveJoinTable()) {
- this.joinTable = getXmlContextNodeFactory().buildOrmJoinTable(this, getResourceJoinTable());
- }
- }
-
- public void update() {
- if (mayHaveJoinTable()) {
- if (this.joinTable == null) {
- setJoinTable_(getXmlContextNodeFactory().buildOrmJoinTable(this, getResourceJoinTable()));
- }
- this.joinTable.update();
- }
- else {
- if (this.joinTable != null) {
- // no resource, so no clean up
- setJoinTable_(null);
- }
- }
- }
-
-
- // **************** validation *********************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- if (this.joinTable != null && getRelationshipMapping().shouldValidateAgainstDatabase()) {
- this.joinTable.validate(messages, reporter);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmManyToManyMapping.java
deleted file mode 100644
index 8a047bd472..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmManyToManyMapping.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0, which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmManyToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmManyToManyRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipReference;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.core.resource.orm.XmlManyToMany;
-
-public abstract class AbstractOrmManyToManyMapping<T extends XmlManyToMany>
- extends AbstractOrmMultiRelationshipMapping<T>
- implements OrmManyToManyMapping
-{
- protected AbstractOrmManyToManyMapping(OrmPersistentAttribute parent, T resourceMapping) {
- super(parent, resourceMapping);
- }
-
-
- @Override
- protected OrmRelationshipReference buildRelationshipReference() {
- return new GenericOrmManyToManyRelationshipReference(this, this.resourceAttributeMapping);
- }
-
- public int getXmlSequence() {
- return 70;
- }
-
- public String getKey() {
- return MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmManyToManyMapping(this);
- }
-
- public void addToResourceModel(Attributes resourceAttributes) {
- resourceAttributes.getManyToManys().add(this.resourceAttributeMapping);
- }
-
- public void removeFromResourceModel(Attributes resourceAttributes) {
- resourceAttributes.getManyToManys().remove(this.resourceAttributeMapping);
- }
-
- @Override
- public OrmManyToManyRelationshipReference getRelationshipReference() {
- return (OrmManyToManyRelationshipReference) super.getRelationshipReference();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmManyToOneMapping.java
deleted file mode 100644
index 14f7359de7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmManyToOneMapping.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmManyToOneRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipReference;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmManyToOneMapping2_0;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.core.resource.orm.XmlManyToOne;
-
-
-public abstract class AbstractOrmManyToOneMapping<T extends XmlManyToOne>
- extends AbstractOrmSingleRelationshipMapping<T>
- implements OrmManyToOneMapping2_0
-{
- protected AbstractOrmManyToOneMapping(OrmPersistentAttribute parent, T resourceMapping) {
- super(parent, resourceMapping);
- }
-
-
- @Override
- protected OrmRelationshipReference buildRelationshipReference() {
- return new GenericOrmManyToOneRelationshipReference(this, this.resourceAttributeMapping);
- }
-
- public int getXmlSequence() {
- return 40;
- }
-
- public String getKey() {
- return MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmManyToOneMapping(this);
- }
-
- public void addToResourceModel(Attributes resourceAttributes) {
- resourceAttributes.getManyToOnes().add(this.resourceAttributeMapping);
- }
-
- public void removeFromResourceModel(Attributes resourceAttributes) {
- resourceAttributes.getManyToOnes().remove(this.resourceAttributeMapping);
- }
-
- @Override
- public OrmManyToOneRelationshipReference getRelationshipReference() {
- return (OrmManyToOneRelationshipReference) super.getRelationshipReference();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMappedSuperclass.java
deleted file mode 100644
index 8f492bc17c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMappedSuperclass.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.Iterator;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.java.JavaMappedSuperclass;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmMappedSuperclass;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.core.resource.orm.XmlIdClass;
-import org.eclipse.jpt.core.resource.orm.XmlMappedSuperclass;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-
-
-public abstract class AbstractOrmMappedSuperclass extends AbstractOrmTypeMapping<XmlMappedSuperclass>
- implements OrmMappedSuperclass
-{
- protected String idClass;
-
- protected AbstractOrmMappedSuperclass(OrmPersistentType parent, XmlMappedSuperclass resourceMapping) {
- super(parent, resourceMapping);
- this.idClass = this.getResourceIdClassName(this.getResourceIdClass());
- }
-
- public JavaMappedSuperclass getJavaMappedSuperclass() {
- JavaPersistentType javaPersistentType = this.getJavaPersistentType();
- if (javaPersistentType != null && javaPersistentType.getMappingKey() == MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY) {
- return (JavaMappedSuperclass) javaPersistentType.getMapping();
- }
- return null;
- }
-
- /**
- * This checks metaDataComplete before returning the JavaMappedSuperclass.
- * As far as defaults are concerned, if metadataComplete is true, the JavaMappedSuperclass is ignored.
- */
- protected JavaMappedSuperclass getJavaMappedSuperclassForDefaults() {
- if (isMetadataComplete()) {
- return null;
- }
- return getJavaMappedSuperclass();
- }
-
-
- public char getIdClassEnclosingTypeSeparator() {
- return '$';
- }
-
- public String getIdClass() {
- return this.idClass;
- }
-
- public void setIdClass(String newIdClass) {
- String oldIdClass = this.idClass;
- this.idClass = newIdClass;
- if (this.attributeValueHasChanged(oldIdClass, newIdClass)) {
- if (this.getResourceIdClass() != null) {
- this.getResourceIdClass().setClassName(newIdClass);
- if (this.getResourceIdClass().isUnset()) {
- removeResourceIdClass();
- }
- }
- else if (newIdClass != null) {
- addResourceIdClass();
- getResourceIdClass().setClassName(newIdClass);
- }
- }
- firePropertyChanged(ID_CLASS_PROPERTY, oldIdClass, newIdClass);
- }
-
- protected void setIdClass_(String newIdClass) {
- String oldIdClass = this.idClass;
- this.idClass = newIdClass;
- firePropertyChanged(ID_CLASS_PROPERTY, oldIdClass, newIdClass);
- }
-
- protected XmlIdClass getResourceIdClass() {
- return this.resourceTypeMapping.getIdClass();
- }
-
- protected void addResourceIdClass() {
- this.resourceTypeMapping.setIdClass(OrmFactory.eINSTANCE.createXmlIdClass());
- }
-
- protected void removeResourceIdClass() {
- this.resourceTypeMapping.setIdClass(null);
- }
-
- public String getKey() {
- return MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY;
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return false;
- }
-
- @Override
- public boolean shouldValidateAgainstDatabase() {
- return false;
- }
-
- public Iterator<String> associatedTableNamesIncludingInherited() {
- return EmptyIterator.instance();
- }
-
- public Iterator<Table> associatedTables() {
- return EmptyIterator.instance();
- }
-
- public Iterator<Table> associatedTablesIncludingInherited() {
- return EmptyIterator.instance();
- }
-
- public int getXmlSequence() {
- return 0;
- }
-
- public void addToResourceModel(XmlEntityMappings entityMappings) {
- entityMappings.getMappedSuperclasses().add(this.resourceTypeMapping);
- }
-
- public void removeFromResourceModel(XmlEntityMappings entityMappings) {
- entityMappings.getMappedSuperclasses().remove(this.resourceTypeMapping);
- }
-
- @Override
- public void update() {
- super.update();
- this.setIdClass_(this.getResourceIdClassName(this.getResourceIdClass()));
- }
-
- protected String getResourceIdClassName(XmlIdClass idClassResource) {
- return idClassResource == null ? null : idClassResource.getClassName();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
deleted file mode 100644
index 8a23c0d862..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.MultiRelationshipMapping;
-import org.eclipse.jpt.core.context.Orderable;
-import org.eclipse.jpt.core.context.orm.OrmMultiRelationshipMapping;
-import org.eclipse.jpt.core.context.orm.OrmOrderable;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.jpa2.context.java.JavaPersistentAttribute2_0;
-import org.eclipse.jpt.core.resource.orm.AbstractXmlMultiRelationshipMapping;
-import org.eclipse.jpt.core.resource.orm.MapKey;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * ORM multi-relationship (m:m, 1:m) mapping
- */
-public abstract class AbstractOrmMultiRelationshipMapping<T extends AbstractXmlMultiRelationshipMapping>
- extends AbstractOrmRelationshipMapping<T>
- implements OrmMultiRelationshipMapping
-{
- protected final OrmOrderable orderable;
-
- protected String specifiedMapKey;
- protected boolean noMapKey = false;
- protected boolean pkMapKey = false;
- protected boolean customMapKey = false;
-
- protected AbstractOrmMultiRelationshipMapping(OrmPersistentAttribute parent, T resourceMapping) {
- super(parent, resourceMapping);
- this.orderable = getXmlContextNodeFactory().buildOrmOrderable(this);
- this.initializeMapKey();
- }
-
- @Override
- public void update() {
- super.update();
- this.orderable.update();
- this.updateMapKey();
- }
-
- @Override
- protected String getResourceDefaultTargetEntity() {
- return this.getJavaPersistentAttribute().getMultiReferenceEntityTypeName();
- }
-
- public FetchType getDefaultFetch() {
- return MultiRelationshipMapping.DEFAULT_FETCH_TYPE;
- }
-
-
- // **************** order by ***********************************************
-
- public Orderable getOrderable() {
- return this.orderable;
- }
-
-
- // **************** 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$
- }
-
- public String getSpecifiedMapKey() {
- return this.specifiedMapKey;
- }
-
- public void setSpecifiedMapKey(String mapKey) {
- String old = this.specifiedMapKey;
- this.specifiedMapKey = mapKey;
- if (this.attributeValueHasChanged(old, mapKey)) {
- MapKey xmlMapKey = this.getXmlMapKey();
- if (mapKey == null) {
- if (xmlMapKey != null) {
- this.removeXmlMapKey();
- }
- } else {
- if (xmlMapKey == null) {
- xmlMapKey = this.addXmlMapKey();
- }
- xmlMapKey.setName(mapKey);
- }
- }
- this.firePropertyChanged(SPECIFIED_MAP_KEY_PROPERTY, old, mapKey);
- }
-
- protected void setSpecifiedMapKey_(String mapKey) {
- String old = this.specifiedMapKey;
- this.specifiedMapKey = mapKey;
- this.firePropertyChanged(SPECIFIED_MAP_KEY_PROPERTY, old, mapKey);
- }
-
- protected void initializeMapKey() {
- MapKey xmlMapKey = this.getXmlMapKey();
- if (xmlMapKey == null) {
- this.noMapKey = true;
- } else {
- this.specifiedMapKey = xmlMapKey.getName();
- if (this.specifiedMapKey == null) {
- this.pkMapKey = true;
- } else {
- this.customMapKey = true;
- }
- }
- }
-
- protected void updateMapKey() {
- MapKey xmlMapKey = this.getXmlMapKey();
- if (xmlMapKey == null) {
- this.setSpecifiedMapKey_(null);
- this.setNoMapKey_(true);
- this.setPkMapKey_(false);
- this.setCustomMapKey_(false);
- } else {
- String mk = xmlMapKey.getName();
- this.setSpecifiedMapKey_(mk);
- this.setNoMapKey_(false);
- this.setPkMapKey_(mk == null);
- this.setCustomMapKey_(mk != null);
- }
- }
-
- protected MapKey getXmlMapKey() {
- return this.resourceAttributeMapping.getMapKey();
- }
-
- protected MapKey addXmlMapKey() {
- MapKey mapKey = OrmFactory.eINSTANCE.createMapKey();
- this.resourceAttributeMapping.setMapKey(mapKey);
- return mapKey;
- }
-
- protected void removeXmlMapKey() {
- this.resourceAttributeMapping.setMapKey(null);
- }
-
- public Iterator<String> candidateMapKeyNames() {
- return this.allTargetEntityAttributeNames();
- }
-
-
- // **************** no map key ***********************************************
-
- public boolean isNoMapKey() {
- return this.noMapKey;
- }
-
- public void setNoMapKey(boolean noMapKey) {
- boolean old = this.noMapKey;
- this.noMapKey = noMapKey;
- if (noMapKey) {
- if (this.getXmlMapKey() != null) {
- this.removeXmlMapKey();
- }
- }
- this.firePropertyChanged(NO_MAP_KEY_PROPERTY, old, noMapKey);
- }
-
- protected void setNoMapKey_(boolean noMapKey) {
- boolean old = this.noMapKey;
- this.noMapKey = noMapKey;
- this.firePropertyChanged(NO_MAP_KEY_PROPERTY, old, noMapKey);
- }
-
-
- // **************** pk map key ***********************************************
-
- public boolean isPkMapKey() {
- return this.pkMapKey;
- }
-
- public void setPkMapKey(boolean pkMapKey) {
- boolean old = this.pkMapKey;
- this.pkMapKey = pkMapKey;
- MapKey xmlMapKey = this.getXmlMapKey();
- if (pkMapKey) {
- if (xmlMapKey == null) {
- this.addXmlMapKey();
- } else {
- xmlMapKey.setName(null);
- }
- }
- this.firePropertyChanged(PK_MAP_KEY_PROPERTY, old, pkMapKey);
- }
-
- protected void setPkMapKey_(boolean pkMapKey) {
- boolean old = this.pkMapKey;
- this.pkMapKey = pkMapKey;
- this.firePropertyChanged(PK_MAP_KEY_PROPERTY, old, pkMapKey);
- }
-
-
- // **************** custom map key ***********************************************
-
- public boolean isCustomMapKey() {
- return this.customMapKey;
- }
-
- public void setCustomMapKey(boolean customMapKey) {
- boolean old = this.customMapKey;
- this.customMapKey = customMapKey;
- if (customMapKey) {
- this.setSpecifiedMapKey(""); //$NON-NLS-1$
- }
- this.firePropertyChanged(CUSTOM_MAP_KEY_PROPERTY, old, customMapKey);
- }
-
- protected void setCustomMapKey_(boolean customMapKey) {
- boolean old = this.customMapKey;
- this.customMapKey = customMapKey;
- this.firePropertyChanged(CUSTOM_MAP_KEY_PROPERTY, old, customMapKey);
- }
-
-
- // ********** metamodel **********
-
- @Override
- protected String getMetamodelFieldTypeName() {
- return ((JavaPersistentAttribute2_0) this.getJavaPersistentAttribute()).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.getJavaPersistentAttribute()).getMetamodelContainerFieldMapKeyTypeName();
- if (keyTypeName != null) {
- typeArgumentNames.add(keyTypeName);
- }
- }
-
- public String getMetamodelFieldMapKeyTypeName() {
- return MappingTools.getMetamodelFieldMapKeyTypeName(this);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.orderable.validate(messages, reporter);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java
deleted file mode 100644
index 3adc4a367c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmNamedColumn;
-import org.eclipse.jpt.core.resource.orm.AbstractXmlNamedColumn;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.db.Table;
-
-
-public abstract class AbstractOrmNamedColumn<T extends AbstractXmlNamedColumn> extends AbstractOrmXmlContextNode
- implements OrmNamedColumn
-{
- protected Owner owner;
-
- protected String specifiedName;
-
- protected String defaultName;
-
- protected String columnDefinition;
-
- protected AbstractOrmNamedColumn(XmlContextNode parent, Owner owner) {
- super(parent);
- this.owner = owner;
- }
-
- @Override
- public XmlContextNode getParent() {
- return (XmlContextNode) super.getParent();
- }
-
- public void initializeFrom(NamedColumn oldColumn) {
- setSpecifiedName(oldColumn.getSpecifiedName());
- setColumnDefinition(oldColumn.getColumnDefinition());
- }
-
- protected abstract T getResourceColumn();
-
- protected abstract void removeResourceColumn();
-
- protected abstract void addResourceColumn();
-
- protected void removeResourceColumnIfFeaturesUnset() {
- if (this.getResourceColumn().isUnset()) {
- removeResourceColumn();
- }
- }
-
- public Owner getOwner() {
- return this.owner;
- }
-
- public String getName() {
- return (this.specifiedName != null) ? this.specifiedName : this.defaultName;
- }
-
- public String getSpecifiedName() {
- return this.specifiedName;
- }
-
- public void setSpecifiedName(String newSpecifiedName) {
- String oldSpecifiedName = this.specifiedName;
- this.specifiedName = newSpecifiedName;
- if (this.attributeValueHasChanged(oldSpecifiedName, newSpecifiedName)) {
- if (this.getResourceColumn() != null) {
- this.getResourceColumn().setName(newSpecifiedName);
- this.removeResourceColumnIfFeaturesUnset();
- }
- else if (newSpecifiedName != null) {
- addResourceColumn();
- getResourceColumn().setName(newSpecifiedName);
- }
- }
- firePropertyChanged(SPECIFIED_NAME_PROPERTY, oldSpecifiedName, newSpecifiedName);
- }
-
- protected void setSpecifiedName_(String newSpecifiedName) {
- String oldSpecifiedName = this.specifiedName;
- this.specifiedName = newSpecifiedName;
- firePropertyChanged(SPECIFIED_NAME_PROPERTY, oldSpecifiedName, newSpecifiedName);
- }
-
- public String getDefaultName() {
- return this.defaultName;
- }
-
- protected void setDefaultName(String newDefaultName) {
- String oldDefaultName = this.defaultName;
- this.defaultName = newDefaultName;
- firePropertyChanged(DEFAULT_NAME_PROPERTY, oldDefaultName, newDefaultName);
- }
-
- public String getColumnDefinition() {
- return this.columnDefinition;
- }
-
- public void setColumnDefinition(String newColumnDefinition) {
- String oldColumnDefinition = this.columnDefinition;
- this.columnDefinition = newColumnDefinition;
- if (this.attributeValueHasChanged(oldColumnDefinition, newColumnDefinition)) {
- if (this.getResourceColumn() != null) {
- this.getResourceColumn().setColumnDefinition(newColumnDefinition);
- this.removeResourceColumnIfFeaturesUnset();
- }
- else if (newColumnDefinition != null) {
- addResourceColumn();
- getResourceColumn().setColumnDefinition(newColumnDefinition);
- }
- }
- firePropertyChanged(COLUMN_DEFINITION_PROPERTY, oldColumnDefinition, newColumnDefinition);
- }
-
- protected void setColumnDefinition_(String newColumnDefinition) {
- String oldColumnDefinition = this.columnDefinition;
- this.columnDefinition = newColumnDefinition;
- firePropertyChanged(COLUMN_DEFINITION_PROPERTY, oldColumnDefinition, newColumnDefinition);
- }
-
- public Column getDbColumn() {
- Table table = this.getDbTable();
- return (table == null) ? null : table.getColumnForIdentifier(getName());
- }
-
- public Table getDbTable() {
- return getOwner().getDbTable(this.getOwningTableName());
- }
-
- protected String getOwningTableName() {
- return this.getOwner().getTypeMapping().getPrimaryTableName();
- }
-
- public boolean isResolved() {
- return getDbColumn() != null;
- }
-
- public TextRange getNameTextRange() {
- if (getResourceColumn() != null) {
- TextRange textRange = getResourceColumn().getNameTextRange();
- if (textRange != null) {
- return textRange;
- }
- }
- return getOwner().getValidationTextRange();
- }
-
- public TextRange getValidationTextRange() {
- TextRange textRange = getResourceColumn().getValidationTextRange();
- if (textRange != null) {
- return textRange;
- }
- return getOwner().getValidationTextRange();
- }
-
-
- // ******************* initialization from orm xml resource model ********************
-
- protected void initialize(T column) {
- this.specifiedName = this.getResourceColumnName(column);
- this.defaultName = this.buildDefaultName();
- this.columnDefinition = this.getResourceColumnDefinition(column);
- }
-
- protected void update(T column) {
- setSpecifiedName_(this.getResourceColumnName(column));
- setDefaultName(this.buildDefaultName());
- setColumnDefinition_(this.getResourceColumnDefinition(column));
- }
-
- protected String getResourceColumnName(T column) {
- return column == null ? null : column.getName();
- }
-
- protected String getResourceColumnDefinition(T column) {
- return column == null ? null : column.getColumnDefinition();
- }
-
- /**
- * Return the default column name.
- */
- protected String buildDefaultName() {
- return this.getOwner().getDefaultColumnName();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getName());
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmOneToManyMapping.java
deleted file mode 100644
index 6db06bcb26..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmOneToManyMapping.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0, which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmOneToManyRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOneToManyMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.core.resource.orm.XmlOneToMany;
-
-
-public abstract class AbstractOrmOneToManyMapping<T extends XmlOneToMany>
- extends AbstractOrmMultiRelationshipMapping<T>
- implements OrmOneToManyMapping2_0, OrmOrphanRemovalHolder2_0
-{
- protected final OrmOrphanRemovable2_0 orphanRemoval;
-
- // ********** constructor **********
- protected AbstractOrmOneToManyMapping(OrmPersistentAttribute parent, T resourceMapping) {
- super(parent, resourceMapping);
- this.orphanRemoval = ((OrmXml2_0ContextNodeFactory) getXmlContextNodeFactory()).buildOrmOrphanRemoval(this, resourceMapping);
- }
-
- // ********** update **********
-
- @Override
- public void update() {
- super.update();
- this.getOrphanRemoval().update();
- }
-
- public int getXmlSequence() {
- return 50;
- }
-
- public String getKey() {
- return MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmOneToManyMapping(this);
- }
-
- public void addToResourceModel(Attributes resourceAttributes) {
- resourceAttributes.getOneToManys().add(this.resourceAttributeMapping);
- }
-
- public void removeFromResourceModel(Attributes resourceAttributes) {
- resourceAttributes.getOneToManys().remove(this.resourceAttributeMapping);
- }
-
- @Override
- public OrmOneToManyRelationshipReference getRelationshipReference() {
- return (OrmOneToManyRelationshipReference) super.getRelationshipReference();
- }
-
- // ********** OrmOrphanRemovalHolder2_0 implementation **********
-
- public OrmOrphanRemovable2_0 getOrphanRemoval() {
- return this.orphanRemoval;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmOneToManyRelationshipReference.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmOneToManyRelationshipReference.java
deleted file mode 100644
index 09cf1d8505..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmOneToManyRelationshipReference.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.orm.OrmJoinTable;
-import org.eclipse.jpt.core.context.orm.OrmJoinTableEnabledRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmJoinTableJoiningStrategy;
-import org.eclipse.jpt.core.context.orm.OrmMappedByJoiningStrategy;
-import org.eclipse.jpt.core.context.orm.OrmOneToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmOneToManyRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmOwnableRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipReference;
-import org.eclipse.jpt.core.resource.orm.XmlOneToMany;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractOrmOneToManyRelationshipReference
- extends AbstractOrmRelationshipReference
- implements OrmOneToManyRelationshipReference
-{
- protected OrmMappedByJoiningStrategy mappedByJoiningStrategy;
-
- protected OrmJoinTableJoiningStrategy joinTableJoiningStrategy;
-
-
- protected AbstractOrmOneToManyRelationshipReference(
- OrmOneToManyMapping parent, XmlOneToMany resource) {
- super(parent, resource);
- }
-
-
- @Override
- protected void initializeJoiningStrategies() {
- this.mappedByJoiningStrategy = buildMappedByJoiningStrategy();
-
- // initialize join table last, as the existence of a default join
- // table is dependent on the other mechanisms (mappedBy)
- // not being specified
- this.joinTableJoiningStrategy = buildJoinTableJoiningStrategy();
- }
-
- protected OrmMappedByJoiningStrategy buildMappedByJoiningStrategy() {
- return new GenericOrmMappedByJoiningStrategy(this, getResourceMapping());
- }
-
- protected OrmJoinTableJoiningStrategy buildJoinTableJoiningStrategy() {
- return new GenericOrmJoinTableJoiningStrategy(this, getResourceMapping());
- }
-
- public void initializeOn(OrmRelationshipReference newRelationshipReference) {
- newRelationshipReference.initializeFromOwnableRelationshipReference(this);
- newRelationshipReference.initializeFromJoinTableEnabledRelationshipReference(this);
- }
-
- @Override
- public void initializeFromOwnableRelationshipReference(
- OrmOwnableRelationshipReference oldRelationshipReference) {
- super.initializeFromOwnableRelationshipReference(oldRelationshipReference);
- this.mappedByJoiningStrategy.setMappedByAttribute(
- oldRelationshipReference.getMappedByJoiningStrategy().getMappedByAttribute());
- }
-
- @Override
- public void initializeFromJoinTableEnabledRelationshipReference(
- OrmJoinTableEnabledRelationshipReference oldRelationshipReference) {
- super.initializeFromJoinTableEnabledRelationshipReference(oldRelationshipReference);
- OrmJoinTable oldTable =
- oldRelationshipReference.getJoinTableJoiningStrategy().getJoinTable();
- if (oldTable != null) {
- this.joinTableJoiningStrategy.addJoinTable().initializeFrom(oldTable);
- }
- }
-
- @Override
- public OrmOneToManyMapping getRelationshipMapping() {
- return (OrmOneToManyMapping) getParent();
- }
-
- public XmlOneToMany getResourceMapping() {
- return getRelationshipMapping().getResourceAttributeMapping();
- }
-
- public boolean isRelationshipOwner() {
- return this.getMappedByJoiningStrategy().getMappedByAttribute() == null;
- }
-
- public boolean isOwnedBy(RelationshipMapping mapping) {
- return this.mappedByJoiningStrategy.relationshipIsOwnedBy(mapping);
- }
-
-
- // **************** mapped by **********************************************
-
- public OrmMappedByJoiningStrategy getMappedByJoiningStrategy() {
- return this.mappedByJoiningStrategy;
- }
-
- public void setMappedByJoiningStrategy() {
- this.mappedByJoiningStrategy.addStrategy();
- this.joinTableJoiningStrategy.removeStrategy();
- }
-
- public void unsetMappedByJoiningStrategy() {
- this.mappedByJoiningStrategy.removeStrategy();
- }
-
- public boolean usesMappedByJoiningStrategy() {
- return this.getPredominantJoiningStrategy() == this.mappedByJoiningStrategy;
- }
-
- public boolean mayBeMappedBy(AttributeMapping mappedByMapping) {
- return mappedByMapping.getKey() == MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
-
- // **************** join table *********************************************
-
- public OrmJoinTableJoiningStrategy getJoinTableJoiningStrategy() {
- return this.joinTableJoiningStrategy;
- }
-
- public boolean usesJoinTableJoiningStrategy() {
- return getPredominantJoiningStrategy() == this.joinTableJoiningStrategy;
- }
-
- public void setJoinTableJoiningStrategy() {
- // join table is default, so no need to add to resource
- this.mappedByJoiningStrategy.removeStrategy();
- }
-
- public void unsetJoinTableJoiningStrategy() {
- this.joinTableJoiningStrategy.removeStrategy();
- }
-
- public boolean mayHaveDefaultJoinTable() {
- return this.mappedByJoiningStrategy.getMappedByAttribute() == null;
- }
-
-
- // **************** resource => context ************************************
-
- @Override
- protected void updateJoiningStrategies() {
- this.mappedByJoiningStrategy.update();
-
- // update join table last, as the existence of a default join
- // table is dependent on the other mechanisms (mappedBy)
- // not being specified
- this.joinTableJoiningStrategy.update();
- }
-
-
- // **************** Validation *********************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.mappedByJoiningStrategy.validate(messages, reporter);
- this.joinTableJoiningStrategy.validate(messages, reporter);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmOneToOneMapping.java
deleted file mode 100644
index 61456cc300..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmOneToOneMapping.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmOneToOneRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipReference;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOneToOneMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.core.resource.orm.XmlOneToOne;
-
-
-public abstract class AbstractOrmOneToOneMapping<T extends XmlOneToOne>
- extends AbstractOrmSingleRelationshipMapping<T>
- implements OrmOneToOneMapping2_0, OrmOrphanRemovalHolder2_0
-{
- protected final OrmOrphanRemovable2_0 orphanRemoval;
-
- // ********** constructor **********
- protected AbstractOrmOneToOneMapping(OrmPersistentAttribute parent, T resourceMapping) {
- super(parent, resourceMapping);
- this.orphanRemoval = ((OrmXml2_0ContextNodeFactory) getXmlContextNodeFactory()).buildOrmOrphanRemoval(this, resourceMapping);
- }
-
- // ********** update **********
-
- @Override
- public void update() {
- super.update();
- this.getOrphanRemoval().update();
- }
-
- @Override
- protected OrmRelationshipReference buildRelationshipReference() {
- return new GenericOrmOneToOneRelationshipReference(this, this.resourceAttributeMapping);
- }
-
- public int getXmlSequence() {
- return 60;
- }
-
- public String getKey() {
- return MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmOneToOneMapping(this);
- }
-
- public void addToResourceModel(Attributes resourceAttributes) {
- resourceAttributes.getOneToOnes().add(this.resourceAttributeMapping);
- }
-
- public void removeFromResourceModel(Attributes resourceAttributes) {
- resourceAttributes.getOneToOnes().remove(this.resourceAttributeMapping);
- }
-
- @Override
- public OrmOneToOneRelationshipReference getRelationshipReference() {
- return (OrmOneToOneRelationshipReference) super.getRelationshipReference();
- }
-
- // ********** OrmOrphanRemovalHolder2_0 implementation **********
-
- public OrmOrphanRemovable2_0 getOrphanRemoval() {
- return this.orphanRemoval;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmPersistentAttribute.java
deleted file mode 100644
index a44bcc569d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmPersistentAttribute.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.List;
-
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmStructureNodes;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * ORM persistent attribute
- */
-public abstract class AbstractOrmPersistentAttribute
- extends AbstractOrmXmlContextNode
- implements OrmPersistentAttribute
-{
- protected final Owner owner;
-
- protected OrmAttributeMapping attributeMapping;
-
- protected JavaPersistentAttribute javaPersistentAttribute;
-
- protected AccessType defaultAccess;
-
- protected AbstractOrmPersistentAttribute(OrmPersistentType parent, Owner owner, XmlAttributeMapping resourceMapping) {
- super(parent);
- this.owner = owner;
- this.attributeMapping = buildAttributeMapping(resourceMapping);
- this.javaPersistentAttribute = findJavaPersistentAttribute();
- this.defaultAccess = buildDefaultAccess();
- }
-
- public XmlAttributeMapping getResourceAttributeMapping() {
- return this.attributeMapping.getResourceAttributeMapping();
- }
-
- public JavaPersistentAttribute getJavaPersistentAttribute() {
- return this.javaPersistentAttribute;
- }
-
- protected void setJavaPersistentAttribute(JavaPersistentAttribute javaPersistentAttribute) {
- JavaPersistentAttribute old = this.javaPersistentAttribute;
- this.javaPersistentAttribute = javaPersistentAttribute;
- this.firePropertyChanged(JAVA_PERSISTENT_ATTRIBUTE_PROPERTY, old, javaPersistentAttribute);
- }
-
- protected OrmAttributeMapping buildAttributeMapping(XmlAttributeMapping resourceMapping) {
- OrmAttributeMappingDefinition mappingDefinition =
- getMappingFileDefinition().getOrmAttributeMappingDefinition(resourceMapping.getMappingKey());
- return mappingDefinition.buildContextMapping(this, resourceMapping, getXmlContextNodeFactory());
- }
-
- public String getId() {
- return OrmStructureNodes.PERSISTENT_ATTRIBUTE_ID;
- }
-
- public AccessType getAccess() {
- return getSpecifiedAccess() != null ? getSpecifiedAccess() : getDefaultAccess();
- }
-
- public AccessType getDefaultAccess() {
- return this.defaultAccess;
- }
-
- protected void setDefaultAccess(AccessType newAccess) {
- AccessType old = this.defaultAccess;
- this.defaultAccess = newAccess;
- firePropertyChanged(DEFAULT_ACCESS_PROPERTY, old, this.defaultAccess);
- }
-
- public String getName() {
- return this.attributeMapping.getName();
- }
-
- public void nameChanged(String oldName, String newName) {
- firePropertyChanged(NAME_PROPERTY, oldName, newName);
- }
-
- public OrmAttributeMapping getSpecifiedMapping() {
- return this.attributeMapping;
- }
-
- public OrmAttributeMapping getMapping() {
- return this.attributeMapping;
- }
-
- public String getMappingKey() {
- return this.attributeMapping.getKey();
- }
-
- public String getDefaultMappingKey() {
- return null;
- }
-
- public void setSpecifiedMappingKey(String newMappingKey) {
- if (this.valuesAreEqual(this.getMappingKey(), newMappingKey)) {
- return;
- }
- OrmAttributeMapping oldMapping = this.attributeMapping;
- OrmAttributeMappingDefinition mappingDefinition =
- getMappingFileDefinition().getOrmAttributeMappingDefinition(newMappingKey);
- XmlAttributeMapping resourceAttributeMapping =
- mappingDefinition.buildResourceMapping(getResourceNodeFactory());
- this.attributeMapping = buildAttributeMapping(resourceAttributeMapping);
-
- getPersistentType().changeMapping(this, oldMapping, this.attributeMapping);
- firePropertyChanged(SPECIFIED_MAPPING_PROPERTY, oldMapping, this.attributeMapping);
- }
-
- public OrmPersistentType getPersistentType() {
- return (OrmPersistentType) getParent();
- }
-
- public OrmTypeMapping getTypeMapping() {
- return getPersistentType().getMapping();
- }
-
- public boolean isVirtual() {
- return getPersistentType().containsVirtualAttribute(this);
- }
-
- public void makeVirtual() {
- if (isVirtual()) {
- throw new IllegalStateException("Attribute is already virtual"); //$NON-NLS-1$
- }
- getPersistentType().makeAttributeVirtual(this);
- }
-
- public void makeSpecified() {
- if (!isVirtual()) {
- throw new IllegalStateException("Attribute is already specified"); //$NON-NLS-1$
- }
- if (getMappingKey() == MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY) {
- throw new IllegalStateException("Use makeSpecified(String) instead and specify a mapping type"); //$NON-NLS-1$
- }
- getPersistentType().makeAttributeSpecified(this);
- }
-
- public void makeSpecified(String mappingKey) {
- if (!isVirtual()) {
- throw new IllegalStateException("Attribute is already specified"); //$NON-NLS-1$
- }
- getPersistentType().makeAttributeSpecified(this, mappingKey);
- }
-
- public String getPrimaryKeyColumnName() {
- return this.attributeMapping.getPrimaryKeyColumnName();
- }
-
- public boolean isIdAttribute() {
- return this.attributeMapping.isIdMapping();
- }
-
- public void update() {
- this.attributeMapping.update();
- this.setJavaPersistentAttribute(findJavaPersistentAttribute());
- this.owner.updateJavaPersistentAttribute();
- this.setDefaultAccess(buildDefaultAccess());
- }
-
- @Override
- public void postUpdate() {
- super.postUpdate();
- getMapping().postUpdate();
- }
-
- protected JavaPersistentAttribute findJavaPersistentAttribute() {
- return this.owner.findJavaPersistentAttribute(this);
- }
-
- protected AccessType buildDefaultAccess() {
- return getPersistentType().getAccess();
- }
-
- public JpaStructureNode getStructureNode(int offset) {
- return this;
- }
-
- public boolean contains(int textOffset) {
- if (isVirtual()) {
- return false;
- }
- return this.attributeMapping.contains(textOffset);
- }
-
- public TextRange getSelectionTextRange() {
- if (isVirtual()) {
- return null;
- }
- return this.attributeMapping.getSelectionTextRange();
- }
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.validateAttribute(messages);
- this.validateModifiers(messages);
- this.attributeMapping.validate(messages, reporter);
- }
-
- protected void validateAttribute(List<IMessage> messages) {
- if (this.javaPersistentAttribute == null) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENT_ATTRIBUTE_UNRESOLVED_NAME,
- new String[] {this.getName(), this.getPersistentType().getMapping().getClass_()},
- this.attributeMapping,
- this.attributeMapping.getNameTextRange()
- )
- );
- }
- }
-
- protected void validateModifiers(List<IMessage> messages) {
- if (this.getMappingKey() == MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY) {
- return;
- }
- if (this.javaPersistentAttribute == null) {
- return;
- }
-
- if (this.javaPersistentAttribute.isField()) {
- if (this.javaPersistentAttribute.isFinal()) {
- messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_FIELD));
- }
- if (this.javaPersistentAttribute.isPublic()) {
- messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_PUBLIC_FIELD));
- }
- } else {
- //TODO validation : need to have a validation message for final methods as well.
- //From the JPA spec : No methods or persistent instance variables of the entity class may be final.
- }
- }
-
- protected IMessage buildAttributeMessage(String msgID) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- msgID,
- new String[] {this.getName()},
- this,
- getValidationTextRange()
- );
- }
-
- public TextRange getValidationTextRange() {
- if (isVirtual()) {
- return getPersistentType().getMapping().getAttributesTextRange();
- }
- return this.attributeMapping.getValidationTextRange();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getName());
- }
-
- public void dispose() {
- //nothing to dispose
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmQuery.java
deleted file mode 100644
index fe9aedf3e6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmQuery.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.jpt.core.context.Query;
-import org.eclipse.jpt.core.context.QueryHint;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.java.JavaQuery;
-import org.eclipse.jpt.core.context.orm.OrmQuery;
-import org.eclipse.jpt.core.context.orm.OrmQueryHint;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlQuery;
-import org.eclipse.jpt.core.resource.orm.XmlQueryHint;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-
-public abstract class AbstractOrmQuery<E extends XmlQuery> extends AbstractOrmXmlContextNode
- implements OrmQuery
-{
-
- protected String name;
-
- protected String query;
-
- protected final List<OrmQueryHint> hints;
-
- protected E resourceQuery;
-
- protected AbstractOrmQuery(XmlContextNode parent, E resourceQuery) {
- super(parent);
- this.hints = new ArrayList<OrmQueryHint>();
- this.initialize(resourceQuery);
- }
-
- protected E getResourceQuery() {
- return this.resourceQuery;
- }
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String newName) {
- String oldName = this.name;
- this.name = newName;
- this.getResourceQuery().setName(newName);
- firePropertyChanged(Query.NAME_PROPERTY, oldName, newName);
- }
-
- public String getQuery() {
- return this.query;
- }
-
- public void setQuery(String newQuery) {
- String oldQuery = this.query;
- this.query = newQuery;
- this.getResourceQuery().setQuery(newQuery);
- firePropertyChanged(Query.QUERY_PROPERTY, oldQuery, newQuery);
- }
-
- public ListIterator<OrmQueryHint> hints() {
- return new CloneListIterator<OrmQueryHint>(this.hints);
- }
-
- public int hintsSize() {
- return this.hints.size();
- }
-
- public OrmQueryHint addHint(int index) {
- XmlQueryHint resourceQueryHint = OrmFactory.eINSTANCE.createXmlQueryHint();
- OrmQueryHint contextQueryHint = buildQueryHint(resourceQueryHint);
- this.hints.add(index, contextQueryHint);
- this.getResourceQuery().getHints().add(index, resourceQueryHint);
- this.fireItemAdded(Query.HINTS_LIST, index, contextQueryHint);
- return contextQueryHint;
- }
-
- protected void addHint(int index, OrmQueryHint queryHint) {
- addItemToList(index, queryHint, this.hints, Query.HINTS_LIST);
- }
-
- protected void addHint(OrmQueryHint queryHint) {
- this.addHint(this.hints.size(), queryHint);
- }
-
- public void removeHint(QueryHint queryHint) {
- removeHint(this.hints.indexOf(queryHint));
- }
-
- public void removeHint(int index) {
- OrmQueryHint queryHint = this.hints.remove(index);
- this.getResourceQuery().getHints().remove(index);
- fireItemRemoved(Query.HINTS_LIST, index, queryHint);
- }
-
- protected void removeHint_(OrmQueryHint queryHint) {
- removeItemFromList(queryHint, this.hints, Query.HINTS_LIST);
- }
-
- public void moveHint(int targetIndex, int sourceIndex) {
- this.getResourceQuery().getHints().move(targetIndex, sourceIndex);
- moveItemInList(targetIndex, sourceIndex, this.hints, Query.HINTS_LIST);
- }
-
-
- protected void initialize(E xmlQuery) {
- this.resourceQuery = xmlQuery;
- this.name = xmlQuery.getName();
- this.query = xmlQuery.getQuery();
- this.initializeHints();
- }
-
- protected void initializeHints() {
- for (XmlQueryHint resourceQueryHint : this.resourceQuery.getHints()) {
- this.hints.add(buildQueryHint(resourceQueryHint));
- }
- }
-
- protected OrmQueryHint buildQueryHint(XmlQueryHint resourceQueryHint) {
- return getXmlContextNodeFactory().buildOrmQueryHint(this, resourceQueryHint);
- }
-
- public void update(E xmlQuery) {
- this.resourceQuery = xmlQuery;
- this.setName(xmlQuery.getName());
- this.setQuery(xmlQuery.getQuery());
- this.updateHints();
- getPersistenceUnit().addQuery(this);
- }
-
- protected void updateHints() {
- // make a copy of the XML hints (to prevent ConcurrentModificationException)
- Iterator<XmlQueryHint> xmlHints = new CloneIterator<XmlQueryHint>(this.resourceQuery.getHints());
-
- for (Iterator<OrmQueryHint> contextHints = this.hints(); contextHints.hasNext(); ) {
- OrmQueryHint contextHint = contextHints.next();
- if (xmlHints.hasNext()) {
- contextHint.update(xmlHints.next());
- }
- else {
- removeHint_(contextHint);
- }
- }
-
- while (xmlHints.hasNext()) {
- addHint(buildQueryHint(xmlHints.next()));
- }
- }
-
- public boolean overrides(Query other) {
- // this isn't ideal, but it will have to do until we have further adopter input
- return (this.name != null)
- && this.name.equals(other.getName())
- && (other instanceof JavaQuery);
- }
-
- public boolean duplicates(Query other) {
- return (this != other)
- && ! StringTools.stringIsEmpty(this.name)
- && this.name.equals(other.getName())
- && ! this.overrides(other)
- && ! other.overrides(this);
- }
-
- public TextRange getValidationTextRange() {
- return this.getResourceQuery().getValidationTextRange();
- }
-
- public TextRange getNameTextRange() {
- return this.getResourceQuery().getNameTextRange();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmRelationshipMapping.java
deleted file mode 100644
index abb3d2cc21..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmRelationshipMapping.java
+++ /dev/null
@@ -1,357 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.orm.OrmCascade;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipMapping;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipReference;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.resource.orm.AbstractXmlRelationshipMapping;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-
-public abstract class AbstractOrmRelationshipMapping<T extends AbstractXmlRelationshipMapping>
- extends AbstractOrmAttributeMapping<T>
- implements OrmRelationshipMapping
-{
- protected String specifiedTargetEntity;
- protected String defaultTargetEntity;
- protected Entity resolvedTargetEntity;
-
- protected final OrmRelationshipReference relationshipReference;
-
- protected final OrmCascade cascade;
-
- protected FetchType specifiedFetch;
-
-
- protected AbstractOrmRelationshipMapping(OrmPersistentAttribute parent, T resourceMapping) {
- super(parent, resourceMapping);
- this.relationshipReference = buildRelationshipReference();
- this.cascade = getXmlContextNodeFactory().buildOrmCascade(this, this.resourceAttributeMapping);
- this.specifiedTargetEntity = getResourceTargetEntity();
- this.defaultTargetEntity = buildDefaultTargetEntity();
- this.resolvedTargetEntity = buildResolvedTargetEntity();
- this.specifiedFetch = getResourceFetch();
- }
-
-
- protected abstract OrmRelationshipReference buildRelationshipReference();
-
- @Override
- public OrmPersistentAttribute getParent() {
- return (OrmPersistentAttribute) super.getParent();
- }
-
- public boolean isRelationshipOwner() {
- return this.relationshipReference.isRelationshipOwner();
- }
-
- @Override
- public boolean isOwnedBy(RelationshipMapping mapping) {
- return this.relationshipReference.isOwnedBy(mapping);
- }
-
- @Override
- public boolean isOverridableAssociationMapping() {
- return this.relationshipReference.isOverridableAssociation();
- }
-
-
- // **************** target entity ******************************************
-
- public char getTargetEntityEnclosingTypeSeparator() {
- return '$';
- }
-
- public String getTargetEntity() {
- return (this.specifiedTargetEntity != null) ? this.specifiedTargetEntity : this.defaultTargetEntity;
- }
-
- public String getSpecifiedTargetEntity() {
- return this.specifiedTargetEntity;
- }
-
- public void setSpecifiedTargetEntity(String targetEntity) {
- String old = this.specifiedTargetEntity;
- this.specifiedTargetEntity = targetEntity;
- this.resourceAttributeMapping.setTargetEntity(targetEntity);
- this.firePropertyChanged(SPECIFIED_TARGET_ENTITY_PROPERTY, old, targetEntity);
- }
-
- protected void setSpecifiedTargetEntity_(String targetEntity) {
- String old = this.specifiedTargetEntity;
- this.specifiedTargetEntity = targetEntity;
- this.firePropertyChanged(SPECIFIED_TARGET_ENTITY_PROPERTY, old, targetEntity);
- }
-
- public String getDefaultTargetEntity() {
- return this.defaultTargetEntity;
- }
-
- protected void setDefaultTargetEntity(String targetEntity) {
- String old = this.defaultTargetEntity;
- this.defaultTargetEntity = targetEntity;
- this.firePropertyChanged(DEFAULT_TARGET_ENTITY_PROPERTY, old, targetEntity);
- }
-
- public Entity getResolvedTargetEntity() {
- return this.resolvedTargetEntity;
- }
-
- protected void setResolvedTargetEntity(Entity targetEntity) {
- Entity old = this.resolvedTargetEntity;
- this.resolvedTargetEntity = targetEntity;
- this.firePropertyChanged(RESOLVED_TARGET_ENTITY_PROPERTY, old, targetEntity);
- }
-
-
- // **************** reference **********************************************
-
- public OrmRelationshipReference getRelationshipReference() {
- return this.relationshipReference;
- }
-
-
- // **************** cascade ************************************************
-
- public OrmCascade getCascade() {
- return this.cascade;
- }
-
-
- // **************** fetch **************************************************
-
- public FetchType getFetch() {
- return (this.specifiedFetch != null) ? this.specifiedFetch : this.getDefaultFetch();
- }
-
- public FetchType getSpecifiedFetch() {
- return this.specifiedFetch;
- }
-
- public void setSpecifiedFetch(FetchType fetch) {
- FetchType old = this.specifiedFetch;
- this.specifiedFetch = fetch;
- this.resourceAttributeMapping.setFetch(FetchType.toOrmResourceModel(fetch));
- this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch);
- }
-
- protected void setSpecifiedFetch_(FetchType fetch) {
- FetchType old = this.specifiedFetch;
- this.specifiedFetch = fetch;
- this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch);
- }
-
-
- // **************** resource => context ************************************
-
- @Override
- public void update() {
- super.update();
- this.setSpecifiedTargetEntity_(this.getResourceTargetEntity());
- this.setDefaultTargetEntity(this.buildDefaultTargetEntity());
- this.setResolvedTargetEntity(this.buildResolvedTargetEntity());
- this.relationshipReference.update();
- this.setSpecifiedFetch_(this.getResourceFetch());
- this.cascade.update();
- }
-
- protected String getResourceTargetEntity() {
- return this.resourceAttributeMapping.getTargetEntity();
- }
-
- protected FetchType getResourceFetch() {
- return FetchType.fromOrmResourceModel(this.resourceAttributeMapping.getFetch());
- }
-
- protected String buildDefaultTargetEntity() {
- RelationshipMapping javaMapping = getJavaRelationshipMapping();
- if (javaMapping != null) {
- if (getPersistentAttribute().isVirtual() && !getTypeMapping().isMetadataComplete()) {
- return javaMapping.getTargetEntity();
- }
- }
- if (this.getJavaPersistentAttribute() != null) {
- return getResourceDefaultTargetEntity();
- }
- return null;
- }
-
- protected RelationshipMapping getJavaRelationshipMapping() {
- if (this.getJavaPersistentAttribute() == null) {
- return null;
- }
- AttributeMapping javaAttributeMapping = this.getJavaPersistentAttribute().getMapping();
- if (javaAttributeMapping instanceof RelationshipMapping) {
- return ((RelationshipMapping) javaAttributeMapping);
- }
- return null;
- }
-
- protected abstract String getResourceDefaultTargetEntity();
-
- protected Entity buildResolvedTargetEntity() {
- String targetEntityName = this.getTargetEntity();
- if (targetEntityName == null) {
- return null;
- }
-
- // first try to resolve using only the locally specified name...
- Entity targetEntity = this.getEntity(targetEntityName);
- if (targetEntity != null) {
- return targetEntity;
- }
-
- // ...then try to resolve by prepending the global package name
- String defaultPackageName = this.getDefaultPackageName();
- if (defaultPackageName == null) {
- return null;
- }
- return this.getEntity(defaultPackageName + '.' + targetEntityName);
- }
-
- protected String getDefaultPackageName() {
- return this.getPersistentAttribute().getPersistentType().getDefaultPackage();
- }
-
- protected Entity getEntity(String typeName) {
- return this.getPersistenceUnit().getEntity(typeName);
- }
-
-
- // ********** RelationshipMapping implementation **********
-
- @Override
- public void initializeFromOrmRelationshipMapping(OrmRelationshipMapping oldMapping) {
- super.initializeFromOrmRelationshipMapping(oldMapping);
- setSpecifiedTargetEntity(oldMapping.getSpecifiedTargetEntity());
- setSpecifiedFetch(oldMapping.getSpecifiedFetch());
- oldMapping.getRelationshipReference().initializeOn(this.relationshipReference);
- this.cascade.initializeFrom(oldMapping.getCascade());
- //TODO should we set the fetch type from a BasicMapping??
- }
-
- public Iterator<String> allTargetEntityAttributeNames() {
- return new CompositeIterator<String>(
- new TransformationIterator<AttributeMapping, Iterator<String>>(this.allTargetEntityAttributeMappings()) {
- @Override
- protected Iterator<String> transform(AttributeMapping mapping) {
- return mapping.allMappingNames();
- }
- });
- }
-
- public Iterator<AttributeMapping> allTargetEntityAttributeMappings() {
- return (this.resolvedTargetEntity != null) ?
- this.resolvedTargetEntity.allAttributeMappings() :
- EmptyIterator.<AttributeMapping> instance();
- }
-
- protected String getTargetEntityIdAttributeName() {
- PersistentAttribute attribute = this.getTargetEntityIdAttribute();
- return (attribute == null) ? null : attribute.getName();
- }
-
- protected PersistentAttribute getTargetEntityIdAttribute() {
- return (this.resolvedTargetEntity == null) ? null : this.resolvedTargetEntity.getIdAttribute();
- }
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- validateTargetEntity(messages);
- this.relationshipReference.validate(messages, reporter);
- }
-
- protected void validateTargetEntity(List<IMessage> messages) {
- if (getTargetEntity() == null) {
- if (getPersistentAttribute().isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_TARGET_ENTITY_NOT_DEFINED,
- new String[] {this.getName()},
- this,
- this.getValidationTextRange()
- )
- );
- }
- else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.TARGET_ENTITY_NOT_DEFINED,
- new String[] {this.getName()},
- this,
- this.getValidationTextRange()
- )
- );
- }
- }
- else if (getResolvedTargetEntity() == null) {
- if (getPersistentAttribute().isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY,
- new String[] {this.getName(), getTargetEntity()},
- this,
- this.getValidationTextRange()
- )
- );
- }
- else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.TARGET_ENTITY_IS_NOT_AN_ENTITY,
- new String[] {getTargetEntity(), this.getName()},
- this,
- this.getTargetEntityTextRange()
- )
- );
- }
- }
- }
-
- protected TextRange getTextRange(TextRange textRange) {
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange();
- }
-
- protected TextRange getTargetEntityTextRange() {
- return this.getTextRange(this.getResourceAttributeMapping().getTargetEntityTextRange());
- }
-
-
- // ********** metamodel **********
-
- @Override
- public String getMetamodelTypeName() {
- String targetEntity = this.getTargetEntity();
- return (targetEntity != null) ? targetEntity : MetamodelField.DEFAULT_TYPE_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmRelationshipReference.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmRelationshipReference.java
deleted file mode 100644
index 80bd196088..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmRelationshipReference.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumnEnabledRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmJoinTableEnabledRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmOwnableRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipMapping;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipReference;
-import org.eclipse.jpt.core.resource.orm.AbstractXmlRelationshipMapping;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public abstract class AbstractOrmRelationshipReference
- extends AbstractOrmXmlContextNode
- implements OrmRelationshipReference
-{
- protected AbstractXmlRelationshipMapping resourceMapping;
-
- // cache the strategy for property change notification
- protected JoiningStrategy cachedPredominantJoiningStrategy;
-
-
- protected AbstractOrmRelationshipReference(
- OrmRelationshipMapping parent, AbstractXmlRelationshipMapping resourceMapping) {
- super(parent);
- this.resourceMapping = resourceMapping;
- this.initialize();
- }
-
- public void initializeFromOwnableRelationshipReference(
- OrmOwnableRelationshipReference oldRelationshipReference) {
- // no op
- }
-
- public void initializeFromJoinColumnEnabledRelationshipReference(
- OrmJoinColumnEnabledRelationshipReference oldRelationshipReference) {
- // no op
- }
-
- public void initializeFromJoinTableEnabledRelationshipReference(
- OrmJoinTableEnabledRelationshipReference oldRelationshipReference) {
- // no op
- }
-
- public OrmRelationshipMapping getRelationshipMapping() {
- return (OrmRelationshipMapping) getParent();
- }
-
- public TypeMapping getTypeMapping() {
- return getRelationshipMapping().getTypeMapping();
- }
-
- public Entity getEntity() {
- TypeMapping typeMapping = getTypeMapping();
- return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
- }
-
- public boolean isOverridableAssociation() {
- return getPredominantJoiningStrategy().isOverridableAssociation();
- }
-
- public boolean isParentVirtual() {
- return getRelationshipMapping().getPersistentAttribute().isVirtual();
- }
-
-
- // **************** predominant joining strategy ***************************
-
- public JoiningStrategy getPredominantJoiningStrategy() {
- return this.cachedPredominantJoiningStrategy;
- }
-
- protected void setPredominantJoiningStrategy(JoiningStrategy newJoiningStrategy) {
- JoiningStrategy oldJoiningStrategy = this.cachedPredominantJoiningStrategy;
- this.cachedPredominantJoiningStrategy = newJoiningStrategy;
- firePropertyChanged(PREDOMINANT_JOINING_STRATEGY_PROPERTY, oldJoiningStrategy, newJoiningStrategy);
- }
-
-
- // **************** resource -> context ************************************
-
- protected void initialize() {
- initializeJoiningStrategies();
- this.cachedPredominantJoiningStrategy = calculatePredominantJoiningStrategy();
- }
-
- protected abstract void initializeJoiningStrategies();
-
-
- public void update() {
- updateJoiningStrategies();
- setPredominantJoiningStrategy(calculatePredominantJoiningStrategy());
- }
-
- protected abstract void updateJoiningStrategies();
-
- protected abstract JoiningStrategy calculatePredominantJoiningStrategy();
-
-
- // **************** validation *********************************************
-
- public TextRange getValidationTextRange() {
- return getRelationshipMapping().getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmSequenceGenerator.java
deleted file mode 100644
index 4f3f6df0be..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmSequenceGenerator.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.SequenceGenerator;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmSequenceGenerator;
-import org.eclipse.jpt.core.resource.orm.XmlSequenceGenerator;
-
-/**
- *
- */
-public abstract class AbstractOrmSequenceGenerator
- extends AbstractOrmGenerator<XmlSequenceGenerator>
- implements OrmSequenceGenerator
-{
-
- protected String specifiedSequenceName;
- protected String defaultSequenceName;
-
-
- protected AbstractOrmSequenceGenerator(XmlContextNode parent, XmlSequenceGenerator resourceSequenceGenerator) {
- super(parent);
- this.initialize(resourceSequenceGenerator);
- }
-
-
- @Override
- public int getDefaultInitialValue() {
- return SequenceGenerator.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) {
- String old = this.specifiedSequenceName;
- this.specifiedSequenceName = specifiedSequenceName;
- this.getResourceGenerator().setSequenceName(specifiedSequenceName);
- this.firePropertyChanged(SPECIFIED_SEQUENCE_NAME_PROPERTY, old, 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);
- }
-
-
- // ********** resource => context **********
-
- @Override
- protected void initialize(XmlSequenceGenerator sequenceGenerator) {
- super.initialize(sequenceGenerator);
- this.specifiedSequenceName = sequenceGenerator.getSequenceName();
- //TODO default sequence name
- }
-
- @Override
- public void update(XmlSequenceGenerator sequenceGenerator) {
- super.update(sequenceGenerator);
- this.setSpecifiedSequenceName_(sequenceGenerator.getSequenceName());
- //TODO default sequence name
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java
deleted file mode 100644
index 0496503604..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.Nullable;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmSingleRelationshipMapping;
-import org.eclipse.jpt.core.jpa2.context.MapsId2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmDerivedId2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmMapsId2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.AbstractXmlSingleRelationshipMapping;
-import org.eclipse.jpt.core.resource.orm.v2_0.XmlDerivedId_2_0;
-import org.eclipse.jpt.core.resource.orm.v2_0.XmlMapsId_2_0;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-
-public abstract class AbstractOrmSingleRelationshipMapping<T extends AbstractXmlSingleRelationshipMapping>
- extends AbstractOrmRelationshipMapping<T>
- implements OrmSingleRelationshipMapping2_0
-{
- protected Boolean specifiedOptional;
-
- protected final OrmDerivedId2_0 derivedId;
-
- protected final OrmMapsId2_0 mapsId;
-
-
- protected AbstractOrmSingleRelationshipMapping(OrmPersistentAttribute parent, T resourceMapping) {
- super(parent, resourceMapping);
- this.specifiedOptional = this.getResourceOptional();
- //TODO defaultOptional
- this.derivedId = buildDerivedId();
- this.mapsId = buildMapsId();
- }
-
-
- @Override
- public void initializeFromOrmSingleRelationshipMapping(OrmSingleRelationshipMapping oldMapping) {
- super.initializeFromOrmSingleRelationshipMapping(oldMapping);
- getDerivedId().setValue(((OrmSingleRelationshipMapping2_0) oldMapping).getDerivedId().getValue());
- getMapsId().setValue(((OrmSingleRelationshipMapping2_0) oldMapping).getMapsId().getValue());
- }
-
- @Override
- protected String getResourceDefaultTargetEntity() {
- return this.getJavaPersistentAttribute().getSingleReferenceEntityTypeName();
- }
-
- public FetchType getDefaultFetch() {
- 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) {
- Boolean old = this.specifiedOptional;
- this.specifiedOptional = optional;
- this.resourceAttributeMapping.setOptional(optional);
- this.firePropertyChanged(Nullable.SPECIFIED_OPTIONAL_PROPERTY, old, optional);
- }
-
- protected void setSpecifiedOptional_(Boolean optional) {
- Boolean old = this.specifiedOptional;
- this.specifiedOptional = optional;
- this.firePropertyChanged(Nullable.SPECIFIED_OPTIONAL_PROPERTY, old, optional);
- }
-
- public boolean isDefaultOptional() {
- return Nullable.DEFAULT_OPTIONAL;
- }
-
-
- // ********** 2.0 derived id **********
-
- protected OrmDerivedId2_0 buildDerivedId() {
- return ((OrmXml2_0ContextNodeFactory) getXmlContextNodeFactory()).
- buildOrmDerivedId(this, (XmlDerivedId_2_0) this.resourceAttributeMapping);
- }
-
- public OrmDerivedId2_0 getDerivedId() {
- return this.derivedId;
- }
-
- @Override
- public boolean isIdMapping() {
- return this.derivedId.getValue();
- }
-
-
- // ********** 2.0 maps id **********
-
- protected OrmMapsId2_0 buildMapsId() {
- return ((OrmXml2_0ContextNodeFactory) getXmlContextNodeFactory()).
- buildOrmMapsId(this, (XmlMapsId_2_0) this.resourceAttributeMapping);
- }
-
- public MapsId2_0 getMapsId() {
- return this.mapsId;
- }
-
-
- // **************** resource => context ************************************
-
- @Override
- public void update() {
- super.update();
- this.setSpecifiedOptional_(this.getResourceOptional());
- this.derivedId.update();
- this.mapsId.update();
- }
-
- protected Boolean getResourceOptional() {
- return this.resourceAttributeMapping.getOptional();
- }
-
-
- // **************** validation ************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.derivedId.validate(messages, reporter);
- this.mapsId.validate(messages, reporter);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTable.java
deleted file mode 100644
index a1abd260cc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTable.java
+++ /dev/null
@@ -1,475 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmUniqueConstraint;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.AbstractXmlTable;
-import org.eclipse.jpt.core.resource.orm.XmlUniqueConstraint;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.SchemaContainer;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.NameTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-
-/**
- *
- */
-public abstract class AbstractOrmTable
- extends AbstractOrmXmlContextNode
- implements Table, UniqueConstraint.Owner
-{
- protected String specifiedName;
- protected String defaultName;
-
- protected String specifiedSchema;
- protected String defaultSchema;
-
- protected String specifiedCatalog;
- protected String defaultCatalog;
-
- protected final List<OrmUniqueConstraint> uniqueConstraints;
-
-
- // ********** constructor **********
-
- protected AbstractOrmTable(XmlContextNode parent) {
- super(parent);
- this.uniqueConstraints = new ArrayList<OrmUniqueConstraint>();
- }
-
-
- // ********** abstract methods **********
-
- /**
- * Return null if no resource table exists.
- */
- protected abstract AbstractXmlTable getResourceTable();
-
- /**
- * Return the added resource table.
- */
- protected abstract AbstractXmlTable addResourceTable();
-
- protected abstract void removeResourceTable();
-
- protected abstract String buildDefaultName();
-
- protected abstract String buildDefaultSchema();
-
- protected abstract String buildDefaultCatalog();
-
-
- public boolean isResourceSpecified() {
- return this.getResourceTable() != null;
- }
-
- // ********** name **********
-
- public String getName() {
- return (this.specifiedName != null) ? this.specifiedName : this.defaultName;
- }
-
- public String getSpecifiedName() {
- return this.specifiedName;
- }
-
- public void setSpecifiedName(String name) {
- String old = this.specifiedName;
- this.specifiedName = name;
- if (this.attributeValueHasChanged(old, name)) {
- AbstractXmlTable resourceTable = this.getResourceTable();
- if (resourceTable == null) {
- resourceTable = this.addResourceTable();
- }
- resourceTable.setName(name);
- if (resourceTable.isUnset()) {
- this.removeResourceTable();
- }
- this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, 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);
- }
-
-
- // ********** schema **********
-
- public String getSchema() {
- return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema;
- }
-
- public String getSpecifiedSchema() {
- return this.specifiedSchema;
- }
-
- public void setSpecifiedSchema(String schema) {
- String old = this.specifiedSchema;
- this.specifiedSchema = schema;
- if (this.attributeValueHasChanged(old, schema)) {
- AbstractXmlTable resourceTable = this.getResourceTable();
- if (resourceTable == null) {
- resourceTable = this.addResourceTable();
- }
- resourceTable.setSchema(schema);
- if (resourceTable.isUnset()) {
- this.removeResourceTable();
- }
- this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, 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);
- }
-
-
- // ********** catalog **********
-
- public String getCatalog() {
- return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog;
- }
-
- public String getSpecifiedCatalog() {
- return this.specifiedCatalog;
- }
-
- public void setSpecifiedCatalog(String catalog) {
- String old = this.specifiedCatalog;
- this.specifiedCatalog = catalog;
- if (this.attributeValueHasChanged(old, catalog)) {
- AbstractXmlTable resourceTable = this.getResourceTable();
- if (resourceTable == null) {
- resourceTable = this.addResourceTable();
- }
- resourceTable.setCatalog(catalog);
- if (resourceTable.isUnset()) {
- this.removeResourceTable();
- }
- this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog);
- }
- }
-
- protected void setSpecifiedCatalog_(String newSpecifiedCatalog) {
- String oldSpecifiedCatalog = this.specifiedCatalog;
- this.specifiedCatalog = newSpecifiedCatalog;
- firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, oldSpecifiedCatalog, newSpecifiedCatalog);
- }
-
- public String getDefaultCatalog() {
- return this.defaultCatalog;
- }
-
- protected void setDefaultCatalog(String newDefaultCatalog) {
- String oldDefaultCatalog = this.defaultCatalog;
- this.defaultCatalog = newDefaultCatalog;
- firePropertyChanged(DEFAULT_CATALOG_PROPERTY, oldDefaultCatalog, newDefaultCatalog);
- }
-
-
- // ********** unique constraints **********
-
- public @SuppressWarnings("unchecked") ListIterator<OrmUniqueConstraint> uniqueConstraints() {
- return new CloneListIterator<OrmUniqueConstraint>(this.uniqueConstraints);
- }
-
- public int uniqueConstraintsSize() {
- return this.uniqueConstraints.size();
- }
-
- public OrmUniqueConstraint addUniqueConstraint(int index) {
- XmlUniqueConstraint resourceConstraint = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- OrmUniqueConstraint contextConstraint = this.buildUniqueConstraint(resourceConstraint);
- this.uniqueConstraints.add(index, contextConstraint);
-
- AbstractXmlTable resourceTable = this.getResourceTable();
- if (resourceTable == null) {
- resourceTable = this.addResourceTable();
- }
- resourceTable.getUniqueConstraints().add(index, resourceConstraint);
-
- this.fireItemAdded(UNIQUE_CONSTRAINTS_LIST, index, contextConstraint);
- return contextConstraint;
- }
-
- protected void addUniqueConstraint(int index, OrmUniqueConstraint uniqueConstraint) {
- this.addItemToList(index, uniqueConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- }
-
- protected void addUniqueConstraint(OrmUniqueConstraint uniqueConstraint) {
- this.addUniqueConstraint(this.uniqueConstraints.size(), uniqueConstraint);
- }
-
- public void removeUniqueConstraint(UniqueConstraint uniqueConstraint) {
- this.removeUniqueConstraint(this.uniqueConstraints.indexOf(uniqueConstraint));
- }
-
- public void removeUniqueConstraint(int index) {
- OrmUniqueConstraint removedUniqueConstraint = this.uniqueConstraints.remove(index);
- this.getResourceTable().getUniqueConstraints().remove(index);
- this.fireItemRemoved(UNIQUE_CONSTRAINTS_LIST, index, removedUniqueConstraint);
- }
-
- protected void removeUniqueConstraint_(OrmUniqueConstraint uniqueConstraint) {
- this.removeItemFromList(uniqueConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- }
-
- public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.uniqueConstraints, targetIndex, sourceIndex);
- this.getResourceTable().getUniqueConstraints().move(targetIndex, sourceIndex);
- this.fireItemMoved(UNIQUE_CONSTRAINTS_LIST, targetIndex, sourceIndex);
- }
-
-
- // ********** convenience methods **********
-
- protected TextRange getTextRange(TextRange textRange) {
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange();
- }
-
- protected TextRange getNameTextRange() {
- return this.getTextRange(this.getResourceTableNameTextRange());
- }
-
- protected TextRange getResourceTableNameTextRange() {
- AbstractXmlTable resourceTable = this.getResourceTable();
- return (resourceTable == null) ? null : resourceTable.getNameTextRange();
- }
-
- protected TextRange getSchemaTextRange() {
- return this.getTextRange(this.getResourceTableSchemaTextRange());
- }
-
- protected TextRange getResourceTableSchemaTextRange() {
- AbstractXmlTable resourceTable = this.getResourceTable();
- return (resourceTable == null) ? null : resourceTable.getSchemaTextRange();
- }
-
- protected TextRange getCatalogTextRange() {
- return this.getTextRange(this.getResourceTableCatalogTextRange());
- }
-
- protected TextRange getResourceTableCatalogTextRange() {
- AbstractXmlTable resourceTable = this.getResourceTable();
- return (resourceTable == null) ? null : resourceTable.getCatalogTextRange();
- }
-
- protected OrmUniqueConstraint buildUniqueConstraint(XmlUniqueConstraint resourceUniqueConstraint) {
- return this.getXmlContextNodeFactory().buildOrmUniqueConstraint(this, this, resourceUniqueConstraint);
- }
-
-
- // ********** resource => context **********
-
- protected void initialize(AbstractXmlTable xmlTable) {
- this.defaultName = this.buildDefaultName();
- this.specifiedName = this.getResourceTableName(xmlTable);
-
- this.defaultSchema = this.buildDefaultSchema();
- this.specifiedSchema = this.getResourceTableSchema(xmlTable);
-
- this.defaultCatalog = this.buildDefaultCatalog();
- this.specifiedCatalog = this.getResourceTableCatalog(xmlTable);
-
- this.initializeUniqueContraints(xmlTable);
- }
-
- protected void initializeUniqueContraints(AbstractXmlTable xmlTable) {
- if (xmlTable == null) {
- return;
- }
- for (XmlUniqueConstraint uniqueConstraint : xmlTable.getUniqueConstraints()) {
- this.uniqueConstraints.add(this.buildUniqueConstraint(uniqueConstraint));
- }
- }
-
- protected void update(AbstractXmlTable xmlTable) {
- this.setDefaultName(this.buildDefaultName());
- this.setSpecifiedName_(this.getResourceTableName(xmlTable));
-
- this.setDefaultSchema(this.buildDefaultSchema());
- this.setSpecifiedSchema_(this.getResourceTableSchema(xmlTable));
-
- this.setDefaultCatalog(this.buildDefaultCatalog());
- this.setSpecifiedCatalog_(this.getResourceTableCatalog(xmlTable));
-
- this.updateUniqueConstraints(xmlTable);
- }
-
- protected String getResourceTableName(AbstractXmlTable xmlTable) {
- return (xmlTable == null) ? null : xmlTable.getName();
- }
-
- protected String getResourceTableSchema(AbstractXmlTable xmlTable) {
- return (xmlTable == null) ? null : xmlTable.getSchema();
- }
-
- protected String getResourceTableCatalog(AbstractXmlTable xmlTable) {
- return (xmlTable == null) ? null : xmlTable.getCatalog();
- }
-
- protected void updateUniqueConstraints(AbstractXmlTable xmlTable) {
- Iterator<XmlUniqueConstraint> xmlConstraints = this.xmlUniqueConstraints(xmlTable);
-
- for (Iterator<OrmUniqueConstraint> contextConstraints = this.uniqueConstraints(); contextConstraints.hasNext(); ) {
- OrmUniqueConstraint contextConstraint = contextConstraints.next();
- if (xmlConstraints.hasNext()) {
- contextConstraint.update(xmlConstraints.next());
- } else {
- this.removeUniqueConstraint_(contextConstraint);
- }
- }
-
- while (xmlConstraints.hasNext()) {
- this.addUniqueConstraint(this.buildUniqueConstraint(xmlConstraints.next()));
- }
- }
-
- protected Iterator<XmlUniqueConstraint> xmlUniqueConstraints(AbstractXmlTable xmlTable) {
- // make a copy of the XML constraints (to prevent ConcurrentModificationException)
- return (xmlTable == null) ? EmptyIterator.<XmlUniqueConstraint>instance()
- : new CloneIterator<XmlUniqueConstraint>(xmlTable.getUniqueConstraints());
- }
-
- public void initializeFrom(Table oldTable) {
- this.setSpecifiedName(oldTable.getSpecifiedName());
- this.setSpecifiedCatalog(oldTable.getSpecifiedCatalog());
- this.setSpecifiedSchema(oldTable.getSpecifiedSchema());
- }
-
-
- // ********** database stuff **********
-
- public org.eclipse.jpt.db.Table getDbTable() {
- Schema dbSchema = this.getDbSchema();
- return (dbSchema == null) ? null : dbSchema.getTableForIdentifier(this.getName());
- }
-
- public Schema getDbSchema() {
- SchemaContainer dbSchemaContainer = this.getDbSchemaContainer();
- return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema());
- }
-
- /**
- * If we don't have a catalog (i.e. we don't even have a <em>default</em> catalog),
- * then the database probably does not support catalogs; and we need to
- * get the schema directly from the database.
- */
- public SchemaContainer getDbSchemaContainer() {
- String catalog = this.getCatalog();
- return (catalog != null) ? this.getDbCatalog(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.getDbCatalog(catalog);
- }
-
- public boolean isResolved() {
- return this.getDbTable() != null;
- }
-
- public 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.
- */
- public boolean hasResolvedCatalog() {
- String catalog = this.getCatalog();
- return (catalog == null) || (this.getDbCatalog(catalog) != null);
- }
-
-
- // ********** UniqueConstraint.Owner implementation **********
-
- public Iterator<String> candidateUniqueConstraintColumnNames() {
- org.eclipse.jpt.db.Table dbTable = this.getDbTable();
- return (dbTable != null) ? dbTable.sortedColumnIdentifiers() : EmptyIterator.<String>instance();
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- return this.getTextRange(this.getResourceTableValidationTextRange());
- }
-
- protected TextRange getResourceTableValidationTextRange() {
- AbstractXmlTable resourceTable = this.getResourceTable();
- return (resourceTable == null) ? null : resourceTable.getValidationTextRange();
- }
-
-
- // ********** misc **********
-
- /**
- * covariant override
- */
- @Override
- public XmlContextNode getParent() {
- return (XmlContextNode) super.getParent();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- super.toString(sb);
- sb.append(this.getQualifiedName());
- }
-
- protected String getQualifiedName() {
- return NameTools.buildQualifiedDatabaseObjectName(this.getCatalog(), this.getSchema(), this.getName());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTypeMapping.java
deleted file mode 100644
index 45ccf0df02..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTypeMapping.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.RelationshipReference;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.XmlTypeMapping;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-
-public abstract class AbstractOrmTypeMapping<T extends XmlTypeMapping>
- extends AbstractOrmXmlContextNode
- implements OrmTypeMapping
-{
- protected String class_;
-
- public boolean defaultMetadataComplete;
-
- protected Boolean specifiedMetadataComplete;
-
- protected final T resourceTypeMapping;
-
-
- protected AbstractOrmTypeMapping(OrmPersistentType parent, T resourceMapping) {
- super(parent);
- this.resourceTypeMapping = resourceMapping;
- this.class_ = this.getResourceClassName();
- this.specifiedMetadataComplete = this.getResourceMetadataComplete();
- this.defaultMetadataComplete = this.getPersistentType().isDefaultMetadataComplete();
- }
-
- // **************** Type Mapping implementation *****************************
-
- @Override
- public OrmPersistentType getParent() {
- return (OrmPersistentType) super.getParent();
- }
-
- public OrmPersistentType getPersistentType() {
- return this.getParent();
- }
-
- protected JavaPersistentType getJavaPersistentType() {
- return this.getPersistentType().getJavaPersistentType();
- }
-
- public boolean isMapped() {
- return true;
- }
-
- public String getPrimaryTableName() {
- return null;
- }
-
- public String getClass_() {
- return this.class_;
- }
-
- public void setClass(String newClass) {
- String oldClass = this.class_;
- this.class_ = newClass;
- this.resourceTypeMapping.setClassName(newClass);
- firePropertyChanged(CLASS_PROPERTY, oldClass, newClass);
- getPersistentType().classChanged(oldClass, newClass);
- }
-
-
- public boolean isMetadataComplete() {
- if (isDefaultMetadataComplete()) {
- //entity-mappings/persistence-unit-metadata/xml-mapping-metadata-complete is specified, then it overrides
- //anything set here
- return true;
- }
- return (this.getSpecifiedMetadataComplete() == null) ? this.isDefaultMetadataComplete() : this.getSpecifiedMetadataComplete().booleanValue();
- }
-
- public boolean isDefaultMetadataComplete() {
- return this.defaultMetadataComplete;
- }
-
- protected void setDefaultMetadataComplete(boolean newDefaultMetadataComplete) {
- boolean oldMetadataComplete = this.defaultMetadataComplete;
- this.defaultMetadataComplete = newDefaultMetadataComplete;
- firePropertyChanged(DEFAULT_METADATA_COMPLETE_PROPERTY, oldMetadataComplete, newDefaultMetadataComplete);
- }
-
- public Boolean getSpecifiedMetadataComplete() {
- return this.specifiedMetadataComplete;
- }
-
- public void setSpecifiedMetadataComplete(Boolean newSpecifiedMetadataComplete) {
- Boolean oldMetadataComplete = this.specifiedMetadataComplete;
- this.specifiedMetadataComplete = newSpecifiedMetadataComplete;
- this.resourceTypeMapping.setMetadataComplete(newSpecifiedMetadataComplete);
- firePropertyChanged(SPECIFIED_METADATA_COMPLETE_PROPERTY, oldMetadataComplete, newSpecifiedMetadataComplete);
- }
-
- /**
- * ITypeMapping is changed and various ITypeMappings may have
- * common settings. In this method initialize the new ITypeMapping (this)
- * fromthe old ITypeMapping (oldMapping)
- */
- public void initializeFrom(OrmTypeMapping oldMapping) {
- this.setClass(oldMapping.getClass_());
- this.setSpecifiedMetadataComplete(oldMapping.getSpecifiedMetadataComplete());
- this.setDefaultMetadataComplete(oldMapping.isDefaultMetadataComplete());
- }
-
- public Table getPrimaryDbTable() {
- return null;
- }
-
- public Table getDbTable(String tableName) {
- return null;
- }
-
- public Schema getDbSchema() {
- return null;
- }
-
- public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
- return true;
- }
-
- public Iterator<OrmAttributeMapping> attributeMappings() {
- return new TransformationIterator<OrmPersistentAttribute, OrmAttributeMapping>(getPersistentType().attributes()) {
- @Override
- protected OrmAttributeMapping transform(OrmPersistentAttribute attribute) {
- return attribute.getMapping();
- }
- };
- }
-
- /**
- * Return an iterator of TypeMappings, each which inherits from the one before,
- * and terminates at the root entity (or at the point of cyclicity).
- */
- public Iterator<TypeMapping> inheritanceHierarchy() {
- return new TransformationIterator<PersistentType, TypeMapping>(getPersistentType().inheritanceHierarchy()) {
- @Override
- protected TypeMapping transform(PersistentType type) {
- return type.getMapping();
- }
- };
- }
-
- public Iterator<AttributeMapping> allAttributeMappings() {
- return new CompositeIterator<AttributeMapping>(
- new TransformationIterator<TypeMapping, Iterator<AttributeMapping>>(this.inheritanceHierarchy()) {
- @Override
- protected Iterator<AttributeMapping> transform(TypeMapping typeMapping) {
- return typeMapping.attributeMappings();
- }
- });
- }
-
- public Iterator<String> overridableAttributeNames() {
- return new CompositeIterator<String>(
- new TransformationIterator<AttributeMapping, Iterator<String>>(this.attributeMappings()) {
- @Override
- protected Iterator<String> transform(AttributeMapping mapping) {
- return mapping.allOverrideableAttributeMappingNames();
- }
- });
- }
-
- public Iterator<String> allOverridableAttributeNames() {
- return new CompositeIterator<String>(new TransformationIterator<TypeMapping, Iterator<String>>(this.inheritanceHierarchy()) {
- @Override
- protected Iterator<String> transform(TypeMapping mapping) {
- return mapping.overridableAttributeNames();
- }
- });
- }
-
- public Column resolveOverridenColumn(String attributeName) {
- for (AttributeMapping attributeMapping : CollectionTools.iterable(attributeMappings())) {
- Column resolvedColumn = attributeMapping.resolveOverridenColumn(attributeName);
- if (resolvedColumn != null) {
- return resolvedColumn;
- }
- }
- if (!isMetadataComplete()) {
- JavaPersistentType javaPersistentType = getJavaPersistentType();
- if (javaPersistentType != null) {
- return javaPersistentType.getMapping().resolveOverridenColumn(attributeName);
- }
- }
- return null;
- }
-
- public Iterator<String> overridableAssociationNames() {
- return new CompositeIterator<String>(
- new TransformationIterator<AttributeMapping, Iterator<String>>(this.attributeMappings()) {
- @Override
- protected Iterator<String> transform(AttributeMapping mapping) {
- return mapping.allOverrideableAssociationMappingNames();
- }
- });
- }
-
- public Iterator<String> allOverridableAssociationNames() {
- return new CompositeIterator<String>(new TransformationIterator<TypeMapping, Iterator<String>>(this.inheritanceHierarchy()) {
- @Override
- protected Iterator<String> transform(TypeMapping mapping) {
- return mapping.overridableAssociationNames();
- }
- });
- }
-
- public RelationshipReference resolveRelationshipReference(String attributeName) {
- for (AttributeMapping attributeMapping : CollectionTools.iterable(attributeMappings())) {
- RelationshipReference resolvedRelationshipReference = attributeMapping.resolveRelationshipReference(attributeName);
- if (resolvedRelationshipReference != null) {
- return resolvedRelationshipReference;
- }
- }
- if (!isMetadataComplete()) {
- JavaPersistentType javaPersistentType = getJavaPersistentType();
- if (javaPersistentType != null) {
- return javaPersistentType.getMapping().resolveRelationshipReference(attributeName);
- }
- }
- return null;
- }
-
- public T getResourceTypeMapping() {
- return this.resourceTypeMapping;
- }
-
- public void update() {
- this.setClass(this.getResourceClassName());
- this.setSpecifiedMetadataComplete(this.getResourceMetadataComplete());
- this.setDefaultMetadataComplete(this.getPersistentType().isDefaultMetadataComplete());
- }
-
- protected String getResourceClassName() {
- return this.resourceTypeMapping.getClassName();
- }
-
- protected Boolean getResourceMetadataComplete() {
- return this.resourceTypeMapping.getMetadataComplete();
- }
-
-
- // *************************************************************************
-
- public JpaStructureNode getStructureNode(int offset) {
- if (this.resourceTypeMapping.containsOffset(offset)) {
- return getPersistentType();
- }
- return null;
- }
-
- public TextRange getSelectionTextRange() {
- return this.resourceTypeMapping.getSelectionTextRange();
- }
-
- public TextRange getClassTextRange() {
- return this.resourceTypeMapping.getClassTextRange();
- }
-
- public TextRange getAttributesTextRange() {
- return this.resourceTypeMapping.getAttributesTextRange();
- }
-
- public boolean containsOffset(int textOffset) {
- return (this.resourceTypeMapping != null)
- && this.resourceTypeMapping.containsOffset(textOffset);
- }
-
- //************************* validation ************************
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.validateClass(messages);
- }
-
- protected void validateClass(List<IMessage> messages) {
- if (StringTools.stringIsEmpty(this.class_)) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENT_TYPE_UNSPECIFIED_CLASS,
- this,
- this.getClassTextRange()
- )
- );
- return;
- }
- }
-
- public boolean shouldValidateAgainstDatabase() {
- return getPersistenceUnit().shouldValidateAgainstDatabase();
- }
-
- public TextRange getValidationTextRange() {
- return this.resourceTypeMapping.getValidationTextRange();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getPersistentType().getName());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVersionMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVersionMapping.java
deleted file mode 100644
index 0675e35940..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVersionMapping.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.List;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmColumn;
-import org.eclipse.jpt.core.context.orm.OrmColumnMapping;
-import org.eclipse.jpt.core.context.orm.OrmConverter;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmVersionMapping;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.core.resource.orm.XmlVersion;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-
-public abstract class AbstractOrmVersionMapping<T extends XmlVersion>
- extends AbstractOrmAttributeMapping<T>
- implements OrmVersionMapping
-{
- protected final OrmColumn column;
-
- protected OrmConverter defaultConverter;
- protected OrmConverter specifiedConverter;
-
- protected AbstractOrmVersionMapping(OrmPersistentAttribute parent, T resourceMapping) {
- super(parent, resourceMapping);
- this.column = getXmlContextNodeFactory().buildOrmColumn(this, this);
- this.column.initialize(this.getResourceColumn());//TODO pass in to constructor
- this.defaultConverter = getXmlContextNodeFactory().buildOrmNullConverter(this);
- this.specifiedConverter = this.buildSpecifiedConverter(this.getResourceConverterType());
- }
-
- public int getXmlSequence() {
- return 30;
- }
-
- public String getKey() {
- return MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmVersionMapping(this);
- }
-
- @Override
- public void initializeFromOrmColumnMapping(OrmColumnMapping oldMapping) {
- super.initializeFromOrmColumnMapping(oldMapping);
- getColumn().initializeFrom(oldMapping.getColumn());
- }
-
- public OrmColumn getColumn() {
- return this.column;
- }
-
- public OrmConverter getConverter() {
- return getSpecifiedConverter() == null ? getDefaultConverter() : getSpecifiedConverter();
- }
-
- public OrmConverter getDefaultConverter() {
- return this.defaultConverter;
- }
-
- public OrmConverter getSpecifiedConverter() {
- return this.specifiedConverter;
- }
-
- protected String getSpecifedConverterType() {
- if (this.specifiedConverter == null) {
- return Converter.NO_CONVERTER;
- }
- return this.specifiedConverter.getType();
- }
-
- public void setSpecifiedConverter(String converterType) {
- if (this.valuesAreEqual(getSpecifedConverterType(), converterType)) {
- return;
- }
- OrmConverter oldConverter = this.specifiedConverter;
- OrmConverter newConverter = buildSpecifiedConverter(converterType);
- this.specifiedConverter = null;
- if (oldConverter != null) {
- oldConverter.removeFromResourceModel();
- }
- this.specifiedConverter = newConverter;
- if (newConverter != null) {
- newConverter.addToResourceModel();
- }
- firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
- }
-
- protected void setSpecifiedConverter(OrmConverter newConverter) {
- OrmConverter oldConverter = this.specifiedConverter;
- this.specifiedConverter = newConverter;
- firePropertyChanged(SPECIFIED_CONVERTER_PROPERTY, oldConverter, newConverter);
- }
-
- public void addToResourceModel(Attributes resourceAttributes) {
- resourceAttributes.getVersions().add(this.resourceAttributeMapping);
- }
-
- public void removeFromResourceModel(Attributes resourceAttributes) {
- resourceAttributes.getVersions().remove(this.resourceAttributeMapping);
- }
-
- public String getDefaultColumnName() {
- return getName();
- }
-
- public String getDefaultTableName() {
- return getTypeMapping().getPrimaryTableName();
- }
-
- public Table getDbTable(String tableName) {
- return getTypeMapping().getDbTable(tableName);
- }
-
- @Override
- public void update() {
- super.update();
- this.column.update(this.getResourceColumn());
- if (this.valuesAreEqual(getResourceConverterType(), getSpecifedConverterType())) {
- getSpecifiedConverter().update();
- }
- else {
- setSpecifiedConverter(buildSpecifiedConverter(getResourceConverterType()));
- }
- }
-
- protected OrmConverter buildSpecifiedConverter(String converterType) {
- if (this.valuesAreEqual(converterType, Converter.TEMPORAL_CONVERTER)) {
- return getXmlContextNodeFactory().buildOrmTemporalConverter(this, this.resourceAttributeMapping);
- }
- return null;
- }
-
- protected String getResourceConverterType() {
- if (this.resourceAttributeMapping.getTemporal() != null) {
- return Converter.TEMPORAL_CONVERTER;
- }
-
- return null;
- }
-
- //***************** XmlColumn.Owner implementation ****************
-
- public XmlColumn getResourceColumn() {
- return this.resourceAttributeMapping.getColumn();
- }
-
- public void addResourceColumn() {
- this.resourceAttributeMapping.setColumn(OrmFactory.eINSTANCE.createXmlColumn());
- }
-
- public void removeResourceColumn() {
- this.resourceAttributeMapping.setColumn(null);
- }
-
- // ****************** validation ****************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
-
- if (this.shouldValidateAgainstDatabase()) {
- this.validateColumn(messages);
- }
- }
-
- protected void validateColumn(List<IMessage> messages) {
- OrmPersistentAttribute pa = this.getPersistentAttribute();
- String tableName = this.column.getTable();
- if (this.getTypeMapping().tableNameIsInvalid(tableName)) {
- if (pa.isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_TABLE,
- new String[] {pa.getName(), tableName, this.column.getName()},
- this.column,
- this.column.getTableTextRange()
- )
- );
- } else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_TABLE,
- new String[] {tableName, this.column.getName()},
- this.column,
- this.column.getTableTextRange()
- )
- );
- }
- return;
- }
-
- if ( ! this.column.isResolved() && this.column.getDbTable() != null) {
- if (pa.isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME,
- new String[] {pa.getName(), this.column.getName()},
- this.column,
- this.column.getNameTextRange()
- )
- );
- } else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {this.column.getName()},
- this.column,
- this.column.getNameTextRange()
- )
- );
- }
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNode.java
deleted file mode 100644
index cd85274c5d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNode.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.context.JpaContextNode;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.context.orm.OrmXmlDefinition;
-import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode;
-
-/**
- * Use this abstract class for context nodes that are part of an OrmXml file.
- * This will not work for purely MappingFile implementations
- */
-public abstract class AbstractOrmXmlContextNode
- extends AbstractXmlContextNode
-{
-
- // ********** constructor **********
-
- protected AbstractOrmXmlContextNode(JpaContextNode parent) {
- super(parent);
- }
-
- public OrmXmlDefinition getMappingFileDefinition() {
- return (OrmXmlDefinition) getJpaPlatform().getResourceDefinition(getResourceType());
- }
-
- public EFactory getResourceNodeFactory() {
- return getMappingFileDefinition().getResourceNodeFactory();
- }
-
- public OrmXmlContextNodeFactory getXmlContextNodeFactory() {
- return getMappingFileDefinition().getContextNodeFactory();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java
deleted file mode 100644
index 10e6b6046e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java
+++ /dev/null
@@ -1,469 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaBasicMapping;
-import org.eclipse.jpt.core.context.java.JavaEmbeddedIdMapping;
-import org.eclipse.jpt.core.context.java.JavaEmbeddedMapping;
-import org.eclipse.jpt.core.context.java.JavaIdMapping;
-import org.eclipse.jpt.core.context.java.JavaManyToManyMapping;
-import org.eclipse.jpt.core.context.java.JavaManyToOneMapping;
-import org.eclipse.jpt.core.context.java.JavaOneToManyMapping;
-import org.eclipse.jpt.core.context.java.JavaOneToOneMapping;
-import org.eclipse.jpt.core.context.java.JavaTransientMapping;
-import org.eclipse.jpt.core.context.java.JavaVersionMapping;
-import org.eclipse.jpt.core.context.orm.EntityMappings;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverride;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmBaseJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmCascade;
-import org.eclipse.jpt.core.context.orm.OrmColumn;
-import org.eclipse.jpt.core.context.orm.OrmConverter;
-import org.eclipse.jpt.core.context.orm.OrmDiscriminatorColumn;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddable;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddedIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddedMapping;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmGeneratedValue;
-import org.eclipse.jpt.core.context.orm.OrmGeneratorContainer;
-import org.eclipse.jpt.core.context.orm.OrmIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmJoinTable;
-import org.eclipse.jpt.core.context.orm.OrmJoinTableJoiningStrategy;
-import org.eclipse.jpt.core.context.orm.OrmManyToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmManyToOneMapping;
-import org.eclipse.jpt.core.context.orm.OrmMappedSuperclass;
-import org.eclipse.jpt.core.context.orm.OrmNamedColumn;
-import org.eclipse.jpt.core.context.orm.OrmNamedNativeQuery;
-import org.eclipse.jpt.core.context.orm.OrmNamedQuery;
-import org.eclipse.jpt.core.context.orm.OrmOneToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmOneToOneMapping;
-import org.eclipse.jpt.core.context.orm.OrmOrderable;
-import org.eclipse.jpt.core.context.orm.OrmPersistenceUnitDefaults;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmQuery;
-import org.eclipse.jpt.core.context.orm.OrmQueryContainer;
-import org.eclipse.jpt.core.context.orm.OrmQueryHint;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipMapping;
-import org.eclipse.jpt.core.context.orm.OrmSecondaryTable;
-import org.eclipse.jpt.core.context.orm.OrmSequenceGenerator;
-import org.eclipse.jpt.core.context.orm.OrmTable;
-import org.eclipse.jpt.core.context.orm.OrmTableGenerator;
-import org.eclipse.jpt.core.context.orm.OrmTransientMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmUniqueConstraint;
-import org.eclipse.jpt.core.context.orm.OrmVersionMapping;
-import org.eclipse.jpt.core.context.orm.OrmXml;
-import org.eclipse.jpt.core.context.orm.PersistenceUnitMetadata;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericEntityMappings;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmAssociationOverride;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmAssociationOverrideContainer;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmAssociationOverrideRelationshipReference;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmAttributeOverride;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmAttributeOverrideContainer;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmBasicMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmCascade;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmColumn;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmDiscriminatorColumn;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmEmbeddable;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmEmbeddedIdMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmEmbeddedMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmEntity;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmEnumeratedConverter;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmGeneratedValue;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmGeneratorContainer;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmIdMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmJoinColumn;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmJoinTable;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmLobConverter;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmManyToManyMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmManyToOneMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmMappedSuperclass;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmNamedNativeQuery;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmNamedQuery;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmNullAttributeMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmNullConverter;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmOneToManyMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmOneToOneMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmOrderable;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmPersistentType;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmQueryContainer;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmQueryHint;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmSecondaryTable;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmSequenceGenerator;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmTable;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmTableGenerator;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmTemporalConverter;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmTransientMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmUniqueConstraint;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmVersionMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmXml;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericPersistenceUnitDefaults;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericPersistenceUnitMetadata;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.UnsupportedOrmAttributeMapping;
-import org.eclipse.jpt.core.internal.jpa2.context.orm.GenericOrmOrderColumn2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.orm.NullOrmCacheable2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.orm.NullOrmDerivedId2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.orm.NullOrmMapsId2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.orm.NullOrmOrphanRemoval2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaElementCollectionMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheableHolder2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmDerivedId2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmElementCollectionMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmEmbeddedMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmMapsId2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrderColumn2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrderable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.AbstractXmlRelationshipMapping;
-import org.eclipse.jpt.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.jpt.core.resource.orm.XmlAssociationOverrideContainer;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeOverrideContainer;
-import org.eclipse.jpt.core.resource.orm.XmlBasic;
-import org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping;
-import org.eclipse.jpt.core.resource.orm.XmlElementCollection;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddable;
-import org.eclipse.jpt.core.resource.orm.XmlEmbedded;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddedId;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.core.resource.orm.XmlGeneratedValue;
-import org.eclipse.jpt.core.resource.orm.XmlGeneratorContainer;
-import org.eclipse.jpt.core.resource.orm.XmlId;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
-import org.eclipse.jpt.core.resource.orm.XmlManyToMany;
-import org.eclipse.jpt.core.resource.orm.XmlManyToOne;
-import org.eclipse.jpt.core.resource.orm.XmlMappedSuperclass;
-import org.eclipse.jpt.core.resource.orm.XmlNamedNativeQuery;
-import org.eclipse.jpt.core.resource.orm.XmlNamedQuery;
-import org.eclipse.jpt.core.resource.orm.XmlNullAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlOneToMany;
-import org.eclipse.jpt.core.resource.orm.XmlOneToOne;
-import org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlQueryContainer;
-import org.eclipse.jpt.core.resource.orm.XmlQueryHint;
-import org.eclipse.jpt.core.resource.orm.XmlSecondaryTable;
-import org.eclipse.jpt.core.resource.orm.XmlSequenceGenerator;
-import org.eclipse.jpt.core.resource.orm.XmlTableGenerator;
-import org.eclipse.jpt.core.resource.orm.XmlTransient;
-import org.eclipse.jpt.core.resource.orm.XmlTypeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlUniqueConstraint;
-import org.eclipse.jpt.core.resource.orm.XmlVersion;
-import org.eclipse.jpt.core.resource.orm.v2_0.XmlCacheable_2_0;
-import org.eclipse.jpt.core.resource.orm.v2_0.XmlDerivedId_2_0;
-import org.eclipse.jpt.core.resource.orm.v2_0.XmlMapsId_2_0;
-import org.eclipse.jpt.core.resource.orm.v2_0.XmlOrphanRemovable_2_0;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-
-public abstract class AbstractOrmXmlContextNodeFactory implements OrmXml2_0ContextNodeFactory
-{
- public OrmXml buildMappingFile(MappingFileRef parent, JpaXmlResource resource) {
- return new GenericOrmXml(parent, resource);
- }
-
- public EntityMappings buildEntityMappings(OrmXml parent, XmlEntityMappings xmlEntityMappings) {
- return new GenericEntityMappings(parent, xmlEntityMappings);
- }
-
- public PersistenceUnitMetadata buildPersistenceUnitMetadata(EntityMappings parent, XmlEntityMappings xmlEntityMappings) {
- return new GenericPersistenceUnitMetadata(parent, xmlEntityMappings);
- }
-
- public OrmPersistenceUnitDefaults buildPersistenceUnitDefaults(PersistenceUnitMetadata parent, XmlEntityMappings xmlEntityMappings) {
- return new GenericPersistenceUnitDefaults(parent, xmlEntityMappings);
- }
-
- 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, OrmPersistentAttribute.Owner owner, XmlAttributeMapping resourceMapping) {
- return new GenericOrmPersistentAttribute(parent, owner, resourceMapping);
- }
-
- public OrmTable buildOrmTable(OrmEntity parent) {
- return new GenericOrmTable(parent);
- }
-
- public OrmSecondaryTable buildOrmSecondaryTable(OrmEntity parent, XmlSecondaryTable xmlSecondaryTable) {
- return new GenericOrmSecondaryTable(parent, xmlSecondaryTable);
- }
-
- public OrmPrimaryKeyJoinColumn buildOrmPrimaryKeyJoinColumn(XmlContextNode parent, OrmBaseJoinColumn.Owner owner, XmlPrimaryKeyJoinColumn resourcePkJoinColumn) {
- return new GenericOrmPrimaryKeyJoinColumn(parent, owner, resourcePkJoinColumn);
- }
-
- public OrmJoinTable buildOrmJoinTable(OrmJoinTableJoiningStrategy parent, XmlJoinTable resourceJoinTable) {
- return new GenericOrmJoinTable(parent, resourceJoinTable);
- }
-
- public OrmJoinColumn buildOrmJoinColumn(XmlContextNode parent, OrmJoinColumn.Owner owner, XmlJoinColumn resourceJoinColumn) {
- return new GenericOrmJoinColumn(parent, owner, resourceJoinColumn);
- }
-
- public OrmAttributeOverrideContainer buildOrmAttributeOverrideContainer(XmlContextNode parent, OrmAttributeOverrideContainer.Owner owner, XmlAttributeOverrideContainer resourceAttributeOverrideContainer) {
- return new GenericOrmAttributeOverrideContainer(parent, owner, resourceAttributeOverrideContainer);
- }
-
- public OrmAssociationOverrideContainer buildOrmAssociationOverrideContainer(OrmEntity parent, OrmAssociationOverrideContainer.Owner owner, XmlAssociationOverrideContainer resourceAssociationOverrideContainer) {
- return new GenericOrmAssociationOverrideContainer(parent, owner, resourceAssociationOverrideContainer);
- }
-
- public OrmAssociationOverrideContainer buildOrmAssociationOverrideContainer(OrmEmbeddedMapping2_0 parent, OrmAssociationOverrideContainer.Owner owner, XmlAssociationOverrideContainer resourceAssociationOverrideContainer) {
- return new NullOrmAssociationOverrideContainer(parent, owner);
- }
-
- public OrmAttributeOverride buildOrmAttributeOverride(OrmAttributeOverrideContainer parent, AttributeOverride.Owner owner, XmlAttributeOverride xmlAttributeOverride) {
- return new GenericOrmAttributeOverride(parent, owner, xmlAttributeOverride);
- }
-
- public OrmAssociationOverride buildOrmAssociationOverride(OrmAssociationOverrideContainer parent, AssociationOverride.Owner owner, XmlAssociationOverride xmlAssociationOverride) {
- return new GenericOrmAssociationOverride(parent, owner, xmlAssociationOverride);
- }
-
- public OrmAssociationOverrideRelationshipReference buildOrmAssociationOverrideRelationshipReference(OrmAssociationOverride parent, XmlAssociationOverride associationOverride) {
- return new GenericOrmAssociationOverrideRelationshipReference(parent, associationOverride);
- }
-
- public OrmDiscriminatorColumn buildOrmDiscriminatorColumn(OrmEntity parent, OrmDiscriminatorColumn.Owner owner) {
- return new GenericOrmDiscriminatorColumn(parent, owner);
- }
-
- public OrmCascade buildOrmCascade(OrmRelationshipMapping parent, AbstractXmlRelationshipMapping resourceMapping) {
- return new GenericOrmCascade(parent, resourceMapping);
- }
-
- public OrmColumn buildOrmColumn(XmlContextNode parent, OrmColumn.Owner owner) {
- return new GenericOrmColumn(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 OrmConverter buildOrmEnumeratedConverter(OrmAttributeMapping parent, XmlConvertibleMapping resourceMapping) {
- return new GenericOrmEnumeratedConverter(parent, resourceMapping);
- }
-
- public OrmConverter buildOrmLobConverter(OrmAttributeMapping parent, XmlConvertibleMapping resourceMapping) {
- return new GenericOrmLobConverter(parent, resourceMapping);
- }
-
- public OrmConverter buildOrmTemporalConverter(OrmAttributeMapping parent, XmlConvertibleMapping resourceMapping) {
- return new GenericOrmTemporalConverter(parent, resourceMapping);
- }
-
- public OrmConverter buildOrmNullConverter(OrmAttributeMapping parent) {
- return new GenericOrmNullConverter(parent);
- }
-
- public OrmOrderable buildOrmOrderable(OrmAttributeMapping parent) {
- return new GenericOrmOrderable(parent);
- }
-
- public OrmOrderColumn2_0 buildOrmOrderColumn(OrmOrderable2_0 parent, OrmNamedColumn.Owner owner) {
- return new GenericOrmOrderColumn2_0(parent, owner);
- }
-
- public OrmDerivedId2_0 buildOrmDerivedId(
- OrmSingleRelationshipMapping2_0 parent, XmlDerivedId_2_0 resource) {
-
- return new NullOrmDerivedId2_0(parent);
- }
-
- public OrmMapsId2_0 buildOrmMapsId(
- OrmSingleRelationshipMapping2_0 parent, XmlMapsId_2_0 resource) {
-
- return new NullOrmMapsId2_0(parent);
- }
-
- public OrmElementCollectionMapping2_0 buildOrmElementCollectionMapping2_0(
- OrmPersistentAttribute parent, XmlElementCollection resourceMapping) {
-
- throw new UnsupportedOperationException();
- }
-
- public OrmCacheable2_0 buildOrmCacheable(OrmCacheableHolder2_0 parent, XmlCacheable_2_0 resource) {
- return new NullOrmCacheable2_0(parent);
- }
-
- public OrmOrphanRemovable2_0 buildOrmOrphanRemoval(OrmOrphanRemovalHolder2_0 parent, XmlOrphanRemovable_2_0 resource) {
- return new NullOrmOrphanRemoval2_0(parent);
- }
-
- // ********** ORM Virtual Resource Model **********
-
- public XmlAssociationOverride buildVirtualXmlAssociationOverride(String name, OrmTypeMapping parent, JoiningStrategy joiningStrategy) {
- return new VirtualXmlAssociationOverride(name, parent, joiningStrategy);
- }
-
- public XmlBasic buildVirtualXmlBasic(OrmTypeMapping ormTypeMapping, JavaBasicMapping javaBasicMapping) {
- return new VirtualXmlBasic(ormTypeMapping, javaBasicMapping);
- }
-
- public XmlEmbeddedId buildVirtualXmlEmbeddedId(OrmTypeMapping ormTypeMapping, JavaEmbeddedIdMapping javaEmbeddedIdMapping) {
- return new VirtualXmlEmbeddedId(ormTypeMapping, javaEmbeddedIdMapping);
- }
-
- public XmlEmbedded buildVirtualXmlEmbedded(OrmTypeMapping ormTypeMapping, JavaEmbeddedMapping javaEmbeddedMapping) {
- return new VirtualXmlEmbedded(ormTypeMapping, javaEmbeddedMapping);
- }
-
- public XmlId buildVirtualXmlId(OrmTypeMapping ormTypeMapping, JavaIdMapping javaIdMapping) {
- return new VirtualXmlId(ormTypeMapping, javaIdMapping);
- }
-
- public XmlManyToMany buildVirtualXmlManyToMany(OrmTypeMapping ormTypeMapping, JavaManyToManyMapping javaManyToManyMapping) {
- return new VirtualXmlManyToMany(ormTypeMapping, javaManyToManyMapping);
- }
-
- public XmlManyToOne buildVirtualXmlManyToOne(OrmTypeMapping ormTypeMapping, JavaManyToOneMapping javaManyToOneMapping) {
- return new VirtualXmlManyToOne(ormTypeMapping, javaManyToOneMapping);
- }
-
- public XmlOneToMany buildVirtualXmlOneToMany(OrmTypeMapping ormTypeMapping, JavaOneToManyMapping javaOneToManyMapping) {
- return new VirtualXmlOneToMany(ormTypeMapping, javaOneToManyMapping);
- }
-
- public XmlOneToOne buildVirtualXmlOneToOne(OrmTypeMapping ormTypeMapping, JavaOneToOneMapping javaOneToOneMapping) {
- return new VirtualXmlOneToOne(ormTypeMapping, javaOneToOneMapping);
- }
-
- public XmlTransient buildVirtualXmlTransient(OrmTypeMapping ormTypeMapping, JavaTransientMapping javaTransientMapping) {
- return new VirtualXmlTransient(ormTypeMapping, javaTransientMapping);
- }
-
- public XmlVersion buildVirtualXmlVersion(OrmTypeMapping ormTypeMapping, JavaVersionMapping javaVersionMapping) {
- return new VirtualXmlVersion(ormTypeMapping, javaVersionMapping);
- }
-
- public XmlNullAttributeMapping buildVirtualXmlNullAttributeMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping) {
- return new VirtualXmlNullAttributeMapping(ormTypeMapping, javaAttributeMapping);
- }
-
- public XmlElementCollection buildVirtualXmlElementCollection2_0(OrmTypeMapping ormTypeMapping, JavaElementCollectionMapping2_0 javaMapping) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlDefinition.java
deleted file mode 100644
index 367f38c895..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlDefinition.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.ListIterator;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.context.orm.OrmXmlDefinition;
-import org.eclipse.jpt.core.context.orm.UnsupportedOrmAttributeMappingDefinition;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayListIterator;
-
-/**
- * All the state in the definition should be "static" (i.e. unchanging once it is initialized).
- */
-public abstract class AbstractOrmXmlDefinition
- implements OrmXmlDefinition
-{
- private OrmTypeMappingDefinition[] ormTypeMappingDefinitions;
-
- private OrmAttributeMappingDefinition[] ormAttributeMappingDefinitions;
-
- private final OrmXmlContextNodeFactory factory;
-
-
- /**
- * zero-argument constructor
- */
- protected AbstractOrmXmlDefinition() {
- super();
- this.factory = buildContextNodeFactory();
- }
-
-
- protected abstract OrmXmlContextNodeFactory buildContextNodeFactory();
-
- public OrmXmlContextNodeFactory getContextNodeFactory() {
- return this.factory;
- }
-
-
- // ********** ORM type mappings **********
-
- public OrmTypeMappingDefinition getOrmTypeMappingDefinition(String mappingKey) {
- for (OrmTypeMappingDefinition definition : CollectionTools.iterable(ormTypeMappingDefinitions())) {
- if (Tools.valuesAreEqual(definition.getKey(), mappingKey)) {
- return definition;
- }
- }
- throw new IllegalArgumentException("Illegal type mapping key: " + mappingKey); //$NON-NLS-1$
- }
-
- public ListIterator<OrmTypeMappingDefinition> ormTypeMappingDefinitions() {
- return new ArrayListIterator<OrmTypeMappingDefinition>(getOrmTypeMappingDefinitions());
- }
-
- protected synchronized OrmTypeMappingDefinition[] getOrmTypeMappingDefinitions() {
- if (this.ormTypeMappingDefinitions == null) {
- this.ormTypeMappingDefinitions = this.buildOrmTypeMappingDefinitions();
- }
- return this.ormTypeMappingDefinitions;
- }
-
- /**
- * Return an array of mapping definitions to use for types in mapping files of this type.
- * The order is unimportant.
- */
- protected abstract OrmTypeMappingDefinition[] buildOrmTypeMappingDefinitions();
-
-
- // ********** ORM attribute mappings **********
-
- public OrmAttributeMappingDefinition getOrmAttributeMappingDefinition(String mappingKey) {
- for (OrmAttributeMappingDefinition definition : CollectionTools.iterable(ormAttributeMappingDefinitions())) {
- if (Tools.valuesAreEqual(definition.getKey(), mappingKey)) {
- return definition;
- }
- }
- return UnsupportedOrmAttributeMappingDefinition.instance();
- }
-
- public ListIterator<OrmAttributeMappingDefinition> ormAttributeMappingDefinitions() {
- return new ArrayListIterator<OrmAttributeMappingDefinition>(getOrmAttributeMappingDefinitions());
- }
-
- protected synchronized OrmAttributeMappingDefinition[] getOrmAttributeMappingDefinitions() {
- if (this.ormAttributeMappingDefinitions == null) {
- this.ormAttributeMappingDefinitions = this.buildOrmAttributeMappingDefinitions();
- }
- return this.ormAttributeMappingDefinitions;
- }
-
- /**
- * Return an array of mapping definitions to use for attributes in mapping files of this type.
- * The order is unimportant.
- */
- protected abstract OrmAttributeMappingDefinition[] buildOrmAttributeMappingDefinitions();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmJoinColumnInAssociationOverrideJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmJoinColumnInAssociationOverrideJoiningStrategy.java
deleted file mode 100644
index c6b54c25a5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmJoinColumnInAssociationOverrideJoiningStrategy.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumnInAssociationOverrideJoiningStrategy;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn.Owner;
-import org.eclipse.jpt.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Table;
-
-public class GenericOrmJoinColumnInAssociationOverrideJoiningStrategy
- extends AbstractOrmJoinColumnJoiningStrategy
- implements OrmJoinColumnInAssociationOverrideJoiningStrategy
-{
-
- public GenericOrmJoinColumnInAssociationOverrideJoiningStrategy(OrmAssociationOverrideRelationshipReference parent, XmlAssociationOverride xao) {
- super(parent, xao);
- }
-
- @Override
- protected Owner buildJoinColumnOwner() {
- return new JoinColumnOwner();
- }
-
- public TypeMapping getTypeMapping() {
- return getAssociationOverride().getOwner().getTypeMapping();
- }
-
- public boolean isOverridableAssociation() {
- return false;
- }
-
- protected OrmAssociationOverride getAssociationOverride() {
- return this.getRelationshipReference().getAssociationOverride();
- }
-
- @Override
- public OrmAssociationOverrideRelationshipReference getRelationshipReference() {
- return (OrmAssociationOverrideRelationshipReference) super.getRelationshipReference();
- }
-
- public TextRange getValidationTextRange() {
- return getRelationshipReference().getValidationTextRange();
- }
-
- public void update(XmlAssociationOverride xao) {
- //TODO can we make resource final and then just have an update() method?
- //would need to update the association overrides with the same resource association override
- this.resource = xao;
- super.update();
- }
-
-
-
- // ********** join column owner adapter **********
-
- protected class JoinColumnOwner
- implements OrmJoinColumn.Owner
- {
- protected JoinColumnOwner() {
- super();
- }
-
- protected AssociationOverride getAssociationOverride() {
- return GenericOrmJoinColumnInAssociationOverrideJoiningStrategy.this.getRelationshipReference().getAssociationOverride();
- }
-
- /**
- * by default, the join column is in the type mapping's primary table
- */
- public String getDefaultTableName() {
- return getTypeMapping().getPrimaryTableName();
- }
-
- public String getDefaultColumnName() {
- //built in MappingTools.buildJoinColumnDefaultName()
- return null;
- }
-
- public Entity getTargetEntity() {
- RelationshipMapping relationshipMapping = getRelationshipMapping();
- return relationshipMapping == null ? null : relationshipMapping.getResolvedTargetEntity();
- }
-
- public String getAttributeName() {
- return getAssociationOverride().getName();
- }
-
- public RelationshipMapping getRelationshipMapping() {
- return getAssociationOverride().getOwner().getRelationshipMapping(GenericOrmJoinColumnInAssociationOverrideJoiningStrategy.this.getRelationshipReference().getAssociationOverride().getName());
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return getTypeMapping().tableNameIsInvalid(tableName);
- }
-
- /**
- * the join column can be on a secondary table
- */
- public boolean tableIsAllowed() {
- return true;
- }
-
- public TypeMapping getTypeMapping() {
- return getAssociationOverride().getOwner().getTypeMapping();
- }
-
- public Table getDbTable(String tableName) {
- return getTypeMapping().getDbTable(tableName);
- }
-
- public Table getReferencedColumnDbTable() {
- Entity targetEntity = getTargetEntity();
- return (targetEntity == null) ? null : targetEntity.getPrimaryDbTable();
- }
-
- public boolean isVirtual(BaseJoinColumn joinColumn) {
- return false;
- }
-
- public int joinColumnsSize() {
- return GenericOrmJoinColumnInAssociationOverrideJoiningStrategy.this.joinColumnsSize();
- }
-
- public TextRange getValidationTextRange() {
- return GenericOrmJoinColumnInAssociationOverrideJoiningStrategy.this.getValidationTextRange();
- }
-
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmJoinColumnJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmJoinColumnJoiningStrategy.java
deleted file mode 100644
index ea6b6feb20..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmJoinColumnJoiningStrategy.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumnEnabledRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn.Owner;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumnsMapping;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Table;
-
-public class GenericOrmJoinColumnJoiningStrategy
- extends AbstractOrmJoinColumnJoiningStrategy
-{
-
- public GenericOrmJoinColumnJoiningStrategy(
- OrmJoinColumnEnabledRelationshipReference parent,
- XmlJoinColumnsMapping resource) {
- super(parent, resource);
- }
-
- @Override
- protected Owner buildJoinColumnOwner() {
- return new JoinColumnOwner();
- }
-
- public TypeMapping getTypeMapping() {
- return getRelationshipMapping().getTypeMapping();
- }
-
- public boolean isOverridableAssociation() {
- return true;
- }
-
- @Override
- public OrmJoinColumnEnabledRelationshipReference getRelationshipReference() {
- return (OrmJoinColumnEnabledRelationshipReference) super.getRelationshipReference();
- }
-
- public TextRange getValidationTextRange() {
- return this.getRelationshipReference().getValidationTextRange();
- }
-
- // ********** join column owner adapter **********
-
- protected class JoinColumnOwner
- implements OrmJoinColumn.Owner
- {
- protected JoinColumnOwner() {
- super();
- }
-
- /**
- * by default, the join column is in the type mapping's primary table
- */
- public String getDefaultTableName() {
- return getTypeMapping().getPrimaryTableName();
- }
-
- public Entity getTargetEntity() {
- return getRelationshipMapping().getResolvedTargetEntity();
- }
-
- public String getAttributeName() {
- return getRelationshipMapping().getName();
- }
-
- public RelationshipMapping getRelationshipMapping() {
- return GenericOrmJoinColumnJoiningStrategy.this.getRelationshipMapping();
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return getTypeMapping().tableNameIsInvalid(tableName);
- }
-
- /**
- * the join column can be on a secondary table
- */
- public boolean tableIsAllowed() {
- return true;
- }
-
- public TypeMapping getTypeMapping() {
- return getRelationshipMapping().getTypeMapping();
- }
-
- public Table getDbTable(String tableName) {
- return getTypeMapping().getDbTable(tableName);
- }
-
- public Table getReferencedColumnDbTable() {
- Entity targetEntity = getTargetEntity();
- return (targetEntity == null) ? null : targetEntity.getPrimaryDbTable();
- }
-
- public boolean isVirtual(BaseJoinColumn joinColumn) {
- return GenericOrmJoinColumnJoiningStrategy.this.defaultJoinColumn == joinColumn;
- }
-
- public String getDefaultColumnName() {
- //built in MappingTools.buildJoinColumnDefaultName()
- return null;
- }
-
- public int joinColumnsSize() {
- return GenericOrmJoinColumnJoiningStrategy.this.joinColumnsSize();
- }
-
- public TextRange getValidationTextRange() {
- return GenericOrmJoinColumnJoiningStrategy.this.getValidationTextRange();
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmJoinTableJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmJoinTableJoiningStrategy.java
deleted file mode 100644
index 6d48894975..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmJoinTableJoiningStrategy.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.orm.OrmJoinTable;
-import org.eclipse.jpt.core.context.orm.OrmJoinTableEnabledRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipMapping;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
-import org.eclipse.jpt.core.resource.orm.XmlJoinTableMapping;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmJoinTableJoiningStrategy
- extends AbstractOrmJoinTableJoiningStrategy
-{
- protected XmlJoinTableMapping resource;
-
-
- public GenericOrmJoinTableJoiningStrategy(
- OrmJoinTableEnabledRelationshipReference parent,
- XmlJoinTableMapping resource) {
- super(parent);
- this.resource = resource;
- this.initialize();
- }
-
-
- @Override
- public OrmJoinTableEnabledRelationshipReference getParent() {
- return (OrmJoinTableEnabledRelationshipReference) super.getParent();
- }
-
- @Override
- public OrmJoinTableEnabledRelationshipReference getRelationshipReference() {
- return this.getParent();
- }
-
- @Override
- public OrmRelationshipMapping getRelationshipMapping() {
- return this.getRelationshipReference().getRelationshipMapping();
- }
-
- @Override
- protected void setResourceJoinTable(XmlJoinTable resourceJoinTable) {
- this.resource.setJoinTable(resourceJoinTable);
- }
-
- public boolean isOverridableAssociation() {
- return getJpaPlatformVariation().isJoinTableOverridable();
- }
-
-
- // **************** join table *********************************************
-
- @Override
- public OrmJoinTable getJoinTable() {
- return this.joinTable;
- }
-
- @Override
- public OrmJoinTable addJoinTable() {
- addStrategy();
- return this.joinTable;
- }
-
- @Override
- protected void setJoinTable_(OrmJoinTable newJoinTable) {
- OrmJoinTable oldJoinTable = this.joinTable;
- this.joinTable = newJoinTable;
- this.firePropertyChanged(JOIN_TABLE_PROPERTY, oldJoinTable, newJoinTable);
- }
-
- @Override
- public XmlJoinTable addResourceJoinTable() {
- XmlJoinTable resourceJoinTable = OrmFactory.eINSTANCE.createXmlJoinTable();
- this.resource.setJoinTable(resourceJoinTable);
- return resourceJoinTable;
- }
-
- public void removeResourceJoinTable() {
- this.resource.setJoinTable(null);
- }
-
- @Override
- protected boolean mayHaveJoinTable() {
- return getResourceJoinTable() != null
- || getRelationshipReference().mayHaveDefaultJoinTable();
- }
-
- public XmlJoinTable getResourceJoinTable() {
- return this.resource.getJoinTable();
- }
-
-
- // **************** resource -> context ************************************
-
- @Override
- public void update() {
- if (mayHaveJoinTable()) {
- if (this.joinTable == null) {
- setJoinTable_(getXmlContextNodeFactory().buildOrmJoinTable(this, getResourceJoinTable()));
- }
- this.joinTable.update();
- }
- else {
- if (this.joinTable != null) {
- // no resource, so no clean up
- setJoinTable_(null);
- }
- }
- }
-
-
- // **************** validation *********************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- if (this.joinTable != null && getRelationshipMapping().shouldValidateAgainstDatabase()) {
- this.joinTable.validate(messages, reporter);
- }
- }
-
- public TextRange getValidationTextRange() {
- return getRelationshipReference().getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmManyToManyRelationshipReference.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmManyToManyRelationshipReference.java
deleted file mode 100644
index be0a784f15..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmManyToManyRelationshipReference.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.orm.OrmJoinTable;
-import org.eclipse.jpt.core.context.orm.OrmJoinTableEnabledRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmJoinTableJoiningStrategy;
-import org.eclipse.jpt.core.context.orm.OrmManyToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmManyToManyRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmMappedByJoiningStrategy;
-import org.eclipse.jpt.core.context.orm.OrmOwnableRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipReference;
-import org.eclipse.jpt.core.resource.orm.XmlManyToMany;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmManyToManyRelationshipReference
- extends AbstractOrmRelationshipReference
- implements OrmManyToManyRelationshipReference
-{
- protected OrmMappedByJoiningStrategy mappedByJoiningStrategy;
-
- protected OrmJoinTableJoiningStrategy joinTableJoiningStrategy;
-
-
- public GenericOrmManyToManyRelationshipReference(
- OrmManyToManyMapping parent, XmlManyToMany resource) {
- super(parent, resource);
- }
-
-
- @Override
- protected void initializeJoiningStrategies() {
- this.mappedByJoiningStrategy = buildMappedByJoiningStrategy();
-
- // initialize join table last, as the existence of a default join
- // table is dependent on the other mechanisms (mappedBy)
- // not being specified
- this.joinTableJoiningStrategy = buildJoinTableJoiningStrategy();
- }
-
- protected OrmMappedByJoiningStrategy buildMappedByJoiningStrategy() {
- return new GenericOrmMappedByJoiningStrategy(this, getResourceMapping());
- }
-
- protected OrmJoinTableJoiningStrategy buildJoinTableJoiningStrategy() {
- return new GenericOrmJoinTableJoiningStrategy(this, getResourceMapping());
- }
-
- public void initializeOn(OrmRelationshipReference newRelationshipReference) {
- newRelationshipReference.initializeFromOwnableRelationshipReference(this);
- newRelationshipReference.initializeFromJoinTableEnabledRelationshipReference(this);
- }
-
- @Override
- public void initializeFromOwnableRelationshipReference(
- OrmOwnableRelationshipReference oldRelationshipReference) {
- super.initializeFromOwnableRelationshipReference(oldRelationshipReference);
- this.mappedByJoiningStrategy.setMappedByAttribute(
- oldRelationshipReference.getMappedByJoiningStrategy().getMappedByAttribute());
- }
-
- @Override
- public void initializeFromJoinTableEnabledRelationshipReference(
- OrmJoinTableEnabledRelationshipReference oldRelationshipReference) {
- super.initializeFromJoinTableEnabledRelationshipReference(oldRelationshipReference);
- OrmJoinTable oldTable =
- oldRelationshipReference.getJoinTableJoiningStrategy().getJoinTable();
- if (oldTable != null) {
- this.joinTableJoiningStrategy.addJoinTable().initializeFrom(oldTable);
- }
- }
-
-
- @Override
- public OrmManyToManyMapping getRelationshipMapping() {
- return (OrmManyToManyMapping) super.getRelationshipMapping();
- }
-
- public XmlManyToMany getResourceMapping() {
- return getRelationshipMapping().getResourceAttributeMapping();
- }
-
- public boolean isRelationshipOwner() {
- return this.mappedByJoiningStrategy.getMappedByAttribute() == null;
- }
-
- public boolean isOwnedBy(RelationshipMapping mapping) {
- return this.mappedByJoiningStrategy.relationshipIsOwnedBy(mapping);
- }
-
- @Override
- protected JoiningStrategy calculatePredominantJoiningStrategy() {
- if (this.mappedByJoiningStrategy.getMappedByAttribute() != null) {
- return this.mappedByJoiningStrategy;
- }
- else {
- return this.joinTableJoiningStrategy;
- }
- }
-
-
- // **************** mapped by **********************************************
-
- public OrmMappedByJoiningStrategy getMappedByJoiningStrategy() {
- return this.mappedByJoiningStrategy;
- }
-
- public boolean usesMappedByJoiningStrategy() {
- return getPredominantJoiningStrategy() == this.mappedByJoiningStrategy;
- }
-
- public void setMappedByJoiningStrategy() {
- this.mappedByJoiningStrategy.addStrategy();
- this.joinTableJoiningStrategy.removeStrategy();
- }
-
- public void unsetMappedByJoiningStrategy() {
- this.mappedByJoiningStrategy.removeStrategy();
- }
-
- public boolean mayBeMappedBy(AttributeMapping mappedByMapping) {
- return mappedByMapping.getKey() == MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-
-
- // **************** join table joining strategy ***************************
-
- public OrmJoinTableJoiningStrategy getJoinTableJoiningStrategy() {
- return this.joinTableJoiningStrategy;
- }
-
- public boolean usesJoinTableJoiningStrategy() {
- return getPredominantJoiningStrategy() == this.joinTableJoiningStrategy;
- }
-
- public void setJoinTableJoiningStrategy() {
- // join table is the default strategy, so no need to add to resource
- this.mappedByJoiningStrategy.removeStrategy();
- }
-
- public void unsetJoinTableJoiningStrategy() {
- this.joinTableJoiningStrategy.removeStrategy();
- }
-
- public boolean mayHaveDefaultJoinTable() {
- return getMappedByJoiningStrategy().getMappedByAttribute() == null;
- }
-
-
- // **************** resource => context ************************************
-
- @Override
- protected void updateJoiningStrategies() {
- this.mappedByJoiningStrategy.update();
-
- // update join table last, as the existence of a default join
- // table is dependent on the other mechanisms (mappedBy)
- // not being specified
- this.joinTableJoiningStrategy.update();
- }
-
-
- // **************** Validation *********************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.mappedByJoiningStrategy.validate(messages, reporter);
- this.joinTableJoiningStrategy.validate(messages, reporter);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmManyToOneRelationshipReference.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmManyToOneRelationshipReference.java
deleted file mode 100644
index 46104045a0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmManyToOneRelationshipReference.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumnEnabledRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumnJoiningStrategy;
-import org.eclipse.jpt.core.context.orm.OrmManyToOneMapping;
-import org.eclipse.jpt.core.context.orm.OrmManyToOneRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipReference;
-import org.eclipse.jpt.core.resource.orm.XmlManyToOne;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmManyToOneRelationshipReference
- extends AbstractOrmRelationshipReference
- implements OrmManyToOneRelationshipReference
-{
- protected OrmJoinColumnJoiningStrategy joinColumnJoiningStrategy;
-
-
- public GenericOrmManyToOneRelationshipReference(
- OrmManyToOneMapping parent, XmlManyToOne resource) {
- super(parent, resource);
- }
-
-
- @Override
- protected void initializeJoiningStrategies() {
- this.joinColumnJoiningStrategy = buildJoinColumnJoiningStrategy();
- }
-
- protected OrmJoinColumnJoiningStrategy buildJoinColumnJoiningStrategy() {
- return new GenericOrmJoinColumnJoiningStrategy(this, getResourceMapping());
- }
-
- public void initializeOn(OrmRelationshipReference newRelationshipReference) {
- newRelationshipReference.initializeFromJoinColumnEnabledRelationshipReference(this);
- }
-
- @Override
- public void initializeFromJoinColumnEnabledRelationshipReference(
- OrmJoinColumnEnabledRelationshipReference oldRelationshipReference) {
- int index = 0;
- for (JoinColumn joinColumn :
- CollectionTools.iterable(
- oldRelationshipReference.getJoinColumnJoiningStrategy().specifiedJoinColumns())) {
- OrmJoinColumn newJoinColumn = getJoinColumnJoiningStrategy().addSpecifiedJoinColumn(index++);
- newJoinColumn.initializeFrom(joinColumn);
- }
- }
-
- @Override
- public OrmManyToOneMapping getRelationshipMapping() {
- return (OrmManyToOneMapping) getParent();
- }
-
- public XmlManyToOne getResourceMapping() {
- return getRelationshipMapping().getResourceAttributeMapping();
- }
-
- public boolean isRelationshipOwner() {
- return true;
- }
-
- public boolean isOwnedBy(RelationshipMapping mapping) {
- return false;
- }
-
- @Override
- protected JoiningStrategy calculatePredominantJoiningStrategy() {
- // the only joining strategy
- return this.joinColumnJoiningStrategy;
- }
-
-
- // **************** join columns *******************************************
-
- public OrmJoinColumnJoiningStrategy getJoinColumnJoiningStrategy() {
- return this.joinColumnJoiningStrategy;
- }
-
- public boolean usesJoinColumnJoiningStrategy() {
- return getPredominantJoiningStrategy() == this.joinColumnJoiningStrategy;
- }
-
- public void setJoinColumnJoiningStrategy() {
- // join columns are default (only strategy in fact) so no need to add to resource
- }
-
- public void unsetJoinColumnJoiningStrategy() {
- this.joinColumnJoiningStrategy.removeStrategy();
- }
-
- public boolean mayHaveDefaultJoinColumn() {
- return true;
- }
-
-
- // **************** resource => context ************************************
-
- @Override
- protected void updateJoiningStrategies() {
- this.joinColumnJoiningStrategy.update();
- }
-
-
- // **************** Validation *********************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.joinColumnJoiningStrategy.validate(messages, reporter);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmMappedByJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmMappedByJoiningStrategy.java
deleted file mode 100644
index d17ce946ad..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmMappedByJoiningStrategy.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.orm.OrmMappedByJoiningStrategy;
-import org.eclipse.jpt.core.context.orm.OrmOwnableRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipMapping;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.XmlMappedByMapping;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmMappedByJoiningStrategy
- extends AbstractOrmXmlContextNode
- implements OrmMappedByJoiningStrategy
-{
- protected XmlMappedByMapping resource;
-
- protected String mappedByAttribute;
-
-
- public GenericOrmMappedByJoiningStrategy(
- OrmOwnableRelationshipReference parent,
- XmlMappedByMapping resource) {
- super(parent);
- this.resource = resource;
- this.mappedByAttribute = this.resource.getMappedBy();
- }
-
-
- @Override
- public OrmOwnableRelationshipReference getParent() {
- return (OrmOwnableRelationshipReference) super.getParent();
- }
-
- public OrmOwnableRelationshipReference getRelationshipReference() {
- return this.getParent();
- }
-
- public boolean isOverridableAssociation() {
- return false;
- }
-
- public OrmRelationshipMapping getRelationshipMapping() {
- return getParent().getRelationshipMapping();
- }
-
- public boolean relationshipIsOwnedBy(RelationshipMapping otherMapping) {
- String thisEntity =
- (getRelationshipReference().getEntity()) == null ?
- null : getRelationshipReference().getEntity().getName();
- String targetEntity =
- (getRelationshipMapping().getResolvedTargetEntity() == null) ?
- null : getRelationshipMapping().getResolvedTargetEntity().getName();
- return StringTools.stringsAreEqual(
- thisEntity,
- targetEntity)
- && StringTools.stringsAreEqual(
- getMappedByAttribute(),
- otherMapping.getName());
- }
-
- public String getMappedByAttribute() {
- return this.mappedByAttribute;
- }
-
- public void setMappedByAttribute(String newMappedByAttribute) {
- String oldMappedByAttribute = this.mappedByAttribute;
- this.mappedByAttribute = newMappedByAttribute;
- this.resource.setMappedBy(newMappedByAttribute);
- firePropertyChanged(MAPPED_BY_ATTRIBUTE_PROPERTY, oldMappedByAttribute, newMappedByAttribute);
- }
-
- protected void setMappedByAttribute_(String newMappedByAttribute) {
- String oldMappedByAttribute = this.mappedByAttribute;
- this.mappedByAttribute = newMappedByAttribute;
- firePropertyChanged(MAPPED_BY_ATTRIBUTE_PROPERTY, oldMappedByAttribute, newMappedByAttribute);
- }
-
- public void addStrategy() {
- if (this.mappedByAttribute == null) {
- setMappedByAttribute("");
- }
- }
-
- public void removeStrategy() {
- if (this.mappedByAttribute != null) {
- setMappedByAttribute(null);
- }
- }
-
- public void update() {
- setMappedByAttribute_(this.resource.getMappedBy());
- }
-
- public Iterator<String> candidateMappedByAttributeNames() {
- return getRelationshipMapping().allTargetEntityAttributeNames();
- }
-
-
- // **************** validation *********************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
-
- if (getMappedByAttribute() == 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(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.MAPPING_UNRESOLVED_MAPPED_BY,
- new String[] {this.mappedByAttribute},
- this,
- this.getValidationTextRange()
- )
- );
- return;
- }
-
- if ( ! this.getRelationshipReference().mayBeMappedBy(mappedByMapping)) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.MAPPING_INVALID_MAPPED_BY,
- new String[] {this.mappedByAttribute},
- this,
- this.getValidationTextRange()
- )
- );
- return;
- }
-
- // if mappedByMapping is not a relationship owner, then it should have
- // been flagged in above rule (mappedByIsValid)
- if (! ((RelationshipMapping) mappedByMapping).isRelationshipOwner()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.MAPPING_MAPPED_BY_ON_BOTH_SIDES,
- this,
- this.getValidationTextRange()
- )
- );
- }
- }
-
- public TextRange getValidationTextRange() {
- TextRange mappedByTextRange = this.resource.getMappedByTextRange();
- return mappedByTextRange != null ? mappedByTextRange : getRelationshipReference().getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOneToOneRelationshipReference.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOneToOneRelationshipReference.java
deleted file mode 100644
index 31b766c09f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOneToOneRelationshipReference.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumnEnabledRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumnJoiningStrategy;
-import org.eclipse.jpt.core.context.orm.OrmJoinTableEnabledRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmMappedByJoiningStrategy;
-import org.eclipse.jpt.core.context.orm.OrmOneToOneMapping;
-import org.eclipse.jpt.core.context.orm.OrmOneToOneRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmOwnableRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumnJoiningStrategy;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipReference;
-import org.eclipse.jpt.core.resource.orm.XmlOneToOne;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmOneToOneRelationshipReference
- extends AbstractOrmRelationshipReference
- implements OrmOneToOneRelationshipReference
-{
- protected OrmMappedByJoiningStrategy mappedByJoiningStrategy;
-
- protected OrmJoinColumnJoiningStrategy joinColumnJoiningStrategy;
-
- protected OrmPrimaryKeyJoinColumnJoiningStrategy primaryKeyJoinColumnJoiningStrategy;
-
-
- public GenericOrmOneToOneRelationshipReference(
- OrmOneToOneMapping parent, XmlOneToOne resource) {
- super(parent, resource);
- }
-
-
- @Override
- protected void initializeJoiningStrategies() {
- this.mappedByJoiningStrategy = buildMappedByJoiningStrategy();
- this.primaryKeyJoinColumnJoiningStrategy = buildPrimaryKeyJoinColumnJoiningStrategy();
-
- // initialize join columns last, as the existence of a default join
- // column is dependent on the other mechanisms (mappedBy, join table)
- // not being specified
- this.joinColumnJoiningStrategy = buildJoinColumnJoiningStrategy();
- }
-
- protected OrmMappedByJoiningStrategy buildMappedByJoiningStrategy() {
- return new GenericOrmMappedByJoiningStrategy(this, getResourceMapping());
- }
-
- protected OrmJoinColumnJoiningStrategy buildJoinColumnJoiningStrategy() {
- return new GenericOrmJoinColumnJoiningStrategy(this, getResourceMapping());
- }
-
- protected OrmPrimaryKeyJoinColumnJoiningStrategy buildPrimaryKeyJoinColumnJoiningStrategy() {
- return new GenericOrmPrimaryKeyJoinColumnJoiningStrategy(this, getResourceMapping());
- }
-
- public void initializeOn(OrmRelationshipReference newRelationshipReference) {
- newRelationshipReference.initializeFromOwnableRelationshipReference(this);
- newRelationshipReference.initializeFromJoinColumnEnabledRelationshipReference(this);
- // no other primary key reference as of yet, so no initialization based on pk join columns
- }
-
- @Override
- public void initializeFromOwnableRelationshipReference(
- OrmOwnableRelationshipReference oldRelationshipReference) {
- this.mappedByJoiningStrategy.setMappedByAttribute(
- oldRelationshipReference.getMappedByJoiningStrategy().getMappedByAttribute());
- }
-
- @Override
- public void initializeFromJoinColumnEnabledRelationshipReference(
- OrmJoinColumnEnabledRelationshipReference oldRelationshipReference) {
- int index = 0;
- for (JoinColumn joinColumn :
- CollectionTools.iterable(
- oldRelationshipReference.getJoinColumnJoiningStrategy().specifiedJoinColumns())) {
- OrmJoinColumn newJoinColumn = getJoinColumnJoiningStrategy().addSpecifiedJoinColumn(index++);
- newJoinColumn.initializeFrom(joinColumn);
- }
- }
-
- @Override
- public void initializeFromJoinTableEnabledRelationshipReference(
- OrmJoinTableEnabledRelationshipReference oldRelationshipReference) {
- // TODO no join table context model support as of yet
-
- }
-
- @Override
- public OrmOneToOneMapping getRelationshipMapping() {
- return (OrmOneToOneMapping) getParent();
- }
-
- public XmlOneToOne getResourceMapping() {
- return getRelationshipMapping().getResourceAttributeMapping();
- }
-
- public boolean isRelationshipOwner() {
- return this.mappedByJoiningStrategy.getMappedByAttribute() == null;
- }
-
- public boolean isOwnedBy(RelationshipMapping mapping) {
- return this.mappedByJoiningStrategy.relationshipIsOwnedBy(mapping);
- }
-
- @Override
- protected JoiningStrategy calculatePredominantJoiningStrategy() {
- if (this.mappedByJoiningStrategy.getMappedByAttribute() != null) {
- return this.mappedByJoiningStrategy;
- }
- else if (this.primaryKeyJoinColumnJoiningStrategy.primaryKeyJoinColumnsSize() > 0) {
- return this.primaryKeyJoinColumnJoiningStrategy;
- }
- else {
- return this.joinColumnJoiningStrategy;
- }
- }
-
-
- // **************** mapped by **********************************************
-
- public OrmMappedByJoiningStrategy getMappedByJoiningStrategy() {
- return this.mappedByJoiningStrategy;
- }
-
- public boolean usesMappedByJoiningStrategy() {
- return getPredominantJoiningStrategy() == this.mappedByJoiningStrategy;
- }
-
- public void setMappedByJoiningStrategy() {
- this.mappedByJoiningStrategy.addStrategy();
- this.joinColumnJoiningStrategy.removeStrategy();
- this.primaryKeyJoinColumnJoiningStrategy.removeStrategy();
- }
-
- public void unsetMappedByJoiningStrategy() {
- this.mappedByJoiningStrategy.removeStrategy();
- }
-
- public boolean mayBeMappedBy(AttributeMapping mappedByMapping) {
- return mappedByMapping.getKey() == MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
-
- // **************** join columns *******************************************
-
- public OrmJoinColumnJoiningStrategy getJoinColumnJoiningStrategy() {
- return this.joinColumnJoiningStrategy;
- }
-
- public boolean usesJoinColumnJoiningStrategy() {
- return getPredominantJoiningStrategy() == this.joinColumnJoiningStrategy;
- }
-
- public void setJoinColumnJoiningStrategy() {
- this.mappedByJoiningStrategy.removeStrategy();
- this.primaryKeyJoinColumnJoiningStrategy.removeStrategy();
- // join columns are default, so no need to add annotations
- }
-
- public void unsetJoinColumnJoiningStrategy() {
- this.joinColumnJoiningStrategy.removeStrategy();
- }
-
- public boolean mayHaveDefaultJoinColumn() {
- return this.getMappedByJoiningStrategy().getMappedByAttribute() == null
- && this.getPrimaryKeyJoinColumnJoiningStrategy().primaryKeyJoinColumnsSize() == 0;
- }
-
-
- // **************** primary key join columns *******************************
-
- public OrmPrimaryKeyJoinColumnJoiningStrategy getPrimaryKeyJoinColumnJoiningStrategy() {
- return this.primaryKeyJoinColumnJoiningStrategy;
- }
-
- public boolean usesPrimaryKeyJoinColumnJoiningStrategy() {
- return getPredominantJoiningStrategy() == this.primaryKeyJoinColumnJoiningStrategy;
- }
-
- public void setPrimaryKeyJoinColumnJoiningStrategy() {
- this.primaryKeyJoinColumnJoiningStrategy.addStrategy();
- this.mappedByJoiningStrategy.removeStrategy();
- this.joinColumnJoiningStrategy.removeStrategy();
- }
-
- public void unsetPrimaryKeyJoinColumnJoiningStrategy() {
- this.primaryKeyJoinColumnJoiningStrategy.removeStrategy();
- }
-
- public boolean mayHaveDefaultPrimaryKeyJoinColumn() {
- return false;
- }
-
-
- // **************** resource => context ************************************
-
- @Override
- protected void updateJoiningStrategies() {
- this.mappedByJoiningStrategy.update();
- this.primaryKeyJoinColumnJoiningStrategy.update();
-
- // update join columns last, as the existence of a default join
- // column is dependent on the other mechanisms (mappedBy, join table)
- // not being specified
- this.joinColumnJoiningStrategy.update();
- }
-
-
- // **************** Validation *********************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.mappedByJoiningStrategy.validate(messages, reporter);
- this.primaryKeyJoinColumnJoiningStrategy.validate(messages, reporter);
- this.joinColumnJoiningStrategy.validate(messages, reporter);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnJoiningStrategy.java
deleted file mode 100644
index 4039e485cb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnJoiningStrategy.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jpt.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumnEnabledRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumnEnabledRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumnJoiningStrategy;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipMapping;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlOneToOne;
-import org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-public class GenericOrmPrimaryKeyJoinColumnJoiningStrategy
- extends AbstractOrmXmlContextNode
- implements OrmPrimaryKeyJoinColumnJoiningStrategy
-{
- protected XmlOneToOne resource;
-
- protected final Vector<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns = new Vector<OrmPrimaryKeyJoinColumn>();
-
- protected final OrmJoinColumn.Owner joinColumnOwner;
-
-
- public GenericOrmPrimaryKeyJoinColumnJoiningStrategy(
- OrmPrimaryKeyJoinColumnEnabledRelationshipReference parent,
- XmlOneToOne resource) {
- super(parent);
- this.resource = resource;
- this.joinColumnOwner = this.buildJoinColumnOwner();
- this.initializePrimaryKeyJoinColumns();
- }
-
- protected OrmJoinColumn.Owner buildJoinColumnOwner() {
- return new JoinColumnOwner();
- }
-
- protected void initializePrimaryKeyJoinColumns() {
- if (this.resource != null) {
- for (XmlPrimaryKeyJoinColumn resourceJoinColumn : this.resource.getPrimaryKeyJoinColumns()) {
- this.primaryKeyJoinColumns.add(buildPrimaryKeyJoinColumn(resourceJoinColumn));
- }
- }
- }
-
- protected OrmPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(
- XmlPrimaryKeyJoinColumn resourceJoinColumn) {
- return this.getXmlContextNodeFactory().buildOrmPrimaryKeyJoinColumn(this, this.joinColumnOwner, resourceJoinColumn);
- }
-
- @Override
- public OrmJoinColumnEnabledRelationshipReference getParent() {
- return (OrmJoinColumnEnabledRelationshipReference) super.getParent();
- }
-
- public OrmJoinColumnEnabledRelationshipReference getRelationshipReference() {
- return this.getParent();
- }
-
- public OrmRelationshipMapping getRelationshipMapping() {
- return this.getRelationshipReference().getRelationshipMapping();
- }
-
- public void addStrategy() {
- if (primaryKeyJoinColumnsSize() == 0) {
- addPrimaryKeyJoinColumn(0);
- }
- }
-
- public void removeStrategy() {
- for (PrimaryKeyJoinColumn each : CollectionTools.iterable(primaryKeyJoinColumns())) {
- removePrimaryKeyJoinColumn(each);
- }
- }
-
- public boolean isOverridableAssociation() {
- return false;
- }
-
-
- // **************** primary key join columns *******************************
-
- public ListIterator<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
- return new CloneListIterator<OrmPrimaryKeyJoinColumn>(this.primaryKeyJoinColumns);
- }
-
- public int primaryKeyJoinColumnsSize() {
- return this.primaryKeyJoinColumns.size();
- }
-
- public boolean hasPrimaryKeyJoinColumns() {
- return ! this.primaryKeyJoinColumns.isEmpty();
- }
-
- public OrmPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(int index) {
- XmlPrimaryKeyJoinColumn resourcePkJoinColumn =
- OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumn();
- OrmPrimaryKeyJoinColumn contextPkJoinColumn =
- this.buildPrimaryKeyJoinColumn(resourcePkJoinColumn);
- this.primaryKeyJoinColumns.add(index, contextPkJoinColumn);
- this.resource.getPrimaryKeyJoinColumns().add(index, resourcePkJoinColumn);
- this.fireItemAdded(PRIMARY_KEY_JOIN_COLUMNS_LIST, index, contextPkJoinColumn);
- return contextPkJoinColumn;
- }
-
- protected void addPrimaryKeyJoinColumn(int index, OrmPrimaryKeyJoinColumn joinColumn) {
- this.addItemToList(index, joinColumn, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- protected void addPrimaryKeyJoinColumn(OrmPrimaryKeyJoinColumn joinColumn) {
- this.addPrimaryKeyJoinColumn(this.primaryKeyJoinColumns.size(), joinColumn);
- }
-
- public void removePrimaryKeyJoinColumn(PrimaryKeyJoinColumn pkJoinColumn) {
- this.removePrimaryKeyJoinColumn(this.primaryKeyJoinColumns.indexOf(pkJoinColumn));
- }
-
- public void removePrimaryKeyJoinColumn(int index) {
- OrmPrimaryKeyJoinColumn removedPkJoinColumn = this.primaryKeyJoinColumns.remove(index);
- this.resource.getPrimaryKeyJoinColumns().remove(index);
- this.fireItemRemoved(PRIMARY_KEY_JOIN_COLUMNS_LIST, index, removedPkJoinColumn);
- }
-
- protected void removePrimaryKeyJoinColumn_(OrmPrimaryKeyJoinColumn joinColumn) {
- removeItemFromList(joinColumn, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- public void movePrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.primaryKeyJoinColumns, targetIndex, sourceIndex);
- this.resource.getPrimaryKeyJoinColumns().move(targetIndex, sourceIndex);
- fireItemMoved(PRIMARY_KEY_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
- }
-
-
- // **************** resource -> context ************************************
-
- public void update() {
- updatePrimaryKeyJoinColumns();
- }
-
- protected void updatePrimaryKeyJoinColumns() {
- // make a copy of the XML PK join columns (to prevent ConcurrentModificationException)
- Iterator<XmlPrimaryKeyJoinColumn> xmlPkJoinColumns =
- new CloneIterator<XmlPrimaryKeyJoinColumn>(this.resource.getPrimaryKeyJoinColumns());
-
- for (Iterator<OrmPrimaryKeyJoinColumn> contextPkJoinColumns = primaryKeyJoinColumns();
- contextPkJoinColumns.hasNext(); ) {
- OrmPrimaryKeyJoinColumn contextPkJoinColumn = contextPkJoinColumns.next();
- if (xmlPkJoinColumns.hasNext()) {
- contextPkJoinColumn.update(xmlPkJoinColumns.next());
- }
- else {
- removePrimaryKeyJoinColumn_(contextPkJoinColumn);
- }
- }
-
- while (xmlPkJoinColumns.hasNext()) {
- addPrimaryKeyJoinColumn(buildPrimaryKeyJoinColumn(xmlPkJoinColumns.next()));
- }
- }
-
- public TextRange getValidationTextRange() {
- return this.getRelationshipReference().getValidationTextRange();
- }
-
-
- // ********** join column owner adapter **********
-
- protected class JoinColumnOwner
- implements OrmJoinColumn.Owner
- {
- protected JoinColumnOwner() {
- super();
- }
-
- /**
- * by default, the join column is in the type mapping's primary table
- */
- public String getDefaultTableName() {
- return getTypeMapping().getPrimaryTableName();
- }
-
- public Entity getTargetEntity() {
- return getRelationshipMapping().getResolvedTargetEntity();
- }
-
- public String getAttributeName() {
- return getRelationshipMapping().getPersistentAttribute().getName();
- }
-
- public RelationshipMapping getRelationshipMapping() {
- return GenericOrmPrimaryKeyJoinColumnJoiningStrategy.this.getRelationshipMapping();
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return getTypeMapping().tableNameIsInvalid(tableName);
- }
-
- /**
- * the join column can be on a secondary table
- */
- public boolean tableIsAllowed() {
- return true;
- }
-
- public TypeMapping getTypeMapping() {
- return getRelationshipMapping().getTypeMapping();
- }
-
- public Table getDbTable(String tableName) {
- return getTypeMapping().getDbTable(tableName);
- }
-
- public Table getReferencedColumnDbTable() {
- Entity targetEntity = getTargetEntity();
- return (targetEntity == null) ? null : targetEntity.getPrimaryDbTable();
- }
-
- public boolean isVirtual(BaseJoinColumn joinColumn) {
- return false;
- }
-
- public String getDefaultColumnName() {
- return null;
- }
-
- public int joinColumnsSize() {
- return GenericOrmPrimaryKeyJoinColumnJoiningStrategy.this.primaryKeyJoinColumnsSize();
- }
-
- public TextRange getValidationTextRange() {
- return GenericOrmPrimaryKeyJoinColumnJoiningStrategy.this.getValidationTextRange();
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmXmlContextNodeFactory.java
deleted file mode 100644
index 26b83ea43d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmXmlContextNodeFactory.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-
-public class GenericOrmXmlContextNodeFactory extends AbstractOrmXmlContextNodeFactory
-{
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/NullOrmAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/NullOrmAssociationOverrideContainer.java
deleted file mode 100644
index ed7b4f75b1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/NullOrmAssociationOverrideContainer.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.ListIterator;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-
-public class NullOrmAssociationOverrideContainer extends AbstractOrmXmlContextNode
- implements OrmAssociationOverrideContainer
-{
-
- protected final OrmAssociationOverrideContainer.Owner owner;
-
- public NullOrmAssociationOverrideContainer(XmlContextNode parent, OrmAssociationOverrideContainer.Owner owner) {
- super(parent);
- this.owner = owner;
- }
-
- public Owner getOwner() {
- return this.owner;
- }
-
- public ListIterator<OrmAssociationOverride> associationOverrides() {
- return EmptyListIterator.instance();
- }
-
- public int associationOverridesSize() {
- return 0;
- }
-
- public ListIterator<OrmAssociationOverride> virtualAssociationOverrides() {
- return EmptyListIterator.instance();
- }
-
- public int virtualAssociationOverridesSize() {
- return 0;
- }
-
- public ListIterator<OrmAssociationOverride> specifiedAssociationOverrides() {
- return EmptyListIterator.instance();
- }
-
- public int specifiedAssociationOverridesSize() {
- return 0;
- }
-
- public void moveSpecifiedAssociationOverride(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public OrmAssociationOverride getAssociationOverrideNamed(String name) {
- return null;
- }
-
- public void update() {
- //no-op
- }
-
-
- public TextRange getValidationTextRange() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmBasicMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmBasicMappingDefinition.java
deleted file mode 100644
index 210c6e2f79..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmBasicMappingDefinition.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlBasic;
-import org.eclipse.jpt.core.resource.xml.EmfTools;
-
-public class OrmBasicMappingDefinition
- implements OrmAttributeMappingDefinition
-{
- // singleton
- private static final OrmAttributeMappingDefinition INSTANCE =
- new OrmBasicMappingDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmBasicMappingDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
- }
-
- public XmlAttributeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlBasic(),
- XmlBasic.class);
- }
-
- public OrmBasicMapping buildContextMapping(
- OrmPersistentAttribute parent,
- XmlAttributeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmBasicMapping(parent, (XmlBasic) resourceMapping);
- }
-
- public XmlAttributeMapping buildVirtualResourceMapping(
- OrmTypeMapping ormTypeMapping,
- JavaAttributeMapping javaAttributeMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildVirtualXmlBasic(ormTypeMapping, (JavaBasicMapping) javaAttributeMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddableDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddableDefinition.java
deleted file mode 100644
index d908024b78..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddableDefinition.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddable;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddable;
-import org.eclipse.jpt.core.resource.orm.XmlTypeMapping;
-import org.eclipse.jpt.core.resource.xml.EmfTools;
-
-/**
- * default ORM Embeddable provider
- */
-public class OrmEmbeddableDefinition
- implements OrmTypeMappingDefinition
-{
- // singleton
- private static final OrmEmbeddableDefinition INSTANCE =
- new OrmEmbeddableDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmTypeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmEmbeddableDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
- }
-
- public XmlTypeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlEmbeddable(),
- XmlEmbeddable.class);
- }
-
- public OrmEmbeddable buildContextMapping(
- OrmPersistentType parent,
- XmlTypeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmEmbeddable(parent, (XmlEmbeddable) resourceMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddedIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddedIdMappingDefinition.java
deleted file mode 100644
index 133bd4fbb2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddedIdMappingDefinition.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaEmbeddedIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddedId;
-import org.eclipse.jpt.core.resource.xml.EmfTools;
-
-public class OrmEmbeddedIdMappingDefinition
- implements OrmAttributeMappingDefinition
-{
- // singleton
- private static final OrmAttributeMappingDefinition INSTANCE =
- new OrmEmbeddedIdMappingDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmEmbeddedIdMappingDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
- }
-
- public XmlAttributeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlEmbeddedId(),
- XmlEmbeddedId.class);
- }
-
- public OrmAttributeMapping buildContextMapping(
- OrmPersistentAttribute parent,
- XmlAttributeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmEmbeddedIdMapping(parent, (XmlEmbeddedId) resourceMapping);
- }
-
- public XmlAttributeMapping buildVirtualResourceMapping(
- OrmTypeMapping ormTypeMapping,
- JavaAttributeMapping javaAttributeMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildVirtualXmlEmbeddedId(ormTypeMapping, (JavaEmbeddedIdMapping) javaAttributeMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddedMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddedMappingDefinition.java
deleted file mode 100644
index 26cd121b1a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddedMappingDefinition.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaEmbeddedMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlEmbedded;
-import org.eclipse.jpt.core.resource.xml.EmfTools;
-
-public class OrmEmbeddedMappingDefinition
- implements OrmAttributeMappingDefinition
-{
- // singleton
- private static final OrmAttributeMappingDefinition INSTANCE =
- new OrmEmbeddedMappingDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmEmbeddedMappingDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
- }
-
- public XmlAttributeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlEmbedded(),
- XmlEmbedded.class);
- }
-
- public OrmAttributeMapping buildContextMapping(
- OrmPersistentAttribute parent,
- XmlAttributeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmEmbeddedMapping(parent, (XmlEmbedded) resourceMapping);
- }
-
- public XmlAttributeMapping buildVirtualResourceMapping(
- OrmTypeMapping ormTypeMapping,
- JavaAttributeMapping javaAttributeMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildVirtualXmlEmbedded(ormTypeMapping, (JavaEmbeddedMapping) javaAttributeMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEntityDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEntityDefinition.java
deleted file mode 100644
index cf734f64dc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEntityDefinition.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.core.resource.orm.XmlTypeMapping;
-import org.eclipse.jpt.core.resource.xml.EmfTools;
-
-/**
- * default ORM Entity provider
- */
-public class OrmEntityDefinition
- implements OrmTypeMappingDefinition
-{
- // singleton
- private static final OrmEntityDefinition INSTANCE =
- new OrmEntityDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmTypeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmEntityDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.ENTITY_TYPE_MAPPING_KEY;
- }
-
- public XmlTypeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlEntity(),
- XmlEntity.class);
- }
-
- public OrmEntity buildContextMapping(
- OrmPersistentType parent,
- XmlTypeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmEntity(parent, (XmlEntity) resourceMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmIdMappingDefinition.java
deleted file mode 100644
index afedc490bd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmIdMappingDefinition.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlId;
-import org.eclipse.jpt.core.resource.xml.EmfTools;
-
-public class OrmIdMappingDefinition
- implements OrmAttributeMappingDefinition
-{
- // singleton
- private static final OrmAttributeMappingDefinition INSTANCE =
- new OrmIdMappingDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmIdMappingDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
- }
-
- public XmlAttributeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlId(),
- XmlId.class);
- }
-
- public OrmAttributeMapping buildContextMapping(
- OrmPersistentAttribute parent,
- XmlAttributeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmIdMapping(parent, (XmlId) resourceMapping);
- }
-
- public XmlAttributeMapping buildVirtualResourceMapping(
- OrmTypeMapping ormTypeMapping,
- JavaAttributeMapping javaAttributeMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildVirtualXmlId(ormTypeMapping, (JavaIdMapping) javaAttributeMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmManyToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmManyToManyMappingDefinition.java
deleted file mode 100644
index c719454455..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmManyToManyMappingDefinition.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaManyToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlManyToMany;
-import org.eclipse.jpt.core.resource.xml.EmfTools;
-
-public class OrmManyToManyMappingDefinition
- implements OrmAttributeMappingDefinition
-{
- // singleton
- private static final OrmAttributeMappingDefinition INSTANCE =
- new OrmManyToManyMappingDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmManyToManyMappingDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-
- public XmlAttributeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlManyToMany(),
- XmlManyToMany.class);
- }
-
- public OrmAttributeMapping buildContextMapping(
- OrmPersistentAttribute parent,
- XmlAttributeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmManyToManyMapping(parent, (XmlManyToMany) resourceMapping);
- }
-
- public XmlAttributeMapping buildVirtualResourceMapping(
- OrmTypeMapping ormTypeMapping,
- JavaAttributeMapping javaAttributeMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildVirtualXmlManyToMany(ormTypeMapping, (JavaManyToManyMapping) javaAttributeMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmManyToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmManyToOneMappingDefinition.java
deleted file mode 100644
index 2098c673e3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmManyToOneMappingDefinition.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaManyToOneMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlManyToOne;
-import org.eclipse.jpt.core.resource.xml.EmfTools;
-
-public class OrmManyToOneMappingDefinition
- implements OrmAttributeMappingDefinition
-{
- // singleton
- private static final OrmAttributeMappingDefinition INSTANCE =
- new OrmManyToOneMappingDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmManyToOneMappingDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
- public XmlAttributeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlManyToOne(),
- XmlManyToOne.class);
- }
-
- public OrmAttributeMapping buildContextMapping(
- OrmPersistentAttribute parent,
- XmlAttributeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmManyToOneMapping(parent, (XmlManyToOne) resourceMapping);
- }
-
- public XmlAttributeMapping buildVirtualResourceMapping(
- OrmTypeMapping ormTypeMapping,
- JavaAttributeMapping javaAttributeMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildVirtualXmlManyToOne(ormTypeMapping, (JavaManyToOneMapping) javaAttributeMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmMappedSuperclassDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmMappedSuperclassDefinition.java
deleted file mode 100644
index c0e2f67d6f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmMappedSuperclassDefinition.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmMappedSuperclass;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlMappedSuperclass;
-import org.eclipse.jpt.core.resource.orm.XmlTypeMapping;
-import org.eclipse.jpt.core.resource.xml.EmfTools;
-
-/**
- * default ORM MappedSuperclass definition
- */
-public class OrmMappedSuperclassDefinition
- implements OrmTypeMappingDefinition
-{
- // singleton
- private static final OrmMappedSuperclassDefinition INSTANCE =
- new OrmMappedSuperclassDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmTypeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmMappedSuperclassDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY;
- }
-
- public XmlTypeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlMappedSuperclass(),
- XmlMappedSuperclass.class);
- }
-
- public OrmMappedSuperclass buildContextMapping(
- OrmPersistentType parent,
- XmlTypeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmMappedSuperclass(parent, (XmlMappedSuperclass) resourceMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmOneToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmOneToManyMappingDefinition.java
deleted file mode 100644
index f7ea7d8ce8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmOneToManyMappingDefinition.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaOneToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlOneToMany;
-import org.eclipse.jpt.core.resource.xml.EmfTools;
-
-public class OrmOneToManyMappingDefinition
- implements OrmAttributeMappingDefinition
-{
- // singleton
- private static final OrmAttributeMappingDefinition INSTANCE =
- new OrmOneToManyMappingDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmOneToManyMappingDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-
- public XmlAttributeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlOneToMany(),
- XmlOneToMany.class);
- }
-
- public OrmAttributeMapping buildContextMapping(
- OrmPersistentAttribute parent,
- XmlAttributeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmOneToManyMapping(parent, (XmlOneToMany) resourceMapping);
- }
-
- public XmlAttributeMapping buildVirtualResourceMapping(
- OrmTypeMapping ormTypeMapping,
- JavaAttributeMapping javaAttributeMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildVirtualXmlOneToMany(ormTypeMapping, (JavaOneToManyMapping) javaAttributeMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmOneToOneMappingDefinition.java
deleted file mode 100644
index 487b0497ea..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmOneToOneMappingDefinition.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaOneToOneMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlOneToOne;
-import org.eclipse.jpt.core.resource.xml.EmfTools;
-
-public class OrmOneToOneMappingDefinition
- implements OrmAttributeMappingDefinition
-{
- // singleton
- private static final OrmAttributeMappingDefinition INSTANCE =
- new OrmOneToOneMappingDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmOneToOneMappingDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
- public XmlAttributeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlOneToOne(),
- XmlOneToOne.class);
- }
-
- public OrmAttributeMapping buildContextMapping(
- OrmPersistentAttribute parent,
- XmlAttributeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmOneToOneMapping(parent, (XmlOneToOne) resourceMapping);
- }
-
- public XmlAttributeMapping buildVirtualResourceMapping(
- OrmTypeMapping ormTypeMapping,
- JavaAttributeMapping javaAttributeMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildVirtualXmlOneToOne(ormTypeMapping, (JavaOneToOneMapping) javaAttributeMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmTransientMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmTransientMappingDefinition.java
deleted file mode 100644
index 6177649214..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmTransientMappingDefinition.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaTransientMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlTransient;
-import org.eclipse.jpt.core.resource.xml.EmfTools;
-
-public class OrmTransientMappingDefinition
- implements OrmAttributeMappingDefinition
-{
- // singleton
- private static final OrmAttributeMappingDefinition INSTANCE =
- new OrmTransientMappingDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmTransientMappingDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
- }
-
- public XmlAttributeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlTransient(),
- XmlTransient.class);
- }
-
- public OrmAttributeMapping buildContextMapping(
- OrmPersistentAttribute parent,
- XmlAttributeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmTransientMapping(parent, (XmlTransient) resourceMapping);
- }
-
- public XmlAttributeMapping buildVirtualResourceMapping(
- OrmTypeMapping ormTypeMapping,
- JavaAttributeMapping javaAttributeMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildVirtualXmlTransient(ormTypeMapping, (JavaTransientMapping) javaAttributeMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmVersionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmVersionMappingDefinition.java
deleted file mode 100644
index abc841dda2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmVersionMappingDefinition.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaVersionMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlVersion;
-import org.eclipse.jpt.core.resource.xml.EmfTools;
-
-public class OrmVersionMappingDefinition
- implements OrmAttributeMappingDefinition
-{
- // singleton
- private static final OrmAttributeMappingDefinition INSTANCE =
- new OrmVersionMappingDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmVersionMappingDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
- }
-
- public XmlAttributeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlVersion(),
- XmlVersion.class);
- }
-
- public OrmAttributeMapping buildContextMapping(
- OrmPersistentAttribute parent,
- XmlAttributeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmVersionMapping(parent, (XmlVersion) resourceMapping);
- }
-
- public XmlAttributeMapping buildVirtualResourceMapping(
- OrmTypeMapping ormTypeMapping,
- JavaAttributeMapping javaAttributeMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildVirtualXmlVersion(ormTypeMapping, (JavaVersionMapping) javaAttributeMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualCascadeType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualCascadeType.java
deleted file mode 100644
index 9c28a4a1a5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualCascadeType.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.Cascade;
-import org.eclipse.jpt.core.resource.orm.CascadeType;
-
-public class VirtualCascadeType extends CascadeType
-{
- Cascade javaCascade;
-
- protected boolean metadataComplete;
-
- public VirtualCascadeType(Cascade javaCascade, boolean metadataComplete) {
- super();
- this.javaCascade = javaCascade;
- this.metadataComplete = metadataComplete;
- }
-
- @Override
- public boolean isCascadeAll() {
- if (this.metadataComplete) {
- return false;
- }
- return this.javaCascade.isAll();
- }
-
- @Override
- public void setCascadeAll(boolean value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public boolean isCascadeMerge() {
- if (this.metadataComplete) {
- return false;
- }
- return this.javaCascade.isMerge();
- }
-
- @Override
- public void setCascadeMerge(boolean value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public boolean isCascadePersist() {
- if (this.metadataComplete) {
- return false;
- }
- return this.javaCascade.isPersist();
- }
-
- @Override
- public void setCascadePersist(boolean value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public boolean isCascadeRefresh() {
- if (this.metadataComplete) {
- return false;
- }
- return this.javaCascade.isRefresh();
- }
-
- @Override
- public void setCascadeRefresh(boolean value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public boolean isCascadeRemove() {
- if (this.metadataComplete) {
- return false;
- }
- return this.javaCascade.isRemove();
- }
-
- @Override
- public void setCascadeRemove(boolean value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualMapKey.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualMapKey.java
deleted file mode 100644
index 0ae38eddc9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualMapKey.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.java.JavaMultiRelationshipMapping;
-import org.eclipse.jpt.core.resource.orm.MapKey;
-
-public class VirtualMapKey extends MapKey
-{
- JavaMultiRelationshipMapping javaMultiRelationshipMapping;
-
- protected boolean metadataComplete;
-
- public VirtualMapKey(JavaMultiRelationshipMapping javaMultiRelationshipMapping, boolean metadataComplete) {
- super();
- this.javaMultiRelationshipMapping = javaMultiRelationshipMapping;
- this.metadataComplete = metadataComplete;
- }
-
- @Override
- public String getName() {
- if (this.metadataComplete) {
- return null;
- }
- return this.javaMultiRelationshipMapping.getSpecifiedMapKey();
- }
-
- @Override
- public void setName(String newName) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlAssociationOverride.java
deleted file mode 100644
index 6f4af8edab..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlAssociationOverride.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c)2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinColumnJoiningStrategy;
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-public class VirtualXmlAssociationOverride extends XmlAssociationOverride
-{
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JoiningStrategy joiningStrategy;
-
-
- public VirtualXmlAssociationOverride(String name, OrmTypeMapping ormTypeMapping, JoiningStrategy joiningStrategy) {
- super();
- this.name = name;
- this.ormTypeMapping = ormTypeMapping;
- this.joiningStrategy = joiningStrategy;
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public void setName(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
-
- @Override
- public EList<XmlJoinColumn> getJoinColumns() {
- EList<XmlJoinColumn> joinColumns = new EObjectContainmentEList<XmlJoinColumn>(XmlJoinColumn.class, this, OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_COLUMNS);
- if (this.joiningStrategy instanceof JoinColumnJoiningStrategy) {
- for (JoinColumn joinColumn :
- CollectionTools.iterable(((JoinColumnJoiningStrategy) this.joiningStrategy).joinColumns())) {
- XmlJoinColumn xmlJoinColumn = new VirtualXmlJoinColumn(joinColumn, this.isOrmMetadataComplete());
- joinColumns.add(xmlJoinColumn);
- }
- }
- return joinColumns;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlAttributeMapping.java
deleted file mode 100644
index a071e1ce71..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlAttributeMapping.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.resource.orm.AccessType;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.xml.AbstractJpaEObject;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class VirtualXmlAttributeMapping extends AbstractJpaEObject implements XmlAttributeMapping
-{
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaAttributeMapping javaAttributeMapping;
-
-
- public VirtualXmlAttributeMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaAttributeMapping;
- }
-
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- public String getMappingKey() {
- if (this.isOrmMetadataComplete()) {
- return this.javaAttributeMapping.getPersistentAttribute().getDefaultMappingKey();
- }
- return this.javaAttributeMapping.getKey();
- }
-
- public String getName() {
- return this.javaAttributeMapping.getPersistentAttribute().getName();
- }
-
- public void setName(String newName) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- public TextRange getNameTextRange() {
- return null;
- }
-
- public AccessType getAccess() {
- return org.eclipse.jpt.core.context.AccessType.toOrmResourceModel(
- this.javaAttributeMapping.getPersistentAttribute().getAccess());
- }
-
- public void setAccess(AccessType value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlAttributeOverride.java
deleted file mode 100644
index 86e3490191..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlAttributeOverride.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-
-public class VirtualXmlAttributeOverride extends XmlAttributeOverride
-{
-
- public VirtualXmlAttributeOverride(String name, XmlColumn xmlColumn) {
- super();
- this.name = name;
- this.column = xmlColumn;
- }
-
- @Override
- public String getName() {
- return this.name;
- }
-
- @Override
- public void setName(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
-
- @Override
- public XmlColumn getColumn() {
- return this.column;
- }
-
- @Override
- public void setColumn(XmlColumn value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlAttributeOverrideColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlAttributeOverrideColumn.java
deleted file mode 100644
index d1383f2d92..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlAttributeOverrideColumn.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.Column;
-
-/**
- * javax.persistence.Column
- */
-public class VirtualXmlAttributeOverrideColumn
- extends VirtualXmlColumn
-{
-
- public VirtualXmlAttributeOverrideColumn(Column column) {
- super(null, column);
- }
-
- @Override
- public String getName() {
- return this.column.getSpecifiedName();
- }
-
- @Override
- public String getColumnDefinition() {
- return this.column.getColumnDefinition();
- }
-
- @Override
- public String getTable() {
- return this.column.getSpecifiedTable();
- }
-
- @Override
- public Boolean getInsertable() {
- return this.column.getSpecifiedInsertable();
- }
-
- @Override
- public Boolean getUpdatable() {
- return this.column.getSpecifiedUpdatable();
- }
-
- @Override
- public Boolean getNullable() {
- return this.column.getSpecifiedNullable();
- }
-
- @Override
- public Boolean getUnique() {
- return this.column.getSpecifiedUnique();
- }
-
- @Override
- public Integer getLength() {
- return this.column.getSpecifiedLength();
- }
-
- @Override
- public Integer getScale() {
- return this.column.getSpecifiedScale();
- }
-
- @Override
- public Integer getPrecision() {
- return this.column.getSpecifiedPrecision();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlBasic.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlBasic.java
deleted file mode 100644
index d3f075932e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlBasic.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.EnumeratedConverter;
-import org.eclipse.jpt.core.context.TemporalConverter;
-import org.eclipse.jpt.core.context.java.JavaBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.resource.orm.EnumType;
-import org.eclipse.jpt.core.resource.orm.FetchType;
-import org.eclipse.jpt.core.resource.orm.TemporalType;
-import org.eclipse.jpt.core.resource.orm.XmlBasic;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * VirtualBasic is an implementation of Basic used when there is
- * no tag in the orm.xml and an underlying javaBasicMapping exists.
- */
-public class VirtualXmlBasic extends XmlBasic
-{
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaBasicMapping javaAttributeMapping;
-
- protected final VirtualXmlAttributeMapping virtualXmlAttributeMapping;
-
- protected final VirtualXmlColumn column;
-
- public VirtualXmlBasic(OrmTypeMapping ormTypeMapping, JavaBasicMapping javaBasicMapping) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaBasicMapping;
- this.virtualXmlAttributeMapping = new VirtualXmlAttributeMapping(ormTypeMapping, javaBasicMapping);
- this.column = new VirtualXmlColumn(ormTypeMapping, javaBasicMapping.getColumn());
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public String getMappingKey() {
- return this.virtualXmlAttributeMapping.getMappingKey();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlAttributeMapping.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlAttributeMapping.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlAttributeMapping.getNameTextRange();
- }
-
- @Override
- public XmlColumn getColumn() {
- return this.column;
- }
-
- @Override
- public void setColumn(XmlColumn value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public FetchType getFetch() {
- if (this.isOrmMetadataComplete()) {
- return org.eclipse.jpt.core.context.FetchType.toOrmResourceModel(this.javaAttributeMapping.getDefaultFetch());
- }
- return org.eclipse.jpt.core.context.FetchType.toOrmResourceModel(this.javaAttributeMapping.getFetch());
- }
-
- @Override
- public void setFetch(FetchType newFetch) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Boolean getOptional() {
- if (this.isOrmMetadataComplete()) {
- return Boolean.valueOf(this.javaAttributeMapping.isDefaultOptional());
- }
- return Boolean.valueOf(this.javaAttributeMapping.isOptional());
- }
-
- @Override
- public void setOptional(Boolean newOptional) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public boolean isLob() {
- if (this.isOrmMetadataComplete()) {
- return false;
- }
- return this.javaAttributeMapping.getConverter().getType() == Converter.LOB_CONVERTER;
- }
-
- @Override
- public void setLob(boolean newLob) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public TemporalType getTemporal() {
- if (this.isOrmMetadataComplete()) {
- return null;
- }
- if (this.javaAttributeMapping.getConverter().getType() == Converter.TEMPORAL_CONVERTER) {
- org.eclipse.jpt.core.context.TemporalType javaTemporalType = ((TemporalConverter) this.javaAttributeMapping.getConverter()).getTemporalType();
- return org.eclipse.jpt.core.context.TemporalType.toOrmResourceModel(javaTemporalType);
- }
- return null;
- }
-
- @Override
- public void setTemporal(TemporalType newTemporal){
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public EnumType getEnumerated() {
- if (this.javaAttributeMapping.getConverter().getType() != Converter.ENUMERATED_CONVERTER) {
- return null;
- }
- org.eclipse.jpt.core.context.EnumType javaEnumeratedType;
- if (this.isOrmMetadataComplete()) {
- if (this.javaAttributeMapping.getDefaultConverter().getType() != Converter.ENUMERATED_CONVERTER) {
- return null;
- }
- javaEnumeratedType = ((EnumeratedConverter) this.javaAttributeMapping.getDefaultConverter()).getSpecifiedEnumType();
- }
- else {
- javaEnumeratedType = ((EnumeratedConverter) this.javaAttributeMapping.getConverter()).getEnumType();
- }
- return org.eclipse.jpt.core.context.EnumType.toOrmResourceModel(javaEnumeratedType);
- }
-
- @Override
- public void setEnumerated(EnumType newEnumerated) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public TextRange getEnumeratedTextRange() {
- return null;
- }
-
- @Override
- public TextRange getLobTextRange() {
- return null;
- }
-
- @Override
- public TextRange getTemporalTextRange() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlColumn.java
deleted file mode 100644
index 86659456f8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlColumn.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * A virtual column is used to represent the XmlColumn resource object
- * within a virtual mapping. A virtual mapping is one which is not specified
- * in the orm.xml file, but is implied from the underlying java. Virtual column
- * is not used when the mapping is specified in the orm.xml, but the column tag does not exist.
- *
- * A virtual column delegates to the underlying java column for its state. The metadataComplete
- * flag determines whether it will get specified or default information from the java column
- *
- */
-public class VirtualXmlColumn extends XmlColumn
-{
-
- protected Column column;
-
- protected OrmTypeMapping ormTypeMapping;
-
-
- public VirtualXmlColumn(OrmTypeMapping ormTypeMapping, Column column) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.column = column;
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public String getColumnDefinition() {
- if (this.isOrmMetadataComplete()) {
- return null;
- }
- return this.column.getColumnDefinition();
- }
-
- @Override
- public void setColumnDefinition(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Boolean getInsertable() {
- if (this.isOrmMetadataComplete()) {
- return Boolean.valueOf(this.column.isDefaultInsertable());
- }
- return Boolean.valueOf(this.column.isInsertable());
- }
-
- @Override
- public void setInsertable(Boolean value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Integer getLength() {
- if (this.isOrmMetadataComplete()) {
- return Integer.valueOf(this.column.getDefaultLength());
- }
- return Integer.valueOf(this.column.getLength());
- }
-
- @Override
- public void setLength(Integer value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getName() {
- if (this.isOrmMetadataComplete()) {
- return this.column.getDefaultName();
- }
- return this.column.getName();
- }
-
- @Override
- public void setName(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Boolean getNullable() {
- if (this.isOrmMetadataComplete()) {
- return Boolean.valueOf(this.column.isDefaultNullable());
- }
- return Boolean.valueOf(this.column.isNullable());
- }
-
- @Override
- public void setNullable(Boolean value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Integer getPrecision() {
- if (this.isOrmMetadataComplete()) {
- return Integer.valueOf(this.column.getDefaultPrecision());
- }
- return Integer.valueOf(this.column.getPrecision());
- }
-
- @Override
- public void setPrecision(Integer value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Integer getScale() {
- if (this.isOrmMetadataComplete()) {
- return Integer.valueOf(this.column.getDefaultScale());
- }
- return Integer.valueOf(this.column.getScale());
- }
-
- @Override
- public void setScale(Integer value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getTable() {
- if (!this.isOrmMetadataComplete()) {
- if (this.column.getSpecifiedTable() != null) {
- return this.column.getSpecifiedTable();
- }
- }
- return this.ormTypeMapping.getPrimaryTableName();
- }
-
- @Override
- public void setTable(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Boolean getUnique() {
- if (this.isOrmMetadataComplete()) {
- return Boolean.valueOf(this.column.isDefaultUnique());
- }
- return Boolean.valueOf(this.column.isUnique());
- }
-
- @Override
- public void setUnique(Boolean value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Boolean getUpdatable() {
- if (this.isOrmMetadataComplete()) {
- return Boolean.valueOf(this.column.isDefaultUpdatable());
- }
- return Boolean.valueOf(this.column.isUpdatable());
- }
-
- @Override
- public void setUpdatable(Boolean value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public TextRange getNameTextRange() {
- return null;
- }
-
- @Override
- public TextRange getTableTextRange() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlEmbedded.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlEmbedded.java
deleted file mode 100644
index 24dfaed2e2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlEmbedded.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.ListIterator;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverride;
-import org.eclipse.jpt.core.context.java.JavaEmbeddedMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.core.resource.orm.XmlEmbedded;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-/**
- * VirtualEmbedded is an implementation of Embedded used when there is
- * no tag in the orm.xml and an underlying javaEmbeddedMapping exists.
- */
-public class VirtualXmlEmbedded extends XmlEmbedded
-{
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaEmbeddedMapping javaAttributeMapping;
-
- protected final VirtualXmlAttributeMapping virtualXmlAttributeMapping;
-
- public VirtualXmlEmbedded(OrmTypeMapping ormTypeMapping, JavaEmbeddedMapping javaEmbeddedMapping) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaEmbeddedMapping;
- this.virtualXmlAttributeMapping = new VirtualXmlAttributeMapping(ormTypeMapping, javaEmbeddedMapping);
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public String getMappingKey() {
- return this.virtualXmlAttributeMapping.getMappingKey();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlAttributeMapping.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlAttributeMapping.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlAttributeMapping.getNameTextRange();
- }
-
- @Override
- public EList<XmlAttributeOverride> getAttributeOverrides() {
- EList<XmlAttributeOverride> attributeOverrides = new EObjectContainmentEList<XmlAttributeOverride>(XmlAttributeOverride.class, this, OrmPackage.XML_EMBEDDED__ATTRIBUTE_OVERRIDES);
- ListIterator<JavaAttributeOverride> javaAttributeOverrides;
- if (!this.isOrmMetadataComplete()) {
- javaAttributeOverrides = this.javaAttributeMapping.getAttributeOverrideContainer().attributeOverrides();
- }
- else {
- javaAttributeOverrides = this.javaAttributeMapping.getAttributeOverrideContainer().virtualAttributeOverrides();
- }
- for (JavaAttributeOverride javaAttributeOverride : CollectionTools.iterable(javaAttributeOverrides)) {
- XmlColumn xmlColumn = new VirtualXmlColumn(this.ormTypeMapping, javaAttributeOverride.getColumn());
- XmlAttributeOverride xmlAttributeOverride = new VirtualXmlAttributeOverride(javaAttributeOverride.getName(), xmlColumn);
- attributeOverrides.add(xmlAttributeOverride);
- }
- return attributeOverrides;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlEmbeddedId.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlEmbeddedId.java
deleted file mode 100644
index 058723fb1b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlEmbeddedId.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.ListIterator;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverride;
-import org.eclipse.jpt.core.context.java.JavaEmbeddedIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddedId;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-/**
- * VirtualEmbeddedId is an implementation of EmbeddedId used when there is
- * no tag in the orm.xml and an underlying javaEmbeddedIdMapping exists.
- */
-public class VirtualXmlEmbeddedId extends XmlEmbeddedId
-{
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaEmbeddedIdMapping javaAttributeMapping;
-
- protected final VirtualXmlAttributeMapping virtualXmlAttributeMapping;
-
- public VirtualXmlEmbeddedId(OrmTypeMapping ormTypeMapping, JavaEmbeddedIdMapping javaEmbeddedIdMapping) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaEmbeddedIdMapping;
- this.virtualXmlAttributeMapping = new VirtualXmlAttributeMapping(ormTypeMapping, javaEmbeddedIdMapping);
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public String getMappingKey() {
- return this.virtualXmlAttributeMapping.getMappingKey();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlAttributeMapping.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlAttributeMapping.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlAttributeMapping.getNameTextRange();
- }
-
- @Override
- public EList<XmlAttributeOverride> getAttributeOverrides() {
- EList<XmlAttributeOverride> attributeOverrides = new EObjectContainmentEList<XmlAttributeOverride>(XmlAttributeOverride.class, this, OrmPackage.XML_EMBEDDED_ID__ATTRIBUTE_OVERRIDES);
- ListIterator<JavaAttributeOverride> javaAttributeOverrides;
- if (!this.isOrmMetadataComplete()) {
- javaAttributeOverrides = this.javaAttributeMapping.getAttributeOverrideContainer().attributeOverrides();
- }
- else {
- javaAttributeOverrides = this.javaAttributeMapping.getAttributeOverrideContainer().virtualAttributeOverrides();
- }
- for (JavaAttributeOverride javaAttributeOverride : CollectionTools.iterable(javaAttributeOverrides)) {
- XmlColumn xmlColumn = new VirtualXmlColumn(this.ormTypeMapping, javaAttributeOverride.getColumn());
- XmlAttributeOverride xmlAttributeOverride = new VirtualXmlAttributeOverride(javaAttributeOverride.getName(), xmlColumn);
- attributeOverrides.add(xmlAttributeOverride);
- }
- return attributeOverrides;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlGeneratedValue.java
deleted file mode 100644
index 828999cb40..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlGeneratedValue.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.java.JavaGeneratedValue;
-import org.eclipse.jpt.core.context.java.JavaIdMapping;
-import org.eclipse.jpt.core.resource.orm.GenerationType;
-import org.eclipse.jpt.core.resource.orm.XmlGeneratedValue;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class VirtualXmlGeneratedValue extends XmlGeneratedValue
-{
- JavaIdMapping javaIdMapping;
-
- protected boolean metadataComplete;
-
-
- public VirtualXmlGeneratedValue(JavaIdMapping javaIdMapping, boolean metadataComplete) {
- super();
- this.javaIdMapping = javaIdMapping;
- this.metadataComplete = metadataComplete;
- }
-
- protected JavaGeneratedValue getJavaGeneratedValue() {
- return this.javaIdMapping.getGeneratedValue();
- }
-
-
- @Override
- public String getGenerator() {
- return this.metadataComplete ? null : this.getJavaGeneratedValue().getGenerator();
- }
-
- @Override
- public GenerationType getStrategy() {
- return this.metadataComplete ? null : org.eclipse.jpt.core.context.GenerationType.toOrmResourceModel(this.getJavaGeneratedValue().getStrategy());
- }
-
- @Override
- public void setGenerator(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public void setStrategy(GenerationType value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public TextRange getGeneratorTextRange() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlId.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlId.java
deleted file mode 100644
index 9e50e0cffb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlId.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.TemporalConverter;
-import org.eclipse.jpt.core.context.java.JavaIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.resource.orm.EnumType;
-import org.eclipse.jpt.core.resource.orm.TemporalType;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.core.resource.orm.XmlGeneratedValue;
-import org.eclipse.jpt.core.resource.orm.XmlId;
-import org.eclipse.jpt.core.resource.orm.XmlSequenceGenerator;
-import org.eclipse.jpt.core.resource.orm.XmlTableGenerator;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * VirtualId is an implementation of Id used when there is
- * no tag in the orm.xml and an underlying javaIdMapping exists.
- */
-public class VirtualXmlId extends XmlId
-{
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaIdMapping javaAttributeMapping;
-
- protected final VirtualXmlAttributeMapping virtualXmlAttributeMapping;
-
- protected final VirtualXmlColumn column;
-
- protected final VirtualXmlGeneratedValue virtualGeneratedValue;
-
- protected final VirtualXmlTableGenerator virtualTableGenerator;
-
- protected final VirtualXmlSequenceGenerator virtualSequenceGenerator;
-
-
- public VirtualXmlId(OrmTypeMapping ormTypeMapping, JavaIdMapping javaIdMapping) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaIdMapping;
- this.virtualXmlAttributeMapping = new VirtualXmlAttributeMapping(ormTypeMapping, javaIdMapping);
- this.column = new VirtualXmlColumn(ormTypeMapping, javaIdMapping.getColumn());
- this.virtualGeneratedValue = new VirtualXmlGeneratedValue(javaIdMapping, this.isOrmMetadataComplete());
- this.virtualTableGenerator = new VirtualXmlTableGenerator(javaIdMapping.getGeneratorContainer(), this.isOrmMetadataComplete());
- this.virtualSequenceGenerator = new VirtualXmlSequenceGenerator(javaIdMapping.getGeneratorContainer(), this.isOrmMetadataComplete());
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public String getMappingKey() {
- return this.virtualXmlAttributeMapping.getMappingKey();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlAttributeMapping.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlAttributeMapping.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlAttributeMapping.getNameTextRange();
- }
-
- @Override
- public XmlColumn getColumn() {
- return this.column;
- }
-
- @Override
- public void setColumn(XmlColumn value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public TemporalType getTemporal() {
- if (this.isOrmMetadataComplete()) {
- return null;
- }
- if (this.javaAttributeMapping.getConverter().getType() == Converter.TEMPORAL_CONVERTER) {
- org.eclipse.jpt.core.context.TemporalType javaTemporalType = ((TemporalConverter) this.javaAttributeMapping.getConverter()).getTemporalType();
- return org.eclipse.jpt.core.context.TemporalType.toOrmResourceModel(javaTemporalType);
- }
- return null;
- }
-
- @Override
- public void setTemporal(TemporalType newTemporal){
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
-
- @Override
- public XmlGeneratedValue getGeneratedValue() {
- if (this.isOrmMetadataComplete()) {
- return null;
- }
- if (this.javaAttributeMapping.getGeneratedValue() != null) {
- return this.virtualGeneratedValue;
- }
- return null;
- }
-
- @Override
- public void setGeneratedValue(XmlGeneratedValue value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public XmlSequenceGenerator getSequenceGenerator() {
- if (this.isOrmMetadataComplete()) {
- return null;
- }
- if (this.javaAttributeMapping.getGeneratorContainer().getSequenceGenerator() != null) {
- return this.virtualSequenceGenerator;
- }
- return null;
- }
-
- @Override
- public void setSequenceGenerator(XmlSequenceGenerator value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public XmlTableGenerator getTableGenerator() {
- if (this.isOrmMetadataComplete()) {
- return null;
- }
- if (this.javaAttributeMapping.getGeneratorContainer().getTableGenerator() != null) {
- return this.virtualTableGenerator;
- }
- return null;
- }
-
- @Override
- public void setTableGenerator(XmlTableGenerator value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- //see eclipselink bug 247078 for info one why I made the interface XmlConvertibleMapping
- @Override
- public EnumType getEnumerated() {
- throw new UnsupportedOperationException("enumerated not supported on id mappings"); //$NON-NLS-1$
- }
-
- @Override
- public void setEnumerated(EnumType value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- //see eclipselink bug 247078 for info one why I made the interface XmlConvertibleMapping
- @Override
- public boolean isLob() {
- throw new UnsupportedOperationException("lob not supported on id mappings"); //$NON-NLS-1$
- }
-
- @Override
- public void setLob(boolean value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public TextRange getEnumeratedTextRange() {
- return null;
- }
-
- @Override
- public TextRange getLobTextRange() {
- return null;
- }
-
- @Override
- public TextRange getTemporalTextRange() {
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlJoinColumn.java
deleted file mode 100644
index 0e862c7c88..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlJoinColumn.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class VirtualXmlJoinColumn extends XmlJoinColumn
-{
- protected JoinColumn javaJoinColumn;
-
- protected boolean metadataComplete;
-
- public VirtualXmlJoinColumn(JoinColumn javaJoinColumn, boolean metadataComplete) {
- super();
- this.javaJoinColumn = javaJoinColumn;
- this.metadataComplete = metadataComplete;
- }
-
- @Override
- public String getColumnDefinition() {
- if (this.metadataComplete) {
- return null;
- }
- return this.javaJoinColumn.getColumnDefinition();
- }
-
- @Override
- public void setColumnDefinition(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Boolean getInsertable() {
- if (this.metadataComplete) {
- return Boolean.valueOf(this.javaJoinColumn.isDefaultInsertable());
- }
- return Boolean.valueOf(this.javaJoinColumn.isInsertable());
- }
-
- @Override
- public void setInsertable(Boolean value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getName() {
- if (this.metadataComplete) {
- return this.javaJoinColumn.getDefaultName();
- }
- return this.javaJoinColumn.getName();
- }
-
- @Override
- public void setName(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getReferencedColumnName() {
- if (this.metadataComplete) {
- return this.javaJoinColumn.getDefaultReferencedColumnName();
- }
- return this.javaJoinColumn.getReferencedColumnName();
- }
-
- @Override
- public void setReferencedColumnName(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Boolean getNullable() {
- if (this.metadataComplete) {
- return Boolean.valueOf(this.javaJoinColumn.isDefaultNullable());
- }
- return Boolean.valueOf(this.javaJoinColumn.isNullable());
- }
-
- @Override
- public void setNullable(Boolean value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getTable() {
- if (this.metadataComplete) {
- return this.javaJoinColumn.getDefaultTable();
- }
- return this.javaJoinColumn.getTable();
- }
-
- @Override
- public void setTable(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Boolean getUnique() {
- if (this.metadataComplete) {
- return Boolean.valueOf(this.javaJoinColumn.isDefaultUnique());
- }
- return Boolean.valueOf(this.javaJoinColumn.isUnique());
- }
-
- @Override
- public void setUnique(Boolean value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Boolean getUpdatable() {
- if (this.metadataComplete) {
- return Boolean.valueOf(this.javaJoinColumn.isDefaultUpdatable());
- }
- return Boolean.valueOf(this.javaJoinColumn.isUpdatable());
- }
-
- @Override
- public void setUpdatable(Boolean value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public TextRange getNameTextRange() {
- return null;
- }
-
- @Override
- public TextRange getTableTextRange() {
- return null;
- }
-
- @Override
- public TextRange getReferencedColumnNameTextRange() {
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlJoinTable.java
deleted file mode 100644
index 40b116a798..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlJoinTable.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
-import org.eclipse.jpt.core.resource.orm.XmlUniqueConstraint;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-public class VirtualXmlJoinTable
- extends XmlJoinTable
-{
- protected OrmTypeMapping ormTypeMapping;
-
- protected JoinTable joinTable;
-
-
- public VirtualXmlJoinTable(OrmTypeMapping ormTypeMapping, JoinTable joinTable) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.joinTable = joinTable;
- }
-
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public String getName() {
- if (this.isOrmMetadataComplete()) {
- return this.joinTable.getDefaultName();
- }
- return this.joinTable.getName();
- }
-
- @Override
- public void setName(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getCatalog() {
- if (this.isOrmMetadataComplete()) {
- return this.joinTable.getDefaultCatalog();
- }
- return this.joinTable.getCatalog();
- }
-
- @Override
- public void setCatalog(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getSchema() {
- if (this.isOrmMetadataComplete()) {
- return this.joinTable.getDefaultSchema();
- }
- return this.joinTable.getSchema();
- }
-
- @Override
- public void setSchema(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- //VirtualXmlJoinTable is rebuilt every time, so just rebuilding the joinColumns list as well
- @Override
- public EList<XmlJoinColumn> getJoinColumns() {
- EList<XmlJoinColumn> joinColumns = new EObjectContainmentEList<XmlJoinColumn>(XmlJoinColumn.class, this, OrmPackage.XML_JOIN_TABLE__JOIN_COLUMNS);
- if (this.joinTable == null) {
- return joinColumns;
- }
- for (JoinColumn joinColumn : CollectionTools.iterable(this.joinTable.specifiedJoinColumns())) {
- XmlJoinColumn xmlJoinColumn = new VirtualXmlJoinColumn(joinColumn, isOrmMetadataComplete());
- joinColumns.add(xmlJoinColumn);
- }
- return joinColumns;
- }
-
- //VirtualXmlJoinTable is rebuilt every time, so just rebuilding the joinColumns list as well
- @Override
- public EList<XmlJoinColumn> getInverseJoinColumns() {
- EList<XmlJoinColumn> inverseJoinColumns = new EObjectContainmentEList<XmlJoinColumn>(XmlJoinColumn.class, this, OrmPackage.XML_JOIN_TABLE__INVERSE_JOIN_COLUMNS);
- if (this.joinTable == null) {
- return inverseJoinColumns;
- }
- for (JoinColumn joinColumn : CollectionTools.iterable(this.joinTable.specifiedInverseJoinColumns())) {
- XmlJoinColumn xmlJoinColumn = new VirtualXmlJoinColumn(joinColumn, isOrmMetadataComplete());
- inverseJoinColumns.add(xmlJoinColumn);
- }
-
- return inverseJoinColumns;
- }
-
- @Override
- public EList<XmlUniqueConstraint> getUniqueConstraints() {
- EList<XmlUniqueConstraint> xmlUniqueConstraints = new EObjectContainmentEList<XmlUniqueConstraint>(XmlUniqueConstraint.class, this, OrmPackage.XML_JOIN_TABLE__UNIQUE_CONSTRAINTS);
- for (UniqueConstraint uniqueConstraint : CollectionTools.iterable(this.joinTable.uniqueConstraints())) {
- XmlUniqueConstraint xmlUniqueConstraint = new VirtualXmlUniqueConstraint(uniqueConstraint, isOrmMetadataComplete());
- xmlUniqueConstraints.add(xmlUniqueConstraint);
- }
-
- return xmlUniqueConstraints;
- }
-
- @Override
- public TextRange getNameTextRange() {
- return null;
- }
-
- @Override
- public TextRange getCatalogTextRange() {
- return null;
- }
-
- @Override
- public TextRange getSchemaTextRange() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlManyToMany.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlManyToMany.java
deleted file mode 100644
index 1d5ebe08a4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlManyToMany.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.core.context.java.JavaManyToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.jpa2.context.Orderable2_0;
-import org.eclipse.jpt.core.resource.orm.CascadeType;
-import org.eclipse.jpt.core.resource.orm.FetchType;
-import org.eclipse.jpt.core.resource.orm.MapKey;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
-import org.eclipse.jpt.core.resource.orm.XmlManyToMany;
-import org.eclipse.jpt.core.resource.orm.XmlOrderColumn;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * VirtualManyToMany is an implementation of ManyToMany used when there is
- * no tag in the orm.xml and an underlying javaManyToManyMapping exists.
- */
-public class VirtualXmlManyToMany
- extends XmlManyToMany
-{
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaManyToManyMapping javaAttributeMapping;
-
- protected final VirtualXmlAttributeMapping virtualXmlAttributeMapping;
-
- protected final VirtualCascadeType virtualCascadeType;
-
- protected final MapKey mapKey;
-
-
- public VirtualXmlManyToMany(
- OrmTypeMapping ormTypeMapping, JavaManyToManyMapping javaManyToManyMapping) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaManyToManyMapping;
- this.virtualXmlAttributeMapping = new VirtualXmlAttributeMapping(ormTypeMapping, javaManyToManyMapping);
- this.virtualCascadeType =
- new VirtualCascadeType(javaManyToManyMapping.getCascade(), this.isOrmMetadataComplete());
- this.mapKey = new VirtualMapKey(javaManyToManyMapping, this.isOrmMetadataComplete());
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public String getMappingKey() {
- return this.virtualXmlAttributeMapping.getMappingKey();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlAttributeMapping.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlAttributeMapping.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlAttributeMapping.getNameTextRange();
- }
-
- @Override
- public FetchType getFetch() {
- if (this.isOrmMetadataComplete()) {
- return org.eclipse.jpt.core.context.FetchType.toOrmResourceModel(this.javaAttributeMapping.getDefaultFetch());
- }
- return org.eclipse.jpt.core.context.FetchType.toOrmResourceModel(this.javaAttributeMapping.getFetch());
- }
-
- @Override
- public void setFetch(FetchType newFetch) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- public EList<XmlJoinColumn> getJoinColumns() {
- return null;
- }
-
- @Override
- public CascadeType getCascade() {
- return this.virtualCascadeType;
- }
-
- @Override
- public void setCascade(CascadeType value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public XmlJoinTable getJoinTable() {
- if (this.javaAttributeMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable() != null) {
- return new VirtualXmlJoinTable(
- this.ormTypeMapping,
- this.javaAttributeMapping.getRelationshipReference().
- getJoinTableJoiningStrategy().getJoinTable());
- }
- return null;
- }
-
- @Override
- public void setJoinTable(XmlJoinTable value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getTargetEntity() {
- if (this.isOrmMetadataComplete()) {
- return this.javaAttributeMapping.getDefaultTargetEntity();
- }
- return this.javaAttributeMapping.getTargetEntity();
- }
-
- @Override
- public void setTargetEntity(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getMappedBy() {
- if (this.isOrmMetadataComplete()) {
- return null;
- }
- return this.javaAttributeMapping.getRelationshipReference().getMappedByJoiningStrategy().getMappedByAttribute();
- }
-
- @Override
- public void setMappedBy(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
-
- @Override
- public MapKey getMapKey() {
- return this.mapKey;
- }
-
- @Override
- public void setMapKey(MapKey value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getOrderBy() {
- if (this.isOrmMetadataComplete()) {
- return null;
- }
- return this.javaAttributeMapping.getOrderable().getSpecifiedOrderBy();
- }
-
- @Override
- public void setOrderBy(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public XmlOrderColumn getOrderColumn() {
- if (((Orderable2_0) this.javaAttributeMapping.getOrderable()).isOrderColumnOrdering()) {
- return new VirtualXmlOrderColumn(
- ((Orderable2_0) this.javaAttributeMapping.getOrderable()).getOrderColumn(),
- this.ormTypeMapping.isMetadataComplete());
- }
- return null;
- }
-
- @Override
- public TextRange getMappedByTextRange() {
- return null;
- }
-
- @Override
- public TextRange getTargetEntityTextRange() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlManyToOne.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlManyToOne.java
deleted file mode 100644
index 3b70d598bf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlManyToOne.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaManyToOneMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.resource.orm.CascadeType;
-import org.eclipse.jpt.core.resource.orm.FetchType;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
-import org.eclipse.jpt.core.resource.orm.XmlManyToOne;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-/**
- * VirtualManyToOne is an implementation of ManyToOne used when there is
- * no tag in the orm.xml and an underlying javaManyToOneMapping exists.
- */
-public class VirtualXmlManyToOne
- extends XmlManyToOne
-{
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaManyToOneMapping javaAttributeMapping;
-
- protected final VirtualXmlAttributeMapping virtualXmlAttributeMapping;
-
- protected final VirtualCascadeType virtualCascadeType;
-
-
- public VirtualXmlManyToOne(
- OrmTypeMapping ormTypeMapping, JavaManyToOneMapping javaManyToOneMapping) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaManyToOneMapping;
- this.virtualXmlAttributeMapping = new VirtualXmlAttributeMapping(ormTypeMapping, javaManyToOneMapping);
- this.virtualCascadeType =
- new VirtualCascadeType(javaManyToOneMapping.getCascade(), this.isOrmMetadataComplete());
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public String getMappingKey() {
- return this.virtualXmlAttributeMapping.getMappingKey();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlAttributeMapping.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlAttributeMapping.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlAttributeMapping.getNameTextRange();
- }
-
- @Override
- public FetchType getFetch() {
- if (this.isOrmMetadataComplete()) {
- return org.eclipse.jpt.core.context.FetchType.toOrmResourceModel(this.javaAttributeMapping.getDefaultFetch());
- }
- return org.eclipse.jpt.core.context.FetchType.toOrmResourceModel(this.javaAttributeMapping.getFetch());
- }
-
- @Override
- public void setFetch(FetchType newFetch) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Boolean getOptional() {
- if (this.isOrmMetadataComplete()) {
- return Boolean.valueOf(this.javaAttributeMapping.isDefaultOptional());
- }
- return Boolean.valueOf(this.javaAttributeMapping.isOptional());
- }
-
- @Override
- public void setOptional(Boolean newOptional) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public EList<XmlJoinColumn> getJoinColumns() {
- EList<XmlJoinColumn> joinColumns = new EObjectContainmentEList<XmlJoinColumn>(XmlJoinColumn.class, this, OrmPackage.XML_JOIN_TABLE__JOIN_COLUMNS);
- //TODO here i'm using joinColumns() while VirtualXmlJoinTable uses specifiedJoinColumns()???
- for (JavaJoinColumn joinColumn :
- CollectionTools.iterable(
- this.javaAttributeMapping.getRelationshipReference().
- getJoinColumnJoiningStrategy().joinColumns())) {
- XmlJoinColumn xmlJoinColumn = new VirtualXmlJoinColumn(joinColumn, this.isOrmMetadataComplete());
- joinColumns.add(xmlJoinColumn);
- }
- return joinColumns;
- }
-
- @Override
- public CascadeType getCascade() {
- return this.virtualCascadeType;
- }
-
- @Override
- public void setCascade(CascadeType value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public XmlJoinTable getJoinTable() {
- //TODO we don't yet support JoinTable in the context model for many-to-one mappings
- return null;//this.virtualJoinTable;
- }
-
- @Override
- public void setJoinTable(XmlJoinTable value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getTargetEntity() {
- if (this.isOrmMetadataComplete()) {
- return this.javaAttributeMapping.getDefaultTargetEntity();
- }
- return this.javaAttributeMapping.getTargetEntity();
- }
-
- @Override
- public void setTargetEntity(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public TextRange getTargetEntityTextRange() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlNullAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlNullAttributeMapping.java
deleted file mode 100644
index e8a503d192..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlNullAttributeMapping.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlNullAttributeMapping;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * VirtualVersion is an implementation of Version used when there is
- * no tag in the orm.xml and an underlying javaVersionMapping exists.
- */
-public class VirtualXmlNullAttributeMapping extends XmlNullAttributeMapping
-{
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaAttributeMapping javaAttributeMapping;
-
- protected final VirtualXmlAttributeMapping virtualXmlAttributeMapping;
-
- public VirtualXmlNullAttributeMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaAttributeMapping;
- this.virtualXmlAttributeMapping = new VirtualXmlAttributeMapping(ormTypeMapping, javaAttributeMapping);
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- public String getMappingKey() {
- if (this.isOrmMetadataComplete()) {
- return this.javaAttributeMapping.getPersistentAttribute().getDefaultMappingKey();
- }
- return this.javaAttributeMapping.getKey();
- }
-
- @Override
- public String getName() {
- return this.javaAttributeMapping.getPersistentAttribute().getName();
- }
-
- @Override
- public void setName(String newName) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public TextRange getNameTextRange() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOneToMany.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOneToMany.java
deleted file mode 100644
index 2a97d19ae5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOneToMany.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.core.context.java.JavaOneToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.jpa2.context.Orderable2_0;
-import org.eclipse.jpt.core.resource.orm.CascadeType;
-import org.eclipse.jpt.core.resource.orm.FetchType;
-import org.eclipse.jpt.core.resource.orm.MapKey;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
-import org.eclipse.jpt.core.resource.orm.XmlOneToMany;
-import org.eclipse.jpt.core.resource.orm.XmlOrderColumn;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * VirtualOneToMany is an implementation of OneToMany used when there is
- * no tag in the orm.xml and an underlying javaOneToManyMapping exists.
- */
-public class VirtualXmlOneToMany
- extends XmlOneToMany
-{
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaOneToManyMapping javaAttributeMapping;
-
- protected final VirtualXmlAttributeMapping virtualXmlAttributeMapping;
-
- protected final VirtualCascadeType virtualCascadeType;
-
- protected final MapKey mapKey;
-
-
- public VirtualXmlOneToMany(
- OrmTypeMapping ormTypeMapping, JavaOneToManyMapping javaOneToManyMapping) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaOneToManyMapping;
- this.virtualXmlAttributeMapping = new VirtualXmlAttributeMapping(ormTypeMapping, javaOneToManyMapping);
- this.virtualCascadeType =
- new VirtualCascadeType(javaOneToManyMapping.getCascade(), this.isOrmMetadataComplete());
- this.mapKey = new VirtualMapKey(javaOneToManyMapping, this.isOrmMetadataComplete());
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public String getMappingKey() {
- return this.virtualXmlAttributeMapping.getMappingKey();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlAttributeMapping.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlAttributeMapping.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlAttributeMapping.getNameTextRange();
- }
-
- @Override
- public FetchType getFetch() {
- if (this.isOrmMetadataComplete()) {
- return org.eclipse.jpt.core.context.FetchType.toOrmResourceModel(this.javaAttributeMapping.getDefaultFetch());
- }
- return org.eclipse.jpt.core.context.FetchType.toOrmResourceModel(this.javaAttributeMapping.getFetch());
- }
-
- @Override
- public void setFetch(FetchType newFetch) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public EList<XmlJoinColumn> getJoinColumns() {
- return null;
- }
-
- @Override
- public CascadeType getCascade() {
- return this.virtualCascadeType;
- }
-
- @Override
- public void setCascade(CascadeType value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
-
- @Override
- public Boolean getOrphanRemoval() {
- throw new UnsupportedOperationException("operation not supported in JPA 1.0"); //$NON-NLS-1$
- }
-
- @Override
- public void setOrphanRemoval(Boolean newOrphanRemoval) {
- throw new UnsupportedOperationException("operation not supported in JPA 1.0"); //$NON-NLS-1$
- }
-
- @Override
- public XmlJoinTable getJoinTable() {
- if (this.javaAttributeMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable() != null) {
- return new VirtualXmlJoinTable(
- this.ormTypeMapping,
- this.javaAttributeMapping.getRelationshipReference().
- getJoinTableJoiningStrategy().getJoinTable());
- }
- return null;
- }
-
- @Override
- public void setJoinTable(XmlJoinTable value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getTargetEntity() {
- if (this.isOrmMetadataComplete()) {
- return this.javaAttributeMapping.getDefaultTargetEntity();
- }
- return this.javaAttributeMapping.getTargetEntity();
- }
-
- @Override
- public void setTargetEntity(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getMappedBy() {
- if (this.isOrmMetadataComplete()) {
- return null;
- }
- return this.javaAttributeMapping.getRelationshipReference().
- getMappedByJoiningStrategy().getMappedByAttribute();
- }
-
- @Override
- public void setMappedBy(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
-
- @Override
- public MapKey getMapKey() {
- return this.mapKey;
- }
-
- @Override
- public void setMapKey(MapKey value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getOrderBy() {
- if (this.isOrmMetadataComplete()) {
- return null;
- }
- return this.javaAttributeMapping.getOrderable().getSpecifiedOrderBy();
- }
-
- @Override
- public void setOrderBy(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public XmlOrderColumn getOrderColumn() {
- if (((Orderable2_0) this.javaAttributeMapping.getOrderable()).isOrderColumnOrdering()) {
- return new VirtualXmlOrderColumn(
- ((Orderable2_0) this.javaAttributeMapping.getOrderable()).getOrderColumn(),
- this.ormTypeMapping.isMetadataComplete());
- }
- return null;
- }
-
- @Override
- public TextRange getMappedByTextRange() {
- return null;
- }
-
- @Override
- public TextRange getTargetEntityTextRange() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOneToOne.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOneToOne.java
deleted file mode 100644
index d1df5aad58..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOneToOne.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaOneToOneMapping;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.resource.orm.CascadeType;
-import org.eclipse.jpt.core.resource.orm.FetchType;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
-import org.eclipse.jpt.core.resource.orm.XmlOneToOne;
-import org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-/**
- * VirtualOneToOne is an implementation of OneToOne used when there is
- * no tag in the orm.xml and an underlying javaOneToOneMapping exists.
- */
-public class VirtualXmlOneToOne extends XmlOneToOne
-{
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaOneToOneMapping javaAttributeMapping;
-
- protected final VirtualXmlAttributeMapping virtualXmlAttributeMapping;
-
- protected final VirtualCascadeType virtualCascadeType;
-
-
- public VirtualXmlOneToOne(
- OrmTypeMapping ormTypeMapping, JavaOneToOneMapping javaOneToOneMapping) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaOneToOneMapping;
- this.virtualXmlAttributeMapping = new VirtualXmlAttributeMapping(ormTypeMapping, javaOneToOneMapping);
- this.virtualCascadeType =
- new VirtualCascadeType(javaOneToOneMapping.getCascade(), this.isOrmMetadataComplete());
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public String getMappingKey() {
- return this.virtualXmlAttributeMapping.getMappingKey();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlAttributeMapping.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlAttributeMapping.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlAttributeMapping.getNameTextRange();
- }
-
- @Override
- public FetchType getFetch() {
- if (this.isOrmMetadataComplete()) {
- return org.eclipse.jpt.core.context.FetchType.toOrmResourceModel(this.javaAttributeMapping.getDefaultFetch());
- }
- return org.eclipse.jpt.core.context.FetchType.toOrmResourceModel(this.javaAttributeMapping.getFetch());
- }
-
- @Override
- public void setFetch(FetchType newFetch) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Boolean getOptional() {
- if (this.isOrmMetadataComplete()) {
- return Boolean.valueOf(this.javaAttributeMapping.isDefaultOptional());
- }
- return Boolean.valueOf(this.javaAttributeMapping.isOptional());
- }
-
- @Override
- public void setOptional(Boolean newOptional) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public EList<XmlJoinColumn> getJoinColumns() {
- //TODO need to check metadataComplete here
- EList<XmlJoinColumn> joinColumns = new EObjectContainmentEList<XmlJoinColumn>(XmlJoinColumn.class, this, OrmPackage.XML_ONE_TO_ONE__JOIN_COLUMNS);
- //TODO here i'm using joinColumns() while VirtualXmlJoinTable uses specifiedJoinColumns()???
- for (JavaJoinColumn joinColumn :
- CollectionTools.iterable(
- this.javaAttributeMapping.getRelationshipReference().
- getJoinColumnJoiningStrategy().joinColumns())) {
- XmlJoinColumn xmlJoinColumn = new VirtualXmlJoinColumn(joinColumn, this.isOrmMetadataComplete());
- joinColumns.add(xmlJoinColumn);
- }
- return joinColumns;
- }
-
- @Override
- public CascadeType getCascade() {
- return this.virtualCascadeType;
- }
-
- @Override
- public void setCascade(CascadeType value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Boolean getOrphanRemoval() {
- throw new UnsupportedOperationException("operation not supported in JPA 1.0"); //$NON-NLS-1$
- }
-
- @Override
- public void setOrphanRemoval(Boolean newOrphanRemoval) {
- throw new UnsupportedOperationException("operation not supported in JPA 1.0"); //$NON-NLS-1$
- }
-
- @Override
- public XmlJoinTable getJoinTable() {
- //TODO we don't yet support JoinTable in the context model for many-to-one mappings
- return null;//this.virtualJoinTable;
- }
-
- @Override
- public void setJoinTable(XmlJoinTable value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getTargetEntity() {
- if (this.isOrmMetadataComplete()) {
- return this.javaAttributeMapping.getDefaultTargetEntity();
- }
- return this.javaAttributeMapping.getTargetEntity();
- }
-
- @Override
- public void setTargetEntity(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getMappedBy() {
- if (this.isOrmMetadataComplete()) {
- return null;
- }
- return this.javaAttributeMapping.getRelationshipReference().
- getMappedByJoiningStrategy().getMappedByAttribute();
- }
-
- @Override
- public void setMappedBy(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public EList<XmlPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
- EList<XmlPrimaryKeyJoinColumn> joinColumns = new EObjectContainmentEList<XmlPrimaryKeyJoinColumn>(XmlPrimaryKeyJoinColumn.class, this, OrmPackage.XML_ONE_TO_ONE__PRIMARY_KEY_JOIN_COLUMNS);
- if (!this.isOrmMetadataComplete()) {
- for (JavaPrimaryKeyJoinColumn joinColumn :
- CollectionTools.iterable(
- this.javaAttributeMapping.getRelationshipReference().
- getPrimaryKeyJoinColumnJoiningStrategy().primaryKeyJoinColumns())) {
- XmlPrimaryKeyJoinColumn xmlJoinColumn = new VirtualXmlPrimaryKeyJoinColumn(joinColumn/*, this.metadataComplete*/);
- joinColumns.add(xmlJoinColumn);
- }
- }
- return joinColumns;
- }
-
- @Override
- public TextRange getMappedByTextRange() {
- return null;
- }
-
- @Override
- public TextRange getTargetEntityTextRange() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOrderColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOrderColumn.java
deleted file mode 100644
index 28081bc7d3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlOrderColumn.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.jpa2.context.OrderColumn2_0;
-import org.eclipse.jpt.core.resource.orm.XmlOrderColumn;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class VirtualXmlOrderColumn extends XmlOrderColumn
-{
- protected OrderColumn2_0 javaOrderColumn;
-
- protected boolean metadataComplete;
-
- public VirtualXmlOrderColumn(OrderColumn2_0 javaOrderColumn, boolean metadataComplete) {
- super();
- this.javaOrderColumn = javaOrderColumn;
- this.metadataComplete = metadataComplete;
- }
-
- @Override
- public String getColumnDefinition() {
- if (this.metadataComplete) {
- return null;
- }
- return this.javaOrderColumn.getColumnDefinition();
- }
-
- @Override
- public void setColumnDefinition(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Boolean getInsertable() {
- if (this.metadataComplete) {
- return Boolean.valueOf(this.javaOrderColumn.isDefaultInsertable());
- }
- return Boolean.valueOf(this.javaOrderColumn.isInsertable());
- }
-
- @Override
- public void setInsertable(Boolean value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getName() {
- if (this.metadataComplete) {
- return this.javaOrderColumn.getDefaultName();
- }
- return this.javaOrderColumn.getName();
- }
-
- @Override
- public void setName(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
-
- @Override
- public Boolean getNullable() {
- if (this.metadataComplete) {
- return Boolean.valueOf(this.javaOrderColumn.isDefaultNullable());
- }
- return Boolean.valueOf(this.javaOrderColumn.isNullable());
- }
-
- @Override
- public void setNullable(Boolean value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Boolean getUpdatable() {
- if (this.metadataComplete) {
- return Boolean.valueOf(this.javaOrderColumn.isDefaultUpdatable());
- }
- return Boolean.valueOf(this.javaOrderColumn.isUpdatable());
- }
-
- @Override
- public void setUpdatable(Boolean value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public TextRange getNameTextRange() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlPrimaryKeyJoinColumn.java
deleted file mode 100644
index 34127e1e98..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlPrimaryKeyJoinColumn.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * A virtual primary key join column is used to represent the XmlPrimaryKeyJoinColumn resource object
- * within a virtual secondary table. A virtual secondary table is one which is not specified
- * in the orm.xml file, but is implied from the underlying java. Virtual pk join column
- * is not used when the secondary table is specified in the orm.xml.
- *
- * A virtual pk join column delegates to the underlying java pk join column for its state.
- */
-public class VirtualXmlPrimaryKeyJoinColumn extends XmlPrimaryKeyJoinColumn
-{
-
- protected JavaPrimaryKeyJoinColumn javaPrimaryKeyJoinColumn;
-
-
- protected VirtualXmlPrimaryKeyJoinColumn(JavaPrimaryKeyJoinColumn javaPrimaryKeyJoinColumn) {
- super();
- this.javaPrimaryKeyJoinColumn = javaPrimaryKeyJoinColumn;
- }
-
- @Override
- public String getName() {
- return this.javaPrimaryKeyJoinColumn.getName();
- }
-
- @Override
- public void setName(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getColumnDefinition() {
- return this.javaPrimaryKeyJoinColumn.getColumnDefinition();
- }
-
- @Override
- public void setColumnDefinition(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getReferencedColumnName() {
- return this.javaPrimaryKeyJoinColumn.getReferencedColumnName();
- }
-
- @Override
- public void setReferencedColumnName(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public TextRange getNameTextRange() {
- return null;
- }
-
- @Override
- public TextRange getReferencedColumnNameTextRange() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlSecondaryTable.java
deleted file mode 100644
index b25ddcb3f6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlSecondaryTable.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaSecondaryTable;
-import org.eclipse.jpt.core.context.java.JavaUniqueConstraint;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlSecondaryTable;
-import org.eclipse.jpt.core.resource.orm.XmlUniqueConstraint;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-/**
- * A virtual secondary table is used to represent the XmlSecondaryTable resource object.
- * A virtual secondary table is one which is not specified in the orm.xml file,
- * but is implied from the underlying java. Virtual secondary table
- * is not used when the secondary table is specified in the orm.xml.
- *
- * A virtual secondary table delegates to the underlying java secondary table for its state.
- */
-public class VirtualXmlSecondaryTable extends XmlSecondaryTable
-{
-
- protected JavaSecondaryTable javaSecondaryTable;
-
- protected VirtualXmlSecondaryTable(JavaSecondaryTable javaSecondaryTable) {
- super();
- this.javaSecondaryTable = javaSecondaryTable;
- }
-
- @Override
- public String getName() {
- return this.javaSecondaryTable.getSpecifiedName();
- }
-
- @Override
- public void setName(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getCatalog() {
- return this.javaSecondaryTable.getSpecifiedCatalog();
- }
-
- @Override
- public void setCatalog(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getSchema() {
- return this.javaSecondaryTable.getSpecifiedSchema();
- }
-
- @Override
- public void setSchema(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- //VirtualXmlSecondaryTable is rebuilt everytime, so rebuilding the joinColumns list as well
- @Override
- public EList<XmlPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
- EList<XmlPrimaryKeyJoinColumn> primaryKeyJoinColumns = new EObjectContainmentEList<XmlPrimaryKeyJoinColumn>(XmlPrimaryKeyJoinColumn.class, this, OrmPackage.XML_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS);
-
- for (JavaPrimaryKeyJoinColumn pkJoinColumn : CollectionTools.iterable(this.javaSecondaryTable.specifiedPrimaryKeyJoinColumns())) {
- XmlPrimaryKeyJoinColumn xmlPkJoinColumn = new VirtualXmlPrimaryKeyJoinColumn(pkJoinColumn);
- primaryKeyJoinColumns.add(xmlPkJoinColumn);
- }
-
- return primaryKeyJoinColumns;
- }
-
- @Override
- public EList<XmlUniqueConstraint> getUniqueConstraints() {
- EList<XmlUniqueConstraint> xmlUniqueConstraints = new EObjectContainmentEList<XmlUniqueConstraint>(XmlUniqueConstraint.class, this, OrmPackage.XML_SECONDARY_TABLE__UNIQUE_CONSTRAINTS);
-
- for (JavaUniqueConstraint uniqueConstraint : CollectionTools.iterable(this.javaSecondaryTable.uniqueConstraints())) {
- XmlUniqueConstraint xmlUniqueConstraint = new VirtualXmlUniqueConstraint(uniqueConstraint, true);
- xmlUniqueConstraints.add(xmlUniqueConstraint);
- }
-
- return xmlUniqueConstraints;
- }
-
- @Override
- public TextRange getNameTextRange() {
- return null;
- }
-
- @Override
- public TextRange getCatalogTextRange() {
- return null;
- }
-
- @Override
- public TextRange getSchemaTextRange() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlSequenceGenerator.java
deleted file mode 100644
index 06a8ffb50d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlSequenceGenerator.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.java.JavaGeneratorContainer;
-import org.eclipse.jpt.core.context.java.JavaSequenceGenerator;
-import org.eclipse.jpt.core.resource.orm.XmlSequenceGenerator;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class VirtualXmlSequenceGenerator extends XmlSequenceGenerator
-{
- JavaGeneratorContainer javaGeneratorHolder;
-
- protected boolean metadataComplete;
-
-
- public VirtualXmlSequenceGenerator(JavaGeneratorContainer javaGeneratorHolder, boolean metadataComplete) {
- super();
- this.javaGeneratorHolder = javaGeneratorHolder;
- this.metadataComplete = metadataComplete;
- }
-
- protected JavaSequenceGenerator getJavaSequenceGenerator() {
- return this.javaGeneratorHolder.getSequenceGenerator();
- }
-
- @Override
- public String getSequenceName() {
- if (this.metadataComplete) {
- return null;
- }
- return this.getJavaSequenceGenerator().getSequenceName();
- }
-
- @Override
- public void setSequenceName(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Integer getAllocationSize() {
- if (this.metadataComplete) {
- return null;
- }
- return Integer.valueOf(this.getJavaSequenceGenerator().getAllocationSize());
- }
-
- @Override
- public void setAllocationSize(Integer value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Integer getInitialValue() {
- if (this.metadataComplete) {
- return null;
- }
- return Integer.valueOf(this.getJavaSequenceGenerator().getInitialValue());
- }
-
- @Override
- public void setInitialValue(Integer value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getName() {
- if (this.metadataComplete) {
- return null;
- }
- return this.getJavaSequenceGenerator().getName();
- }
-
- @Override
- public void setName(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public TextRange getNameTextRange() {
- return getValidationTextRange();
- }
-
- @Override
- public boolean isVirtual() {
- return true;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlTableGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlTableGenerator.java
deleted file mode 100644
index 26121e2f4b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlTableGenerator.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.jpt.core.context.java.JavaGeneratorContainer;
-import org.eclipse.jpt.core.context.java.JavaTableGenerator;
-import org.eclipse.jpt.core.context.java.JavaUniqueConstraint;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlTableGenerator;
-import org.eclipse.jpt.core.resource.orm.XmlUniqueConstraint;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-public class VirtualXmlTableGenerator extends XmlTableGenerator
-{
- JavaGeneratorContainer javaGeneratorHolder;
-
- protected boolean metadataComplete;
-
-
- public VirtualXmlTableGenerator(JavaGeneratorContainer javaGeneratorHolder, boolean metadataComplete) {
- super();
- this.javaGeneratorHolder = javaGeneratorHolder;
- this.metadataComplete = metadataComplete;
- }
-
- protected JavaTableGenerator getJavaTableGenerator() {
- return this.javaGeneratorHolder.getTableGenerator();
- }
-
- @Override
- public String getCatalog() {
- if (this.metadataComplete) {
- return null;
- }
- return this.getJavaTableGenerator().getCatalog();
- }
-
- @Override
- public void setCatalog(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getPkColumnName() {
- if (this.metadataComplete) {
- return null;
- }
- return this.getJavaTableGenerator().getPkColumnName();
- }
-
- @Override
- public void setPkColumnName(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getPkColumnValue() {
- if (this.metadataComplete) {
- return null;
- }
- return this.getJavaTableGenerator().getPkColumnValue();
- }
-
- @Override
- public void setPkColumnValue(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getSchema() {
- if (this.metadataComplete) {
- return null;
- }
- return this.getJavaTableGenerator().getSchema();
- }
-
- @Override
- public void setSchema(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getTable() {
- if (this.metadataComplete) {
- return null;
- }
- return this.getJavaTableGenerator().getTable();
- }
-
- @Override
- public void setTable(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getValueColumnName() {
- if (this.metadataComplete) {
- return null;
- }
- return this.getJavaTableGenerator().getValueColumnName();
- }
-
- @Override
- public void setValueColumnName(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Integer getAllocationSize() {
- if (this.metadataComplete) {
- return null;
- }
- return Integer.valueOf(this.getJavaTableGenerator().getAllocationSize());
- }
-
- @Override
- public void setAllocationSize(Integer value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Integer getInitialValue() {
- if (this.metadataComplete) {
- return null;
- }
- return Integer.valueOf(this.getJavaTableGenerator().getInitialValue());
- }
-
- @Override
- public void setInitialValue(Integer value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getName() {
- if (this.metadataComplete) {
- return null;
- }
- return this.getJavaTableGenerator().getName();
- }
-
- @Override
- public void setName(String value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public EList<XmlUniqueConstraint> getUniqueConstraints() {
- EList<XmlUniqueConstraint> xmlUniqueConstraints = new EObjectContainmentEList<XmlUniqueConstraint>(XmlUniqueConstraint.class, this, OrmPackage.XML_TABLE_GENERATOR__UNIQUE_CONSTRAINTS);
-
- for (JavaUniqueConstraint uniqueConstraint : CollectionTools.iterable(this.getJavaTableGenerator().uniqueConstraints())) {
- XmlUniqueConstraint xmlUniqueConstraint = new VirtualXmlUniqueConstraint(uniqueConstraint, this.metadataComplete);
- xmlUniqueConstraints.add(xmlUniqueConstraint);
- }
-
- return xmlUniqueConstraints;
- }
-
- @Override
- public TextRange getNameTextRange() {
- return getValidationTextRange();
- }
-
- @Override
- public boolean isVirtual() {
- return true;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlTransient.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlTransient.java
deleted file mode 100644
index 63f2b4ae99..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlTransient.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.java.JavaTransientMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlTransient;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * VirtualTransient is an implementation of Transient used when there is
- * no tag in the orm.xml and an underlying javaTransientMapping exists.
- */
-public class VirtualXmlTransient extends XmlTransient
-{
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaTransientMapping javaAttributeMapping;
-
- protected final VirtualXmlAttributeMapping virtualXmlAttributeMapping;
-
- public VirtualXmlTransient(OrmTypeMapping ormTypeMapping, JavaTransientMapping javaTransientMapping) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaTransientMapping;
- this.virtualXmlAttributeMapping = new VirtualXmlAttributeMapping(ormTypeMapping, javaTransientMapping);
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public String getMappingKey() {
- return this.virtualXmlAttributeMapping.getMappingKey();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlAttributeMapping.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlAttributeMapping.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlAttributeMapping.getNameTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlUniqueConstraint.java
deleted file mode 100644
index c5070a843d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlUniqueConstraint.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.util.EDataTypeEList;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlUniqueConstraint;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-public class VirtualXmlUniqueConstraint extends XmlUniqueConstraint
-{
- protected UniqueConstraint uniqueConstraint;
-
- protected boolean metadataComplete;
-
- protected VirtualXmlUniqueConstraint(UniqueConstraint uniqueConstraint, boolean metadataComplete) {
- super();
- this.uniqueConstraint = uniqueConstraint;
- this.metadataComplete = metadataComplete;
- }
-
- @Override
- public EList<String> getColumnNames() {
- EList<String> columnNames = new EDataTypeEList<String>(String.class, this, OrmPackage.XML_UNIQUE_CONSTRAINT__COLUMN_NAMES);
-
- for (String columnName : CollectionTools.iterable(this.uniqueConstraint.columnNames())) {
- columnNames.add(columnName);
- }
- return columnNames;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlVersion.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlVersion.java
deleted file mode 100644
index b23f94a7c0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlVersion.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.TemporalConverter;
-import org.eclipse.jpt.core.context.java.JavaVersionMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.resource.orm.EnumType;
-import org.eclipse.jpt.core.resource.orm.TemporalType;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.core.resource.orm.XmlVersion;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * VirtualVersion is an implementation of Version used when there is
- * no tag in the orm.xml and an underlying javaVersionMapping exists.
- */
-public class VirtualXmlVersion extends XmlVersion
-{
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaVersionMapping javaAttributeMapping;
-
- protected final VirtualXmlAttributeMapping virtualXmlAttributeMapping;
-
- protected final VirtualXmlColumn column;
-
- public VirtualXmlVersion(OrmTypeMapping ormTypeMapping, JavaVersionMapping javaVersionMapping) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaVersionMapping;
- this.virtualXmlAttributeMapping = new VirtualXmlAttributeMapping(ormTypeMapping, javaVersionMapping);
- this.column = new VirtualXmlColumn(ormTypeMapping, javaVersionMapping.getColumn());
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public String getMappingKey() {
- return this.virtualXmlAttributeMapping.getMappingKey();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlAttributeMapping.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlAttributeMapping.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlAttributeMapping.getNameTextRange();
- }
-
- @Override
- public XmlColumn getColumn() {
- return this.column;
- }
-
- @Override
- public void setColumn(XmlColumn value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public TemporalType getTemporal() {
- if (this.isOrmMetadataComplete()) {
- return null;
- }
- if (this.javaAttributeMapping.getConverter().getType() == Converter.TEMPORAL_CONVERTER) {
- org.eclipse.jpt.core.context.TemporalType javaTemporalType = ((TemporalConverter) this.javaAttributeMapping.getConverter()).getTemporalType();
- return org.eclipse.jpt.core.context.TemporalType.toOrmResourceModel(javaTemporalType);
- }
- return null;
- }
-
- @Override
- public void setTemporal(TemporalType newTemporal){
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- //see eclipselink bug 247078 for info one why I made the interface XmlConvertibleMapping
- @Override
- public EnumType getEnumerated() {
- throw new UnsupportedOperationException("enumerated not supported on version mappings"); //$NON-NLS-1$
- }
-
- @Override
- public void setEnumerated(EnumType value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- //see eclipselink bug 247078 for info one why I made the interface XmlConvertibleMapping
- @Override
- public boolean isLob() {
- throw new UnsupportedOperationException("lob not supported on version mappings"); //$NON-NLS-1$
- }
-
- @Override
- public void setLob(boolean value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public TextRange getEnumeratedTextRange() {
- return null;
- }
-
- @Override
- public TextRange getLobTextRange() {
- return null;
- }
-
- @Override
- public TextRange getTemporalTextRange() {
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractJarFileRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractJarFileRef.java
deleted file mode 100644
index 6dcf105784..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractJarFileRef.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.persistence;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jpt.core.JpaFile;
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.java.JarFile;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.persistence.JarFileRef;
-import org.eclipse.jpt.core.context.persistence.PersistenceStructureNodes;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragmentRoot;
-import org.eclipse.jpt.core.resource.persistence.XmlJarFileRef;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.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;
-
-
-public abstract class AbstractJarFileRef
- extends AbstractPersistenceXmlContextNode
- implements JarFileRef
-{
- protected XmlJarFileRef xmlJarFileRef;
-
- protected String fileName;
-
- protected JarFile jarFile;
-
-
- // **************** construction/initialization ****************************
-
- public AbstractJarFileRef(PersistenceUnit parent, XmlJarFileRef xmlJarFileRef) {
- super(parent);
- this.xmlJarFileRef = xmlJarFileRef;
- this.fileName = xmlJarFileRef.getFileName();
- this.jarFile = this.buildJarFile();
- }
-
- protected JarFile buildJarFile() {
- if (StringTools.stringIsEmpty(this.fileName)) {
- return null;
- }
- JavaResourcePackageFragmentRoot jrpfr = this.getJpaProject().getJavaResourcePackageFragmentRoot(this.getFileName());
- return (jrpfr == null) ? null : this.buildJarFile(jrpfr);
- }
-
- @Override
- public PersistenceUnit getParent() {
- return (PersistenceUnit) super.getParent();
- }
-
-
- // **************** file name **********************************************
-
- public String getFileName() {
- return this.fileName;
- }
-
- public void setFileName(String newFileName) {
- String old = this.fileName;
- this.fileName = newFileName;
- this.xmlJarFileRef.setFileName(newFileName);
- this.firePropertyChanged(FILE_NAME_PROPERTY, old, newFileName);
- }
-
- protected void setFileName_(String newFileName) {
- String old = this.fileName;
- this.fileName = newFileName;
- this.firePropertyChanged(FILE_NAME_PROPERTY, old, newFileName);
- }
-
-
- // **************** 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);
- }
-
-
- // ********** JarFileRef implementation **********
-
- 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();
- }
-
-
- // **************** JpaStructureNode impl **********************************
-
- 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();
- }
- }
-
-
- // **************** XmlContextNode impl ************************************
-
- public TextRange getValidationTextRange() {
- return (this.xmlJarFileRef == null) ? null : this.xmlJarFileRef.getValidationTextRange();
- }
-
-
- // **************** updating ***********************************************
-
- public void update(XmlJarFileRef xjfr) {
- this.xmlJarFileRef = xjfr;
- this.setFileName_(xjfr.getFileName());
- this.updateJarFile();
- }
-
- protected void updateJarFile() {
- JavaResourcePackageFragmentRoot jrpfr = null;
-
- if (! StringTools.stringIsEmpty(this.fileName)) {
-
- // first, attempt to resolve location specifically
- jrpfr = javaPackageRoot_specifically();
-
- // then ... guess, basically
- if (jrpfr == null) {
- jrpfr = javaPackageRoot_guess();
- }
- }
-
- if (jrpfr == null) {
- if (this.jarFile != null) {
- this.jarFile.dispose();
- this.setJarFile(null);
- }
- } else {
- if (this.jarFile == null) {
- this.setJarFile(this.buildJarFile(jrpfr));
- } else {
- this.jarFile.update(jrpfr);
- }
- }
- }
-
- private JavaResourcePackageFragmentRoot javaPackageRoot_specifically() {
- for (IPath deploymentPath : resolveDeploymentJarFilePath(new Path(this.fileName))) {
- IVirtualFile virtualJar = ComponentCore.createFile(this.getProject(), deploymentPath);
- IFile realJar = virtualJar.getUnderlyingFile();
- if (realJar.exists() && realJar.getProject().equals(this.getProject())) {
- return getJpaProject().getJavaResourcePackageFragmentRoot(realJar.getProjectRelativePath().toString());
- }
- }
-
- return null;
- }
-
- private JavaResourcePackageFragmentRoot javaPackageRoot_guess() {
- String jarFileName = new Path(this.fileName).lastSegment();
- for (JpaFile jpaFile : CollectionTools.iterable(getJpaProject().jpaFiles())) {
- if (jpaFile.getFile().getName().equals(jarFileName)
- && JptCorePlugin.JAR_CONTENT_TYPE.equals(jpaFile.getContentType())) {
- return (JavaResourcePackageFragmentRoot) jpaFile.getResourceModel();
- }
- }
-
- return null;
- }
-
- /**
- * Return an array of deployment paths that may correspond
- * to the given persistence.xml jar file entry
- */
- protected IPath[] resolveDeploymentJarFilePath(IPath jarFilePath) {
- IPath root = this.getJarDeploymentRootPath();
- return this.projectHasWebFacet() ?
- this.resolveDeploymentJarFilePathWeb(root, jarFilePath) :
- this.resolveDeploymentJarFilePathNonWeb(root, jarFilePath);
- }
-
- protected IPath getJarDeploymentRootPath() {
- return JptCorePlugin.getJarDeploymentRootPath(this.getProject());
- }
-
- protected boolean projectHasWebFacet() {
- return JptCorePlugin.projectHasWebFacet(this.getProject());
- }
-
- protected IPath[] resolveDeploymentJarFilePathWeb(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[] resolveDeploymentJarFilePathNonWeb(IPath root, IPath jarFilePath) {
- return new IPath[] {
- // assumes form "../lib/other.jar"
- root.append(jarFilePath)
- };
- }
-
-
- protected JarFile buildJarFile(JavaResourcePackageFragmentRoot jrpfr) {
- return this.getContextNodeFactory().buildJarFile(this, jrpfr);
- }
-
- protected IProject getProject() {
- return this.getJpaProject().getProject();
- }
-
-
- // **************** 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);
- }
-
-
- // **************** misc ***************************************************
-
- @Override
- public void toString(StringBuilder sb) {
- super.toString(sb);
- sb.append(this.getFileName());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractMappingFileRef.java
deleted file mode 100644
index 276721d824..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractMappingFileRef.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.context.persistence;
-
-import java.util.List;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.MappingFile;
-import org.eclipse.jpt.core.context.MappingFilePersistenceUnitDefaults;
-import org.eclipse.jpt.core.context.MappingFileRoot;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.MappingFileDefinition;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.context.persistence.PersistenceStructureNodes;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractMappingFileRef
- extends AbstractPersistenceXmlContextNode
- implements MappingFileRef
-{
- protected String fileName;
-
- protected MappingFile mappingFile;
-
-
- // ********** construction/initialization **********
-
- protected AbstractMappingFileRef(PersistenceUnit parent, String resourceFileName) {
- super(parent);
- this.fileName = resourceFileName;
- this.mappingFile = this.buildMappingFile();
- }
-
- protected MappingFile buildMappingFile() {
- JpaXmlResource xmlResource = this.getXmlResource();
- return (xmlResource == null) ? null : this.buildMappingFile(xmlResource);
- }
-
- @Override
- public PersistenceUnit getParent() {
- return (PersistenceUnit) super.getParent();
- }
-
-
- // ********** 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();
- }
- }
-
-
- // ********** queries **********
-
- public MappingFilePersistenceUnitDefaults getPersistenceUnitDefaults() {
- MappingFileRoot root = this.getMappingFileRoot_();
- return (root == null) ? null : root.getPersistenceUnitDefaults();
- }
-
- /**
- * #getMappingFileRoot() is already defined by JpaContextNode for the
- * descendants of a "mapping file root" - we want something slightly
- * different here...
- */
- protected MappingFileRoot getMappingFileRoot_() {
- return (this.mappingFile == null) ? null : this.mappingFile.getRoot();
- }
-
- public boolean persistenceUnitDefaultsExists() {
- MappingFilePersistenceUnitDefaults defaults = this.getPersistenceUnitDefaults();
- return (defaults != null) && defaults.resourceExists();
- }
-
- public PersistentType getPersistentType(String typeName) {
- return (this.mappingFile == null) ? null : this.mappingFile.getPersistentType(typeName);
- }
-
-
- // ********** file name **********
-
- public String getFileName() {
- return this.fileName;
- }
-
-
- // ********** 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);
- }
-
-
- // ********** PersistentTypeContainer implementation **********
-
- public Iterable<? extends PersistentType> getPersistentTypes() {
- return (this.mappingFile != null) ? this.mappingFile.getPersistentTypes() : EmptyIterable.<JavaPersistentType>instance();
- }
-
- // ********** updating **********
-
- protected void update() {
- this.updateMappingFile();
- }
-
- protected void updateMappingFile() {
- JpaXmlResource xmlResource = this.getXmlResource();
- if (xmlResource != null) {
- if (this.mappingFile == null) {
- this.setMappingFile(this.buildMappingFile(xmlResource));
- } else {
- // if the resource type has changed, rebuild the mapping file
- if (this.mappingFile.getXmlResource() != xmlResource) {
- this.mappingFile.dispose();
- this.setMappingFile(this.buildMappingFile(xmlResource));
- } else {
- this.mappingFile.update(xmlResource);
- }
- }
- } else {
- if (this.mappingFile != null) {
- this.mappingFile.dispose();
- this.setMappingFile(null);
- }
- }
- }
-
- /**
- * The XmlMappingFileRef resource is the Persistence xml resource.
- * This returns the resource of the mapping file itself.
- */
- protected JpaXmlResource getXmlResource() {
- return this.fileName == null ? null : this.getJpaProject().getMappingFileXmlResource(this.fileName);
- }
-
- protected MappingFile buildMappingFile(JpaXmlResource resource) {
- MappingFileDefinition mappingFileDef;
- try {
- mappingFileDef = (MappingFileDefinition) getJpaPlatform().getResourceDefinition(resource.getResourceType());
- }
- catch (IllegalArgumentException iae) {
- JptCorePlugin.log(iae);
- return null;
- }
- return (mappingFileDef == null) ? null : mappingFileDef.getContextNodeFactory().buildMappingFile(this, resource);
- }
-
- @Override
- public void postUpdate() {
- super.postUpdate();
- if (this.mappingFile != null) {
- this.mappingFile.postUpdate();
- }
- }
-
-
- // ********** 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(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- this.buildMissingMappingFileMessageID(),
- new String[] {this.fileName},
- this,
- this.getValidationTextRange()
- )
- );
- return;
- }
-
- if (this.mappingFile.getRoot() == null) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENCE_UNIT_INVALID_MAPPING_FILE,
- new String[] {this.fileName},
- this,
- this.getValidationTextRange()
- )
- );
- }
-
- this.mappingFile.validate(messages, reporter);
- }
-
- protected String buildMissingMappingFileMessageID() {
- return this.getPlatformFile().exists() ?
- JpaValidationMessages.PERSISTENCE_UNIT_UNSUPPORTED_MAPPING_FILE_CONTENT
- :
- JpaValidationMessages.PERSISTENCE_UNIT_NONEXISTENT_MAPPING_FILE;
- }
-
- protected IFile getPlatformFile() {
- return this.getJpaProject().convertToPlatformFile(this.fileName);
- }
-
-
- // ********** misc **********
-
- @Override
- public void toString(StringBuilder sb) {
- super.toString(sb);
- sb.append(this.fileName);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java
deleted file mode 100644
index 95ad6b192b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java
+++ /dev/null
@@ -1,1735 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.context.persistence;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Set;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.Embeddable;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.Generator;
-import org.eclipse.jpt.core.context.MappingFilePersistenceUnitDefaults;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.Query;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.persistence.ClassRef;
-import org.eclipse.jpt.core.context.persistence.JarFileRef;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceStructureNodes;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType;
-import org.eclipse.jpt.core.context.persistence.PersistentTypeContainer;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.JpaProject2_0;
-import org.eclipse.jpt.core.jpa2.context.PersistentType2_0;
-import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0;
-import org.eclipse.jpt.core.jpa2.context.persistence.options.SharedCacheMode;
-import org.eclipse.jpt.core.jpa2.context.persistence.options.ValidationMode;
-import org.eclipse.jpt.core.jpa2.resource.java.JavaResourcePersistentType2_0;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlJarFileRef;
-import org.eclipse.jpt.core.resource.persistence.XmlJavaClassRef;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.jpt.core.resource.persistence.XmlProperties;
-import org.eclipse.jpt.core.resource.persistence.XmlProperty;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.HashBag;
-import org.eclipse.jpt.utility.internal.NotNullFilter;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.CompositeListIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * persistence-unit
- */
-public abstract class AbstractPersistenceUnit
- extends AbstractPersistenceXmlContextNode
- implements PersistenceUnit2_0
-{
- protected XmlPersistenceUnit xmlPersistenceUnit;
-
- protected String name;
-
- protected PersistenceUnitTransactionType specifiedTransactionType;
- protected PersistenceUnitTransactionType defaultTransactionType;
-
- protected String description;
-
- protected String provider;
-
- protected String jtaDataSource;
- protected String nonJtaDataSource;
-
- protected final Vector<MappingFileRef> specifiedMappingFileRefs = new Vector<MappingFileRef>();
- protected MappingFileRef impliedMappingFileRef;
-
- protected final Vector<JarFileRef> jarFileRefs = new Vector<JarFileRef>();
-
- protected final Vector<ClassRef> specifiedClassRefs = new Vector<ClassRef>();
- protected final Vector<ClassRef> impliedClassRefs = new Vector<ClassRef>();
-
- protected Boolean specifiedExcludeUnlistedClasses;
-
- protected final Vector<Property> properties = new Vector<Property>();
-
- /* 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 final Set<String> rootEntityNames = Collections.synchronizedSet(new HashSet<String>());
-
- protected AccessType defaultAccess;
- protected String defaultCatalog;
- protected String defaultSchema;
- protected boolean defaultCascadePersist;
-
- //****** PersistenceUnit2_0 features
- private PersistenceUnitProperties connection;
- private 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.defaultTransactionType = this.buildDefaultTransactionType();
- this.description = xmlPersistenceUnit.getDescription();
- this.provider = xmlPersistenceUnit.getProvider();
- this.jtaDataSource = xmlPersistenceUnit.getJtaDataSource();
- this.nonJtaDataSource = xmlPersistenceUnit.getNonJtaDataSource();
- this.specifiedExcludeUnlistedClasses = xmlPersistenceUnit.getExcludeUnlistedClasses();
-
- // initialize the properties before building the entities because the
- // entities will need the properties
- this.initializeProperties();
-
- this.initializeJarFileRefs();
-
- //initialize specified classRefs before mappingFileRefs because of
- //JpaFile rootStructureNode, we want the mapping file to "win",
- //as it would in a Jpa runtime implementation
- this.initializeSpecifiedClassRefs();
- this.initializeMappingFileRefs();
- //initialize implied classRefs last since they depend on both
- //specified classRefs and mappingFileRefs
- this.initializeImpliedClassRefs();
- this.initializePersistenceUnitDefaults();
-
- this.specifiedSharedCacheMode = this.buildSpecifiedSharedCacheMode();
- this.defaultSharedCacheMode = this.buildDefaultSharedCacheMode();
-
- this.specifiedValidationMode = this.buildSpecifiedValidationMode();
- this.defaultValidationMode = this.buildDefaultValidationMode();
-
- this.initializeMetamodelFiles();
- }
-
- /**
- * These lists are just copies of what is distributed across the context
- * model; so, if they have (virtually) changed, the resulting update has
- * already been triggered. We don't need to trigger another one here.
- */
- @Override
- protected void addNonUpdateAspectNamesTo(Set<String> nonUpdateAspectNames) {
- super.addNonUpdateAspectNamesTo(nonUpdateAspectNames);
- nonUpdateAspectNames.add(GENERATORS_LIST);
- nonUpdateAspectNames.add(QUERIES_LIST);
- }
-
-
- // ********** updating **********
-
- public void update(XmlPersistenceUnit xpu) {
- this.xmlPersistenceUnit = xpu;
-
- // the 'generators' and 'queries' lists are simply cleared out with each
- // "update" and completely rebuilt as the "update" cascades through
- // the persistence unit. When the persistence unit's "update" is
- // complete, the lists have been populated and we fire the change event.
- // @see #addGenerator(Generator) (and references)
- // @see #addQuery(Query) (and references)
- this.generators.clear();
- this.queries.clear();
-
- this.rootEntityNames.clear();
-
- this.setName(xpu.getName());
- this.setSpecifiedTransactionType(this.buildSpecifiedTransactionType());
- this.setDefaultTransactionType(this.buildDefaultTransactionType());
- this.setDescription(xpu.getDescription());
- this.setProvider(xpu.getProvider());
- this.setJtaDataSource(xpu.getJtaDataSource());
- this.setNonJtaDataSource(xpu.getNonJtaDataSource());
- this.updateJarFileRefs();
-
- // update 'specifiedClassRefs' before 'mappingFileRefs' because of
- // JpaFile rootStructureNode, we want the mapping file to "win",
- // as it would in a JPA runtime implementation
- this.updateSpecifiedClassRefs();
- this.updateMappingFileRefs();
-
- // update 'impliedClassRefs' last since it depends on the contents of
- // both 'specifiedClassRefs' and 'mappingFileRefs'
- this.updateImpliedClassRefs();
-
- this.setSpecifiedExcludeUnlistedClasses(xpu.getExcludeUnlistedClasses());
- this.updateProperties();
- this.updatePersistenceUnitDefaults();
-
- this.setSpecifiedSharedCacheMode(this.buildSpecifiedSharedCacheMode());
- this.setDefaultSharedCacheMode(this.buildDefaultSharedCacheMode());
- this.setSpecifiedValidationMode(this.buildSpecifiedValidationMode());
- this.setDefaultValidationMode(this.buildDefaultValidationMode());
-
- // see comment at top of method
- this.fireListChanged(GENERATORS_LIST, this.generators);
- this.fireListChanged(QUERIES_LIST, this.queries);
- }
-
- @Override
- public void postUpdate() {
- super.postUpdate();
- for (ClassRef classRef : this.getSpecifiedClassRefs()) {
- classRef.postUpdate();
- }
- for (ClassRef classRef : this.getImpliedClassRefs()) {
- classRef.postUpdate();
- }
- for (MappingFileRef mappingFileRef : CollectionTools.iterable(this.specifiedMappingFileRefs())) {
- mappingFileRef.postUpdate();
- }
- if (this.impliedMappingFileRef != null) {
- this.impliedMappingFileRef.postUpdate();
- }
- }
-
-
- // ********** JpaContextNode implementation **********
-
- @Override
- public Persistence getParent() {
- return (Persistence) super.getParent();
- }
-
- @Override
- public PersistenceUnit getPersistenceUnit() {
- return this;
- }
-
-
- // ********** JpaStructureNode implementation **********
-
- public String getId() {
- return PersistenceStructureNodes.PERSISTENCE_UNIT_ID;
- }
-
- public TextRange getSelectionTextRange() {
- return this.xmlPersistenceUnit.getSelectionTextRange();
- }
-
- public void dispose() {
- for (Iterator<ClassRef> stream = this.classRefs(); stream.hasNext(); ) {
- stream.next().dispose();
- }
- for (Iterator<MappingFileRef> stream = this.mappingFileRefs(); stream.hasNext(); ) {
- stream.next().dispose();
- }
- }
-
-
- // ********** name **********
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- String old = this.name;
- this.name = name;
- this.xmlPersistenceUnit.setName(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 specifiedTransactionType) {
- PersistenceUnitTransactionType old = this.specifiedTransactionType;
- this.specifiedTransactionType = specifiedTransactionType;
- this.xmlPersistenceUnit.setTransactionType(PersistenceUnitTransactionType.toXmlResourceModel(specifiedTransactionType));
- this.firePropertyChanged(SPECIFIED_TRANSACTION_TYPE_PROPERTY, old, specifiedTransactionType);
- }
-
- public PersistenceUnitTransactionType getDefaultTransactionType() {
- return this.defaultTransactionType;
- }
-
- protected void setDefaultTransactionType(PersistenceUnitTransactionType defaultTransactionType) {
- PersistenceUnitTransactionType old = this.defaultTransactionType;
- this.defaultTransactionType = defaultTransactionType;
- this.firePropertyChanged(DEFAULT_TRANSACTION_TYPE_PROPERTY, old, defaultTransactionType);
- }
-
- protected PersistenceUnitTransactionType buildSpecifiedTransactionType() {
- return PersistenceUnitTransactionType.fromXmlResourceModel(this.xmlPersistenceUnit.getTransactionType());
- }
-
- /**
- * TODO - calculate default
- * From the JPA spec: "In a Java EE environment, if this element is not
- * specified, the default is JTA. In a Java SE environment, if this element
- * is not specified, a default of RESOURCE_LOCAL may be assumed."
- */
- protected PersistenceUnitTransactionType buildDefaultTransactionType() {
- return PersistenceUnitTransactionType.JTA; //return JTA for now, fixing regression in bug 277524
- }
-
-
- // ********** description **********
-
- public String getDescription() {
- return this.description;
- }
-
- public void setDescription(String description) {
- String old = this.description;
- this.description = description;
- this.xmlPersistenceUnit.setDescription(description);
- this.firePropertyChanged(DESCRIPTION_PROPERTY, old, description);
- }
-
-
- // ********** provider **********
-
- public String getProvider() {
- return this.provider;
- }
-
- public void setProvider(String provider) {
- String old = this.provider;
- this.provider = provider;
- this.xmlPersistenceUnit.setProvider(provider);
- this.firePropertyChanged(PROVIDER_PROPERTY, old, provider);
- }
-
-
- // ********** JTA/non-JTA data source **********
-
- public String getJtaDataSource() {
- return this.jtaDataSource;
- }
-
- public void setJtaDataSource(String jtaDataSource) {
- String old = this.jtaDataSource;
- this.jtaDataSource = jtaDataSource;
- this.xmlPersistenceUnit.setJtaDataSource(jtaDataSource);
- this.firePropertyChanged(JTA_DATA_SOURCE_PROPERTY, old, jtaDataSource);
- }
-
- public String getNonJtaDataSource() {
- return this.nonJtaDataSource;
- }
-
- public void setNonJtaDataSource(String nonJtaDataSource) {
- String old = this.nonJtaDataSource;
- this.nonJtaDataSource = nonJtaDataSource;
- this.xmlPersistenceUnit.setNonJtaDataSource(nonJtaDataSource);
- this.firePropertyChanged(NON_JTA_DATA_SOURCE_PROPERTY, old, nonJtaDataSource);
- }
-
-
- // ********** mapping file refs **********
-
- public ListIterator<MappingFileRef> mappingFileRefs() {
- return (this.impliedMappingFileRef == null) ? this.specifiedMappingFileRefs() : this.combinedMappingFileRefs();
- }
-
- protected Iterable<MappingFileRef> getMappingFileRefs() {
- return (this.impliedMappingFileRef == null) ? this.getSpecifiedMappingFileRefs() : this.getCombinedMappingFileRefs();
- }
-
- protected ListIterator<MappingFileRef> combinedMappingFileRefs() {
- return new CompositeListIterator<MappingFileRef>(this.specifiedMappingFileRefs(), this.impliedMappingFileRef);
- }
-
- protected Iterable<MappingFileRef> getCombinedMappingFileRefs() {
- return new CompositeIterable<MappingFileRef>(this.getSpecifiedMappingFileRefs(), this.impliedMappingFileRef);
- }
-
- public int mappingFileRefsSize() {
- return (this.impliedMappingFileRef == null) ? this.specifiedMappingFileRefsSize() : this.combinedMappingFileRefsSize();
- }
-
- protected int combinedMappingFileRefsSize() {
- return this.specifiedMappingFileRefsSize() + 1;
- }
-
- public Iterator<MappingFileRef> mappingFileRefsContaining(final String typeName) {
- return new FilteringIterator<MappingFileRef, MappingFileRef> (this.mappingFileRefs()) {
- @Override
- protected boolean accept(MappingFileRef mappingFileRef) {
- return mappingFileRef.getPersistentType(typeName) != null;
- }
- };
- }
-
- protected void initializeMappingFileRefs() {
- for (XmlMappingFileRef xmlMappingFileRef : this.xmlPersistenceUnit.getMappingFiles()) {
- this.specifiedMappingFileRefs.add(this.buildSpecifiedMappingFileRef(xmlMappingFileRef));
- }
- if ( ! this.impliedMappingFileIsSpecified() && this.impliedMappingFileExists()) {
- this.impliedMappingFileRef = this.buildImpliedMappingFileRef();
- }
- }
-
- /**
- * Since this is a *list*, we simply loop through the elements and match
- * the context to the resource element by index, not by name like we do
- * with 'impliedClassRefs'.
- */
- protected void updateMappingFileRefs() {
- // first update the specified mapping file refs...
- // make a copy of the XML file refs (to prevent ConcurrentModificationException)
- Iterator<XmlMappingFileRef> xmlFileRefs = new CloneIterator<XmlMappingFileRef>(this.xmlPersistenceUnit.getMappingFiles());
-
- for (Iterator<MappingFileRef> contextFileRefs = this.specifiedMappingFileRefs(); contextFileRefs.hasNext(); ) {
- MappingFileRef contextFileRef = contextFileRefs.next();
- if (xmlFileRefs.hasNext()) {
- contextFileRef.update(xmlFileRefs.next());
- } else {
- this.removeSpecifiedMappingFileRef_(contextFileRef);
- }
- }
-
- while (xmlFileRefs.hasNext()) {
- this.addSpecifiedMappingFileRef_(this.buildSpecifiedMappingFileRef(xmlFileRefs.next()));
- }
-
- // ...then update the implied mapping file ref
- if (this.impliedMappingFileIsSpecified()) {
- if (this.impliedMappingFileRef != null) {
- this.unsetImpliedMappingFileRef();
- }
- } else {
- if (this.impliedMappingFileExists()) {
- if (this.impliedMappingFileRef == null) {
- this.setImpliedMappingFileRef();
- }
- this.impliedMappingFileRef.update(null);
- } else {
- if (this.impliedMappingFileRef != null) {
- this.unsetImpliedMappingFileRef();
- }
- }
- }
- }
-
- protected MappingFileRef buildSpecifiedMappingFileRef(XmlMappingFileRef xmlMappingFileRef) {
- return this.getContextNodeFactory().buildMappingFileRef(this, xmlMappingFileRef);
- }
-
- protected boolean impliedMappingFileIsSpecified() {
- String impliedMappingFileName = JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH;
- for (Iterator<MappingFileRef> stream = this.specifiedMappingFileRefs(); stream.hasNext(); ) {
- if (impliedMappingFileName.equals(stream.next().getFileName())) {
- return true;
- }
- }
- return false;
- }
-
- protected boolean impliedMappingFileExists() {
- return getJpaProject().getDefaultOrmXmlResource() != null;
- }
-
-
- // ********** specified mapping file refs **********
-
- public ListIterator<MappingFileRef> specifiedMappingFileRefs() {
- return new CloneListIterator<MappingFileRef>(this.specifiedMappingFileRefs);
- }
-
- protected Iterable<MappingFileRef> getSpecifiedMappingFileRefs() {
- return new LiveCloneIterable<MappingFileRef>(this.specifiedMappingFileRefs);
- }
-
- public int specifiedMappingFileRefsSize() {
- return this.specifiedMappingFileRefs.size();
- }
-
- public MappingFileRef addSpecifiedMappingFileRef() {
- return this.addSpecifiedMappingFileRef(this.specifiedMappingFileRefs.size());
- }
-
- public MappingFileRef addSpecifiedMappingFileRef(int index) {
- XmlMappingFileRef xmlMappingFileRef = this.buildXmlMappingFileRef();
- MappingFileRef mappingFileRef = this.buildSpecifiedMappingFileRef(xmlMappingFileRef);
- this.specifiedMappingFileRefs.add(index, mappingFileRef);
- this.xmlPersistenceUnit.getMappingFiles().add(index, xmlMappingFileRef);
- this.fireItemAdded(SPECIFIED_MAPPING_FILE_REFS_LIST, index, mappingFileRef);
- return mappingFileRef;
- }
-
- protected XmlMappingFileRef buildXmlMappingFileRef() {
- return PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- }
-
- public void removeSpecifiedMappingFileRef(MappingFileRef mappingFileRef) {
- this.removeSpecifiedMappingFileRef(this.specifiedMappingFileRefs.indexOf(mappingFileRef));
- }
-
- public void removeSpecifiedMappingFileRef(int index) {
- MappingFileRef mappingFileRef = this.specifiedMappingFileRefs.remove(index);
- mappingFileRef.dispose();
- this.xmlPersistenceUnit.getMappingFiles().remove(index);
- this.fireItemRemoved(SPECIFIED_MAPPING_FILE_REFS_LIST, index, mappingFileRef);
- }
-
- protected void addSpecifiedMappingFileRef_(MappingFileRef mappingFileRef) {
- this.addItemToList(mappingFileRef, this.specifiedMappingFileRefs, SPECIFIED_MAPPING_FILE_REFS_LIST);
- }
-
- protected void removeSpecifiedMappingFileRef_(MappingFileRef mappingFileRef) {
- mappingFileRef.dispose();
- this.removeItemFromList(mappingFileRef, this.specifiedMappingFileRefs, SPECIFIED_MAPPING_FILE_REFS_LIST);
- }
-
-
- // ********** implied mapping file ref **********
-
- public MappingFileRef getImpliedMappingFileRef() {
- return this.impliedMappingFileRef;
- }
-
- protected MappingFileRef setImpliedMappingFileRef() {
- if (this.impliedMappingFileRef != null) {
- throw new IllegalStateException("The implied mapping file ref is already set."); //$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 unsetImpliedMappingFileRef() {
- if (this.impliedMappingFileRef == null) {
- throw new IllegalStateException("The implied mapping file ref is already unset."); //$NON-NLS-1$
- }
- MappingFileRef old = this.impliedMappingFileRef;
- this.impliedMappingFileRef.dispose();
- this.impliedMappingFileRef = null;
- this.firePropertyChanged(IMPLIED_MAPPING_FILE_REF_PROPERTY, old, null);
- }
-
-
- // ********** JAR file refs **********
-
- public ListIterator<JarFileRef> jarFileRefs() {
- return new CloneListIterator<JarFileRef>(this.jarFileRefs);
- }
-
- protected Iterable<JarFileRef> getJarFileRefs() {
- return new LiveCloneIterable<JarFileRef>(this.jarFileRefs);
- }
-
- public int jarFileRefsSize() {
- return this.jarFileRefs.size();
- }
-
- public JarFileRef addJarFileRef() {
- return this.addJarFileRef(this.jarFileRefs.size());
- }
-
- public JarFileRef addJarFileRef(int index) {
- XmlJarFileRef xmlJarFileRef = this.buildXmlJarFileRef();
- JarFileRef jarFileRef = this.buildJarFileRef(xmlJarFileRef);
- this.jarFileRefs.add(index, jarFileRef);
- this.xmlPersistenceUnit.getJarFiles().add(index, xmlJarFileRef);
- this.fireItemAdded(JAR_FILE_REFS_LIST, index, jarFileRef);
- return jarFileRef;
- }
-
- protected XmlJarFileRef buildXmlJarFileRef() {
- return PersistenceFactory.eINSTANCE.createXmlJarFileRef();
- }
-
- public void removeJarFileRef(JarFileRef jarFileRef) {
- this.removeJarFileRef(this.jarFileRefs.indexOf(jarFileRef));
- }
-
- public void removeJarFileRef(int index) {
- JarFileRef jarFileRef = this.jarFileRefs.remove(index);
- jarFileRef.dispose();
- this.xmlPersistenceUnit.getJarFiles().remove(index);
- this.fireItemRemoved(JAR_FILE_REFS_LIST, index, jarFileRef);
- }
-
- protected void addJarFileRef_(JarFileRef jarFileRef) {
- this.addItemToList(jarFileRef, this.jarFileRefs, JAR_FILE_REFS_LIST);
- }
-
- protected void removeJarFileRef_(JarFileRef jarFileRef) {
- jarFileRef.dispose();
- this.removeItemFromList(jarFileRef, this.jarFileRefs, JAR_FILE_REFS_LIST);
- }
-
- protected void initializeJarFileRefs() {
- for (XmlJarFileRef xmlJarFileRef : this.xmlPersistenceUnit.getJarFiles()) {
- this.jarFileRefs.add(this.buildJarFileRef(xmlJarFileRef));
- }
- }
-
- /**
- * Since this is a *list*, we simply loop through the elements and match
- * the context to the resource element by index, not by name like we do
- * with 'impliedClassRefs'.
- */
- protected void updateJarFileRefs() {
- // make a copy of the XML file refs (to prevent ConcurrentModificationException)
- Iterator<XmlJarFileRef> xmlFileRefs = new CloneIterator<XmlJarFileRef>(this.xmlPersistenceUnit.getJarFiles());
-
- for (Iterator<JarFileRef> contextFileRefs = this.jarFileRefs(); contextFileRefs.hasNext(); ) {
- JarFileRef contextFileRef = contextFileRefs.next();
- if (xmlFileRefs.hasNext()) {
- contextFileRef.update(xmlFileRefs.next());
- } else {
- this.removeJarFileRef_(contextFileRef);
- }
- }
-
- while (xmlFileRefs.hasNext()) {
- this.addJarFileRef_(this.buildJarFileRef(xmlFileRefs.next()));
- }
- }
-
- protected JarFileRef buildJarFileRef(XmlJarFileRef xmlJarFileRef) {
- return this.getContextNodeFactory().buildJarFileRef(this, xmlJarFileRef);
- }
-
-
- // ********** class refs **********
-
- public Iterator<ClassRef> classRefs() {
- return this.getClassRefs().iterator();
- }
-
- @SuppressWarnings("unchecked")
- protected Iterable<ClassRef> getClassRefs() {
- return new CompositeIterable<ClassRef>(
- this.getSpecifiedClassRefs(),
- this.getImpliedClassRefs()
- );
- }
-
- public int classRefsSize() {
- return this.specifiedClassRefs.size() + this.impliedClassRefs.size();
- }
-
- protected Iterable<PersistentType> getNonNullClassRefPersistentTypes() {
- return new FilteringIterable<PersistentType, PersistentType>(this.getClassRefPersistentTypes(), NotNullFilter.<PersistentType>instance());
- }
-
- protected Iterable<PersistentType> getClassRefPersistentTypes() {
- return new TransformationIterable<ClassRef, PersistentType>(this.getClassRefs()) {
- @Override
- protected PersistentType transform(ClassRef classRef) {
- return classRef.getJavaPersistentType();
- }
- };
- }
-
-
- // ********** specified class refs **********
-
- public ListIterator<ClassRef> specifiedClassRefs() {
- return new CloneListIterator<ClassRef>(this.specifiedClassRefs);
- }
-
- protected Iterable<ClassRef> getSpecifiedClassRefs() {
- return new LiveCloneIterable<ClassRef>(this.specifiedClassRefs);
- }
-
- public int specifiedClassRefsSize() {
- return this.specifiedClassRefs.size();
- }
-
- public ClassRef addSpecifiedClassRef() {
- return this.addSpecifiedClassRef(this.specifiedClassRefs.size());
- }
-
- public ClassRef addSpecifiedClassRef(int index) {
- XmlJavaClassRef xmlClassRef = this.buildXmlJavaClassRef();
- ClassRef classRef = this.buildClassRef(xmlClassRef);
- this.specifiedClassRefs.add(index, classRef);
- this.xmlPersistenceUnit.getClasses().add(index, xmlClassRef);
- this.fireItemAdded(SPECIFIED_CLASS_REFS_LIST, index, classRef);
- return classRef;
- }
-
- protected XmlJavaClassRef buildXmlJavaClassRef() {
- return PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
- }
-
- public void removeSpecifiedClassRef(ClassRef classRef) {
- this.removeSpecifiedClassRef(this.specifiedClassRefs.indexOf(classRef));
- }
-
- public void removeSpecifiedClassRef(int index) {
- ClassRef classRef = this.specifiedClassRefs.remove(index);
- classRef.dispose();
- this.xmlPersistenceUnit.getClasses().remove(index);
- this.fireItemRemoved(SPECIFIED_CLASS_REFS_LIST, index, classRef);
- }
-
- protected void addSpecifiedClassRef_(ClassRef classRef) {
- this.addItemToList(classRef, this.specifiedClassRefs, SPECIFIED_CLASS_REFS_LIST);
- }
-
- protected void removeSpecifiedClassRef_(ClassRef classRef) {
- classRef.dispose();
- this.removeItemFromList(classRef, this.specifiedClassRefs, SPECIFIED_CLASS_REFS_LIST);
- }
-
- protected void initializeSpecifiedClassRefs() {
- for (XmlJavaClassRef xmlJavaClassRef : this.xmlPersistenceUnit.getClasses()) {
- this.specifiedClassRefs.add(this.buildClassRef(xmlJavaClassRef));
- }
- }
-
- /**
- * Since this is a *list*, we simply loop through the elements and match
- * the context to the resource element by index, not by name like we do
- * with 'impliedClassRefs'.
- */
- protected void updateSpecifiedClassRefs() {
- // make a copy of the XML class refs (to prevent ConcurrentModificationException)
- Iterator<XmlJavaClassRef> xmlClassRefs = new CloneIterator<XmlJavaClassRef>(this.xmlPersistenceUnit.getClasses());
-
- for (ClassRef contextClassRef : this.getSpecifiedClassRefs()) {
- if (xmlClassRefs.hasNext()) {
- contextClassRef.update(xmlClassRefs.next());
- } else {
- this.removeSpecifiedClassRef_(contextClassRef);
- }
- }
-
- while (xmlClassRefs.hasNext()) {
- this.addSpecifiedClassRef_(this.buildClassRef(xmlClassRefs.next()));
- }
- }
-
- protected ClassRef buildClassRef(XmlJavaClassRef xmlClassRef) {
- return this.getContextNodeFactory().buildClassRef(this, xmlClassRef);
- }
-
-
- // ********** implied class refs **********
-
- public Iterator<ClassRef> impliedClassRefs() {
- return new CloneIterator<ClassRef>(this.impliedClassRefs);
- }
-
- protected Iterable<ClassRef> getImpliedClassRefs() {
- return new LiveCloneIterable<ClassRef>(this.impliedClassRefs);
- }
-
- public int impliedClassRefsSize() {
- return this.impliedClassRefs.size();
- }
-
- protected ClassRef addImpliedClassRef(String className) {
- ClassRef classRef = this.buildClassRef(className);
- this.addItemToCollection(classRef, this.impliedClassRefs, IMPLIED_CLASS_REFS_COLLECTION);
- return classRef;
- }
-
- protected ClassRef buildClassRef(String className) {
- return this.getContextNodeFactory().buildClassRef(this, className);
- }
-
- protected void removeImpliedClassRef(ClassRef classRef) {
- classRef.dispose();
- this.removeItemFromCollection(classRef, this.impliedClassRefs, IMPLIED_CLASS_REFS_COLLECTION);
- }
-
- protected void initializeImpliedClassRefs() {
- if ( ! this.excludesUnlistedClasses()) {
- this.initializeImpliedClassRefs_();
- }
- }
-
- protected void initializeImpliedClassRefs_() {
- for (Iterator<String> stream = this.getJpaProject().mappedJavaSourceClassNames(); stream.hasNext(); ) {
- String typeName = stream.next();
- if ( ! this.specifiesPersistentType(typeName)) {
- this.impliedClassRefs.add(this.buildClassRef(typeName));
- }
- }
- }
-
- protected void updateImpliedClassRefs() {
- if (this.excludesUnlistedClasses()) {
- this.clearImpliedClassRefs_();
- } else {
- this.updateImpliedClassRefs_();
- }
- }
-
- protected void updateImpliedClassRefs_() {
- HashBag<ClassRef> impliedRefsToRemove = CollectionTools.bag(this.impliedClassRefs(), this.impliedClassRefsSize());
- ArrayList<ClassRef> impliedRefsToUpdate = new ArrayList<ClassRef>(this.impliedClassRefsSize());
-
- for (Iterator<String> mappedClassNames = this.getJpaProject().mappedJavaSourceClassNames(); mappedClassNames.hasNext(); ) {
- String mappedClassName = mappedClassNames.next();
- if ( ! this.specifiesPersistentType(mappedClassName)) {
- boolean match = false;
- for (Iterator<ClassRef> classRefs = impliedRefsToRemove.iterator(); classRefs.hasNext(); ) {
- ClassRef classRef = classRefs.next();
- if (mappedClassName.equals(classRef.getClassName())) {
- classRefs.remove();
- impliedRefsToUpdate.add(classRef);
- match = true;
- break;
- }
- }
- if ( ! match) {
- this.addImpliedClassRef(mappedClassName);
- }
- }
- }
- for (ClassRef classRef : impliedRefsToRemove) {
- this.removeImpliedClassRef(classRef);
- }
- // handle adding and removing implied class refs first, update the
- // remaining implied class refs last; this reduces the churn during "update"
- for (ClassRef classRef : impliedRefsToUpdate) {
- classRef.update(classRef.getClassName());
- }
- }
-
- protected void clearImpliedClassRefs_() {
- for (ClassRef classRef : this.getImpliedClassRefs()) {
- this.removeImpliedClassRef(classRef);
- }
- }
-
-
- // ********** exclude unlisted classes **********
-
- public boolean excludesUnlistedClasses() {
- return (this.specifiedExcludeUnlistedClasses != null) ? this.specifiedExcludeUnlistedClasses.booleanValue() : this.getDefaultExcludeUnlistedClasses();
- }
-
- public Boolean getSpecifiedExcludeUnlistedClasses() {
- return this.specifiedExcludeUnlistedClasses;
- }
-
- public void setSpecifiedExcludeUnlistedClasses(Boolean specifiedExcludeUnlistedClasses) {
- Boolean old = this.specifiedExcludeUnlistedClasses;
- this.specifiedExcludeUnlistedClasses = specifiedExcludeUnlistedClasses;
- this.xmlPersistenceUnit.setExcludeUnlistedClasses(this.specifiedExcludeUnlistedClasses);
- this.firePropertyChanged(SPECIFIED_EXCLUDE_UNLISTED_CLASSES_PROPERTY, old, specifiedExcludeUnlistedClasses);
- }
-
- public boolean getDefaultExcludeUnlistedClasses() {
- return false; // ???
- }
-
-
- // ********** properties **********
-
- public ListIterator<Property> properties() {
- return new CloneListIterator<Property>(this.properties);
- }
-
- protected Iterable<Property> getProperties() {
- return new LiveCloneIterable<Property>(this.properties);
- }
-
- public int propertiesSize() {
- return this.properties.size();
- }
-
- public Property getProperty(String propertyName) {
- if (propertyName == null) {
- throw new NullPointerException();
- }
- for (Property property : this.getProperties()) {
- if (propertyName.equals(property.getName())) {
- return property;
- }
- }
- return null;
- }
-
- public Iterator<Property> propertiesWithNamePrefix(final String propertyNamePrefix) {
- if (propertyNamePrefix == null) {
- throw new NullPointerException();
- }
- return new FilteringIterator<Property, Property>(this.properties()) {
- @Override
- protected boolean accept(Property property) {
- String pName = property.getName();
- return (pName != null) && pName.startsWith(propertyNamePrefix);
- }
- };
- }
-
- public Property addProperty() {
- return this.addProperty(this.properties.size());
- }
-
- public Property addProperty(int index) {
- return this.addProperty(this.buildXmlProperty(), index);
- }
-
- protected XmlProperty buildXmlProperty() {
- return PersistenceFactory.eINSTANCE.createXmlProperty();
- }
-
- protected Property addProperty(XmlProperty xmlProperty, int index) {
- Property property = this.buildProperty(xmlProperty);
-
- XmlProperties xmlProperties = this.xmlPersistenceUnit.getProperties();
- if (xmlProperties == null) {
- xmlProperties = this.buildXmlProperties();
- this.xmlPersistenceUnit.setProperties(xmlProperties);
- }
-
- this.properties.add(index, property);
- xmlProperties.getProperties().add(index, xmlProperty);
- this.fireItemAdded(PROPERTIES_LIST, index, property);
- if (property.getName() != null) {
- this.propertyAdded(property.getName(), property.getValue());
- }
- return property;
- }
-
- protected Property buildProperty(XmlProperty xmlProperty) {
- return this.getContextNodeFactory().buildProperty(this, xmlProperty);
- }
-
- protected XmlProperties buildXmlProperties() {
- return PersistenceFactory.eINSTANCE.createXmlProperties();
- }
-
- public void setProperty(String propertyName, String value) {
- this.setProperty(propertyName, value, false);
- }
-
- public void setProperty(String propertyName, String value, boolean duplicatePropertyNamesAllowed) {
- Property prev = this.getProperty(propertyName);
- if (prev == null) {
- if (value != null) {
- this.addProperty(propertyName, value); // add [first] property
- }
- } else {
- if (duplicatePropertyNamesAllowed) {
- if (value == null) {
- // do nothing?
- } else {
- this.addProperty(propertyName, value); // add [duplicate] property
- }
- } else {
- if (value == null) {
- this.removeProperty(prev); // remove existing property
- } else {
- prev.setValue(value); // change existing property
- }
- }
- }
- }
-
- protected void addProperty(String propertyName, String value) {
- Property property = this.addProperty();
- property.setName(propertyName);
- property.setValue(value);
- }
-
- public void removeProperty(Property property) {
- this.removeProperty(this.properties.indexOf(property));
- }
-
- public void removeProperty(String propertyName) {
- if (propertyName == null) {
- throw new NullPointerException();
- }
- for (ListIterator<Property> stream = this.properties.listIterator(); stream.hasNext(); ) {
- Property property = stream.next();
- if (propertyName.equals(property.getName())) {
- this.removeProperty(stream.previousIndex());
- return;
- }
- }
- throw new IllegalArgumentException("invalid property name: " + propertyName); //$NON-NLS-1$
- }
-
- public void removeProperty(String propertyName, String value) {
- if ((propertyName == null) || (value == null)) {
- throw new NullPointerException();
- }
- for (ListIterator<Property> stream = this.properties.listIterator(); stream.hasNext(); ) {
- Property property = stream.next();
- if (propertyName.equals(property.getName()) && value.equals(property.getValue())) {
- this.removeProperty(stream.previousIndex());
- return;
- }
- }
- throw new IllegalArgumentException("invalid property name/value pair: " + propertyName + " = " + value); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- protected void removeProperty(int index) {
- Property removedProperty = this.properties.remove(index);
- this.xmlPersistenceUnit.getProperties().getProperties().remove(index);
-
- if (this.xmlPersistenceUnit.getProperties().getProperties().isEmpty()) {
- this.xmlPersistenceUnit.setProperties(null);
- }
-
- this.fireItemRemoved(PROPERTIES_LIST, index, removedProperty);
- if (removedProperty.getName() != null) {
- this.propertyRemoved(removedProperty.getName());
- }
- }
-
- protected void addProperty_(int index, Property property) {
- this.addItemToList(index, property, this.properties, PROPERTIES_LIST);
- if (property.getName() != null) {
- this.propertyAdded(property.getName(), property.getValue());
- }
- }
-
- protected void removeProperty_(int index) {
- removeProperty_(this.properties.get(index));
- }
-
- protected void removeProperty_(Property property) {
- this.removeItemFromList(property, this.properties, PROPERTIES_LIST);
- if (property.getName() != null) {
- this.propertyRemoved(property.getName());
- }
- }
-
- protected void moveProperty_(int index, Property property) {
- this.moveItemInList(index, this.properties.indexOf(property), this.properties, PROPERTIES_LIST);
- }
-
- 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);
- }
-
- public void propertyAdded(String propertyName, String value) {
- this.propertyValueChanged(propertyName, value);
- }
-
- public 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);
-
- XmlProperties xmlProperties = this.xmlPersistenceUnit.getProperties();
- if (xmlProperties == null) {
- return;
- }
- for (XmlProperty xmlProperty : xmlProperties.getProperties()) {
- this.properties.add(this.buildProperty(xmlProperty));
- }
- }
-
- /**
- * Match the elements based on the XmlProperty resource object and also keep the order
- * the same as the source.
- */
- protected void updateProperties() {
- HashBag<Property> contextPropertiesToRemove = CollectionTools.bag(this.properties(), this.propertiesSize());
- int resourceIndex = 0;
-
- for (Iterator<XmlProperty> xmlProperties = this.xmlProperties(); xmlProperties.hasNext(); ) {
- XmlProperty xmlProperty = xmlProperties.next();
- boolean match = false;
- for (Iterator<Property> contextProperties = contextPropertiesToRemove.iterator(); contextProperties.hasNext();) {
- Property contextProperty = contextProperties.next();
- if (contextProperty.getXmlProperty() == xmlProperty) {
- contextProperties.remove();
- this.moveProperty_(resourceIndex, contextProperty);
- contextProperty.update();
- match = true;
- break;
- }
- }
- if ( ! match) {
- this.addProperty_(resourceIndex, this.buildProperty(xmlProperty));
- }
- resourceIndex++;
- }
- for (Property contextProperty : contextPropertiesToRemove) {
- this.removeProperty_(contextProperty);
- }
- }
-
- protected Iterator<XmlProperty> xmlProperties() {
- XmlProperties xmlProperties = this.xmlPersistenceUnit.getProperties();
- // make a copy of the XML properties (to prevent ConcurrentModificationException)
- return (xmlProperties != null) ? new CloneIterator<XmlProperty>(xmlProperties.getProperties()) : EmptyIterator.<XmlProperty>instance();
- }
-
- protected int xmlPropertiesSize() {
- XmlProperties xmlProperties = this.xmlPersistenceUnit.getProperties();
- return xmlProperties == null ? 0 : xmlProperties.getProperties().size();
- }
-
-
- // ********** ORM persistence unit defaults **********
-
- public AccessType getDefaultAccess() {
- return this.defaultAccess;
- }
-
- protected void setDefaultAccess(AccessType defaultAccess) {
- AccessType old = this.defaultAccess;
- this.defaultAccess = defaultAccess;
- this.firePropertyChanged(DEFAULT_ACCESS_PROPERTY, old, defaultAccess);
- }
-
- protected AccessType buildDefaultAccess(MappingFilePersistenceUnitDefaults defaults) {
- return (defaults == null) ? null : defaults.getAccess();
- }
-
- public String getDefaultCatalog() {
- return this.defaultCatalog;
- }
-
- protected void setDefaultCatalog(String defaultCatalog) {
- String old = this.defaultCatalog;
- this.defaultCatalog = defaultCatalog;
- this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, defaultCatalog);
- }
-
- protected String buildDefaultCatalog(MappingFilePersistenceUnitDefaults defaults) {
- String catalog = (defaults == null) ? null : defaults.getCatalog();
- return (catalog != null) ? catalog : this.getJpaProject().getDefaultCatalog();
- }
-
- public String getDefaultSchema() {
- return this.defaultSchema;
- }
-
- protected void setDefaultSchema(String defaultSchema) {
- String old = this.defaultSchema;
- this.defaultSchema = defaultSchema;
- this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, defaultSchema);
- }
-
- protected String buildDefaultSchema(MappingFilePersistenceUnitDefaults defaults) {
- String schema = (defaults == null) ? null : defaults.getSchema();
- return (schema != null) ? schema : this.getJpaProject().getDefaultSchema();
- }
-
- public boolean getDefaultCascadePersist() {
- return this.defaultCascadePersist;
- }
-
- protected void setDefaultCascadePersist(boolean defaultCascadePersist) {
- boolean old = this.defaultCascadePersist;
- this.defaultCascadePersist = defaultCascadePersist;
- this.firePropertyChanged(DEFAULT_CASCADE_PERSIST_PROPERTY, old, defaultCascadePersist);
- }
-
- protected boolean buildDefaultCascadePersist(MappingFilePersistenceUnitDefaults defaults) {
- return (defaults == null) ? false : defaults.isCascadePersist();
- }
-
- protected void initializePersistenceUnitDefaults() {
- MappingFilePersistenceUnitDefaults defaults = this.getDefaults();
- this.defaultAccess = this.buildDefaultAccess(defaults);
- this.defaultCatalog = this.buildDefaultCatalog(defaults);
- this.defaultSchema = this.buildDefaultSchema(defaults);
- this.defaultCascadePersist = this.buildDefaultCascadePersist(defaults);
- }
-
- protected void updatePersistenceUnitDefaults() {
- MappingFilePersistenceUnitDefaults defaults = this.getDefaults();
- this.setDefaultAccess(this.buildDefaultAccess(defaults));
- this.setDefaultCatalog(this.buildDefaultCatalog(defaults));
- this.setDefaultSchema(this.buildDefaultSchema(defaults));
- this.setDefaultCascadePersist(this.buildDefaultCascadePersist(defaults));
- }
-
- /**
- * return the first persistence unit defaults we encounter in a mapping file
- */
- protected MappingFilePersistenceUnitDefaults getDefaults() {
- for (Iterator<MappingFileRef> stream = this.mappingFileRefs(); stream.hasNext(); ) {
- MappingFileRef mappingFileRef = stream.next();
- if (mappingFileRef.persistenceUnitDefaultsExists()) {
- return mappingFileRef.getPersistenceUnitDefaults();
- }
- }
- return null;
- }
-
-
- //************** 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) {
- SharedCacheMode old = this.specifiedSharedCacheMode;
- this.specifiedSharedCacheMode = specifiedSharedCacheMode;
- this.xmlPersistenceUnit.setSharedCacheMode(SharedCacheMode.toXmlResourceModel(specifiedSharedCacheMode));
- this.firePropertyChanged(SPECIFIED_SHARED_CACHE_MODE_PROPERTY, old, specifiedSharedCacheMode);
- }
-
- 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() {
- switch (getSharedCacheMode()) {
- case NONE:
- case ENABLE_SELECTIVE:
- case UNSPECIFIED:
- return false;
- case ALL:
- case DISABLE_SELECTIVE:
- return true;
- }
- return false;//null
- }
-
- 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) {
- ValidationMode old = this.specifiedValidationMode;
- this.specifiedValidationMode = specifiedValidationMode;
- this.xmlPersistenceUnit.setValidationMode(ValidationMode.toXmlResourceModel(specifiedValidationMode));
- this.firePropertyChanged(SPECIFIED_VALIDATION_MODE_PROPERTY, old, specifiedValidationMode);
- }
-
- 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 ListIterator<Generator> generators() {
- return new CloneListIterator<Generator>(this.generators);
- }
-
- public int generatorsSize() {
- return this.generators.size();
- }
-
- public void addGenerator(Generator generator) {
- this.generators.add(generator);
- }
-
- public String[] uniqueGeneratorNames() {
- HashSet<String> names = new HashSet<String>(this.generators.size());
- this.addNonNullGeneratorNamesTo(names);
- return names.toArray(new String[names.size()]);
- }
-
- protected void addNonNullGeneratorNamesTo(Set<String> names) {
- for (Iterator<Generator> stream = this.generators(); stream.hasNext(); ) {
- String generatorName = stream.next().getName();
- if (generatorName != null) {
- names.add(generatorName);
- }
- }
- }
-
-
- // ********** queries **********
-
- public ListIterator<Query> queries() {
- return new CloneListIterator<Query>(this.queries);
- }
-
- public int queriesSize() {
- return this.queries.size();
- }
-
- public void addQuery(Query query) {
- this.queries.add(query);
- }
-
-
- // ********** root entities **********
-
- public void addRootEntityWithSubEntities(String entityName) {
- this.rootEntityNames.add(entityName);
- }
-
- public boolean entityIsRootWithSubEntities(String entityName) {
- return this.rootEntityNames.contains(entityName);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- validateMappingFiles(messages, reporter);
- validateClassRefs(messages, reporter);
- validateJarFileRefs(messages, reporter);
- }
-
- protected void validateMappingFiles(List<IMessage> messages, IReporter reporter) {
- this.checkForMultiplePersistenceUnitDefaults(messages);
- this.checkForDuplicateMappingFiles(messages);
- for (Iterator<MappingFileRef> stream = this.mappingFileRefs(); stream.hasNext();) {
- stream.next().validate(messages, reporter);
- }
- }
-
- protected void checkForMultiplePersistenceUnitDefaults(List<IMessage> messages) {
- Iterator<MappingFileRef> stream = mappingFileRefs();
- while (stream.hasNext()) {
- if (stream.next().persistenceUnitDefaultsExists()) {
- break;
- }
- }
- while (stream.hasNext()) {
- MappingFileRef mappingFileRef = stream.next();
- if (mappingFileRef.persistenceUnitDefaultsExists()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.NORMAL_SEVERITY,
- JpaValidationMessages.MAPPING_FILE_EXTRANEOUS_PERSISTENCE_UNIT_DEFAULTS,
- new String[] {mappingFileRef.getFileName()},
- mappingFileRef
- )
- );
- }
- }
- }
-
- protected void checkForDuplicateMappingFiles(List<IMessage> messages) {
- HashBag<String> fileNames = new HashBag<String>();
- CollectionTools.addAll(fileNames, this.mappingFileRefNames());
- for (Iterator<MappingFileRef> stream = this.mappingFileRefs(); stream.hasNext(); ) {
- MappingFileRef mappingFileRef = stream.next();
- 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 Iterator<String> mappingFileRefNames() {
- return new TransformationIterator<MappingFileRef, String>(this.mappingFileRefs()) {
- @Override
- protected String transform(MappingFileRef mappingFileRef) {
- return mappingFileRef.getFileName();
- }
- };
- }
-
- protected void validateClassRefs(List<IMessage> messages, IReporter reporter) {
- this.checkForDuplicateClasses(messages);
- for (Iterator<ClassRef> stream = this.classRefs(); stream.hasNext(); ) {
- stream.next().validate(messages, reporter);
- }
- }
-
- protected void checkForDuplicateClasses(List<IMessage> messages) {
- HashBag<String> classNames = new HashBag<String>();
- CollectionTools.addAll(classNames, this.classRefNames());
- for (Iterator<ClassRef> stream = this.classRefs(); stream.hasNext(); ) {
- ClassRef classRef = stream.next();
- String className = classRef.getClassName();
- if ((className != null) && (classNames.count(className) > 1)) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENCE_UNIT_DUPLICATE_CLASS,
- new String[] {className},
- classRef,
- classRef.getValidationTextRange()
- )
- );
- }
- }
- }
-
- protected Iterator<String> classRefNames() {
- return new TransformationIterator<ClassRef, String>(this.classRefs()) {
- @Override
- protected String transform(ClassRef classRef) {
- return classRef.getClassName();
- }
- };
- }
-
- protected void validateJarFileRefs(List<IMessage> messages, IReporter reporter) {
- checkForDuplicateJarFileRefs(messages);
- for (JarFileRef each : CollectionTools.iterable(jarFileRefs())) {
- each.validate(messages, reporter);
- }
- }
-
- protected void checkForDuplicateJarFileRefs(List<IMessage> messages) {
- HashBag<String> jarFileNames = new HashBag<String>();
- CollectionTools.addAll(jarFileNames, jarFileNames());
- for (JarFileRef jarFileRef : CollectionTools.iterable(jarFileRefs())) {
- String jarFileName = jarFileRef.getFileName();
- if ((jarFileName != null) && (jarFileNames.count(jarFileName) > 1)) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENCE_UNIT_DUPLICATE_JAR_FILE,
- new String[] {jarFileName},
- jarFileRef,
- jarFileRef.getValidationTextRange()
- )
- );
- }
- }
- }
-
- protected Iterator<String> jarFileNames() {
- return new TransformationIterator<JarFileRef, String>(jarFileRefs()) {
- @Override
- protected String transform(JarFileRef jarFileRef) {
- return jarFileRef.getFileName();
- }
- };
- }
-
-
- // ********** misc **********
-
- public JpaStructureNode getStructureNode(int textOffset) {
- for (Iterator<JarFileRef> stream = this.jarFileRefs(); stream.hasNext(); ) {
- JarFileRef jarFileRef = stream.next();
- if (jarFileRef.containsOffset(textOffset)) {
- return jarFileRef;
- }
- }
- for (Iterator<MappingFileRef> stream = this.mappingFileRefs(); stream.hasNext(); ) {
- MappingFileRef mappingFileRef = stream.next();
- if (mappingFileRef.containsOffset(textOffset)) {
- return mappingFileRef;
- }
- }
- for (Iterator<ClassRef> stream = this.classRefs(); stream.hasNext(); ) {
- ClassRef classRef = stream.next();
- if (classRef.containsOffset(textOffset)) {
- return classRef;
- }
- }
- return this;
- }
-
- public boolean shouldValidateAgainstDatabase() {
- return connectionProfileIsActive();
- }
-
- public TextRange getValidationTextRange() {
- return this.xmlPersistenceUnit.getValidationTextRange();
- }
-
- public PersistentType getPersistentType(String typeName) {
- for (Iterator<MappingFileRef> stream = this.mappingFileRefs(); stream.hasNext(); ) {
- PersistentType persistentType = stream.next().getPersistentType(typeName);
- if (persistentType != null) {
- return persistentType;
- }
- }
- for (Iterator<ClassRef> stream = this.classRefs(); stream.hasNext(); ) {
- ClassRef classRef = stream.next();
- if (classRef.isFor(typeName)) {
- return classRef.getJavaPersistentType();
- }
- }
- for (Iterator<JarFileRef> stream = this.jarFileRefs(); stream.hasNext(); ) {
- PersistentType persistentType = stream.next().getPersistentType(typeName);
- if (persistentType != null) {
- return persistentType;
- }
- }
- return null;
- }
-
- public boolean specifiesPersistentType(String className) {
- for (ClassRef classRef : this.getSpecifiedClassRefs()) {
- if (className.equals(classRef.getClassName())) {
- return true;
- }
- }
- for (Iterator<MappingFileRef> stream = this.mappingFileRefs(); stream.hasNext(); ) {
- if (stream.next().getPersistentType(className) != null) {
- return true;
- }
- }
- return false;
- }
-
- public Entity getEntity(String typeName) {
- PersistentType persistentType = this.getPersistentType(typeName);
- if (persistentType == null) {
- return null;
- }
- TypeMapping typeMapping = persistentType.getMapping();
- return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
- }
-
- public Embeddable getEmbeddable(String typeName) {
- PersistentType persistentType = this.getPersistentType(typeName);
- if (persistentType == null) {
- return null;
- }
- TypeMapping typeMapping = persistentType.getMapping();
- return (typeMapping instanceof Embeddable) ? (Embeddable) typeMapping : null;
- }
-
- public boolean containsOffset(int textOffset) {
- return (this.xmlPersistenceUnit != null) && this.xmlPersistenceUnit.containsOffset(textOffset);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- super.toString(sb);
- sb.append(this.name);
- }
-
-
- // ********** metamodel **********
- // put metamodel stuff here so it can be shared by Generic and EclipseLink implementations
-
- public void initializeMetamodel() {
- this.initializeMetamodelFiles();
- }
-
- protected void initializeMetamodelFiles() {
- CollectionTools.addAll(this.metamodelFiles, this.getGeneratedMetamodelFiles());
- }
-
- protected Iterable<IFile> getGeneratedMetamodelFiles() {
- return new TransformationIterable<JavaResourcePersistentType2_0, IFile>(this.getGeneratedMetamodelTypes()) {
- @Override
- protected IFile transform(JavaResourcePersistentType2_0 jrpt) {
- return jrpt.getFile();
- }
- };
- }
-
- protected Iterable<JavaResourcePersistentType2_0> getGeneratedMetamodelTypes() {
- return ((JpaProject2_0) this.getJpaProject()).getGeneratedMetamodelTypes();
- }
-
- /**
- * If we have the same persistent type in multiple locations, the last one
- * we encounter wins (i.e. the classes in the orm.xml take precedence).
- */
- public void synchronizeMetamodel() {
- // gather the persistent unit's types (eliminating duplicates, ignoring case)
- HashMap<String, PersistentType2_0> persistentTypes = new HashMap<String, PersistentType2_0>();
- this.addContainerPersistentTypesTo(this.getJarFileRefs(), persistentTypes);
- this.addPersistentTypesTo(this.getNonNullClassRefPersistentTypes(), persistentTypes);
- this.addContainerPersistentTypesTo(this.getMappingFileRefs(), persistentTypes);
-
- // copy the list of metamodel files...
- HashSet<IFile> deadMetamodelFiles = new HashSet<IFile>(this.metamodelFiles);
- this.metamodelFiles.clear();
- for (PersistentType2_0 persistentType : persistentTypes.values()) {
- IFile metamodelFile = persistentType.getMetamodelFile();
- // ...remove whatever files are still present...
- deadMetamodelFiles.remove(metamodelFile);
- // ...rebuild the list of metamodel files...
- if (this.fileIsGeneratedMetamodel(metamodelFile)) { // only add files with the Dali tag
- this.metamodelFiles.add(metamodelFile);
- }
- }
- // ...delete the files that are now gone
- // [perform the deletes first - this is critical when a file has been
- // renamed by only altering its name's case; since we will try to write
- // out a new file that, on Windows, collides with the old file :-( ]
- for (IFile deadMetamodelFile : deadMetamodelFiles) {
- this.deleteMetamodelFile(deadMetamodelFile);
- }
- // now generate the metamodel classes
- for (PersistentType2_0 persistentType : persistentTypes.values()) {
- persistentType.synchronizeMetamodel();
- }
- }
-
- protected void addContainerPersistentTypesTo(Iterable<? extends PersistentTypeContainer> ptContainers, HashMap<String, PersistentType2_0> persistentTypeMap) {
- for (PersistentTypeContainer ptContainer : ptContainers) {
- this.addPersistentTypesTo(ptContainer.getPersistentTypes(), persistentTypeMap);
- }
- }
-
- protected void addPersistentTypesTo(Iterable<? extends PersistentType> persistentTypes, HashMap<String, PersistentType2_0> persistentTypeMap) {
- for (PersistentType persistentType : persistentTypes) {
- // hopefully this is case-insensitive enough...
- persistentTypeMap.put(persistentType.getName().toLowerCase(), (PersistentType2_0) persistentType);
- }
- }
-
- protected void deleteMetamodelFile(IFile file) {
- try {
- this.deleteMetamodelFile_(file);
- } catch (CoreException ex) {
- JptCorePlugin.log(ex);
- }
- }
-
- protected void deleteMetamodelFile_(IFile file) throws CoreException {
- if (this.fileIsGeneratedMetamodel(file)) {
- file.delete(true, null); // true = force
- }
- }
-
- protected boolean fileIsGeneratedMetamodel(IFile file) {
- return ((JpaProject2_0) this.getJpaProject()).getGeneratedMetamodelType(file) != null;
- }
-
- public void disposeMetamodel() {
- this.metamodelFiles.clear();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnitProperties.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnitProperties.java
deleted file mode 100644
index 368b210e97..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnitProperties.java
+++ /dev/null
@@ -1,394 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.context.persistence;
-
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.utility.internal.ClassTools;
-import org.eclipse.jpt.utility.internal.model.AbstractModel;
-
-/**
- * AbstractPersistenceUnitProperties
- */
-public abstract class AbstractPersistenceUnitProperties extends AbstractModel
- implements PersistenceUnitProperties
-{
- private PersistenceUnit persistenceUnit;
-
- // key = PersistenceUnit property key; value = property id
- private Map<String, String> propertyNames;
-
- private static final long serialVersionUID = 1L;
-
- // ********** constructors / initialization **********
- protected AbstractPersistenceUnitProperties(PersistenceUnit parent) {
- super();
- this.initialize(parent);
- }
-
- protected void initialize(PersistenceUnit parent) {
- this.persistenceUnit = parent;
-
- this.initializePropertyNames();
- this.initializeProperties();
- this.postInitializeProperties();
- }
-
- protected void initializePropertyNames() {
- this.propertyNames = new HashMap<String, String>();
- 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 postInitializeProperties() {
- // do nothing by default
- }
-
- // ********** behavior **********
- public PersistenceUnit getPersistenceUnit() {
- return this.persistenceUnit;
- }
-
- public JpaProject getJpaProject() {
- return this.persistenceUnit.getJpaProject();
- }
-
- private Map<String, String> propertyNames() {
- return this.propertyNames;
- }
- /**
- * 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;
- }
-
- /*
- * 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);
- }
- }
-
- 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);
- }
-
- /**
- * 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);
- }
-
- // ****** Static methods *******
-
- public static Boolean getBooleanValueOf(String puStringValue) {
- if (puStringValue == null) {
- return null;
- }
- return Boolean.valueOf(puStringValue);
- }
-
- public static Integer getIntegerValueOf(String puStringValue) {
- if (puStringValue == null) {
- return null;
- }
- return Integer.valueOf(puStringValue);
- }
-
- /**
- * 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) ClassTools.staticFieldValue(value.getClass(), value.toString().toUpperCase(Locale.ENGLISH));
- }
- return value.toString();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlContextNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlContextNode.java
deleted file mode 100644
index 9172edd8d3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlContextNode.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.persistence;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.context.JpaContextNode;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.persistence.PersistenceXmlContextNodeFactory;
-import org.eclipse.jpt.core.context.persistence.PersistenceXmlDefinition;
-import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode;
-
-/**
- * Use this abstract class for context nodes that are part of an OrmXml file.
- * This will not work for purely MappingFile implementations
- */
-public abstract class AbstractPersistenceXmlContextNode
- extends AbstractXmlContextNode
- implements XmlContextNode
-{
-
- // ********** constructor **********
-
- protected AbstractPersistenceXmlContextNode(JpaContextNode parent) {
- super(parent);
- }
-
- public PersistenceXmlDefinition getPersistenceXmlDefinition() {
- return (PersistenceXmlDefinition) getJpaPlatform().getResourceDefinition(getResourceType());
- }
-
- public EFactory getResourceNodeFactory() {
- return getPersistenceXmlDefinition().getResourceNodeFactory();
- }
-
- public PersistenceXmlContextNodeFactory getContextNodeFactory() {
- return getPersistenceXmlDefinition().getContextNodeFactory();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java
deleted file mode 100644
index f9600a0401..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.persistence;
-
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.JpaRootContextNode;
-import org.eclipse.jpt.core.context.java.JarFile;
-import org.eclipse.jpt.core.context.persistence.ClassRef;
-import org.eclipse.jpt.core.context.persistence.JarFileRef;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.core.context.persistence.PersistenceXmlContextNodeFactory;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJarFile;
-import org.eclipse.jpt.core.internal.jpa1.context.persistence.GenericClassRef;
-import org.eclipse.jpt.core.internal.jpa1.context.persistence.GenericJarFileRef;
-import org.eclipse.jpt.core.internal.jpa1.context.persistence.GenericMappingFileRef;
-import org.eclipse.jpt.core.internal.jpa1.context.persistence.GenericPersistence;
-import org.eclipse.jpt.core.internal.jpa1.context.persistence.GenericPersistenceUnit;
-import org.eclipse.jpt.core.internal.jpa1.context.persistence.GenericPersistenceUnitProperty;
-import org.eclipse.jpt.core.internal.jpa1.context.persistence.GenericPersistenceXml;
-import org.eclipse.jpt.core.internal.jpa1.context.persistence.ImpliedMappingFileRef;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragmentRoot;
-import org.eclipse.jpt.core.resource.persistence.XmlJarFileRef;
-import org.eclipse.jpt.core.resource.persistence.XmlJavaClassRef;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistence;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.jpt.core.resource.persistence.XmlProperty;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-
-public abstract class AbstractPersistenceXmlContextNodeFactory implements PersistenceXmlContextNodeFactory
-{
-
- public PersistenceXml buildPersistenceXml(JpaRootContextNode parent, JpaXmlResource resource) {
- return new GenericPersistenceXml(parent, resource);
- }
-
- public Persistence buildPersistence(PersistenceXml parent, XmlPersistence xmlPersistence) {
- return new GenericPersistence(parent, xmlPersistence);
- }
-
- public PersistenceUnit buildPersistenceUnit(Persistence parent, XmlPersistenceUnit xmlPersistenceUnit) {
- return new GenericPersistenceUnit(parent, xmlPersistenceUnit);
- }
-
- public MappingFileRef buildMappingFileRef(PersistenceUnit parent, XmlMappingFileRef xmlMappingFileRef) {
- return new GenericMappingFileRef(parent, xmlMappingFileRef);
- }
-
- public MappingFileRef buildImpliedMappingFileRef(PersistenceUnit parent) {
- return new ImpliedMappingFileRef(parent, JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH );
- }
-
- public ClassRef buildClassRef(PersistenceUnit parent, XmlJavaClassRef classRef) {
- return new GenericClassRef(parent, classRef);
- }
-
- public ClassRef buildClassRef(PersistenceUnit parent, String className) {
- return new GenericClassRef(parent, className);
- }
-
- public JarFileRef buildJarFileRef(PersistenceUnit parent, XmlJarFileRef xmlJarFileRef) {
- return new GenericJarFileRef(parent, xmlJarFileRef);
- }
-
- public JarFile buildJarFile(JarFileRef parent, JavaResourcePackageFragmentRoot jarResourcePackageFragmentRoot) {
- return new GenericJarFile(parent, jarResourcePackageFragmentRoot);
- }
-
- public PersistenceUnit.Property buildProperty(PersistenceUnit parent, XmlProperty xmlProperty) {
- return new GenericPersistenceUnitProperty(parent, xmlProperty);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java
deleted file mode 100644
index 86c07e8b1d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.persistence;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceXmlContextNodeFactory;
-import org.eclipse.jpt.core.context.persistence.PersistenceXmlDefinition;
-
-/**
- * All the state in the definition should be "static" (i.e. unchanging once it is initialized).
- */
-public abstract class AbstractPersistenceXmlDefinition
- implements PersistenceXmlDefinition
-{
-
- private final PersistenceXmlContextNodeFactory factory;
-
-
- /**
- * zero-argument constructor
- */
- protected AbstractPersistenceXmlDefinition() {
- super();
- this.factory = buildContextNodeFactory();
- }
-
-
- protected abstract PersistenceXmlContextNodeFactory buildContextNodeFactory();
-
- public PersistenceXmlContextNodeFactory getContextNodeFactory() {
- return this.factory;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java
deleted file mode 100644
index 64b67b65b2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.persistence;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.core.internal.jpa2.context.persistence.connection.NullConnection2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.persistence.options.NullOptions2_0;
-
-
-public class GenericPersistenceXmlContextNodeFactory extends AbstractPersistenceXmlContextNodeFactory
-{
-
- public PersistenceUnitProperties buildConnection(PersistenceUnit parent) {
- return new NullConnection2_0(parent);
- }
-
- public PersistenceUnitProperties buildOptions(PersistenceUnit parent) {
- return new NullOptions2_0(parent);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetActionDelegate.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetActionDelegate.java
deleted file mode 100644
index 399d37db68..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetActionDelegate.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.facet;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jpt.core.JptCorePlugin;
-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 {
-
- monitor = this.nonNullMonitor(monitor);
- try {
- this.execute_(project, fv, config, monitor);
- } finally {
- monitor.done();
- }
- }
-
- protected void execute_(
- IProject project, @SuppressWarnings("unused") IProjectFacetVersion fv,
- Object config, IProgressMonitor monitor) throws CoreException {
-
- monitor.beginTask("", 1); //$NON-NLS-1$
-
- // NB: WTP Natures (including the JavaEMFNature)
- // should already be added, as this facet should
- // always coexist with a module facet.
-
- IDataModel dataModel = (IDataModel) config;
-
- // project settings
- JptCorePlugin.setJpaPlatformId(project, dataModel.getStringProperty(PLATFORM_ID));
-
- // do NOT use IDataModel.getStringProperty(String) - or the connection profile name can
- // be set to an empty string - we want it to be null
- JptCorePlugin.setConnectionProfileName(project, (String) dataModel.getProperty(CONNECTION));
-
- if (dataModel.getBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG)) {
- JptCorePlugin.setUserOverrideDefaultCatalog(project, dataModel.getStringProperty(USER_OVERRIDE_DEFAULT_CATALOG));
- }
- if (dataModel.getBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA)) {
- JptCorePlugin.setUserOverrideDefaultSchema(project, dataModel.getStringProperty(USER_OVERRIDE_DEFAULT_SCHEMA));
- }
-
- JptCorePlugin.setDiscoverAnnotatedClasses(project, dataModel.getBooleanProperty(DISCOVER_ANNOTATED_CLASSES));
-
- // defaults settings
- JptCorePlugin.setDefaultJpaPlatformId(dataModel.getStringProperty(PLATFORM_ID));
-
- //Delegate to LibraryInstallDelegate to configure the project classpath
- ((LibraryInstallDelegate) dataModel.getProperty(JpaFacetInstallDataModelProperties.LIBRARY_PROVIDER_DELEGATE)).execute(new NullProgressMonitor());
-
- monitor.worked(1);
- }
-
- private IProgressMonitor nonNullMonitor(IProgressMonitor monitor) {
- return (monitor != null) ? monitor : new NullProgressMonitor();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetDataModelProperties.java
deleted file mode 100644
index 4b3eb38bf5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetDataModelProperties.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.facet;
-
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties;
-
-public interface JpaFacetDataModelProperties
- extends IDataModelProperties
-{
- String PREFIX = "JpaFacetDataModelProperties";
- String PREFIX_ = PREFIX + '.';
-
- /**
- * Internal, type IRuntime, identifies runtime associated with project
- * Used only in conjunction with validation of other properties, because this information
- * is otherwise inaccessible to this data model
- */
- String RUNTIME = PREFIX_ + "RUNTIME";
-
- /**
- * Required, type String, identifies Jpa Platform
- */
- String PLATFORM_ID = PREFIX_ + "PLATFORM_ID";
-
- /**
- * Required, type LibraryInstallDelegate, the library install delegate used to configure JPA provider library
- */
- String LIBRARY_PROVIDER_DELEGATE = PREFIX_ + "LIBRARY_PROVIDER_DELEGATE";
-
- /**
- * Not required, type String, identifies database connection
- */
- String CONNECTION = PREFIX_ + "CONNECTION";
-
- /**
- * Required, type Boolean, identifies whether database connection is active
- */
- String CONNECTION_ACTIVE = PREFIX_ + "CONNECTION_ACTIVE";
-
- /**
- * Required, type Boolean, identifies if the user wishes to override default Catalog name
- */
- String USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG = PREFIX_ + "USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG";
-
- /**
- * Not required, type String, identifies the user overridden default Catalog name
- */
- String USER_OVERRIDE_DEFAULT_CATALOG = PREFIX_ + "USER_OVERRIDE_DEFAULT_CATALOG";
-
- /**
- * Required, type Boolean, identifies if the user wishes to override default schema name
- */
- String USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA = PREFIX_ + "USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA";
-
- /**
- * Not required, type String, identifies the user overridden default schema name
- */
- String USER_OVERRIDE_DEFAULT_SCHEMA = PREFIX_ + "USER_OVERRIDE_DEFAULT_SCHEMA";
-
- /**
- * Required, type boolean, opposite of LIST_ANNOTATED_CLASSES, identifies
- * whether all annotated classes are to be automatically included as part of
- * all persistence units
- */
- String DISCOVER_ANNOTATED_CLASSES = PREFIX_ + "DISCOVER_ANNOTATED_CLASSES";
-
- /**
- * Required, type boolean, opposite of DISCOVER_ANNOTATED_CLASSES, identifies
- * if annotated classes should be listed in the persistence.xml in order to
- * be considered part of a persistence unit
- * (This additional setting is necessary in order to use synchHelper within
- * the wizard - there must be a unique property for each radio button. Stupid
- * but true)
- */
- String LIST_ANNOTATED_CLASSES = PREFIX_ + "LIST_ANNOTATED_CLASSES";
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetDataModelProvider.java
deleted file mode 100644
index cf6bd1d039..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetDataModelProvider.java
+++ /dev/null
@@ -1,684 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.facet;
-
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-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.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.JpaPlatformRegistry;
-import org.eclipse.jpt.core.internal.JptCoreMessages;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.ConnectionProfile;
-import org.eclipse.jpt.db.ConnectionProfileFactory;
-import org.eclipse.jpt.db.Database;
-import org.eclipse.jpt.db.DatabaseFinder;
-import org.eclipse.jpt.db.JptDbPlugin;
-import org.eclipse.jpt.db.SchemaContainer;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jst.common.project.facet.core.libprov.IPropertyChangeListener;
-import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate;
-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_ID);
- 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 String getPlatformId() {
- return (String) this.getProperty(PLATFORM_ID);
- }
-
- 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 JptCorePlugin.FACET_ID;
- }
- if (propertyName.equals(RUNTIME)) {
- return null;
- }
- if (propertyName.equals(PLATFORM_ID)) {
- return getDefaultPlatformId();
- }
- 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 String getDefaultPlatformId();
-
- protected LibraryInstallDelegate getDefaultLibraryProvider() {
- // delegate itself changes, not the instance of delegate
- if (this.defaultLibraryProvider == null) {
- this.defaultLibraryProvider = this.buildDefaultLibraryProvider();
- }
- return defaultLibraryProvider;
- }
-
- protected LibraryInstallDelegate buildDefaultLibraryProvider() {
- IFacetedProjectWorkingCopy fpjwc = this.getFacetedProjectWorkingCopy();
- if (fpjwc == null) {
- return null;
- }
- IProjectFacetVersion pfv = this.getProjectFacetVersion();
- if (pfv == null) {
- return null;
- }
- LibraryInstallDelegate lp = new LibraryInstallDelegate(fpjwc, pfv, this.buildEnablementVariables());
- lp.addListener(this.buildLibraryProviderListener());
- return lp;
- }
-
- protected Map<String, Object> buildEnablementVariables() {
- Map<String, Object> enablementVariables = new HashMap<String, Object>();
- enablementVariables.put(JpaLibraryProviderConstants.EXPR_VAR_JPA_PLATFORM, this.getPlatformId());
- return enablementVariables;
- }
-
- protected IPropertyChangeListener buildLibraryProviderListener() {
- return new IPropertyChangeListener() {
- public void propertyChanged(String property, Object oldValue, Object newValue ) {
- 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)) {
- 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_ID)) {
- LibraryInstallDelegate lid = this.getLibraryInstallDelegate();
- if (lid != null) {
- // may be null while model is being built up
- // ... or in tests
- lid.setEnablementContextVariable(JpaLibraryProviderConstants.EXPR_VAR_JPA_PLATFORM, propertyValue);
- }
- }
- 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();
- }
-
-
- // ********** property descriptors **********
-
- @Override
- public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
- if (propertyName.equals(PLATFORM_ID)) {
- 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<String> validPlatformIds = buildValidPlatformIds();
- Iterable<DataModelPropertyDescriptor> validPlatformDescriptors =
- new TransformationIterable<String, DataModelPropertyDescriptor>(validPlatformIds) {
- @Override
- protected DataModelPropertyDescriptor transform(String platformId) {
- return JpaFacetDataModelProvider.this.buildPlatformIdDescriptor(platformId);
- }
- };
- return ArrayTools.sort(ArrayTools.array(validPlatformDescriptors, EMPTY_DMPD_ARRAY), DESCRIPTOR_COMPARATOR);
- }
-
- protected Iterable<String> buildValidPlatformIds() {
- String jpaFacetVersion = this.getProjectFacetVersion().getVersionString();
- return JpaPlatformRegistry.instance().getJpaPlatformIdsForJpaFacetVersion(jpaFacetVersion);
- }
-
- 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.connectionProfileNames()));
- 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.sortedCatalogIdentifiers(), 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.schemaIdentifiers(), this.getDefaultSchemaIdentifier());
- }
-
- protected Iterator<String> schemaIdentifiers() {
- SchemaContainer sc = this.getSchemaContainer();
- // use schema *identifiers* since the string ends up being the "default" for various text entries
- return (sc != null) ? sc.sortedSchemaIdentifiers() : EmptyIterator.<String>instance();
- }
-
- /**
- * put an entry for the default at the top of the list
- */
- protected List<String> buildValidStrings(Iterator<String> stream, String defaultString) {
- List<String> strings = CollectionTools.list(stream);
- if ((defaultString != null) && ! strings.contains(defaultString)) {
- strings.add(0, defaultString);
- }
- return strings;
- }
-
- 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_ID)) {
- return buildPlatformIdDescriptor(this.getPlatformId());
- }
- if (propertyName.equals(CONNECTION)) {
- return buildConnectionDescriptor(this.getConnectionName());
- }
- return super.getPropertyDescriptor(propertyName);
- }
-
- protected DataModelPropertyDescriptor buildPlatformIdDescriptor(String platformId) {
- return new DataModelPropertyDescriptor(platformId, this.getPlatformLabel(platformId));
- }
-
- protected String getPlatformLabel(String platformId) {
- return JpaPlatformRegistry.instance().getJpaPlatformLabel(platformId);
- }
-
- 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, DatabaseFinder.Default.instance());
- }
-
- protected Iterator<String> connectionProfileNames() {
- return this.getConnectionProfileFactory().connectionProfileNames();
- }
-
- protected ConnectionProfileFactory getConnectionProfileFactory() {
- // we don't have a JPA project yet, so go to the db plug-in directly to get the factory
- return JptDbPlugin.instance().getConnectionProfileFactory();
- }
-
-
- // ********** validation **********
-
- @Override
- public IStatus validate(String propertyName) {
- if (propertyName.equals(PLATFORM_ID)) {
- return this.validatePlatformId();
- }
- 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 validatePlatformId() {
- return (this.getPlatformId() == null) ? PLATFORM_NOT_SPECIFIED_STATUS : OK_STATUS;
- }
-
- protected IStatus validateConnection() {
- String connectionName = this.getConnectionName();
- return (connectionName == null) ? OK_STATUS : this.validateNonNullConnection(connectionName);
- }
-
- protected IStatus validateNonNullConnection(String connectionName) {
- ConnectionProfile cp = this.getConnectionProfile(connectionName);
- if (cp == null) {
- return buildErrorStatus(NLS.bind(JptCoreMessages.VALIDATE_CONNECTION_INVALID, connectionName));
- }
- if ( ! cp.isActive()) {
- return CONNECTION_NOT_CONNECTED_STATUS;
- }
- return OK_STATUS;
- }
-
- protected IStatus validateUserOverrideDefaultCatalog() {
- if (this.userWantsToOverrideDefaultCatalog()) {
- if (this.getUserOverrideDefaultCatalog() == null) {
- return USER_OVERRIDE_DEFAULT_CATALOG_NOT_SPECIFIED_STATUS;
- }
- }
- return OK_STATUS;
- }
-
- protected IStatus validateUserOverrideDefaultSchema() {
- if (this.userWantsToOverrideDefaultSchema()) {
- if (this.getUserOverrideDefaultSchema() == null) {
- return USER_OVERRIDE_DEFAULT_SCHEMA_NOT_SPECIFIED_STATUS;
- }
- }
- return OK_STATUS;
- }
-
- protected IStatus validatePersistentClassManagement() {
- // TODO warning if "discovery" is used, but no runtime specified ??
- // boolean discoverAnnotatedClasses = this.discoverAnnotatedClasses();
- return OK_STATUS;
- }
-
-
- // ********** static methods **********
-
- protected static IStatus buildInfoStatus(String message) {
- return buildStatus(IStatus.INFO, message);
- }
-
-// private static IStatus buildWarningStatus(String message) {
-// return buildStatus(IStatus.WARNING, message);
-// }
-
- protected static IStatus buildErrorStatus(String message) {
- return buildStatus(IStatus.ERROR, message);
- }
-
- protected static IStatus buildStatus(int severity, String message) {
- return new Status(severity, JptCorePlugin.PLUGIN_ID, message);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDataModelProperties.java
deleted file mode 100644
index 4a0bfb1c57..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDataModelProperties.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.facet;
-
-@SuppressWarnings("nls")
-public interface JpaFacetInstallDataModelProperties
- extends JpaFacetDataModelProperties
-{
- String PREFIX = "JpaFacetInstallDataModelProperties";
- String PREFIX_ = PREFIX + '.';
-
- /**
- * Required, type Boolean, identifies if the user wishes to add the database driver jars to the classpath
- */
- String USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH = PREFIX_ + "USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH";
-
- /**
- * Not required, type String, identifies the database driver library added to the classpath
- */
- String DB_DRIVER_NAME = PREFIX_ + "DB_DRIVER_NAME";
-
- /**
- * Required, type boolean, details whether orm.xml should be created
- */
- String CREATE_ORM_XML = PREFIX_ + "CREATE_ORM_XML";
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDataModelProvider.java
deleted file mode 100644
index 2832f2fdc3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDataModelProvider.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.facet;
-
-import java.util.Set;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.db.ConnectionProfile;
-import org.eclipse.jpt.db.Database;
-import org.eclipse.jpt.db.SchemaContainer;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class JpaFacetInstallDataModelProvider
- extends JpaFacetDataModelProvider
- implements JpaFacetInstallDataModelProperties
-{
- /**
- * required default constructor
- */
- public JpaFacetInstallDataModelProvider() {
- super();
- }
-
- @Override
- public Set<String> getPropertyNames() {
- Set<String> propertyNames = super.getPropertyNames();
- propertyNames.add(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH);
- propertyNames.add(DB_DRIVER_NAME);
- propertyNames.add(CREATE_ORM_XML);
- return propertyNames;
- }
-
-
- // ********** properties **********
-
- protected boolean userWantsToAddDbDriverJarsToClasspath() {
- return this.getBooleanProperty(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH);
- }
-
- protected String getDriverName() {
- return (String) this.getProperty(DB_DRIVER_NAME);
- }
-
-
- // ********** enabled **********
-
- @Override
- public boolean isPropertyEnabled(String propertyName) {
- if (propertyName.equals(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH)) {
- return (this.getConnectionProfile() != null);
- }
- if (propertyName.equals(DB_DRIVER_NAME)) {
- return this.userWantsToAddDbDriverJarsToClasspath();
- }
-
- return super.isPropertyEnabled(propertyName);
- }
-
-
- // ********** defaults **********
-
- @Override
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH)) {
- return Boolean.FALSE;
- }
- if (propertyName.equals(DB_DRIVER_NAME)) {
- return this.getDefaultDriverName();
- }
- if (propertyName.equals(CREATE_ORM_XML)) {
- return Boolean.FALSE;
- }
-
- return super.getDefaultProperty(propertyName);
- }
-
- @Override
- protected String getDefaultPlatformId() {
- return JptCorePlugin.getDefaultJpaPlatformId(getProjectFacetVersion().getVersionString());
- }
-
- @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_ID)) {
- return this.buildValidPlatformDescriptors();
- }
-
- if (propertyName.equals(CONNECTION)) {
- return this.buildValidConnectionDescriptors();
- }
-
- if (propertyName.equals(DB_DRIVER_NAME)) {
- return this.buildValidDriverDescriptors();
- }
-
- if (propertyName.equals(USER_OVERRIDE_DEFAULT_CATALOG)) {
- return this.buildValidCatalogDescriptors();
- }
-
- if (propertyName.equals(USER_OVERRIDE_DEFAULT_SCHEMA)) {
- return this.buildValidSchemaDescriptors();
- }
-
- return super.getValidPropertyDescriptors(propertyName);
- }
-
- protected DataModelPropertyDescriptor[] buildValidDriverDescriptors() {
- return new DataModelPropertyDescriptor[] { new DataModelPropertyDescriptor(this.getDriverName()) };
- }
-
-
- // ********** validation **********
-
- @Override
- public IStatus validate(String propertyName) {
- if (propertyName.equals(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH)
- || propertyName.equals(DB_DRIVER_NAME)) {
- return this.validateDbDriverName();
- }
-
- return super.validate(propertyName);
- }
-
- protected IStatus validateDbDriverName() {
- return OK_STATUS;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java
deleted file mode 100644
index 41e4d1c198..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.facet;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-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.db.JptDbPlugin;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-/**
- * 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, @SuppressWarnings("unused") IProjectFacetVersion fv,
- Object config, IProgressMonitor monitor) throws CoreException {
-
- // NB: WTP Natures (including the JavaEMFNature)
- // should already be added, as this facet should
- // always coexist with a module facet.
-
- super.execute_(project, fv, config, monitor);
-
- IJavaProject javaProject = JavaCore.create(project);
- IDataModel dataModel = (IDataModel) config;
-
- monitor.beginTask("", 1); //$NON-NLS-1$
-
- // project settings
- this.addDbDriverLibraryToClasspath(javaProject, dataModel, monitor);
-
- monitor.worked(1);
- }
-
- protected void addDbDriverLibraryToClasspath(
- IJavaProject javaProject, IDataModel dataModel,
- IProgressMonitor monitor) throws CoreException {
-
- if( ! dataModel.getBooleanProperty(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH)) {
- return;
- }
- String driverName = dataModel.getStringProperty(DB_DRIVER_NAME);
-
- IClasspathContainer container = JptDbPlugin.instance().buildDriverClasspathContainerFor(driverName);
- IClasspathEntry entry = JavaCore.newContainerEntry(container.getPath());
- this.addClasspathEntryToProject(entry, javaProject, monitor);
- }
-
- private void addClasspathEntryToProject(
- IClasspathEntry classpathEntry, IJavaProject javaProject, IProgressMonitor monitor)
- throws CoreException {
-
- // if the classpathEntry is already there, do nothing
- IClasspathEntry[] classpath = javaProject.getRawClasspath();
- if (ArrayTools.contains(classpath, classpathEntry)) {
- return;
- }
-
- // add the given classpathEntry to the project classpath
- int len = classpath.length;
- IClasspathEntry[] newClasspath = new IClasspathEntry[len + 1];
- System.arraycopy(classpath, 0, newClasspath, 0, len);
- newClasspath[len] = classpathEntry;
- javaProject.setRawClasspath(newClasspath, monitor);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetUninstallDelegate.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetUninstallDelegate.java
deleted file mode 100644
index acdfa2dff5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetUninstallDelegate.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.facet;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-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 {
-
- // There is nothing to do here. Everything is taken care of by the
- // JpaModelManager *whenever* the facet is removed (even via meta-file
- // editing and CVS updating), but this delegate needs to be here because
- // it is required by the facet extension point action element, and that
- // is required by the facet UI to allow uninstallation of this facet.
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java
deleted file mode 100644
index 17a394b0f2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.facet;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.JpaPlatformRegistry;
-import org.eclipse.jpt.core.internal.JptCoreMessages;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-
-public class JpaFacetVersionChangeDataModelProvider
- extends JpaFacetDataModelProvider
- implements JpaFacetDataModelProperties
-{
- protected static final IStatus PLATFORM_DOES_NOT_SUPPORT_FACET_VERSION_STATUS =
- buildErrorStatus(JptCoreMessages.VALIDATE_PLATFORM_DOES_NOT_SUPPORT_FACET_VERSION);
-
-
- /**
- * required default constructor
- */
- public JpaFacetVersionChangeDataModelProvider() {
- super();
- }
-
-
- protected String getProjectName() {
- return getStringProperty(FACET_PROJECT_NAME);
- }
-
- protected JpaProject getJpaProject() {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(getProjectName());
- return JptCorePlugin.getJpaProject(project);
- }
-
-
- // **************** defaults **********************************************
-
- @Override
- protected String getDefaultPlatformId() {
- return getJpaProject().getJpaPlatform().getId();
- }
-
- @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<String> buildValidPlatformIds() {
- // add existing platform id to list of choices
- Iterable<String> validPlatformIds = super.buildValidPlatformIds();
- if (! CollectionTools.contains(validPlatformIds, getDefaultPlatformId())) {
- validPlatformIds = new CompositeIterable(getDefaultPlatformId(), validPlatformIds);
- }
- return validPlatformIds;
- }
-
-
- // **************** validation ********************************************
-
- @Override
- protected IStatus validatePlatformId() {
- IStatus status = super.validatePlatformId();
-
- if (status.isOK()) {
- if (! JpaPlatformRegistry.instance().platformSupportsJpaFacetVersion(
- getPlatformId(), getProjectFacetVersion().getVersionString())) {
- status = PLATFORM_DOES_NOT_SUPPORT_FACET_VERSION_STATUS;
- }
- }
-
- return status;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetVersionChangeDelegate.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetVersionChangeDelegate.java
deleted file mode 100644
index 157bf080cc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetVersionChangeDelegate.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.facet;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-public class JpaFacetVersionChangeDelegate
- extends JpaFacetActionDelegate
-{
- @Override
- protected void execute_(
- IProject project, IProjectFacetVersion fv,
- Object config, IProgressMonitor monitor) throws CoreException {
-
- super.execute_(project, fv, config, monitor);
-
- // need to do a rebuild here
-
- monitor.beginTask("", 1); //$NON-NLS-1$
-
- JptCorePlugin.rebuildJpaProject(project);
-
- monitor.worked(1);
-
- // nothing further to do here *just* yet
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaLibraryProviderConstants.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaLibraryProviderConstants.java
deleted file mode 100644
index 626ae91738..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaLibraryProviderConstants.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.facet;
-
-public interface JpaLibraryProviderConstants
-{
- public static final String EXPR_VAR_JPA_PLATFORM
- = "jpaPlatform"; //$NON-NLS-1$
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/LegacyJpaLibraryProviderDetector.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/LegacyJpaLibraryProviderDetector.java
deleted file mode 100644
index 3c3bef9618..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/LegacyJpaLibraryProviderDetector.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.facet;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-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.getId().equals(JptCorePlugin.FACET_ID)) {
- return LibraryProviderFramework.getProvider(LEGACY_JPA_LIBRARY_PROVIDER_ID);
- }
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/LegacyJpaLibraryProviderInstallOperation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/LegacyJpaLibraryProviderInstallOperation.java
deleted file mode 100644
index 2b286e642d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/LegacyJpaLibraryProviderInstallOperation.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.facet;
-
-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 LegacyJpaLibraryProviderInstallOperation
- extends LibraryProviderOperation
-{
- @Override
- public void execute(
- LibraryProviderOperationConfig config, IProgressMonitor monitor)
- throws CoreException {
- // no op - nothing to uninstall
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaDataSource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaDataSource.java
deleted file mode 100644
index eaa4d1ffab..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaDataSource.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1;
-
-import org.eclipse.jpt.core.JpaDataSource;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.AbstractJpaNode;
-import org.eclipse.jpt.db.ConnectionAdapter;
-import org.eclipse.jpt.db.ConnectionListener;
-import org.eclipse.jpt.db.ConnectionProfile;
-import org.eclipse.jpt.db.ConnectionProfileFactory;
-import org.eclipse.jpt.db.ConnectionProfileListener;
-import org.eclipse.jpt.db.Database;
-import org.eclipse.jpt.db.DatabaseObject;
-
-/**
- * GenericJpaDataSource
- */
-public class GenericJpaDataSource
- extends AbstractJpaNode
- implements JpaDataSource
-{
- /**
- * cache the connection profile name so we can detect when
- * it changes and notify listeners
- */
- protected String connectionProfileName;
-
- protected transient ConnectionProfile connectionProfile;
-
- /**
- * listen for the connection to be added or removed or its name changed
- */
- protected final ConnectionProfileListener connectionProfileListener;
-
- /**
- * listen for the connection to be opened or closed
- */
- protected final ConnectionListener connectionListener;
-
- private static final long serialVersionUID = 1L;
-
-
- // ********** constructor/initialization **********
-
- public GenericJpaDataSource(JpaProject jpaProject, String connectionProfileName) {
- super(jpaProject);
- //moving the building of the connection profile before the connectionProfileListener
- //is added. Need to make sure the loading of db profiles is completed before
- //listening, otherwise we get notifications before our model is finished being built.
- //this means our updater is called before it is set which results in an IllegalStateException.
- //Hopefully this change is temporary and DTP will fix bug 246270 where I suggest they
- //not fire events when building profiles.
- this.connectionProfileName = connectionProfileName;
- this.connectionProfile = this.buildConnectionProfile(connectionProfileName);
-
- this.connectionProfileListener = this.buildConnectionProfileListener();
- this.getConnectionProfileFactory().addConnectionProfileListener(this.connectionProfileListener);
-
- this.connectionListener = this.buildConnectionListener();
- if (this.connectionProfile != null) {
- this.connectionProfile.addConnectionListener(this.connectionListener);
- }
- }
-
- protected ConnectionProfileFactory getConnectionProfileFactory() {
- return this.getJpaPlatform().getConnectionProfileFactory();
- }
-
- protected ConnectionProfileListener buildConnectionProfileListener() {
- return new LocalConnectionProfileListener();
- }
-
- protected ConnectionListener buildConnectionListener() {
- return new LocalConnectionListener();
- }
-
-
- // ********** JpaDataSource implementation **********
-
- public String getConnectionProfileName() {
- return this.connectionProfileName;
- }
-
- public void setConnectionProfileName(String connectionProfileName) {
- String old = this.connectionProfileName;
- this.connectionProfileName = connectionProfileName;
- if (this.attributeValueHasChanged(old, connectionProfileName)) {
- this.firePropertyChanged(CONNECTION_PROFILE_NAME_PROPERTY, old, connectionProfileName);
- // synch the connection profile when the name changes
- this.setConnectionProfile(this.buildConnectionProfile(connectionProfileName));
- JptCorePlugin.setConnectionProfileName(this.getJpaProject().getProject(), connectionProfileName);
- }
- }
-
- public ConnectionProfile getConnectionProfile() {
- return this.connectionProfile;
- }
-
- @Override
- public boolean connectionProfileIsActive() {
- ConnectionProfile cp = this.connectionProfile;
- return (cp != null) && cp.isActive();
- }
-
- @Override
- public Database getDatabase() {
- ConnectionProfile cp = this.connectionProfile;
- return (cp == null) ? null : cp.getDatabase();
- }
-
- public <T extends DatabaseObject> T selectDatabaseObjectForIdentifier(T[] databaseObjects, String identifier) {
- Database db = this.getDatabase();
- return (db == null) ? null : db.selectDatabaseObjectForIdentifier(databaseObjects, identifier);
- }
-
- public void dispose() {
- if (this.connectionProfile != null) {
- this.connectionProfile.removeConnectionListener(this.connectionListener);
- }
- this.getConnectionProfileFactory().removeConnectionProfileListener(this.connectionProfileListener);
- }
-
-
- // ********** internal methods **********
-
- protected ConnectionProfile buildConnectionProfile(String name) {
- return this.getConnectionProfileFactory().buildConnectionProfile(name, this.getJpaPlatform().getDatabaseFinder());
- }
-
- 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.getJpaProject().update();
- }
-
- @Override
- public void closed(ConnectionProfile profile) {
- GenericJpaDataSource.this.getJpaProject().update();
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaFactory.java
deleted file mode 100644
index 65c0f5237c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaFactory.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1;
-
-import org.eclipse.jpt.core.internal.AbstractJpaFactory;
-
-/**
- * Generic JPA
- */
-public class GenericJpaFactory
- extends AbstractJpaFactory
-{
- public GenericJpaFactory() {
- super();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaFile.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaFile.java
deleted file mode 100644
index c1651bc2ac..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaFile.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1;
-
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.JpaFile;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JpaResourceModel;
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.internal.AbstractJpaNode;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-
-/**
- * The transition between a JPA project and the resource model associated
- * with a file.
- * Hold the associated root structure nodes, which are hooks to the
- * context model.
- */
-public class GenericJpaFile
- extends AbstractJpaNode
- implements JpaFile
-{
- /**
- * typically a .java or .xml file.
- */
- protected final IFile file;
-
- /**
- * cache the content type
- */
- protected final IContentType contentType;
-
- /**
- * the resource model corresponding to the file
- */
- protected final JpaResourceModel resourceModel;
-
- /**
- * the root structure (context model) nodes corresponding to the resource
- * model
- */
- protected final Hashtable<Object, JpaStructureNode> rootStructureNodes;
-
-
- // ********** construction **********
-
- public GenericJpaFile(JpaProject jpaProject, IFile file, IContentType contentType, JpaResourceModel resourceModel) {
- super(jpaProject);
- this.file = file;
- this.contentType = contentType;
- this.resourceModel = resourceModel;
- this.rootStructureNodes = new Hashtable<Object, JpaStructureNode>();
- }
-
- /**
- * Changes to 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 JpaResourceModel getResourceModel() {
- return this.resourceModel;
- }
-
- public JpaResourceModel getResourceModel(IContentType ct) {
- return this.contentType.isKindOf(ct) ? this.resourceModel : null;
- }
-
-
- // ********** root structure nodes **********
-
- public Iterator<JpaStructureNode> rootStructureNodes() {
- return this.getRootStructureNodes().iterator();
- }
-
- protected Iterable<JpaStructureNode> getRootStructureNodes() {
- return new LiveCloneIterable<JpaStructureNode>(this.rootStructureNodes.values());
- }
-
- public int rootStructureNodesSize() {
- return this.rootStructureNodes.size();
- }
-
- public void addRootStructureNode(Object key, JpaStructureNode rootStructureNode) {
- JpaStructureNode old = this.rootStructureNodes.put(key, rootStructureNode);
- if (rootStructureNode != old) {
- if (old != null) {
- this.fireItemRemoved(ROOT_STRUCTURE_NODES_COLLECTION, old);
- }
- this.fireItemAdded(ROOT_STRUCTURE_NODES_COLLECTION, rootStructureNode);
- }
- }
-
- public void removeRootStructureNode(Object key) {
- this.fireItemRemoved(ROOT_STRUCTURE_NODES_COLLECTION, this.rootStructureNodes.remove(key));
- }
-
- public JpaStructureNode getStructureNode(int textOffset) {
- for (JpaStructureNode rootNode : this.getRootStructureNodes()) {
- JpaStructureNode node = rootNode.getStructureNode(textOffset);
- if (node != null) {
- return node;
- }
- }
- return null;
- }
-
-
- // ********** misc **********
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.file);
- sb.append('[');
- sb.append(this.contentType.getName());
- sb.append(']');
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaProject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaProject.java
deleted file mode 100644
index 7d0c986d6f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaProject.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1;
-
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.internal.AbstractJpaProject;
-
-/**
- * Not much different from the abstract JPA project.
- */
-public class GenericJpaProject
- extends AbstractJpaProject
-{
-
- // ********** constructor/initialization **********
-
- public GenericJpaProject(JpaProject.Config config) {
- super(config);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericRootContextNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericRootContextNode.java
deleted file mode 100644
index 62242132a2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericRootContextNode.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.MappingFileRoot;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.core.context.persistence.PersistenceXmlDefinition;
-import org.eclipse.jpt.core.internal.context.AbstractJpaContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.JpaRootContextNode2_0;
-import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceXml2_0;
-import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.HashBag;
-import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-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);
- if (jpaProject == null) {
- throw new NullPointerException();
- }
- this.jpaProject = jpaProject;
- JpaXmlResource resource = getPersistenceXmlResource();
- if (resource != null) {
- this.persistenceXml = buildPersistenceXml(resource);
- }
- }
-
-
- @Override
- protected boolean requiresParent() {
- return false;
- }
-
-
- // **************** JpaNode impl *******************************************
-
- @Override
- public JpaProject getJpaProject() {
- return this.jpaProject;
- }
-
- @Override
- public IResource getResource() {
- return this.getProject();
- }
-
- protected IProject getProject() {
- return this.jpaProject.getProject();
- }
-
-
- // **************** JpaContextNode impl ************************************
-
- @Override
- public PersistenceUnit getPersistenceUnit() {
- // No PersistenceUnit in this context
- return null;
- }
-
- @Override
- public MappingFileRoot getMappingFileRoot() {
- // No MappingFileRoot in this context
- return null;
- }
-
-
- // **************** 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);
- }
-
-
- // *************** 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();
- }
- }
-
-
- // **************** updating ***********************************************
-
- public void update(IProgressMonitor monitor) {
- JpaXmlResource resource = getPersistenceXmlResource();
-
- if (resource != null) {
- if (this.persistenceXml == null) {
- this.setPersistenceXml(this.buildPersistenceXml(resource));
- } else {
- this.persistenceXml.update(resource);
- }
- } else {
- this.setPersistenceXml(null);
- }
- }
-
- @Override
- public void postUpdate() {
- super.postUpdate();
- if (this.persistenceXml != null) {
- this.persistenceXml.postUpdate();
- }
- }
-
- protected JpaXmlResource getPersistenceXmlResource() {
- return this.jpaProject.getPersistenceXmlResource();
- }
-
- protected PersistenceXml buildPersistenceXml(JpaXmlResource resource) {
- PersistenceXmlDefinition persistenceXmlDef;
- try {
- persistenceXmlDef = (PersistenceXmlDefinition) getJpaPlatform().getResourceDefinition(resource.getResourceType());
- }
- catch (IllegalArgumentException iae) {
- JptCorePlugin.log(iae);
- return null;
- }
- return (persistenceXmlDef == null) ? null : persistenceXmlDef.getContextNodeFactory().buildPersistenceXml(this, resource);
- }
-
-
- // **************** Validation *********************************************
-
- public void validate(List<IMessage> messages, IReporter reporter) {
- if (reporter.isCancelled()) {
- throw new ValidationCancelledException();
- }
-
- if (this.persistenceXml == null) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- this.buildMissingFileMessageID(),
- this
- )
- );
- return;
- }
- if ( ! this.jpaProject.discoversAnnotatedClasses()) {
- this.validateOrphanClasses(messages);
- }
- this.persistenceXml.validate(messages, reporter);
- }
-
- protected String buildMissingFileMessageID() {
- return this.getPlatformFile().exists() ?
- JpaValidationMessages.PERSISTENCE_XML_INVALID_CONTENT
- :
- JpaValidationMessages.PROJECT_NO_PERSISTENCE_XML;
- }
-
- protected IFile getPlatformFile() {
- return this.jpaProject.convertToPlatformFile(JptCorePlugin.DEFAULT_PERSISTENCE_XML_FILE_PATH);
- }
-
- protected void validateOrphanClasses(List<IMessage> messages) {
- Persistence persistence = this.persistenceXml.getPersistence();
- if (persistence == null) {
- return; // handled with other validation
- }
- if (persistence.persistenceUnitsSize() != 1) {
- return; // the context model currently only supports 1 persistence unit
- }
-
- PersistenceUnit persistenceUnit = persistence.persistenceUnits().next();
- HashBag<String> annotatedClassNames = CollectionTools.bag(this.jpaProject.annotatedJavaSourceClassNames());
- HashBag<String> orphans = annotatedClassNames.clone();
- for (String annotatedClassName : annotatedClassNames) {
- if (persistenceUnit.specifiesPersistentType(annotatedClassName)) {
- orphans.remove(annotatedClassName);
- }
- }
-
- // TODO remove 'jrcu'
- // replace jrcu.getFile() with jrpt.getFile()
- // replace jrpt.getMappingAnnotation().getTextRange(jrcu.buildASTRoot())
- // with jrpt.getMappingAnnotation().getTextRange()
- // (new method #getTextRange() ?)
- for (String orphan : orphans) {
- JavaResourcePersistentType jrpt = this.jpaProject.getJavaResourcePersistentType(orphan);
- JavaResourceCompilationUnit jrcu = jrpt.getJavaResourceCompilationUnit();
- if (jrpt.isMapped()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENT_TYPE_MAPPED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT,
- new String[] {jrpt.getName()},
- jrpt.getFile(),
- jrpt.getNameTextRange(jrcu.buildASTRoot())
- )
- );
- }
- else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.NORMAL_SEVERITY,
- JpaValidationMessages.PERSISTENT_TYPE_ANNOTATED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT,
- new String[] {jrpt.getName()},
- jrpt.getFile(),
- jrpt.getNameTextRange(jrcu.buildASTRoot())
- )
- );
- }
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJarFile.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJarFile.java
deleted file mode 100644
index f25606219d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJarFile.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jpt.core.JpaResourceType;
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.java.JarFile;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.persistence.JarFileRef;
-import org.eclipse.jpt.core.internal.context.AbstractJpaContextNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragmentRoot;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.HashBag;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-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;
-
-/**
- * Context JAR file
- */
-public class GenericJarFile
- extends AbstractJpaContextNode
- implements JarFile, PersistentType.Owner
-{
- protected JavaResourcePackageFragmentRoot jarResourcePackageFragmentRoot;
- protected final Vector<JavaPersistentType> javaPersistentTypes = new Vector<JavaPersistentType>();
-
-
- // ********** constructor/initialization **********
-
- public GenericJarFile(JarFileRef parent, JavaResourcePackageFragmentRoot jarResourcePackageFragmentRoot) {
- super(parent);
- this.jarResourcePackageFragmentRoot = jarResourcePackageFragmentRoot;
- CollectionTools.addAll(this.javaPersistentTypes, this.buildJavaPersistentTypes());
- }
-
- protected Iterator<JavaPersistentType> buildJavaPersistentTypes() {
- return new TransformationIterator<JavaResourcePersistentType, JavaPersistentType>(this.javaResourcePersistentTypes()) {
- @Override
- protected JavaPersistentType transform(JavaResourcePersistentType jrpt) {
- return GenericJarFile.this.buildJavaPersistentType(jrpt);
- }
- };
- }
-
- /**
- * the resource JAR holds only annotated types, so we can use them all for
- * building the context types
- */
- protected Iterator<JavaResourcePersistentType> javaResourcePersistentTypes() {
- return this.jarResourcePackageFragmentRoot.persistentTypes();
- }
-
- protected JavaPersistentType buildJavaPersistentType(JavaResourcePersistentType jrpt) {
- return this.getJpaFactory().buildJavaPersistentType(this, jrpt);
- }
-
-
- // ********** JpaStructureNode implementation **********
-
- public String getId() {
- return null;
- }
-
- @Override
- public JpaResourceType getResourceType() {
- return JptCorePlugin.JAR_RESOURCE_TYPE;
- }
-
- public TextRange getSelectionTextRange() {
- return null;
- }
-
- public JpaStructureNode getStructureNode(int textOffset) {
- return null;
- }
-
- public void dispose() {
- // nothing yet
- }
-
-
- // ********** JarFile implementation **********
-
- public JavaPersistentType getPersistentType(String typeName) {
- for (JavaPersistentType pt : this.getJavaPersistentTypes()) {
- if (pt.getName().equals(typeName)) {
- return pt;
- }
- }
- return null;
- }
-
- public Iterator<JavaPersistentType> javaPersistentTypes() {
- return this.getJavaPersistentTypes().iterator();
- }
-
- protected Iterable<JavaPersistentType> getJavaPersistentTypes() {
- return new LiveCloneIterable<JavaPersistentType>(this.javaPersistentTypes);
- }
-
- public int javaPersistentTypesSize() {
- return this.javaPersistentTypes.size();
- }
-
- protected JavaPersistentType addJavaPersistentType(JavaResourcePersistentType jrpt) {
- JavaPersistentType javaPersistentType = this.buildJavaPersistentType(jrpt);
- this.addItemToCollection(javaPersistentType, this.javaPersistentTypes, JAVA_PERSISTENT_TYPES_COLLECTION);
- return javaPersistentType;
- }
-
- protected void removeJavaPersistentType(JavaPersistentType javaPersistentType ) {
- this.removeItemFromCollection(javaPersistentType, this.javaPersistentTypes, JAVA_PERSISTENT_TYPES_COLLECTION);
- }
-
-
- // ********** PersistentTypeContainer implementation **********
-
- public Iterable<? extends PersistentType> getPersistentTypes() {
- return this.getJavaPersistentTypes();
- }
-
-
- // ********** PersistentType.Owner implementation **********
-
- public AccessType getDefaultPersistentTypeAccess() {
- return this.getPersistenceUnit().getDefaultAccess();
- }
-
- public AccessType getOverridePersistentTypeAccess() {
- // no access type at this level overrides any local access type specification
- return null;
- }
-
-
- // ********** JpaNode implementation **********
-
- @Override
- public IResource getResource() {
- return this.jarResourcePackageFragmentRoot.getFile();
- }
-
-
- // ********** updating **********
-
- public void update(JavaResourcePackageFragmentRoot jrpfr) {
- this.jarResourcePackageFragmentRoot = jrpfr;
- this.updateJavaPersistentTypes();
- }
-
- protected void updateJavaPersistentTypes() {
- HashBag<JavaPersistentType> contextTypesToRemove = CollectionTools.bag(this.javaPersistentTypes(), this.javaPersistentTypes.size());
- ArrayList<JavaPersistentType> contextTypesToUpdate = new ArrayList<JavaPersistentType>(this.javaPersistentTypes.size());
-
- for (Iterator<JavaResourcePersistentType> resourceTypes = this.javaResourcePersistentTypes(); resourceTypes.hasNext(); ) {
- JavaResourcePersistentType resourceType = resourceTypes.next();
- boolean match = false;
- for (Iterator<JavaPersistentType> contextTypes = contextTypesToRemove.iterator(); contextTypes.hasNext(); ) {
- JavaPersistentType contextType = contextTypes.next();
- if (contextType.getResourcePersistentType() == resourceType) {
- contextTypes.remove();
- contextTypesToUpdate.add(contextType);
- match = true;
- break;
- }
- }
- if ( ! match) {
- this.addJavaPersistentType(resourceType);
- }
- }
- for (JavaPersistentType contextType : contextTypesToRemove) {
- this.removeJavaPersistentType(contextType);
- }
- // handle adding and removing java persistent types first, update the
- // remaining java persistent types last; this reduces the churn during "update"
- for (JavaPersistentType contextType : contextTypesToUpdate) {
- contextType.update();
- }
- }
-
-
- // ********** validation **********
-
- public void validate(List<IMessage> messages, IReporter reporter) {
- if (reporter.isCancelled()) {
- throw new ValidationCancelledException();
- }
- // TODO validate 'javaPersistentTypes'
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverride.java
deleted file mode 100644
index a46c14964f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverride.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverrideRelationshipReference;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaOverride;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaAssociationOverride extends AbstractJavaOverride
- implements JavaAssociationOverride
-{
-
- protected final JavaAssociationOverrideRelationshipReference relationshipReference;
-
- public GenericJavaAssociationOverride(JavaAssociationOverrideContainer parent, AssociationOverride.Owner owner) {
- super(parent, owner);
- this.relationshipReference = buildRelationshipReference();
- }
-
- public void initializeFrom(AssociationOverride oldAssociationOverride) {
- this.setName(oldAssociationOverride.getName());
- this.relationshipReference.initializeFrom(oldAssociationOverride.getRelationshipReference());
- }
-
- protected JavaAssociationOverrideRelationshipReference buildRelationshipReference() {
- return getJpaFactory().buildJavaAssociationOverrideRelationshipReference(this);
- }
-
- public JavaAssociationOverrideRelationshipReference getRelationshipReference() {
- return this.relationshipReference;
- }
-
- @Override
- public JavaAssociationOverride setVirtual(boolean virtual) {
- return (JavaAssociationOverride) super.setVirtual(virtual);
- }
-
- @Override
- protected AssociationOverrideAnnotation getOverrideAnnotation() {
- return (AssociationOverrideAnnotation) super.getOverrideAnnotation();
- }
-
- @Override
- public AssociationOverride.Owner getOwner() {
- return (AssociationOverride.Owner) super.getOwner();
- }
-
- @Override
- protected Iterator<String> candidateNames() {
- return this.getOwner().getTypeMapping().allOverridableAssociationNames();
- }
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.relationshipReference.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return null;
- }
-
- public void initialize(AssociationOverrideAnnotation associationOverride) {
- super.initialize(associationOverride);
- this.relationshipReference.initialize(associationOverride);
- }
-
- public void update(AssociationOverrideAnnotation associationOverride) {
- super.update(associationOverride);
- this.relationshipReference.update(associationOverride);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- if (this.connectionProfileIsActive()) {
- this.validateJoinColumns(messages, astRoot);
- }
- }
-
- protected void validateJoinColumns(List<IMessage> messages, CompilationUnit astRoot) {
- for (Iterator<JavaJoinColumn> stream = this.getRelationshipReference().getJoinColumnJoiningStrategy().joinColumns(); stream.hasNext(); ) {
- this.validateJoinColumn(stream.next(), messages, astRoot);
- }
- }
-
- protected void validateJoinColumn(JavaJoinColumn joinColumn, List<IMessage> messages, CompilationUnit astRoot) {
- String tableName = joinColumn.getTable();
- if (this.getOwner().getTypeMapping().tableNameIsInvalid(tableName)) {
- if (this.isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_TABLE,
- new String[] {this.getName(), tableName, joinColumn.getName()},
- joinColumn,
- joinColumn.getTableTextRange(astRoot)
- )
- );
- } else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_TABLE,
- new String[] {tableName, joinColumn.getName()},
- joinColumn,
- joinColumn.getTableTextRange(astRoot)
- )
- );
- }
- return;
- }
-
- if ( ! joinColumn.isResolved()) {
- if (this.isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {this.getName(), joinColumn.getName()},
- joinColumn,
- joinColumn.getNameTextRange(astRoot)
- )
- );
- } else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {joinColumn.getName()},
- joinColumn,
- joinColumn.getNameTextRange(astRoot)
- )
- );
- }
- }
-
- if ( ! joinColumn.isReferencedColumnResolved()) {
- if (this.isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME,
- new String[] {this.getName(), joinColumn.getReferencedColumnName(), joinColumn.getName()},
- joinColumn,
- joinColumn.getReferencedColumnNameTextRange(astRoot)
- )
- );
- } else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME,
- new String[] {joinColumn.getReferencedColumnName(), joinColumn.getName()},
- joinColumn,
- joinColumn.getReferencedColumnNameTextRange(astRoot)
- )
- );
- }
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java
deleted file mode 100644
index 655c254db8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java
+++ /dev/null
@@ -1,396 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.AssociationOverrideContainer;
-import org.eclipse.jpt.core.context.BaseOverride;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.RelationshipReference;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AssociationOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.CompositeListIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaAssociationOverrideContainer extends AbstractJavaJpaContextNode
- implements JavaAssociationOverrideContainer
-{
- protected JavaResourcePersistentMember javaResourcePersistentMember;
-
- protected final AssociationOverrideContainer.Owner owner;
-
- protected final List<JavaAssociationOverride> specifiedAssociationOverrides;
-
- protected final List<JavaAssociationOverride> virtualAssociationOverrides;
-
- public GenericJavaAssociationOverrideContainer(JavaJpaContextNode parent, AssociationOverrideContainer.Owner owner) {
- super(parent);
- this.owner = owner;
- this.specifiedAssociationOverrides = new ArrayList<JavaAssociationOverride>();
- this.virtualAssociationOverrides = new ArrayList<JavaAssociationOverride>();
- }
-
- public Owner getOwner() {
- return this.owner;
- }
-
- public JavaAssociationOverride getAssociationOverrideNamed(String name) {
- return (JavaAssociationOverride) getOverrideNamed(name, associationOverrides());
- }
-
- public boolean containsAssociationOverride(String name) {
- return containsOverride(name, associationOverrides());
- }
-
- public boolean containsSpecifiedAssociationOverride(String name) {
- return containsOverride(name, specifiedAssociationOverrides());
- }
-
- public boolean containsDefaultAssociationOverride(String name) {
- return containsOverride(name, virtualAssociationOverrides());
- }
-
- protected BaseOverride getOverrideNamed(String name, ListIterator<? extends BaseOverride> overrides) {
- for (BaseOverride override : CollectionTools.iterable(overrides)) {
- String overrideName = override.getName();
- if (overrideName == null && name == null) {
- return override;
- }
- if (overrideName != null && overrideName.equals(name)) {
- return override;
- }
- }
- return null;
- }
-
- protected boolean containsOverride(String name, ListIterator<? extends BaseOverride> overrides) {
- return getOverrideNamed(name, overrides) != null;
- }
-
- protected Iterator<String> allOverridableAssociationNames() {
- TypeMapping overridableTypeMapping = getOwner().getOverridableTypeMapping();
- if (overridableTypeMapping != null) {
- return overridableTypeMapping.allOverridableAssociationNames();
- }
- return EmptyIterator.instance();
- }
-
-
- @SuppressWarnings("unchecked")
- public ListIterator<JavaAssociationOverride> associationOverrides() {
- return new CompositeListIterator<JavaAssociationOverride>(specifiedAssociationOverrides(), virtualAssociationOverrides());
- }
-
- public int associationOverridesSize() {
- return this.specifiedAssociationOverridesSize() + this.virtualAssociationOverridesSize();
- }
-
- public ListIterator<JavaAssociationOverride> virtualAssociationOverrides() {
- return new CloneListIterator<JavaAssociationOverride>(this.virtualAssociationOverrides);
- }
-
- public int virtualAssociationOverridesSize() {
- return this.virtualAssociationOverrides.size();
- }
-
- public ListIterator<JavaAssociationOverride> specifiedAssociationOverrides() {
- return new CloneListIterator<JavaAssociationOverride>(this.specifiedAssociationOverrides);
- }
-
- public int specifiedAssociationOverridesSize() {
- return this.specifiedAssociationOverrides.size();
- }
-
- public JavaAssociationOverride addSpecifiedAssociationOverride(int index) {
- JavaAssociationOverride associationOverride = getJpaFactory().buildJavaAssociationOverride(this, createAssociationOverrideOwner());
- this.specifiedAssociationOverrides.add(index, associationOverride);
- AssociationOverrideAnnotation associationOverrideResource =
- (AssociationOverrideAnnotation) this.javaResourcePersistentMember.addAnnotation(
- index, AssociationOverrideAnnotation.ANNOTATION_NAME,
- AssociationOverridesAnnotation.ANNOTATION_NAME);
- associationOverride.initialize(associationOverrideResource);
- this.fireItemAdded(SPECIFIED_ASSOCIATION_OVERRIDES_LIST, index, associationOverride);
- return associationOverride;
- }
-
- protected AssociationOverride.Owner createAssociationOverrideOwner() {
- return new AssociationOverrideOwner();
- }
-
- protected void addSpecifiedAssociationOverride(int index, JavaAssociationOverride associationOverride) {
- addItemToList(index, associationOverride, this.specifiedAssociationOverrides, SPECIFIED_ASSOCIATION_OVERRIDES_LIST);
- }
-
- protected void addSpecifiedAssociationOverride(JavaAssociationOverride associationOverride) {
- this.addSpecifiedAssociationOverride(this.specifiedAssociationOverrides.size(), associationOverride);
- }
-
- protected void removeSpecifiedAssociationOverride_(JavaAssociationOverride associationOverride) {
- removeItemFromList(associationOverride, this.specifiedAssociationOverrides, SPECIFIED_ASSOCIATION_OVERRIDES_LIST);
- }
-
- public void moveSpecifiedAssociationOverride(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.specifiedAssociationOverrides, targetIndex, sourceIndex);
- this.javaResourcePersistentMember.moveAnnotation(
- targetIndex, sourceIndex, AssociationOverridesAnnotation.ANNOTATION_NAME);
- fireItemMoved(SPECIFIED_ASSOCIATION_OVERRIDES_LIST, targetIndex, sourceIndex);
- }
-
- protected JavaAssociationOverride setAssociationOverrideVirtual(boolean virtual, JavaAssociationOverride associationOverride) {
- // Add a new attribute override
- if (virtual) {
- return setAssociationOverrideVirtual(associationOverride);
- }
- return setAssociationOverrideSpecified(associationOverride);
- }
-
- protected JavaAssociationOverride setAssociationOverrideVirtual(JavaAssociationOverride associationOverride) {
- int index = this.specifiedAssociationOverrides.indexOf(associationOverride);
- this.specifiedAssociationOverrides.remove(index);
- String associationOverrideName = associationOverride.getName();
- //add the virtual attribute override so that I can control the order that change notification is sent.
- //otherwise when we remove the annotation from java we will get an update and add the attribute override
- //during the update. This causes the UI to be flaky, since change notification might not occur in the correct order
- JavaAssociationOverride virtualAssociationOverride = null;
- if (associationOverrideName != null) {
- for (String name : CollectionTools.iterable(allOverridableAssociationNames())) {
- if (name.equals(associationOverrideName)) {
- //store the virtualAttributeOverride so we can fire change notification later
- virtualAssociationOverride = buildVirtualAssociationOverride(name);
- this.virtualAssociationOverrides.add(virtualAssociationOverride);
- break;
- }
- }
- }
-
- this.javaResourcePersistentMember.removeAnnotation(
- index, AssociationOverrideAnnotation.ANNOTATION_NAME,
- AssociationOverridesAnnotation.ANNOTATION_NAME);
- fireItemRemoved(SPECIFIED_ASSOCIATION_OVERRIDES_LIST, index, associationOverride);
-
- if (virtualAssociationOverride != null) {
- fireItemAdded(VIRTUAL_ASSOCIATION_OVERRIDES_LIST, virtualAssociationOverridesSize() - 1, virtualAssociationOverride);
- }
- return virtualAssociationOverride;
- }
-
- protected JavaAssociationOverride setAssociationOverrideSpecified(JavaAssociationOverride oldAssociationOverride) {
- int index = specifiedAssociationOverridesSize();
- JavaAssociationOverride newAssociationOverride = getJpaFactory().buildJavaAssociationOverride(this, createAssociationOverrideOwner());
- this.specifiedAssociationOverrides.add(index, newAssociationOverride);
-
- AssociationOverrideAnnotation attributeOverrideResource =
- (AssociationOverrideAnnotation) this.javaResourcePersistentMember.addAnnotation(
- index, AssociationOverrideAnnotation.ANNOTATION_NAME,
- AssociationOverridesAnnotation.ANNOTATION_NAME);
- newAssociationOverride.initialize(attributeOverrideResource);
-
- int virtualIndex = this.virtualAssociationOverrides.indexOf(oldAssociationOverride);
- this.virtualAssociationOverrides.remove(virtualIndex);
-
- newAssociationOverride.initializeFrom(oldAssociationOverride);
-
- this.fireItemRemoved(VIRTUAL_ASSOCIATION_OVERRIDES_LIST, virtualIndex, oldAssociationOverride);
- this.fireItemAdded(SPECIFIED_ASSOCIATION_OVERRIDES_LIST, index, newAssociationOverride);
-
- return newAssociationOverride;
- }
-
- protected void addVirtualAssociationOverride(JavaAssociationOverride associationOverride) {
- addItemToList(associationOverride, this.virtualAssociationOverrides, VIRTUAL_ASSOCIATION_OVERRIDES_LIST);
- }
-
- protected void removeVirtualAssociationOverride(JavaAssociationOverride associationOverride) {
- removeItemFromList(associationOverride, this.virtualAssociationOverrides, VIRTUAL_ASSOCIATION_OVERRIDES_LIST);
- }
-
-
-
- public void initialize(JavaResourcePersistentMember resourcePersistentMember) {
- this.javaResourcePersistentMember = resourcePersistentMember;
- this.initializeSpecifiedAssociationOverrides();
- this.initializeVirtualAssociationOverrides();
- }
-
- protected void initializeSpecifiedAssociationOverrides() {
- for (Iterator<NestableAnnotation> stream =
- this.javaResourcePersistentMember.annotations(
- AssociationOverrideAnnotation.ANNOTATION_NAME,
- AssociationOverridesAnnotation.ANNOTATION_NAME);
- stream.hasNext(); ) {
- this.specifiedAssociationOverrides.add(
- buildAssociationOverride((AssociationOverrideAnnotation) stream.next()));
- }
- }
-
- protected void initializeVirtualAssociationOverrides() {
- for (String name : CollectionTools.iterable(allOverridableAssociationNames())) {
- JavaAssociationOverride associationOverride = getAssociationOverrideNamed(name);
- if (associationOverride == null) {
- this.virtualAssociationOverrides.add(buildVirtualAssociationOverride(name));
- }
- }
- }
-
- public void update(JavaResourcePersistentMember resourcePersistentMember) {
- this.javaResourcePersistentMember = resourcePersistentMember;
- this.updateSpecifiedAssociationOverrides();
- }
-
- @Override
- public void postUpdate() {
- super.postUpdate();
-
- //In postUpdate because the joiningStrategy is not initialized on relationship mappings.
- //if we fix the issue that we do not initialize java mappings, but they instead get initialized
- //during the first update, then we can probably move this.
- updateVirtualAssociationOverrides();
- }
-
-
- protected void updateSpecifiedAssociationOverrides() {
- ListIterator<JavaAssociationOverride> associationOverrides = specifiedAssociationOverrides();
- Iterator<NestableAnnotation> resourceAssociationOverrides =
- this.javaResourcePersistentMember.annotations(
- AssociationOverrideAnnotation.ANNOTATION_NAME,
- AssociationOverridesAnnotation.ANNOTATION_NAME);
-
- while (associationOverrides.hasNext()) {
- JavaAssociationOverride associationOverride = associationOverrides.next();
- if (resourceAssociationOverrides.hasNext()) {
- associationOverride.update((AssociationOverrideAnnotation) resourceAssociationOverrides.next());
- }
- else {
- removeSpecifiedAssociationOverride_(associationOverride);
- }
- }
-
- while (resourceAssociationOverrides.hasNext()) {
- addSpecifiedAssociationOverride(buildAssociationOverride((AssociationOverrideAnnotation) resourceAssociationOverrides.next()));
- }
- }
-
- protected JavaAssociationOverride buildAssociationOverride(AssociationOverrideAnnotation associationOverrideResource) {
- JavaAssociationOverride associationOverride = getJpaFactory().buildJavaAssociationOverride(this, createAssociationOverrideOwner());
- associationOverride.initialize(associationOverrideResource);
- return associationOverride;
- }
-
- protected JavaAssociationOverride buildVirtualAssociationOverride(String name) {
- return buildAssociationOverride(buildVirtualAssociationOverrideAnnotation(name));
- }
-
- protected AssociationOverrideAnnotation buildVirtualAssociationOverrideAnnotation(String name) {
- RelationshipReference relationshipReference = this.resolveAssociationOverrideRelationshipReference(name);
- return getJpaFactory().buildJavaVirtualAssociationOverrideAnnotation(this.javaResourcePersistentMember, name, relationshipReference.getPredominantJoiningStrategy());
- }
-
- private RelationshipReference resolveAssociationOverrideRelationshipReference(String associationOverrideName) {
- return getOwner().resolveRelationshipReference(associationOverrideName);
- }
-
- protected void updateVirtualAssociationOverrides() {
- for (String name : CollectionTools.iterable(allOverridableAssociationNames())) {
- JavaAssociationOverride associationOverride = getAssociationOverrideNamed(name);
- if (associationOverride == null) {
- addVirtualAssociationOverride(buildVirtualAssociationOverride(name));
- }
- else if (associationOverride.isVirtual()) {
- associationOverride.update(buildVirtualAssociationOverrideAnnotation(name));
- }
- }
-
- Collection<String> associationNames = CollectionTools.collection(allOverridableAssociationNames());
-
- //remove any default mappings that are not included in the associationNames collection
- for (JavaAssociationOverride associationOverride : CollectionTools.iterable(virtualAssociationOverrides())) {
- if (!associationNames.contains(associationOverride.getName())
- || containsSpecifiedAssociationOverride(associationOverride.getName())) {
- removeVirtualAssociationOverride(associationOverride);
- }
- }
- }
-
-
- //******************** Code Completion *************************
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (JavaAssociationOverride override : CollectionTools.iterable(this.associationOverrides())) {
- result = override.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
- //********** Validation ********************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
-
- for (Iterator<JavaAssociationOverride> stream = this.associationOverrides(); stream.hasNext();) {
- stream.next().validate(messages, reporter, astRoot);
- }
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.javaResourcePersistentMember.getTextRange(astRoot);
- }
-
-
- // ********** association override owner **********
-
- class AssociationOverrideOwner implements AssociationOverride.Owner {
-
- public RelationshipMapping getRelationshipMapping(String attributeName) {
- return MappingTools.getRelationshipMapping(attributeName, getOwner().getOverridableTypeMapping());
- }
-
- public boolean isVirtual(BaseOverride override) {
- return GenericJavaAssociationOverrideContainer.this.virtualAssociationOverrides.contains(override);
- }
-
- public BaseOverride setVirtual(boolean virtual, BaseOverride attributeOverride) {
- return GenericJavaAssociationOverrideContainer.this.setAssociationOverrideVirtual(virtual, (JavaAssociationOverride) attributeOverride);
- }
-
- public TypeMapping getTypeMapping() {
- return getOwner().getTypeMapping();
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverrideRelationshipReference.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverrideRelationshipReference.java
deleted file mode 100644
index 9c18c1ee73..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverrideRelationshipReference.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.AssociationOverrideRelationshipReference;
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaAssociationOverrideRelationshipReference;
-
-public class GenericJavaAssociationOverrideRelationshipReference extends AbstractJavaAssociationOverrideRelationshipReference
-{
-
- public GenericJavaAssociationOverrideRelationshipReference(JavaAssociationOverride parent) {
- super(parent);
- }
-
- public void initializeFrom(AssociationOverrideRelationshipReference oldAssociationOverride) {
- if (oldAssociationOverride.getJoinColumnJoiningStrategy().hasSpecifiedJoinColumns()) {
- getJoinColumnJoiningStrategy().initializeFrom(oldAssociationOverride.getJoinColumnJoiningStrategy());
- }
- }
-
- @Override
- protected JoiningStrategy calculatePredominantJoiningStrategy() {
- return this.joinColumnJoiningStrategy;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java
deleted file mode 100644
index 493de8b3b0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverride;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaColumn;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaOverride;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-
-public class GenericJavaAttributeOverride extends AbstractJavaOverride
- implements JavaAttributeOverride
-{
-
- protected final JavaColumn column;
-
-
- public GenericJavaAttributeOverride(JavaAttributeOverrideContainer parent, AttributeOverride.Owner owner) {
- super(parent, owner);
- this.column = getJpaFactory().buildJavaColumn(this, this);
- }
-
- @Override
- public JavaAttributeOverride setVirtual(boolean virtual) {
- return (JavaAttributeOverride) super.setVirtual(virtual);
- }
-
- @Override
- protected AttributeOverrideAnnotation getOverrideAnnotation() {
- return (AttributeOverrideAnnotation) super.getOverrideAnnotation();
- }
-
- @Override
- public AttributeOverride.Owner getOwner() {
- return (AttributeOverride.Owner) super.getOwner();
- }
-
- public ColumnAnnotation getResourceColumn() {
- return this.getOverrideAnnotation().getNonNullColumn();
- }
-
- public ColumnAnnotation getResourceColumnOrNull() {
- return this.getOverrideAnnotation().getColumn();
- }
-
- public String getDefaultColumnName() {
- Column column = resolveOverridenColumn();
- if (column == null) {
- return null;
- }
- return column.getName();
- }
-
- public String getDefaultTableName() {
- Column column = resolveOverridenColumn();
- if (column == null) {
- return null;
- }
- String tableName = column.getSpecifiedTable();
- if (tableName != null) {
- return tableName;
- }
- return getOwner().getTypeMapping().getPrimaryTableName();
- }
-
- protected Column resolveOverridenColumn() {
- return getOwner().resolveOverridenColumn(getName());
- }
-
- //************* IColumn.Owner implementation **************
- public TypeMapping getTypeMapping() {
- return this.getOwner().getTypeMapping();
- }
-
- public Table getDbTable(String tableName) {
- return this.getTypeMapping().getDbTable(tableName);
- }
-
- //************* IAttributeOverride implementation **************
-
- public JavaColumn getColumn() {
- return this.column;
- }
-
- //************* JavaOverride implementation **************
-
- @Override
- protected Iterator<String> candidateNames() {
- return this.getOwner().getTypeMapping().allOverridableAttributeNames();
- }
-
- //************* java resource model -> java context model **************
- public void initialize(AttributeOverrideAnnotation attributeOverrideResource) {
- super.initialize(attributeOverrideResource);
- this.column.initialize(this.getResourceColumn());
- }
-
- public void update(AttributeOverrideAnnotation attributeOverrideResource) {
- super.update(attributeOverrideResource);
- this.column.update(this.getResourceColumn());
- }
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.getColumn().javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return null;
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- if (this.connectionProfileIsActive()) {
- this.validateColumn(messages, astRoot);
- }
- }
-
- protected void validateColumn(List<IMessage> messages, CompilationUnit astRoot) {
- String tableName = this.column.getTable();
- if (this.getTypeMapping().tableNameIsInvalid(tableName)) {
- if (this.isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_TABLE,
- new String[] {this.getName(), tableName, this.column.getName()},
- this.column,
- this.column.getTableTextRange(astRoot)
- )
- );
- } else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_TABLE,
- new String[] {tableName, this.column.getName()},
- this.column,
- this.column.getTableTextRange(astRoot)
- )
- );
- }
- return;
- }
-
- if ( ! this.column.isResolved() && this.column.getDbTable() != null) {
- if (this.isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME,
- new String[] {this.getName(), this.column.getName()},
- this.column,
- this.column.getNameTextRange(astRoot)
- )
- );
- } else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {this.column.getName()},
- this.column,
- this.column.getNameTextRange(astRoot)
- )
- );
- }
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java
deleted file mode 100644
index 4fde308a47..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java
+++ /dev/null
@@ -1,386 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.BaseOverride;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverride;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.internal.context.java.VirtualAttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.CompositeListIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaAttributeOverrideContainer extends AbstractJavaJpaContextNode
- implements JavaAttributeOverrideContainer
-{
- protected JavaResourcePersistentMember javaResourcePersistentMember;
-
- protected final List<JavaAttributeOverride> specifiedAttributeOverrides;
-
- protected final List<JavaAttributeOverride> virtualAttributeOverrides;
-
- protected final Owner owner;
-
- public GenericJavaAttributeOverrideContainer(JavaJpaContextNode parent, Owner owner) {
- super(parent);
- this.owner = owner;
- this.specifiedAttributeOverrides = new ArrayList<JavaAttributeOverride>();
- this.virtualAttributeOverrides = new ArrayList<JavaAttributeOverride>();
- }
-
- public Owner getOwner() {
- return this.owner;
- }
-
- @SuppressWarnings("unchecked")
- public ListIterator<JavaAttributeOverride> attributeOverrides() {
- return new CompositeListIterator<JavaAttributeOverride>(specifiedAttributeOverrides(), virtualAttributeOverrides());
- }
-
- public int attributeOverridesSize() {
- return this.specifiedAttributeOverridesSize() + this.virtualAttributeOverridesSize();
- }
-
- public ListIterator<JavaAttributeOverride> virtualAttributeOverrides() {
- return new CloneListIterator<JavaAttributeOverride>(this.virtualAttributeOverrides);
- }
-
- public int virtualAttributeOverridesSize() {
- return this.virtualAttributeOverrides.size();
- }
-
- public ListIterator<JavaAttributeOverride> specifiedAttributeOverrides() {
- return new CloneListIterator<JavaAttributeOverride>(this.specifiedAttributeOverrides);
- }
-
- public int specifiedAttributeOverridesSize() {
- return this.specifiedAttributeOverrides.size();
- }
-
- protected JavaAttributeOverride addSpecifiedAttributeOverride(int index) {
- JavaAttributeOverride attributeOverride = getJpaFactory().buildJavaAttributeOverride(this, createAttributeOverrideOwner());
- this.specifiedAttributeOverrides.add(index, attributeOverride);
- AttributeOverrideAnnotation attributeOverrideResource =
- (AttributeOverrideAnnotation) this.javaResourcePersistentMember.addAnnotation(
- index, AttributeOverrideAnnotation.ANNOTATION_NAME,
- AttributeOverridesAnnotation.ANNOTATION_NAME);
- attributeOverride.initialize(attributeOverrideResource);
- this.fireItemAdded(SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, index, attributeOverride);
- return attributeOverride;
- }
-
- protected JavaAttributeOverride setAttributeOverrideVirtual(boolean virtual, JavaAttributeOverride attributeOverride) {
- // Add a new attribute override
- if (virtual) {
- return setAttributeOverrideVirtual(attributeOverride);
- }
- return setAttributeOverrideSpecified(attributeOverride);
- }
-
- protected JavaAttributeOverride setAttributeOverrideVirtual(JavaAttributeOverride attributeOverride) {
- int index = this.specifiedAttributeOverrides.indexOf(attributeOverride);
- this.specifiedAttributeOverrides.remove(index);
- String attributeOverrideName = attributeOverride.getName();
- //add the virtual attribute override so that I can control the order that change notification is sent.
- //otherwise when we remove the annotation from java we will get an update and add the attribute override
- //during the update. This causes the UI to be flaky, since change notification might not occur in the correct order
- JavaAttributeOverride virtualAttributeOverride = null;
- if (attributeOverrideName != null) {
- for (String name : CollectionTools.iterable(allOverridableAttributeNames())) {
- if (name.equals(attributeOverrideName)) {
- //store the virtualAttributeOverride so we can fire change notification later
- virtualAttributeOverride = buildVirtualAttributeOverride(name);
- this.virtualAttributeOverrides.add(virtualAttributeOverride);
- break;
- }
- }
- }
-
- this.javaResourcePersistentMember.removeAnnotation(
- index, AttributeOverrideAnnotation.ANNOTATION_NAME,
- AttributeOverridesAnnotation.ANNOTATION_NAME);
- fireItemRemoved(SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, index, attributeOverride);
-
- if (virtualAttributeOverride != null) {
- fireItemAdded(VIRTUAL_ATTRIBUTE_OVERRIDES_LIST, virtualAttributeOverridesSize() - 1, virtualAttributeOverride);
- }
- return virtualAttributeOverride;
- }
-
- protected JavaAttributeOverride setAttributeOverrideSpecified(JavaAttributeOverride oldAttributeOverride) {
- int index = specifiedAttributeOverridesSize();
- JavaAttributeOverride newAttributeOverride = getJpaFactory().buildJavaAttributeOverride(this, createAttributeOverrideOwner());
- this.specifiedAttributeOverrides.add(index, newAttributeOverride);
-
- AttributeOverrideAnnotation attributeOverrideResource =
- (AttributeOverrideAnnotation) this.javaResourcePersistentMember.addAnnotation(
- index, AttributeOverrideAnnotation.ANNOTATION_NAME,
- AttributeOverridesAnnotation.ANNOTATION_NAME);
- newAttributeOverride.initialize(attributeOverrideResource);
-
- int defaultIndex = this.virtualAttributeOverrides.indexOf(oldAttributeOverride);
- this.virtualAttributeOverrides.remove(defaultIndex);
-
- newAttributeOverride.setName(oldAttributeOverride.getName());
- newAttributeOverride.getColumn().setSpecifiedName(oldAttributeOverride.getColumn().getName());
-
- this.fireItemRemoved(VIRTUAL_ATTRIBUTE_OVERRIDES_LIST, defaultIndex, oldAttributeOverride);
- this.fireItemAdded(SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, index, newAttributeOverride);
-
- return newAttributeOverride;
- }
-
- protected AttributeOverride.Owner createAttributeOverrideOwner() {
- return new AttributeOverrideOwner();
- }
-
- protected void addSpecifiedAttributeOverride(int index, JavaAttributeOverride attributeOverride) {
- addItemToList(index, attributeOverride, this.specifiedAttributeOverrides, SPECIFIED_ATTRIBUTE_OVERRIDES_LIST);
- }
-
- protected void addSpecifiedAttributeOverride(JavaAttributeOverride attributeOverride) {
- this.addSpecifiedAttributeOverride(this.specifiedAttributeOverrides.size(), attributeOverride);
- }
-
- protected void removeSpecifiedAttributeOverride_(JavaAttributeOverride attributeOverride) {
- removeItemFromList(attributeOverride, this.specifiedAttributeOverrides, SPECIFIED_ATTRIBUTE_OVERRIDES_LIST);
- }
-
- public void moveSpecifiedAttributeOverride(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.specifiedAttributeOverrides, targetIndex, sourceIndex);
- this.javaResourcePersistentMember.moveAnnotation(
- targetIndex, sourceIndex, AttributeOverridesAnnotation.ANNOTATION_NAME);
- fireItemMoved(SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, targetIndex, sourceIndex);
- }
-
- protected void addVirtualAttributeOverride(JavaAttributeOverride attributeOverride) {
- addItemToList(attributeOverride, this.virtualAttributeOverrides, VIRTUAL_ATTRIBUTE_OVERRIDES_LIST);
- }
-
- protected void removeVirtualAttributeOverride(JavaAttributeOverride attributeOverride) {
- removeItemFromList(attributeOverride, this.virtualAttributeOverrides, VIRTUAL_ATTRIBUTE_OVERRIDES_LIST);
- }
-
- public JavaAttributeOverride getAttributeOverrideNamed(String name) {
- return (JavaAttributeOverride) getOverrideNamed(name, attributeOverrides());
- }
-
- public boolean containsAttributeOverride(String name) {
- return containsOverride(name, attributeOverrides());
- }
-
- public boolean containsDefaultAttributeOverride(String name) {
- return containsOverride(name, virtualAttributeOverrides());
- }
-
- public boolean containsSpecifiedAttributeOverride(String name) {
- return containsOverride(name, specifiedAttributeOverrides());
- }
-
- protected BaseOverride getOverrideNamed(String name, ListIterator<? extends BaseOverride> overrides) {
- for (BaseOverride override : CollectionTools.iterable(overrides)) {
- String overrideName = override.getName();
- if (overrideName == null && name == null) {
- return override;
- }
- if (overrideName != null && overrideName.equals(name)) {
- return override;
- }
- }
- return null;
- }
-
- protected boolean containsOverride(String name, ListIterator<? extends BaseOverride> overrides) {
- return getOverrideNamed(name, overrides) != null;
- }
-
- protected Iterator<String> allOverridableAttributeNames() {
- TypeMapping overridableTypeMapping = getOwner().getOverridableTypeMapping();
- if (overridableTypeMapping != null) {
- return overridableTypeMapping.allOverridableAttributeNames();
- }
- return EmptyIterator.instance();
- }
-
-
- public void initialize(JavaResourcePersistentMember resourcePersistentMember) {
- this.javaResourcePersistentMember = resourcePersistentMember;
- this.initializeSpecifiedAttributeOverrides();
- this.initializeVirtualAttributeOverrides();
- }
-
- protected void initializeSpecifiedAttributeOverrides() {
- for (Iterator<NestableAnnotation> stream =
- this.javaResourcePersistentMember.annotations(
- AttributeOverrideAnnotation.ANNOTATION_NAME,
- AttributeOverridesAnnotation.ANNOTATION_NAME);
- stream.hasNext(); ) {
- this.specifiedAttributeOverrides.add(
- buildAttributeOverride((AttributeOverrideAnnotation) stream.next()));
- }
- }
-
- protected void initializeVirtualAttributeOverrides() {
- for (String name : CollectionTools.iterable(allOverridableAttributeNames())) {
- JavaAttributeOverride attributeOverride = getAttributeOverrideNamed(name);
- if (attributeOverride == null) {
- this.virtualAttributeOverrides.add(buildVirtualAttributeOverride(name));
- }
- }
- }
-
- public void update(JavaResourcePersistentMember resourcePersistentMember) {
- this.javaResourcePersistentMember = resourcePersistentMember;
- this.updateSpecifiedAttributeOverrides();
- this.updateVirtualAttributeOverrides();
- }
-
- protected void updateSpecifiedAttributeOverrides() {
- ListIterator<JavaAttributeOverride> attributeOverrides = specifiedAttributeOverrides();
- Iterator<NestableAnnotation> resourceAttributeOverrides =
- this.javaResourcePersistentMember.annotations(
- AttributeOverrideAnnotation.ANNOTATION_NAME,
- AttributeOverridesAnnotation.ANNOTATION_NAME);
-
- while (attributeOverrides.hasNext()) {
- JavaAttributeOverride attributeOverride = attributeOverrides.next();
- if (resourceAttributeOverrides.hasNext()) {
- attributeOverride.update((AttributeOverrideAnnotation) resourceAttributeOverrides.next());
- }
- else {
- removeSpecifiedAttributeOverride_(attributeOverride);
- }
- }
-
- while (resourceAttributeOverrides.hasNext()) {
- addSpecifiedAttributeOverride(buildAttributeOverride((AttributeOverrideAnnotation) resourceAttributeOverrides.next()));
- }
- }
-
- protected JavaAttributeOverride buildAttributeOverride(AttributeOverrideAnnotation attributeOverrideResource) {
- JavaAttributeOverride attributeOverride = getJpaFactory().buildJavaAttributeOverride(this, createAttributeOverrideOwner());
- attributeOverride.initialize(attributeOverrideResource);
- return attributeOverride;
- }
-
- protected JavaAttributeOverride buildVirtualAttributeOverride(String attributeOverrideName) {
- return buildAttributeOverride(buildVirtualAttributeOverrideAnnotation(attributeOverrideName));
- }
-
- protected VirtualAttributeOverrideAnnotation buildVirtualAttributeOverrideAnnotation(String attributeOverrideName) {
- Column column = resolveOverridenColumn(attributeOverrideName);
- return new VirtualAttributeOverrideAnnotation(this.javaResourcePersistentMember, attributeOverrideName, column);
- }
-
- private Column resolveOverridenColumn(String attributeOverrideName) {
- return getOwner().resolveOverridenColumn(attributeOverrideName);
- }
-
- protected void updateVirtualAttributeOverrides() {
- for (String name : CollectionTools.iterable(allOverridableAttributeNames())) {
- JavaAttributeOverride attributeOverride = getAttributeOverrideNamed(name);
- if (attributeOverride == null) {
- addVirtualAttributeOverride(buildVirtualAttributeOverride(name));
- }
- else if (attributeOverride.isVirtual()) {
- attributeOverride.update(buildVirtualAttributeOverrideAnnotation(name));
- }
- }
-
- Collection<String> attributeNames = CollectionTools.collection(allOverridableAttributeNames());
-
- //remove any default mappings that are not included in the attributeNames collection
- for (JavaAttributeOverride attributeOverride : CollectionTools.iterable(virtualAttributeOverrides())) {
- if (!attributeNames.contains(attributeOverride.getName())
- || containsSpecifiedAttributeOverride(attributeOverride.getName())) {
- removeVirtualAttributeOverride(attributeOverride);
- }
- }
- }
-
-
- //******************** Code Completion *************************
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (JavaAttributeOverride override : CollectionTools.iterable(this.attributeOverrides())) {
- result = override.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
- //********** Validation ********************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- for (Iterator<JavaAttributeOverride> stream = this.attributeOverrides(); stream.hasNext();) {
- stream.next().validate(messages, reporter, astRoot);
- }
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.javaResourcePersistentMember.getTextRange(astRoot);
- }
-
-
-
- // ********** attribute override owner **********
-
- class AttributeOverrideOwner implements AttributeOverride.Owner {
-
- public Column resolveOverridenColumn(String attributeName) {
- if (attributeName == null) {
- return null;
- }
- return GenericJavaAttributeOverrideContainer.this.resolveOverridenColumn(attributeName);
- }
-
- public boolean isVirtual(BaseOverride override) {
- return GenericJavaAttributeOverrideContainer.this.virtualAttributeOverrides.contains(override);
- }
-
- public BaseOverride setVirtual(boolean virtual, BaseOverride attributeOverride) {
- return GenericJavaAttributeOverrideContainer.this.setAttributeOverrideVirtual(virtual, (JavaAttributeOverride) attributeOverride);
- }
-
- public TypeMapping getTypeMapping() {
- return getOwner().getTypeMapping();
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaBasicMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaBasicMapping.java
deleted file mode 100644
index 9d6fa7b60d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaBasicMapping.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaBasicMapping;
-
-
-public class GenericJavaBasicMapping extends AbstractJavaBasicMapping
-{
- public GenericJavaBasicMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaCascade.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaCascade.java
deleted file mode 100644
index 8cb5e73a0f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaCascade.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.Cascade;
-import org.eclipse.jpt.core.context.java.JavaCascade;
-import org.eclipse.jpt.core.context.java.JavaRelationshipMapping;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.resource.java.RelationshipMappingAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class GenericJavaCascade extends AbstractJavaJpaContextNode implements JavaCascade
-{
- protected boolean all;
-
- protected boolean persist;
-
- protected boolean merge;
-
- protected boolean remove;
-
- protected boolean refresh;
-
- protected RelationshipMappingAnnotation relationshipMapping;
-
- public GenericJavaCascade(JavaRelationshipMapping parent) {
- super(parent);
- }
-
- public boolean isAll() {
- return this.all;
- }
-
- public void setAll(boolean newAll) {
- boolean oldAll = this.all;
- this.all = newAll;
- this.relationshipMapping.setCascadeAll(newAll);
- firePropertyChanged(Cascade.ALL_PROPERTY, oldAll, newAll);
- }
-
- protected void setAll_(boolean newAll) {
- boolean oldAll = this.all;
- this.all = newAll;
- firePropertyChanged(Cascade.ALL_PROPERTY, oldAll, newAll);
- }
-
- public boolean isPersist() {
- return this.persist;
- }
-
- public void setPersist(boolean newPersist) {
- boolean oldPersist = this.persist;
- this.persist = newPersist;
- this.relationshipMapping.setCascadePersist(newPersist);
- firePropertyChanged(Cascade.PERSIST_PROPERTY, oldPersist, newPersist);
- }
-
- protected void setPersist_(boolean newPersist) {
- boolean oldPersist = this.persist;
- this.persist = newPersist;
- firePropertyChanged(Cascade.PERSIST_PROPERTY, oldPersist, newPersist);
- }
-
- public boolean isMerge() {
- return this.merge;
- }
-
- public void setMerge(boolean newMerge) {
- boolean oldMerge = this.merge;
- this.merge = newMerge;
- this.relationshipMapping.setCascadeMerge(newMerge);
- firePropertyChanged(Cascade.MERGE_PROPERTY, oldMerge, newMerge);
- }
-
- protected void setMerge_(boolean newMerge) {
- boolean oldMerge = this.merge;
- this.merge = newMerge;
- firePropertyChanged(Cascade.MERGE_PROPERTY, oldMerge, newMerge);
- }
-
- public boolean isRemove() {
- return this.remove;
- }
-
- public void setRemove(boolean newRemove) {
- boolean oldRemove = this.remove;
- this.remove = newRemove;
- this.relationshipMapping.setCascadeRemove(newRemove);
- firePropertyChanged(Cascade.REMOVE_PROPERTY, oldRemove, newRemove);
- }
-
- protected void setRemove_(boolean newRemove) {
- boolean oldRemove = this.remove;
- this.remove = newRemove;
- firePropertyChanged(Cascade.REMOVE_PROPERTY, oldRemove, newRemove);
- }
-
- public boolean isRefresh() {
- return this.refresh;
- }
-
- public void setRefresh(boolean newRefresh) {
- boolean oldRefresh = this.refresh;
- this.refresh = newRefresh;
- this.relationshipMapping.setCascadeRefresh(newRefresh);
- firePropertyChanged(Cascade.REFRESH_PROPERTY, oldRefresh, newRefresh);
- }
-
- protected void setRefresh_(boolean newRefresh) {
- boolean oldRefresh = this.refresh;
- this.refresh = newRefresh;
- firePropertyChanged(Cascade.REFRESH_PROPERTY, oldRefresh, newRefresh);
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.relationshipMapping.getCascadeTextRange(astRoot);
- }
-
- public void initialize(RelationshipMappingAnnotation relationshipMapping) {
- this.relationshipMapping = relationshipMapping;
- this.all = relationshipMapping.isCascadeAll();
- this.persist = relationshipMapping.isCascadePersist();
- this.merge = relationshipMapping.isCascadeMerge();
- this.remove = relationshipMapping.isCascadeRemove();
- this.refresh = relationshipMapping.isCascadeRefresh();
- }
-
- public void update(RelationshipMappingAnnotation relationshipMapping) {
- this.relationshipMapping = relationshipMapping;
- this.setAll_(relationshipMapping.isCascadeAll());
- this.setPersist_(relationshipMapping.isCascadePersist());
- this.setMerge_(relationshipMapping.isCascadeMerge());
- this.setRemove_(relationshipMapping.isCascadeRemove());
- this.setRefresh_(relationshipMapping.isCascadeRefresh());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaColumn.java
deleted file mode 100644
index 35b1ce06f0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaColumn.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.java.JavaBaseColumn;
-import org.eclipse.jpt.core.context.java.JavaColumn;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaBaseColumn;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class GenericJavaColumn extends AbstractJavaBaseColumn<ColumnAnnotation> implements JavaColumn
-{
-
- protected Integer specifiedLength;
-
- protected Integer specifiedPrecision;
-
- protected Integer specifiedScale;
-
- public GenericJavaColumn(JavaJpaContextNode parent, JavaBaseColumn.Owner owner) {
- super(parent, owner);
- }
-
- @Override
- public void initialize(ColumnAnnotation column) {
- super.initialize(column);
- this.specifiedLength = this.getResourceLength();
- this.specifiedPrecision = this.getResourcePrecision();
- this.specifiedScale = this.getResourceScale();
- }
-
- @Override
- public void update(ColumnAnnotation column) {
- super.update(column);
- this.setSpecifiedLength_(this.getResourceLength());
- this.setSpecifiedPrecision_(this.getResourcePrecision());
- this.setSpecifiedScale_(this.getResourceScale());
- }
-
- public int getLength() {
- return (this.getSpecifiedLength() == null) ? getDefaultLength() : this.getSpecifiedLength().intValue();
- }
-
- public int getDefaultLength() {
- return Column.DEFAULT_LENGTH;
- }
-
- public Integer getSpecifiedLength() {
- return this.specifiedLength;
- }
-
- public void setSpecifiedLength(Integer newSpecifiedLength) {
- Integer oldSpecifiedLength = this.specifiedLength;
- this.specifiedLength = newSpecifiedLength;
- getResourceColumn().setLength(newSpecifiedLength);
- firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, oldSpecifiedLength, newSpecifiedLength);
- }
-
- protected void setSpecifiedLength_(Integer newSpecifiedLength) {
- Integer oldSpecifiedLength = this.specifiedLength;
- this.specifiedLength = newSpecifiedLength;
- firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, oldSpecifiedLength, newSpecifiedLength);
- }
-
- protected Integer getResourceLength() {
- return getResourceColumn().getLength();
- }
-
- public int getPrecision() {
- return (this.getSpecifiedPrecision() == null) ? getDefaultPrecision() : this.getSpecifiedPrecision().intValue();
- }
-
- public int getDefaultPrecision() {
- return Column.DEFAULT_PRECISION;
- }
-
- public Integer getSpecifiedPrecision() {
- return this.specifiedPrecision;
- }
-
- public void setSpecifiedPrecision(Integer newSpecifiedPrecision) {
- Integer oldSpecifiedPrecision = this.specifiedPrecision;
- this.specifiedPrecision = newSpecifiedPrecision;
- getResourceColumn().setPrecision(newSpecifiedPrecision);
- firePropertyChanged(SPECIFIED_PRECISION_PROPERTY, oldSpecifiedPrecision, newSpecifiedPrecision);
- }
-
- protected void setSpecifiedPrecision_(Integer newSpecifiedPrecision) {
- Integer oldSpecifiedPrecision = this.specifiedPrecision;
- this.specifiedPrecision = newSpecifiedPrecision;
- firePropertyChanged(SPECIFIED_PRECISION_PROPERTY, oldSpecifiedPrecision, newSpecifiedPrecision);
- }
-
- protected Integer getResourcePrecision() {
- return getResourceColumn().getPrecision();
- }
-
- public int getScale() {
- return (this.getSpecifiedScale() == null) ? getDefaultScale() : this.getSpecifiedScale().intValue();
- }
-
- public int getDefaultScale() {
- return Column.DEFAULT_SCALE;
- }
-
- public Integer getSpecifiedScale() {
- return this.specifiedScale;
- }
-
- public void setSpecifiedScale(Integer newSpecifiedScale) {
- Integer oldSpecifiedScale = this.specifiedScale;
- this.specifiedScale = newSpecifiedScale;
- getResourceColumn().setScale(newSpecifiedScale);
- firePropertyChanged(SPECIFIED_SCALE_PROPERTY, oldSpecifiedScale, newSpecifiedScale);
- }
-
- protected void setSpecifiedScale_(Integer newSpecifiedScale) {
- Integer oldSpecifiedScale = this.specifiedScale;
- this.specifiedScale = newSpecifiedScale;
- firePropertyChanged(SPECIFIED_SCALE_PROPERTY, oldSpecifiedScale, newSpecifiedScale);
- }
-
- protected Integer getResourceScale() {
- return getResourceColumn().getScale();
- }
-
- @Override
- public boolean tableIsAllowed() {
- return true;
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = getResourceColumn().getTextRange(astRoot);
- return (textRange != null) ? textRange : this.getOwner().getValidationTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java
deleted file mode 100644
index 389e9cd197..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0, which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.DiscriminatorColumn;
-import org.eclipse.jpt.core.context.DiscriminatorType;
-import org.eclipse.jpt.core.context.java.JavaDiscriminatorColumn;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaNamedColumn;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.DiscriminatorColumnAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaDiscriminatorColumn extends AbstractJavaNamedColumn<DiscriminatorColumnAnnotation>
- implements JavaDiscriminatorColumn
-{
-
- protected DiscriminatorType specifiedDiscriminatorType;
-
- protected DiscriminatorType defaultDiscriminatorType;
-
- protected Integer specifiedLength;
-
- protected int defaultLength;
-
- public GenericJavaDiscriminatorColumn(JavaEntity parent, JavaDiscriminatorColumn.Owner owner) {
- super(parent, owner);
- }
-
- @Override
- public void initialize(DiscriminatorColumnAnnotation column) {
- super.initialize(column);
- this.defaultDiscriminatorType = this.buildDefaultDiscriminatorType();
- this.defaultLength = this.buildDefaultLength();
- this.specifiedDiscriminatorType = this.getResourceDiscriminatorType();
- this.specifiedLength = this.getResourceLength();
- }
-
- @Override
- public JavaDiscriminatorColumn.Owner getOwner() {
- return (JavaDiscriminatorColumn.Owner) super.getOwner();
- }
-
- public boolean isResourceSpecified() {
- return getResourceColumn().isSpecified();
- }
-
- public DiscriminatorType getDiscriminatorType() {
- return (this.getSpecifiedDiscriminatorType() == null) ? this.getDefaultDiscriminatorType() : this.getSpecifiedDiscriminatorType();
- }
-
- public DiscriminatorType getDefaultDiscriminatorType() {
- return this.defaultDiscriminatorType;
- }
-
- protected void setDefaultDiscriminatorType(DiscriminatorType discriminatorType) {
- DiscriminatorType old = this.defaultDiscriminatorType;
- this.defaultDiscriminatorType = discriminatorType;
- firePropertyChanged(DEFAULT_DISCRIMINATOR_TYPE_PROPERTY, old, discriminatorType);
- }
-
- public DiscriminatorType getSpecifiedDiscriminatorType() {
- return this.specifiedDiscriminatorType;
- }
-
- public void setSpecifiedDiscriminatorType(DiscriminatorType newSpecifiedDiscriminatorType) {
- DiscriminatorType oldDiscriminatorType = this.specifiedDiscriminatorType;
- this.specifiedDiscriminatorType = newSpecifiedDiscriminatorType;
- getResourceColumn().setDiscriminatorType(DiscriminatorType.toJavaResourceModel(newSpecifiedDiscriminatorType));
- firePropertyChanged(DiscriminatorColumn.SPECIFIED_DISCRIMINATOR_TYPE_PROPERTY, oldDiscriminatorType, newSpecifiedDiscriminatorType);
- }
-
- /**
- * internal setter used only for updating from the resource model.
- * There were problems with InvalidThreadAccess exceptions in the UI
- * when you set a value from the UI and the annotation doesn't exist yet.
- * Adding the annotation causes an update to occur and then the exception.
- */
- protected void setSpecifiedDiscriminatorType_(DiscriminatorType newSpecifiedDiscriminatorType) {
- DiscriminatorType oldDiscriminatorType = this.specifiedDiscriminatorType;
- this.specifiedDiscriminatorType = newSpecifiedDiscriminatorType;
- firePropertyChanged(DiscriminatorColumn.SPECIFIED_DISCRIMINATOR_TYPE_PROPERTY, oldDiscriminatorType, newSpecifiedDiscriminatorType);
- }
-
- public int getLength() {
- return (this.getSpecifiedLength() == null) ? this.getDefaultLength() : this.getSpecifiedLength().intValue();
- }
-
- public int getDefaultLength() {
- return this.defaultLength;
- }
-
- protected void setDefaultLength(int defaultLength) {
- int old = this.defaultLength;
- this.defaultLength = defaultLength;
- firePropertyChanged(DEFAULT_LENGTH_PROPERTY, old, defaultLength);
- }
-
- public Integer getSpecifiedLength() {
- return this.specifiedLength;
- }
-
- public void setSpecifiedLength(Integer newSpecifiedLength) {
- Integer oldSpecifiedLength = this.specifiedLength;
- this.specifiedLength = newSpecifiedLength;
- getResourceColumn().setLength(newSpecifiedLength);
- firePropertyChanged(DiscriminatorColumn.SPECIFIED_LENGTH_PROPERTY, oldSpecifiedLength, newSpecifiedLength);
- }
-
- /**
- * internal setter used only for updating from the resource model.
- * There were problems with InvalidThreadAccess exceptions in the UI
- * when you set a value from the UI and the annotation doesn't exist yet.
- * Adding the annotation causes an update to occur and then the exception.
- */
- protected void setSpecifiedLength_(Integer newSpecifiedLength) {
- Integer oldSpecifiedLength = this.specifiedLength;
- this.specifiedLength = newSpecifiedLength;
- firePropertyChanged(DiscriminatorColumn.SPECIFIED_LENGTH_PROPERTY, oldSpecifiedLength, newSpecifiedLength);
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = getResourceColumn().getTextRange(astRoot);
- return (textRange != null) ? textRange : this.getOwner().getValidationTextRange(astRoot);
- }
-
-
- // ********** java annotations -> persistence model **********
-
- @Override
- public void update(DiscriminatorColumnAnnotation discriminatorColumn) {
- //don't call super because postUpdate() handles updating the default column name
- this.resourceColumn = discriminatorColumn;
- this.setSpecifiedName_(discriminatorColumn.getName());
- this.setColumnDefinition_(discriminatorColumn.getColumnDefinition());
- this.setSpecifiedDiscriminatorType_(this.getResourceDiscriminatorType());
- this.setSpecifiedLength_(this.getResourceLength());
- }
-
- @Override
- /**
- * Using postUpdate since these defaults are dependent on the entity hierarchy
- */
- public void postUpdate() {
- super.postUpdate();
- this.setDefaultName(this.buildDefaultName());
- this.setDefaultDiscriminatorType(this.buildDefaultDiscriminatorType());
- this.setDefaultLength(this.buildDefaultLength());
- }
-
- protected DiscriminatorType getResourceDiscriminatorType() {
- return DiscriminatorType.fromJavaResourceModel(getResourceColumn().getDiscriminatorType());
- }
-
- protected Integer getResourceLength() {
- return getResourceColumn().getLength();
- }
-
- @Override
- public JavaEntity getParent() {
- return (JavaEntity) super.getParent();
- }
-
- protected int buildDefaultLength() {
- return this.getOwner().getDefaultLength();
- }
-
- protected DiscriminatorType buildDefaultDiscriminatorType() {
- return this.getOwner().getDefaultDiscriminatorType();
- }
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- if (this.connectionProfileIsActive()) {
- if ( ! this.isResolved()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.DISCRIMINATOR_COLUMN_UNRESOLVED_NAME,
- new String[] {this.getName()},
- this,
- this.getNameTextRange(astRoot)
- )
- );
- }
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddable.java
deleted file mode 100644
index 38a2c98167..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddable.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaEmbeddable;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-
-
-public class GenericJavaEmbeddable
- extends AbstractJavaEmbeddable
-{
- public GenericJavaEmbeddable(JavaPersistentType parent) {
- super(parent);
- }
-
- @Override
- public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
- //generic only allows basic and transient within an Embeddable
- return ArrayTools.contains(ALLOWED_ATTRIBUTE_MAPPING_KEYS, attributeMappingKey);
- }
-
- public static final String[] ALLOWED_ATTRIBUTE_MAPPING_KEYS =
- new String[] {
- MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY,
- MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY
- };
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java
deleted file mode 100644
index cecd583e01..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaEmbeddedIdMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaBaseEmbeddedMapping;
-import org.eclipse.jpt.core.resource.java.EmbeddedIdAnnotation;
-
-
-public class GenericJavaEmbeddedIdMapping
- extends AbstractJavaBaseEmbeddedMapping<EmbeddedIdAnnotation>
- implements JavaEmbeddedIdMapping
-{
-
- public GenericJavaEmbeddedIdMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-
- //****************** JavaAttributeMapping implementation *******************
-
- public String getKey() {
- return MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String getAnnotationName() {
- return EmbeddedIdAnnotation.ANNOTATION_NAME;
- }
-
- @Override
- public boolean isIdMapping() {
- return true;
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java
deleted file mode 100644
index 1145a8c2ed..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.AssociationOverrideContainer;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.RelationshipReference;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaBaseEmbeddedMapping;
-import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaEmbeddedMapping2_0;
-import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-
-public class GenericJavaEmbeddedMapping
- extends AbstractJavaBaseEmbeddedMapping<EmbeddedAnnotation>
- implements JavaEmbeddedMapping2_0
-{
- protected final JavaAssociationOverrideContainer associationOverrideContainer;
-
- public GenericJavaEmbeddedMapping(JavaPersistentAttribute parent) {
- super(parent);
- this.associationOverrideContainer = ((JpaFactory2_0) this.getJpaFactory()).buildJavaAssociationOverrideContainer(this, new AssociationOverrideContainerOwner());
- }
-
- @Override
- protected void initialize() {
- super.initialize();
- this.associationOverrideContainer.initialize(this.getResourcePersistentAttribute());
- }
-
- @Override
- protected void update() {
- super.update();
- this.associationOverrideContainer.update(this.getResourcePersistentAttribute());
- }
-
- @Override
- public void postUpdate() {
- super.postUpdate();
- this.associationOverrideContainer.postUpdate();
- }
-
- //****************** JavaAttributeMapping implementation *******************
-
- public String getKey() {
- return MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String getAnnotationName() {
- return EmbeddedAnnotation.ANNOTATION_NAME;
- }
-
- //only putting this in EmbeddedMapping since relationship mappings
- //defined within an embedded id class are not supported by the 2.0 spec.
- @Override
- public Iterator<String> allMappingNames() {
- if (getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
- return new CompositeIterator<String>(
- getName(),
- embeddableAttributeMappingNames()
- );
- }
- return super.allMappingNames();
- }
-
- protected Iterator<String> embeddableAttributeMappingNames() {
- return new TransformationIterator<String, String>(
- new CompositeIterator<String>(
- new TransformationIterator<AttributeMapping, Iterator<String>>(this.embeddableAttributeMappings()) {
- @Override
- protected Iterator<String> transform(AttributeMapping mapping) {
- return mapping.allMappingNames();
- }
- }
- )
- ) {
- @Override
- protected String transform(String next) {
- return getName() + '.' + next;
- }
- };
- }
-
- @Override
- public AttributeMapping resolveAttributeMapping(String name) {
- AttributeMapping resolvedMapping = super.resolveAttributeMapping(name);
- if (resolvedMapping != null) {
- return resolvedMapping;
- }
- if (getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
- int dotIndex = name.indexOf('.');
- if (dotIndex != -1) {
- if (getName().equals(name.substring(0, dotIndex))) {
- for (AttributeMapping attributeMapping : CollectionTools.iterable(embeddableAttributeMappings())) {
- resolvedMapping = attributeMapping.resolveAttributeMapping(name.substring(dotIndex + 1));
- if (resolvedMapping != null) {
- return resolvedMapping;
- }
- }
- }
- }
- }
- return null;
- }
-
- @Override
- public RelationshipReference resolveRelationshipReference(String attributeName) {
- if (getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
- int dotIndex = attributeName.indexOf('.');
- if (dotIndex != -1) {
- if (getName().equals(attributeName.substring(0, dotIndex))) {
- attributeName = attributeName.substring(dotIndex + 1);
- AssociationOverride override = getAssociationOverrideContainer().getAssociationOverrideNamed(attributeName);
- if (override != null && !override.isVirtual()) {
- return override.getRelationshipReference();
- }
- if (this.getEmbeddable() == null) {
- return null;
- }
- return this.getEmbeddable().resolveRelationshipReference(attributeName);
- }
- }
- }
- return null;
- }
-
- //****************** AbstractJavaAttributeMapping implementation *******************
- @Override
- protected void addSupportingAnnotationNamesTo(Vector<String> names) {
- super.addSupportingAnnotationNamesTo(names);
- if (this.getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
- names.add(JPA.ASSOCIATION_OVERRIDE);
- names.add(JPA.ASSOCIATION_OVERRIDES);
- }
- }
-
-
- //****************** association overrides - 2.0 supports this *******************
-
- public JavaAssociationOverrideContainer getAssociationOverrideContainer() {
- return this.associationOverrideContainer;
- }
-
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- result = getAssociationOverrideContainer().javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return null;
- }
-
- // ********** association override container owner **********
-
- class AssociationOverrideContainerOwner implements AssociationOverrideContainer.Owner {
-
- public TypeMapping getOverridableTypeMapping() {
- return GenericJavaEmbeddedMapping.this.getOverridableTypeMapping();
- }
-
- public TypeMapping getTypeMapping() {
- return GenericJavaEmbeddedMapping.this.getTypeMapping();
- }
-
- public RelationshipReference resolveRelationshipReference(String associationOverrideName) {
- TypeMapping overridableTypeMapping = getOverridableTypeMapping();
- RelationshipReference relationshipReference = null;
- if (overridableTypeMapping != null) {
- for (TypeMapping typeMapping : CollectionTools.iterable(overridableTypeMapping.inheritanceHierarchy())) {
- relationshipReference = typeMapping.resolveRelationshipReference(associationOverrideName);
- if (relationshipReference != null) {
- return relationshipReference;
- }
- }
- }
- return relationshipReference;
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEntity.java
deleted file mode 100644
index 4bdefc8639..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEntity.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaEntity;
-import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
-import org.eclipse.jpt.core.jpa2.context.CacheableHolder2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCacheable2_0;
-import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-
-public class GenericJavaEntity
- extends AbstractJavaEntity
-{
-
- protected final JavaCacheable2_0 cacheable;
-
- public GenericJavaEntity(JavaPersistentType parent) {
- super(parent);
- this.cacheable = ((JpaFactory2_0) this.getJpaFactory()).buildJavaCacheable(this);
- }
-
- @Override
- public void initialize(JavaResourcePersistentType resourcePersistentType) {
- super.initialize(resourcePersistentType);
- this.cacheable.initialize(resourcePersistentType);
- }
-
- @Override
- public void update(JavaResourcePersistentType resourcePersistentType) {
- super.update(resourcePersistentType);
- this.cacheable.update(resourcePersistentType);
- }
-
- //****************** Entity2_0 implementation *******************
-
- public JavaCacheable2_0 getCacheable() {
- return this.cacheable;
- }
-
- public boolean calculateDefaultCacheable() {
- CacheableHolder2_0 parentEntity = (CacheableHolder2_0) getParentEntity();
- if (parentEntity != null) {
- return parentEntity.getCacheable().isCacheable();
- }
- return ((PersistenceUnit2_0) getPersistenceUnit()).calculateDefaultCacheable();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java
deleted file mode 100644
index 69c03c3f65..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.EnumType;
-import org.eclipse.jpt.core.context.EnumeratedConverter;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaEnumeratedConverter;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class GenericJavaEnumeratedConverter extends AbstractJavaJpaContextNode
- implements JavaEnumeratedConverter
-{
- private EnumType specifiedEnumType;
-
- private JavaResourcePersistentAttribute resourcePersistenceAttribute;
-
- public GenericJavaEnumeratedConverter(JavaAttributeMapping parent, JavaResourcePersistentAttribute jrpa) {
- super(parent);
- this.initialize(jrpa);
- }
-
- @Override
- public JavaAttributeMapping getParent() {
- return (JavaAttributeMapping) super.getParent();
- }
-
- public String getType() {
- return Converter.ENUMERATED_CONVERTER;
- }
-
- protected String getAnnotationName() {
- return EnumeratedAnnotation.ANNOTATION_NAME;
- }
-
- public void addToResourceModel() {
- this.resourcePersistenceAttribute.addAnnotation(getAnnotationName());
- }
-
- public void removeFromResourceModel() {
- this.resourcePersistenceAttribute.removeAnnotation(getAnnotationName());
- }
-
- public EnumType getEnumType() {
- return getSpecifiedEnumType() == null ? getDefaultEnumType() : getSpecifiedEnumType();
- }
-
- public EnumType getDefaultEnumType() {
- return EnumeratedConverter.DEFAULT_ENUM_TYPE;
- }
-
- public EnumType getSpecifiedEnumType() {
- return this.specifiedEnumType;
- }
-
- public void setSpecifiedEnumType(EnumType newSpecifiedEnumType) {
- EnumType oldSpecifiedEnumType = this.specifiedEnumType;
- this.specifiedEnumType = newSpecifiedEnumType;
- this.getResourceEnumerated().setValue(EnumType.toJavaResourceModel(newSpecifiedEnumType));
- firePropertyChanged(EnumeratedConverter.SPECIFIED_ENUM_TYPE_PROPERTY, oldSpecifiedEnumType, newSpecifiedEnumType);
- }
-
- protected void setSpecifiedEnumType_(EnumType newSpecifiedEnumType) {
- EnumType oldSpecifiedEnumType = this.specifiedEnumType;
- this.specifiedEnumType = newSpecifiedEnumType;
- firePropertyChanged(EnumeratedConverter.SPECIFIED_ENUM_TYPE_PROPERTY, oldSpecifiedEnumType, newSpecifiedEnumType);
- }
-
- protected EnumeratedAnnotation getResourceEnumerated() {
- return (EnumeratedAnnotation) this.resourcePersistenceAttribute.
- getAnnotation(getAnnotationName());
- }
-
- protected void initialize(JavaResourcePersistentAttribute jrpa) {
- this.resourcePersistenceAttribute = jrpa;
- this.specifiedEnumType = this.specifiedEnumType(getResourceEnumerated());
- }
-
- public void update(JavaResourcePersistentAttribute jrpa) {
- this.resourcePersistenceAttribute = jrpa;
- this.setSpecifiedEnumType_(this.specifiedEnumType(getResourceEnumerated()));
- }
-
- protected EnumType specifiedEnumType(EnumeratedAnnotation resourceEnumerated) {
- return resourceEnumerated == null ? null : EnumType.fromJavaResourceModel(resourceEnumerated.getValue());
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getResourceEnumerated().getTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java
deleted file mode 100644
index de24ea665f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.GeneratedValue;
-import org.eclipse.jpt.core.context.GenerationType;
-import org.eclipse.jpt.core.context.Generator;
-import org.eclipse.jpt.core.context.java.JavaGeneratedValue;
-import org.eclipse.jpt.core.context.java.JavaIdMapping;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- *
- */
-public class GenericJavaGeneratedValue
- extends AbstractJavaJpaContextNode
- implements JavaGeneratedValue
-{
- private GeneratedValueAnnotation resourceGeneratedValue;
-
- private GenerationType specifiedStrategy;
-
- private String specifiedGenerator;
-
- // always null?
- private String defaultGenerator = null;
-
-
- public GenericJavaGeneratedValue(JavaIdMapping parent) {
- super(parent);
- }
-
- public void initialize(GeneratedValueAnnotation generatedValueAnnotation) {
- this.resourceGeneratedValue = generatedValueAnnotation;
- this.specifiedStrategy = this.buildSpecifiedStrategy();
- this.specifiedGenerator = generatedValueAnnotation.getGenerator();
- }
-
-
- // ********** strategy **********
-
- public GenerationType getStrategy() {
- return (this.specifiedStrategy != null) ? this.specifiedStrategy : this.getDefaultStrategy();
- }
-
- public GenerationType getDefaultStrategy() {
- return GeneratedValue.DEFAULT_STRATEGY;
- }
-
- public GenerationType getSpecifiedStrategy() {
- return this.specifiedStrategy;
- }
-
- public void setSpecifiedStrategy(GenerationType strategy) {
- GenerationType old = this.specifiedStrategy;
- this.specifiedStrategy = strategy;
- this.resourceGeneratedValue.setStrategy(GenerationType.toJavaResourceModel(strategy));
- this.firePropertyChanged(SPECIFIED_STRATEGY_PROPERTY, old, strategy);
- }
-
- protected void setSpecifiedStrategy_(GenerationType strategy) {
- GenerationType old = this.specifiedStrategy;
- this.specifiedStrategy = strategy;
- this.firePropertyChanged(SPECIFIED_STRATEGY_PROPERTY, old, strategy);
- }
-
-
- // ********** generator **********
-
- public String getGenerator() {
- return (this.specifiedGenerator != null) ? this.specifiedGenerator : this.defaultGenerator;
- }
-
- public String getDefaultGenerator() {
- return this.defaultGenerator;
- }
-
- public String getSpecifiedGenerator() {
- return this.specifiedGenerator;
- }
-
- public void setSpecifiedGenerator(String generator) {
- String old = this.specifiedGenerator;
- this.specifiedGenerator = generator;
- this.resourceGeneratedValue.setGenerator(generator);
- this.firePropertyChanged(SPECIFIED_GENERATOR_PROPERTY, old, generator);
- }
-
- protected void setSpecifiedGenerator_(String generator) {
- String old = this.specifiedGenerator;
- this.specifiedGenerator = generator;
- this.firePropertyChanged(SPECIFIED_GENERATOR_PROPERTY, old, generator);
- }
-
-
- // ********** text ranges **********
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.resourceGeneratedValue.getTextRange(astRoot);
- }
-
- public TextRange getGeneratorTextRange(CompilationUnit astRoot) {
- return this.resourceGeneratedValue.getGeneratorTextRange(astRoot);
- }
-
-
- // ********** completion proposals **********
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.generatorTouches(pos, astRoot)) {
- return this.javaCandidateGeneratorNames(filter);
- }
- return null;
- }
-
- protected boolean generatorTouches(int pos, CompilationUnit astRoot) {
- return this.resourceGeneratedValue.generatorTouches(pos, astRoot);
- }
-
- protected Iterator<String> javaCandidateGeneratorNames(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.candidateGeneratorNames(filter));
- }
-
- protected Iterator<String> candidateGeneratorNames(Filter<String> filter) {
- return new FilteringIterator<String, String>(this.candidateGeneratorNames(), filter);
- }
-
- protected Iterator<String> candidateGeneratorNames() {
- return new TransformationIterator<Generator, String>(this.candidateGenerators()) {
- @Override
- protected String transform(Generator generator) {
- return generator.getName();
- }
- };
- }
-
- protected Iterator<Generator> candidateGenerators() {
- return this.getPersistenceUnit().generators();
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
-
- String generator = this.getGenerator();
- if (generator == null) {
- return;
- }
-
- for (Iterator<Generator> stream = this.getPersistenceUnit().generators(); stream.hasNext(); ) {
- if (generator.equals(stream.next().getName())) {
- return;
- }
- }
-
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ID_MAPPING_UNRESOLVED_GENERATOR_NAME,
- new String[] {generator},
- this.getParent(),
- this.getGeneratorTextRange(astRoot)
- )
- );
- }
-
-
- // ********** update from resource model **********
-
- public void update(GeneratedValueAnnotation generatedValueAnnotation) {
- this.resourceGeneratedValue = generatedValueAnnotation;
- this.setSpecifiedStrategy_(this.buildSpecifiedStrategy());
- this.setSpecifiedGenerator_(generatedValueAnnotation.getGenerator());
- }
-
- protected GenerationType buildSpecifiedStrategy() {
- return GenerationType.fromJavaResourceModel(this.resourceGeneratedValue.getStrategy());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java
deleted file mode 100644
index 1f4586a705..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.Generator;
-import org.eclipse.jpt.core.context.java.JavaGenerator;
-import org.eclipse.jpt.core.context.java.JavaGeneratorContainer;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaSequenceGenerator;
-import org.eclipse.jpt.core.context.java.JavaTableGenerator;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaGeneratorContainer extends AbstractJavaJpaContextNode
- implements JavaGeneratorContainer
-{
- protected JavaResourcePersistentMember javaResourcePersistentMember;
-
- protected JavaSequenceGenerator sequenceGenerator;
-
- protected JavaTableGenerator tableGenerator;
-
- public GenericJavaGeneratorContainer(JavaJpaContextNode parent) {
- super(parent);
- }
-
- @Override
- public JavaJpaContextNode getParent() {
- return (JavaJpaContextNode) super.getParent();
- }
-
- public JavaTableGenerator addTableGenerator() {
- if (getTableGenerator() != null) {
- throw new IllegalStateException("tableGenerator already exists"); //$NON-NLS-1$
- }
- this.tableGenerator = getJpaFactory().buildJavaTableGenerator(this);
- TableGeneratorAnnotation tableGeneratorResource =
- (TableGeneratorAnnotation) this.javaResourcePersistentMember.
- addAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME);
- this.tableGenerator.initialize(tableGeneratorResource);
- firePropertyChanged(TABLE_GENERATOR_PROPERTY, null, this.tableGenerator);
- return this.tableGenerator;
- }
-
- public void removeTableGenerator() {
- if (getTableGenerator() == null) {
- throw new IllegalStateException("tableGenerator does not exist, cannot be removed"); //$NON-NLS-1$
- }
- JavaTableGenerator oldTableGenerator = this.tableGenerator;
- this.tableGenerator = null;
- this.javaResourcePersistentMember.removeAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME);
- firePropertyChanged(TABLE_GENERATOR_PROPERTY, oldTableGenerator, null);
- }
-
- public JavaTableGenerator getTableGenerator() {
- return this.tableGenerator;
- }
-
- protected void setTableGenerator(JavaTableGenerator newTableGenerator) {
- JavaTableGenerator oldTableGenerator = this.tableGenerator;
- this.tableGenerator = newTableGenerator;
- firePropertyChanged(TABLE_GENERATOR_PROPERTY, oldTableGenerator, newTableGenerator);
- }
-
- public JavaSequenceGenerator addSequenceGenerator() {
- if (getSequenceGenerator() != null) {
- throw new IllegalStateException("sequenceGenerator already exists"); //$NON-NLS-1$
- }
- this.sequenceGenerator = getJpaFactory().buildJavaSequenceGenerator(this);
- SequenceGeneratorAnnotation sequenceGeneratorResource =
- (SequenceGeneratorAnnotation) this.javaResourcePersistentMember.
- addAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME);
- this.sequenceGenerator.initialize(sequenceGeneratorResource);
- firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, null, this.sequenceGenerator);
- return this.sequenceGenerator;
- }
-
- public void removeSequenceGenerator() {
- if (getSequenceGenerator() == null) {
- throw new IllegalStateException("sequenceGenerator does not exist, cannot be removed"); //$NON-NLS-1$
- }
- JavaSequenceGenerator oldSequenceGenerator = this.sequenceGenerator;
- this.sequenceGenerator = null;
- this.javaResourcePersistentMember.removeAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME);
- firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, oldSequenceGenerator,null);
- }
-
- public JavaSequenceGenerator getSequenceGenerator() {
- return this.sequenceGenerator;
- }
-
- protected void setSequenceGenerator(JavaSequenceGenerator newSequenceGenerator) {
- JavaSequenceGenerator oldSequenceGenerator = this.sequenceGenerator;
- this.sequenceGenerator = newSequenceGenerator;
- firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, oldSequenceGenerator, newSequenceGenerator);
- }
-
-
- public void initialize(JavaResourcePersistentMember jrpm) {
- this.javaResourcePersistentMember = jrpm;
- this.initializeTableGenerator();
- this.initializeSequenceGenerator();
- }
-
- protected void initializeTableGenerator() {
- TableGeneratorAnnotation tableGeneratorResource = getResourceTableGenerator();
- if (tableGeneratorResource != null) {
- this.tableGenerator = buildTableGenerator(tableGeneratorResource);
- }
- }
-
- protected void initializeSequenceGenerator() {
- SequenceGeneratorAnnotation sequenceGeneratorResource = getResourceSequenceGenerator();
- if (sequenceGeneratorResource != null) {
- this.sequenceGenerator = buildSequenceGenerator(sequenceGeneratorResource);
- }
- }
-
- public void update(JavaResourcePersistentMember jrpm) {
- this.javaResourcePersistentMember = jrpm;
- this.updateTableGenerator();
- this.updateSequenceGenerator();
- }
-
- protected void updateTableGenerator() {
- TableGeneratorAnnotation tableGeneratorResource = getResourceTableGenerator();
- if (tableGeneratorResource == null) {
- if (getTableGenerator() != null) {
- setTableGenerator(null);
- }
- }
- else {
- if (getTableGenerator() == null) {
- setTableGenerator(buildTableGenerator(tableGeneratorResource));
- }
- else {
- getTableGenerator().update(tableGeneratorResource);
- }
- }
- }
-
- protected JavaTableGenerator buildTableGenerator(TableGeneratorAnnotation tableGeneratorResource) {
- JavaTableGenerator generator = getJpaFactory().buildJavaTableGenerator(this);
- generator.initialize(tableGeneratorResource);
- return generator;
- }
-
- protected TableGeneratorAnnotation getResourceTableGenerator() {
- return (TableGeneratorAnnotation) this.javaResourcePersistentMember.
- getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME);
- }
-
- protected void updateSequenceGenerator() {
- SequenceGeneratorAnnotation sequenceGeneratorResource = getResourceSequenceGenerator();
- if (sequenceGeneratorResource == null) {
- if (getSequenceGenerator() != null) {
- setSequenceGenerator(null);
- }
- }
- else {
- if (getSequenceGenerator() == null) {
- setSequenceGenerator(buildSequenceGenerator(sequenceGeneratorResource));
- }
- else {
- getSequenceGenerator().update(sequenceGeneratorResource);
- }
- }
- }
-
- protected JavaSequenceGenerator buildSequenceGenerator(SequenceGeneratorAnnotation sequenceGeneratorResource) {
- JavaSequenceGenerator generator = getJpaFactory().buildJavaSequenceGenerator(this);
- generator.initialize(sequenceGeneratorResource);
- return generator;
- }
-
- protected SequenceGeneratorAnnotation getResourceSequenceGenerator() {
- return (SequenceGeneratorAnnotation) this.javaResourcePersistentMember.
- getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME);
- }
-
-
- //******************** Code Completion *************************
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.getTableGenerator() != null) {
- result = this.getTableGenerator().javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- if (this.getSequenceGenerator() != null) {
- result = this.getSequenceGenerator().javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
- //********** Validation ********************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.validateGenerators(messages, astRoot);
- }
-
- protected void validateGenerators(List<IMessage> messages, CompilationUnit astRoot) {
- for (Iterator<JavaGenerator> localGenerators = this.generators(); localGenerators.hasNext(); ) {
- JavaGenerator localGenerator = localGenerators.next();
- for (Iterator<Generator> globalGenerators = this.getPersistenceUnit().generators(); globalGenerators.hasNext(); ) {
- if (localGenerator.duplicates(globalGenerators.next())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.GENERATOR_DUPLICATE_NAME,
- new String[] {localGenerator.getName()},
- localGenerator,
- localGenerator.getNameTextRange(astRoot)
- )
- );
- }
- }
- }
- }
-
- protected final Iterator<JavaGenerator> generators() {
- ArrayList<JavaGenerator> generators = new ArrayList<JavaGenerator>();
- this.addGeneratorsTo(generators);
- return generators.iterator();
- }
-
- protected void addGeneratorsTo(ArrayList<JavaGenerator> generators) {
- if (this.sequenceGenerator != null) {
- generators.add(this.sequenceGenerator);
- }
- if (this.tableGenerator != null) {
- generators.add(this.tableGenerator);
- }
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.javaResourcePersistentMember.getTextRange(astRoot);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaIdMapping.java
deleted file mode 100644
index 97620c7e05..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaIdMapping.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaIdMapping;
-
-
-public class GenericJavaIdMapping
- extends AbstractJavaIdMapping
-{
-
- public GenericJavaIdMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinColumn.java
deleted file mode 100644
index 7914e66777..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinColumn.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaBaseColumn;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-
-public class GenericJavaJoinColumn extends AbstractJavaBaseColumn<JoinColumnAnnotation> implements JavaJoinColumn
-{
-
- protected String specifiedReferencedColumnName;
-
- protected String defaultReferencedColumnName;
-
- public GenericJavaJoinColumn(JavaJpaContextNode parent, JavaJoinColumn.Owner owner) {
- super(parent, owner);
- }
-
- @Override
- public void initialize(JoinColumnAnnotation annotation) {
- super.initialize(annotation);
- this.specifiedReferencedColumnName = annotation.getReferencedColumnName();
- this.defaultReferencedColumnName = this.buildDefaultReferencedColumnName();
- }
-
- @Override
- public void update(JoinColumnAnnotation annotation) {
- super.update(annotation);
- this.setSpecifiedReferencedColumnName_(annotation.getReferencedColumnName());
- this.setDefaultReferencedColumnName(this.buildDefaultReferencedColumnName());
- }
-
-
- public String getReferencedColumnName() {
- return (this.specifiedReferencedColumnName == null) ? this.defaultReferencedColumnName : this.specifiedReferencedColumnName;
- }
-
- public String getSpecifiedReferencedColumnName() {
- return this.specifiedReferencedColumnName;
- }
-
- public void setSpecifiedReferencedColumnName(String newSpecifiedReferencedColumnName) {
- String oldSpecifiedReferencedColumnName = this.specifiedReferencedColumnName;
- this.specifiedReferencedColumnName = newSpecifiedReferencedColumnName;
- this.getResourceColumn().setReferencedColumnName(newSpecifiedReferencedColumnName);
- firePropertyChanged(BaseJoinColumn.SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, oldSpecifiedReferencedColumnName, newSpecifiedReferencedColumnName);
- }
-
- protected void setSpecifiedReferencedColumnName_(String newSpecifiedReferencedColumnName) {
- String oldSpecifiedReferencedColumnName = this.specifiedReferencedColumnName;
- this.specifiedReferencedColumnName = newSpecifiedReferencedColumnName;
- firePropertyChanged(BaseJoinColumn.SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, oldSpecifiedReferencedColumnName, newSpecifiedReferencedColumnName);
- }
-
- public String getDefaultReferencedColumnName() {
- return this.defaultReferencedColumnName;
- }
-
- protected void setDefaultReferencedColumnName(String newDefaultReferencedColumnName) {
- String oldDefaultReferencedColumnName = this.defaultReferencedColumnName;
- this.defaultReferencedColumnName = newDefaultReferencedColumnName;
- firePropertyChanged(BaseJoinColumn.DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, oldDefaultReferencedColumnName, newDefaultReferencedColumnName);
- }
-
-
- @Override
- public JavaJoinColumn.Owner getOwner() {
- return (JavaJoinColumn.Owner) super.getOwner();
- }
-
- public boolean isVirtual() {
- return getOwner().isVirtual(this);
- }
-
- public Table getReferencedColumnDbTable() {
- return getOwner().getReferencedColumnDbTable();
- }
-
- public Column getReferencedDbColumn() {
- Table table = this.getReferencedColumnDbTable();
- return (table == null) ? null : table.getColumnForIdentifier(this.getReferencedColumnName());
- }
-
- @Override
- public boolean tableIsAllowed() {
- return this.getOwner().tableIsAllowed();
- }
-
- public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
- return getResourceColumn().referencedColumnNameTouches(pos, astRoot);
- }
-
- @Override
- public Iterator<String> connectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.connectedJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.referencedColumnNameTouches(pos, astRoot)) {
- return this.javaCandidateReferencedColumnNames(filter);
- }
- return null;
- }
-
- private Iterator<String> javaCandidateReferencedColumnNames(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.candidateReferencedColumnNames(filter));
- }
-
- private Iterator<String> candidateReferencedColumnNames(Filter<String> filter) {
- return new FilteringIterator<String, String>(this.candidateReferencedColumnNames(), filter);
- }
-
- private Iterator<String> candidateReferencedColumnNames() {
- Table table = this.getOwner().getReferencedColumnDbTable();
- return (table != null) ? table.sortedColumnIdentifiers() : EmptyIterator.<String> instance();
- }
-
- public boolean isReferencedColumnResolved() {
- return getReferencedDbColumn() != null;
- }
-
- public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) {
- TextRange textRange = getResourceColumn().getReferencedColumnNameTextRange(astRoot);
- return (textRange != null) ? textRange : getOwner().getValidationTextRange(astRoot);
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- protected String buildDefaultName() {
- return MappingTools.buildJoinColumnDefaultName(this);
- }
-
- protected String buildDefaultReferencedColumnName() {
- return MappingTools.buildJoinColumnDefaultReferencedColumnName(this.getOwner());
- }
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- validateName(messages, astRoot);
- validateReferencedColumnName(messages, astRoot);
- }
-
- protected void validateName(List<IMessage> messages, CompilationUnit astRoot) {
- if ( ! this.isResolved() && getDbTable() != null) {
- if (getName() != null) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {this.getName()},
- this,
- this.getNameTextRange(astRoot)
- )
- );
- }
- else if (getOwner().joinColumnsSize() > 1) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME_MULTIPLE_JOIN_COLUMNS,
- this,
- this.getNameTextRange(astRoot)
- )
- );
- }
- //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, CompilationUnit astRoot) {
- if ( ! this.isReferencedColumnResolved() && getReferencedColumnDbTable() != null) {
- if (getReferencedColumnName() != null) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME,
- new String[] {this.getReferencedColumnName(), this.getName()},
- this,
- this.getReferencedColumnNameTextRange(astRoot)
- )
- );
- }
- else if (getOwner().joinColumnsSize() > 1) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME_MULTIPLE_JOIN_COLUMNS,
- this,
- this.getNameTextRange(astRoot)
- )
- );
- }
- //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
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinTable.java
deleted file mode 100644
index 1f3f841016..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinTable.java
+++ /dev/null
@@ -1,725 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaJoinTable;
-import org.eclipse.jpt.core.context.java.JavaJoinTableJoiningStrategy;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaTable;
-import org.eclipse.jpt.core.internal.resource.java.NullJoinColumnAnnotation;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-import org.eclipse.jpt.utility.internal.iterators.SingleElementListIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java join table
- */
-public class GenericJavaJoinTable
- extends AbstractJavaTable
- implements JavaJoinTable
-{
-
- protected JavaJoinColumn defaultJoinColumn;
-
- protected final Vector<JavaJoinColumn> specifiedJoinColumns = new Vector<JavaJoinColumn>();
- protected final JavaJoinColumn.Owner joinColumnOwner;
-
- protected JavaJoinColumn defaultInverseJoinColumn;
-
- protected final Vector<JavaJoinColumn> specifiedInverseJoinColumns = new Vector<JavaJoinColumn>();
- protected final JavaJoinColumn.Owner inverseJoinColumnOwner;
-
-
- public GenericJavaJoinTable(JavaJoinTableJoiningStrategy parent) {
- super(parent);
- this.joinColumnOwner = this.buildJoinColumnOwner();
- this.inverseJoinColumnOwner = this.buildInverseJoinColumnOwner();
- }
-
- protected JavaJoinColumn.Owner buildJoinColumnOwner() {
- return new JoinColumnOwner();
- }
-
- protected JavaJoinColumn.Owner buildInverseJoinColumnOwner() {
- return new InverseJoinColumnOwner();
- }
-
- public RelationshipMapping getRelationshipMapping() {
- return this.getParent().getRelationshipReference().getRelationshipMapping();
- }
-
- public void initialize(JoinTableAnnotation joinTable) {
- super.initialize(joinTable);
- this.initializeSpecifiedJoinColumns(joinTable);
- this.initializeDefaultJoinColumn(joinTable);
- this.initializeSpecifiedInverseJoinColumns(joinTable);
- this.initializeDefaultInverseJoinColumn(joinTable);
- }
-
- public void update(JoinTableAnnotation joinTable) {
- super.update(joinTable);
- this.updateSpecifiedJoinColumns(joinTable);
- this.updateDefaultJoinColumn(joinTable);
- this.updateSpecifiedInverseJoinColumns(joinTable);
- this.updateDefaultInverseJoinColumn(joinTable);
- }
-
-
- // ********** AbstractJavaTable implementation **********
-
- @Override
- public JavaJoinTableJoiningStrategy getParent() {
- return (JavaJoinTableJoiningStrategy) super.getParent();
- }
-
- @Override
- protected String getAnnotationName() {
- return JoinTableAnnotation.ANNOTATION_NAME;
- }
-
- @Override
- protected String buildDefaultName() {
- return this.getParent().getJoinTableDefaultName();
- }
-
- @Override
- protected String buildDefaultSchema() {
- return this.getContextDefaultSchema();
- }
-
- @Override
- protected String buildDefaultCatalog() {
- return this.getContextDefaultCatalog();
- }
-
- @Override
- protected JoinTableAnnotation getAnnotation() {
- return this.getParent().getAnnotation();
- }
-
-
- // ********** Table implementation **********
-
- public boolean isResourceSpecified() {
- return this.getAnnotation().isSpecified();
- }
-
-
- // ********** join columns **********
-
- public ListIterator<JavaJoinColumn> joinColumns() {
- return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumns() : this.defaultJoinColumns();
- }
-
- public int joinColumnsSize() {
- return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.defaultJoinColumnsSize();
- }
-
- public void convertDefaultToSpecifiedJoinColumn() {
- MappingTools.convertJoinTableDefaultToSpecifiedJoinColumn(this);
- }
-
- protected JavaJoinColumn buildJoinColumn(JoinColumnAnnotation joinColumnAnnotation) {
- return this.buildJoinColumn(joinColumnAnnotation, this.joinColumnOwner);
- }
-
-
- // ********** default join column **********
-
- public JavaJoinColumn getDefaultJoinColumn() {
- return this.defaultJoinColumn;
- }
-
- protected void setDefaultJoinColumn(JavaJoinColumn defaultJoinColumn) {
- JavaJoinColumn old = this.defaultJoinColumn;
- this.defaultJoinColumn = defaultJoinColumn;
- this.firePropertyChanged(DEFAULT_JOIN_COLUMN, old, defaultJoinColumn);
- }
-
- protected ListIterator<JavaJoinColumn> defaultJoinColumns() {
- if (this.defaultJoinColumn != null) {
- return new SingleElementListIterator<JavaJoinColumn>(this.defaultJoinColumn);
- }
- return EmptyListIterator.instance();
- }
-
- protected int defaultJoinColumnsSize() {
- return (this.defaultJoinColumn == null) ? 0 : 1;
- }
-
- protected void initializeDefaultJoinColumn(JoinTableAnnotation joinTableAnnotation) {
- if (this.shouldBuildDefaultJoinColumn()) {
- this.defaultJoinColumn = this.buildJoinColumn(new NullJoinColumnAnnotation(joinTableAnnotation));
- }
- }
-
- protected void updateDefaultJoinColumn(JoinTableAnnotation joinTableAnnotation) {
- if (this.shouldBuildDefaultJoinColumn()) {
- if (this.defaultJoinColumn == null) {
- this.setDefaultJoinColumn(this.buildJoinColumn(new NullJoinColumnAnnotation(joinTableAnnotation)));
- } else {
- this.defaultJoinColumn.update(new NullJoinColumnAnnotation(joinTableAnnotation));
- }
- } else {
- this.setDefaultJoinColumn(null);
- }
- }
-
- protected boolean shouldBuildDefaultJoinColumn() {
- return ! this.hasSpecifiedJoinColumns();
- }
-
-
- // ********** specified join columns **********
-
- public ListIterator<JavaJoinColumn> specifiedJoinColumns() {
- return new CloneListIterator<JavaJoinColumn>(this.specifiedJoinColumns);
- }
-
- public int specifiedJoinColumnsSize() {
- return this.specifiedJoinColumns.size();
- }
-
- public boolean hasSpecifiedJoinColumns() {
- return this.specifiedJoinColumns.size() != 0;
- }
-
- public JavaJoinColumn addSpecifiedJoinColumn(int index) {
- // Clear out the default now so it doesn't get removed during an update and
- // cause change notifications to be sent to the UI in the wrong order.
- // If the default is already null, nothing will happen.
- JoinColumn oldDefault = this.defaultJoinColumn;
- this.defaultJoinColumn = null;
-
- JavaJoinColumn joinColumn = this.getJpaFactory().buildJavaJoinColumn(this, this.joinColumnOwner);
- this.specifiedJoinColumns.add(index, joinColumn);
- JoinTableAnnotation joinTableAnnotation = this.getAnnotation();
- JoinColumnAnnotation joinColumnAnnotation = joinTableAnnotation.addJoinColumn(index);
- joinColumn.initialize(joinColumnAnnotation);
- this.fireItemAdded(SPECIFIED_JOIN_COLUMNS_LIST, index, joinColumn);
-
- this.firePropertyChanged(DEFAULT_JOIN_COLUMN, oldDefault, null);
- return joinColumn;
- }
-
- protected void addSpecifiedJoinColumn(int index, JavaJoinColumn joinColumn) {
- this.addItemToList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- }
-
- protected void addSpecifiedJoinColumn(JavaJoinColumn joinColumn) {
- this.addSpecifiedJoinColumn(this.specifiedJoinColumns.size(), joinColumn);
- }
-
- public void removeSpecifiedJoinColumn(JoinColumn joinColumn) {
- this.removeSpecifiedJoinColumn(this.specifiedJoinColumns.indexOf(joinColumn));
- }
-
- public void removeSpecifiedJoinColumn(int index) {
- JavaJoinColumn removedJoinColumn = this.specifiedJoinColumns.remove(index);
- if ( ! this.hasSpecifiedJoinColumns()) {
- //create the defaultJoinColumn now or this will happen during project update
- //after removing the join column from the resource model. That causes problems
- //in the UI because the change notifications end up in the wrong order.
- this.defaultJoinColumn = this.buildJoinColumn(new NullJoinColumnAnnotation(this.getAnnotation()));
- }
- this.getAnnotation().removeJoinColumn(index);
- this.fireItemRemoved(SPECIFIED_JOIN_COLUMNS_LIST, index, removedJoinColumn);
- if (this.defaultJoinColumn != null) {
- //fire change notification if a defaultJoinColumn was created above
- this.firePropertyChanged(DEFAULT_JOIN_COLUMN, null, this.defaultJoinColumn);
- }
- }
-
- protected void removeSpecifiedJoinColumn_(JavaJoinColumn joinColumn) {
- this.removeItemFromList(joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- }
-
- public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.specifiedJoinColumns, targetIndex, sourceIndex);
- this.getAnnotation().moveJoinColumn(targetIndex, sourceIndex);
- this.fireItemMoved(SPECIFIED_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
- }
-
- public void clearSpecifiedJoinColumns() {
- // for now, we have to remove annotations one at a time...
- for (int i = this.specifiedJoinColumns.size(); i-- > 0; ) {
- this.removeSpecifiedJoinColumn(i);
- }
- }
-
- protected void initializeSpecifiedJoinColumns(JoinTableAnnotation joinTableAnnotation) {
- for (ListIterator<JoinColumnAnnotation> stream = joinTableAnnotation.joinColumns(); stream.hasNext(); ) {
- this.specifiedJoinColumns.add(this.buildJoinColumn(stream.next()));
- }
- }
-
- protected void updateSpecifiedJoinColumns(JoinTableAnnotation joinTableAnnotation) {
- ListIterator<JavaJoinColumn> joinColumns = this.specifiedJoinColumns();
- ListIterator<JoinColumnAnnotation> joinColumnAnnotations = joinTableAnnotation.joinColumns();
-
- while (joinColumns.hasNext()) {
- JavaJoinColumn joinColumn = joinColumns.next();
- if (joinColumnAnnotations.hasNext()) {
- joinColumn.update(joinColumnAnnotations.next());
- } else {
- this.removeSpecifiedJoinColumn_(joinColumn);
- }
- }
-
- while (joinColumnAnnotations.hasNext()) {
- this.addSpecifiedJoinColumn(this.buildJoinColumn(joinColumnAnnotations.next()));
- }
- }
-
-
- // ********** inverse join columns **********
-
- public ListIterator<JavaJoinColumn> inverseJoinColumns() {
- return this.hasSpecifiedInverseJoinColumns() ? this.specifiedInverseJoinColumns() : this.defaultInverseJoinColumns();
- }
-
- public int inverseJoinColumnsSize() {
- return this.hasSpecifiedInverseJoinColumns() ? this.specifiedInverseJoinColumnsSize() : this.defaultInverseJoinColumnsSize();
- }
-
- public void convertDefaultToSpecifiedInverseJoinColumn() {
- MappingTools.convertJoinTableDefaultToSpecifiedInverseJoinColumn(this);
- }
-
- protected JavaJoinColumn buildInverseJoinColumn(JoinColumnAnnotation joinColumnAnnotation) {
- return this.buildJoinColumn(joinColumnAnnotation, this.inverseJoinColumnOwner);
- }
-
-
- // ********** default inverse join column **********
-
- public JavaJoinColumn getDefaultInverseJoinColumn() {
- return this.defaultInverseJoinColumn;
- }
-
- protected void setDefaultInverseJoinColumn(JavaJoinColumn defaultInverseJoinColumn) {
- JavaJoinColumn old = this.defaultInverseJoinColumn;
- this.defaultInverseJoinColumn = defaultInverseJoinColumn;
- this.firePropertyChanged(DEFAULT_INVERSE_JOIN_COLUMN, old, defaultInverseJoinColumn);
- }
-
- protected ListIterator<JavaJoinColumn> defaultInverseJoinColumns() {
- if (this.defaultInverseJoinColumn != null) {
- return new SingleElementListIterator<JavaJoinColumn>(this.defaultInverseJoinColumn);
- }
- return EmptyListIterator.instance();
- }
-
- protected int defaultInverseJoinColumnsSize() {
- return (this.defaultInverseJoinColumn == null) ? 0 : 1;
- }
-
- protected void initializeDefaultInverseJoinColumn(JoinTableAnnotation joinTableAnnotation) {
- if (this.shouldBuildDefaultInverseJoinColumn()) {
- this.defaultInverseJoinColumn = this.buildInverseJoinColumn(new NullJoinColumnAnnotation(joinTableAnnotation));
- }
- }
-
- protected boolean shouldBuildDefaultInverseJoinColumn() {
- return ! this.hasSpecifiedInverseJoinColumns();
- }
-
- protected void updateDefaultInverseJoinColumn(JoinTableAnnotation joinTableAnnotation) {
- if (this.shouldBuildDefaultInverseJoinColumn()) {
- if (this.defaultInverseJoinColumn == null) {
- this.setDefaultInverseJoinColumn(this.buildInverseJoinColumn(new NullJoinColumnAnnotation(joinTableAnnotation)));
- } else {
- this.defaultInverseJoinColumn.update(new NullJoinColumnAnnotation(joinTableAnnotation));
- }
- } else {
- this.setDefaultInverseJoinColumn(null);
- }
- }
-
-
- // ********** specified inverse join columns **********
-
- public ListIterator<JavaJoinColumn> specifiedInverseJoinColumns() {
- return new CloneListIterator<JavaJoinColumn>(this.specifiedInverseJoinColumns);
- }
-
- public int specifiedInverseJoinColumnsSize() {
- return this.specifiedInverseJoinColumns.size();
- }
-
- public boolean hasSpecifiedInverseJoinColumns() {
- return this.specifiedInverseJoinColumns.size() != 0;
- }
-
- public JavaJoinColumn addSpecifiedInverseJoinColumn(int index) {
- // Clear out the default now so it doesn't get removed during an update and
- // cause change notifications to be sent to the UI in the wrong order.
- // If the default is already null, nothing will happen.
- JoinColumn oldDefault = this.defaultInverseJoinColumn;
- this.defaultInverseJoinColumn = null;
-
- JavaJoinColumn inverseJoinColumn = this.getJpaFactory().buildJavaJoinColumn(this, this.inverseJoinColumnOwner);
- this.specifiedInverseJoinColumns.add(index, inverseJoinColumn);
- JoinTableAnnotation joinTableAnnotation = this.getAnnotation();
- JoinColumnAnnotation joinColumnAnnotation = joinTableAnnotation.addInverseJoinColumn(index);
- inverseJoinColumn.initialize(joinColumnAnnotation);
- this.fireItemAdded(SPECIFIED_INVERSE_JOIN_COLUMNS_LIST, index, inverseJoinColumn);
-
- this.firePropertyChanged(DEFAULT_INVERSE_JOIN_COLUMN, oldDefault, null);
- return inverseJoinColumn;
- }
-
- protected void addSpecifiedInverseJoinColumn(int index, JavaJoinColumn inverseJoinColumn) {
- this.addItemToList(index, inverseJoinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
- }
-
- protected void addSpecifiedInverseJoinColumn(JavaJoinColumn inverseJoinColumn) {
- this.addSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumns.size(), inverseJoinColumn);
- }
-
- public void removeSpecifiedInverseJoinColumn(JoinColumn inverseJoinColumn) {
- this.removeSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumns.indexOf(inverseJoinColumn));
- }
-
- public void removeSpecifiedInverseJoinColumn(int index) {
- JavaJoinColumn removedJoinColumn = this.specifiedInverseJoinColumns.remove(index);
- if ( ! this.hasSpecifiedInverseJoinColumns()) {
- //create the defaultJoinColumn now or this will happen during project update
- //after removing the join column from the resource model. That causes problems
- //in the UI because the change notifications end up in the wrong order.
- this.defaultInverseJoinColumn = this.buildInverseJoinColumn(new NullJoinColumnAnnotation(this.getAnnotation()));
- }
- this.getAnnotation().removeInverseJoinColumn(index);
- this.fireItemRemoved(SPECIFIED_INVERSE_JOIN_COLUMNS_LIST, index, removedJoinColumn);
- if (this.defaultInverseJoinColumn != null) {
- //fire change notification if a defaultJoinColumn was created above
- this.firePropertyChanged(DEFAULT_INVERSE_JOIN_COLUMN, null, this.defaultInverseJoinColumn);
- }
- }
-
- protected void removeSpecifiedInverseJoinColumn_(JavaJoinColumn joinColumn) {
- this.removeItemFromList(joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
- }
-
- public void moveSpecifiedInverseJoinColumn(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.specifiedInverseJoinColumns, targetIndex, sourceIndex);
- this.getAnnotation().moveInverseJoinColumn(targetIndex, sourceIndex);
- this.fireItemMoved(SPECIFIED_INVERSE_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
- }
-
- public void clearSpecifiedInverseJoinColumns() {
- // for now, we have to remove annotations one at a time...
- for (int i = this.specifiedInverseJoinColumns.size(); i-- > 0; ) {
- this.removeSpecifiedInverseJoinColumn(i);
- }
- }
-
- protected void initializeSpecifiedInverseJoinColumns(JoinTableAnnotation joinTableAnnotation) {
- for (ListIterator<JoinColumnAnnotation> stream = joinTableAnnotation.inverseJoinColumns(); stream.hasNext(); ) {
- this.specifiedInverseJoinColumns.add(this.buildInverseJoinColumn(stream.next()));
- }
- }
-
- protected void updateSpecifiedInverseJoinColumns(JoinTableAnnotation joinTableAnnotation) {
- ListIterator<JavaJoinColumn> joinColumns = this.specifiedInverseJoinColumns();
- ListIterator<JoinColumnAnnotation> joinColumnAnnotations = joinTableAnnotation.inverseJoinColumns();
-
- while (joinColumns.hasNext()) {
- JavaJoinColumn joinColumn = joinColumns.next();
- if (joinColumnAnnotations.hasNext()) {
- joinColumn.update(joinColumnAnnotations.next());
- } else {
- this.removeSpecifiedInverseJoinColumn_(joinColumn);
- }
- }
-
- while (joinColumnAnnotations.hasNext()) {
- this.addSpecifiedInverseJoinColumn(this.buildInverseJoinColumn(joinColumnAnnotations.next()));
- }
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (JavaJoinColumn column : CollectionTools.iterable(this.joinColumns())) {
- result = column.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- for (JavaJoinColumn column : CollectionTools.iterable(this.inverseJoinColumns())) {
- result = column.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
-
- // ********** misc **********
-
- protected JavaJoinColumn buildJoinColumn(JoinColumnAnnotation joinColumnAnnotation, JavaJoinColumn.Owner owner) {
- JavaJoinColumn joinColumn = this.getJpaFactory().buildJavaJoinColumn(this, owner);
- joinColumn.initialize(joinColumnAnnotation);
- return joinColumn;
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- if (this.getRelationshipMapping().shouldValidateAgainstDatabase()) {
- this.validateAgainstDatabase(messages, reporter, astRoot);
- }
- }
-
- protected void validateAgainstDatabase(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- if ( ! this.hasResolvedCatalog()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_TABLE_UNRESOLVED_CATALOG,
- new String[] {this.getCatalog(), this.getName()},
- this,
- this.getCatalogTextRange(astRoot)
- )
- );
- return;
- }
-
- if ( ! this.hasResolvedSchema()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_TABLE_UNRESOLVED_SCHEMA,
- new String[] {this.getSchema(), this.getName()},
- this,
- this.getSchemaTextRange(astRoot)
- )
- );
- return;
- }
-
- if ( ! this.isResolved()) {
- if (getName() != null) { //if name is null, the validation will be handled elsewhere, such as the target entity is not defined
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_TABLE_UNRESOLVED_NAME,
- new String[] {this.getName()},
- this,
- this.getNameTextRange(astRoot))
- );
- }
- return;
- }
-
- this.validateJoinColumns(this.joinColumns(), messages, reporter, astRoot);
- this.validateJoinColumns(this.inverseJoinColumns(), messages, reporter, astRoot);
- }
-
- protected void validateJoinColumns(Iterator<JavaJoinColumn> joinColumns, List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- while (joinColumns.hasNext()) {
- joinColumns.next().validate(messages, reporter, astRoot);
- }
- }
-
-
- // ********** join column owner adapters **********
-
- /**
- * just a little common behavior
- */
- protected abstract class AbstractJoinColumnOwner
- implements JavaJoinColumn.Owner
- {
- protected AbstractJoinColumnOwner() {
- super();
- }
-
- public TypeMapping getTypeMapping() {
- return GenericJavaJoinTable.this.getParent().getRelationshipReference().getTypeMapping();
- }
-
- public RelationshipMapping getRelationshipMapping() {
- return GenericJavaJoinTable.this.getRelationshipMapping();
- }
-
- /**
- * the default table name is always valid and a specified table name
- * is prohibited (which will be handled elsewhere)
- */
- public boolean tableNameIsInvalid(String tableName) {
- return false;
- }
-
- /**
- * the join column can only be on the join table itself
- */
- public boolean tableIsAllowed() {
- return false;
- }
-
- public org.eclipse.jpt.db.Table getDbTable(String tableName) {
- if (GenericJavaJoinTable.this.getName() == null) {
- return null;
- }
- return (GenericJavaJoinTable.this.getName().equals(tableName)) ? GenericJavaJoinTable.this.getDbTable() : null;
- }
-
- /**
- * by default, the join column is, obviously, in the join table;
- * not sure whether it can be anywhere else...
- */
- public String getDefaultTableName() {
- return GenericJavaJoinTable.this.getName();
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return GenericJavaJoinTable.this.getValidationTextRange(astRoot);
- }
- }
-
-
- /**
- * owner for "back-pointer" JoinColumns;
- * these point at the source/owning entity
- */
- protected class JoinColumnOwner
- extends AbstractJoinColumnOwner
- {
- protected JoinColumnOwner() {
- super();
- }
-
- public Entity getTargetEntity() {
- return GenericJavaJoinTable.this.getParent().getRelationshipReference().getEntity();
- }
-
- public String getAttributeName() {
- Entity targetEntity = GenericJavaJoinTable.this.getRelationshipMapping().getResolvedTargetEntity();
- if (targetEntity == null) {
- return null;
- }
- for (PersistentAttribute each :
- CollectionTools.iterable(
- targetEntity.getPersistentType().allAttributes())) {
- if (each.getMapping().isOwnedBy(this.getRelationshipMapping())) {
- return each.getName();
- }
- }
- return null;
- }
-
- @Override
- public org.eclipse.jpt.db.Table getDbTable(String tableName) {
- org.eclipse.jpt.db.Table dbTable = super.getDbTable(tableName);
- return (dbTable != null) ? dbTable : this.getTypeMapping().getDbTable(tableName);
- }
-
- public org.eclipse.jpt.db.Table getReferencedColumnDbTable() {
- return getTypeMapping().getPrimaryDbTable();
- }
-
- public boolean isVirtual(BaseJoinColumn joinColumn) {
- return GenericJavaJoinTable.this.defaultJoinColumn == joinColumn;
- }
-
- public String getDefaultColumnName() {
- //built in MappingTools.buildJoinColumnDefaultName()
- return null;
- }
-
- public int joinColumnsSize() {
- return GenericJavaJoinTable.this.joinColumnsSize();
- }
- }
-
-
- /**
- * owner for "forward-pointer" JoinColumns;
- * these point at the target/inverse entity
- */
- protected class InverseJoinColumnOwner
- extends AbstractJoinColumnOwner
- {
- protected InverseJoinColumnOwner() {
- super();
- }
-
- public Entity getTargetEntity() {
- return GenericJavaJoinTable.this.getRelationshipMapping().getResolvedTargetEntity();
- }
-
- public String getAttributeName() {
- return GenericJavaJoinTable.this.getRelationshipMapping().getName();
- }
-
- @Override
- public org.eclipse.jpt.db.Table getDbTable(String tableName) {
- org.eclipse.jpt.db.Table dbTable = super.getDbTable(tableName);
- if (dbTable != null) {
- return dbTable;
- }
- Entity targetEntity = getTargetEntity();
- return (targetEntity == null) ? null : targetEntity.getDbTable(tableName);
- }
-
- public org.eclipse.jpt.db.Table getReferencedColumnDbTable() {
- Entity targetEntity = getTargetEntity();
- return (targetEntity == null) ? null : targetEntity.getPrimaryDbTable();
- }
-
- public boolean isVirtual(BaseJoinColumn joinColumn) {
- return GenericJavaJoinTable.this.defaultInverseJoinColumn == joinColumn;
- }
-
- public String getDefaultColumnName() {
- //built in MappingTools.buildJoinColumnDefaultName()
- return null;
- }
-
- public int joinColumnsSize() {
- return GenericJavaJoinTable.this.inverseJoinColumnsSize();
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaLobConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaLobConverter.java
deleted file mode 100644
index 0ab1f95469..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaLobConverter.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaLobConverter;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.LobAnnotation;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class GenericJavaLobConverter extends AbstractJavaJpaContextNode
- implements JavaLobConverter
-{
- private JavaResourcePersistentAttribute resourcePersistentAttribute;
-
-
- public GenericJavaLobConverter(JavaAttributeMapping parent, JavaResourcePersistentAttribute jrpa) {
- super(parent);
- this.initialize(jrpa);
- }
-
- @Override
- public JavaAttributeMapping getParent() {
- return (JavaAttributeMapping) super.getParent();
- }
-
- public String getType() {
- return Converter.LOB_CONVERTER;
- }
-
- protected String getAnnotationName() {
- return LobAnnotation.ANNOTATION_NAME;
- }
-
- public void addToResourceModel() {
- this.resourcePersistentAttribute.addAnnotation(getAnnotationName());
- }
-
- public void removeFromResourceModel() {
- this.resourcePersistentAttribute.removeAnnotation(getAnnotationName());
- }
-
- protected TemporalAnnotation getResourceLob() {
- return (TemporalAnnotation) this.resourcePersistentAttribute.
- getAnnotation(getAnnotationName());
- }
-
- protected void initialize(JavaResourcePersistentAttribute jrpa) {
- this.resourcePersistentAttribute = jrpa;
- }
-
- public void update(JavaResourcePersistentAttribute jrpa) {
- this.resourcePersistentAttribute = jrpa;
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return getResourceLob().getTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaManyToManyMapping.java
deleted file mode 100644
index 4d0780cc47..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaManyToManyMapping.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaManyToManyMapping;
-
-
-public class GenericJavaManyToManyMapping
- extends AbstractJavaManyToManyMapping
-{
- public GenericJavaManyToManyMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaManyToOneMapping.java
deleted file mode 100644
index 535861906d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaManyToOneMapping.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaManyToOneMapping;
-
-
-public class GenericJavaManyToOneMapping
- extends AbstractJavaManyToOneMapping
-{
- public GenericJavaManyToOneMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaMappedSuperclass.java
deleted file mode 100644
index 3b19e3a6e7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaMappedSuperclass.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaMappedSuperclass;
-
-public class GenericJavaMappedSuperclass extends AbstractJavaMappedSuperclass
-{
-
- public GenericJavaMappedSuperclass(JavaPersistentType parent) {
- super(parent);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java
deleted file mode 100644
index ab5d1a5d28..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.NamedNativeQuery;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaNamedNativeQuery;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaQuery;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueryAnnotation;
-
-
-public class GenericJavaNamedNativeQuery extends AbstractJavaQuery
- implements JavaNamedNativeQuery
-{
-
- protected String resultClass;
-
- protected String resultSetMapping;
-
- public GenericJavaNamedNativeQuery(JavaJpaContextNode parent) {
- super(parent);
- }
-
- @Override
- protected NamedNativeQueryAnnotation getResourceQuery() {
- return (NamedNativeQueryAnnotation) super.getResourceQuery();
- }
-
- public char getResultClassEnclosingTypeSeparator() {
- return '.';
- }
-
- public String getResultClass() {
- return this.resultClass;
- }
-
- public void setResultClass(String newResultClass) {
- String oldResultClass = this.resultClass;
- this.resultClass = newResultClass;
- getResourceQuery().setResultClass(newResultClass);
- firePropertyChanged(NamedNativeQuery.RESULT_CLASS_PROPERTY, oldResultClass, newResultClass);
- }
-
- protected void setResultClass_(String newResultClass) {
- String oldResultClass = this.resultClass;
- this.resultClass = newResultClass;
- firePropertyChanged(NamedNativeQuery.RESULT_CLASS_PROPERTY, oldResultClass, newResultClass);
- }
-
- public String getResultSetMapping() {
- return this.resultSetMapping;
- }
-
- public void setResultSetMapping(String newResultSetMapping) {
- String oldResultSetMapping = this.resultSetMapping;
- this.resultSetMapping = newResultSetMapping;
- getResourceQuery().setResultSetMapping(newResultSetMapping);
- firePropertyChanged(NamedNativeQuery.RESULT_SET_MAPPING_PROPERTY, oldResultSetMapping, newResultSetMapping);
- }
-
- protected void setResultSetMapping_(String newResultSetMapping) {
- String oldResultSetMapping = this.resultSetMapping;
- this.resultSetMapping = newResultSetMapping;
- firePropertyChanged(NamedNativeQuery.RESULT_SET_MAPPING_PROPERTY, oldResultSetMapping, newResultSetMapping);
- }
-
- public void initialize(NamedNativeQueryAnnotation resourceQuery) {
- super.initialize(resourceQuery);
- this.resultClass = resourceQuery.getResultClass();
- this.resultSetMapping = resourceQuery.getResultSetMapping();
- }
-
- public void update(NamedNativeQueryAnnotation resourceQuery) {
- super.update(resourceQuery);
- this.setResultClass_(resourceQuery.getResultClass());
- this.setResultSetMapping_(resourceQuery.getResultSetMapping());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNamedQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNamedQuery.java
deleted file mode 100644
index d227c50b13..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNamedQuery.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaNamedQuery;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaQuery;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
-
-
-
-public class GenericJavaNamedQuery extends AbstractJavaQuery implements JavaNamedQuery
-{
-
- public GenericJavaNamedQuery(JavaJpaContextNode parent) {
- super(parent);
- }
-
- @Override
- protected NamedQueryAnnotation getResourceQuery() {
- return (NamedQueryAnnotation) super.getResourceQuery();
- }
-
- public void initialize(NamedQueryAnnotation resourceQuery) {
- super.initialize(resourceQuery);
- }
-
- public void update(NamedQueryAnnotation resourceQuery) {
- super.update(resourceQuery);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java
deleted file mode 100644
index 790b932832..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMapping;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-
-public class GenericJavaNullAttributeMapping
- extends AbstractJavaAttributeMapping<Annotation>
-{
- public GenericJavaNullAttributeMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-
- public String getKey() {
- return MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String getAnnotationName() {
- return null;
- }
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- }
-
-
- // ********** metamodel **********
-
- @Override
- public MetamodelField getMetamodelField() {
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNullConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNullConverter.java
deleted file mode 100644
index 3c23fe6d0d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNullConverter.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaConverter;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class GenericJavaNullConverter extends AbstractJavaJpaContextNode
- implements JavaConverter
-{
-
- public GenericJavaNullConverter(JavaAttributeMapping parent) {
- super(parent);
- }
-
- @Override
- public JavaAttributeMapping getParent() {
- return (JavaAttributeMapping) super.getParent();
- }
-
- public String getType() {
- return Converter.NO_CONVERTER;
- }
-
- public void addToResourceModel() {
- //do nothing
- }
-
- public void removeFromResourceModel() {
- //do nothin
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public void update(JavaResourcePersistentAttribute jrpa) {
- //do nothing
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOneToManyMapping.java
deleted file mode 100644
index 45ff0ba1a9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOneToManyMapping.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaRelationshipReference;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaOneToManyMapping;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-
-
-public class GenericJavaOneToManyMapping<T extends OneToManyAnnotation>
- extends AbstractJavaOneToManyMapping<OneToManyAnnotation>
-{
-
- public GenericJavaOneToManyMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-
- @Override
- protected JavaRelationshipReference buildRelationshipReference() {
- return new GenericJavaOneToManyRelationshipReference(this);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOneToManyRelationshipReference.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOneToManyRelationshipReference.java
deleted file mode 100644
index d85cb0692e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOneToManyRelationshipReference.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.java.JavaOneToManyMapping;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaOneToManyRelationshipReference;
-
-public class GenericJavaOneToManyRelationshipReference
- extends AbstractJavaOneToManyRelationshipReference
-{
-
- public GenericJavaOneToManyRelationshipReference(JavaOneToManyMapping parent) {
- super(parent);
- }
-
- @Override
- protected JoiningStrategy calculatePredominantJoiningStrategy() {
- if (this.mappedByJoiningStrategy.getMappedByAttribute() != null) {
- return this.mappedByJoiningStrategy;
- }
- return this.joinTableJoiningStrategy;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOneToOneMapping.java
deleted file mode 100644
index 365e45a6da..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOneToOneMapping.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaOneToOneMapping;
-
-
-public class GenericJavaOneToOneMapping
- extends AbstractJavaOneToOneMapping
-{
- public GenericJavaOneToOneMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOrderable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOrderable.java
deleted file mode 100644
index cb2620dc1a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOrderable.java
+++ /dev/null
@@ -1,358 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrderColumn2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrderable2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.OrderByAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-
-public class GenericJavaOrderable
- extends AbstractJavaJpaContextNode
- implements JavaOrderable2_0
-{
- protected String specifiedOrderBy = null;
- protected boolean noOrdering = false;
- protected boolean pkOrdering = false;
- protected boolean customOrdering = false;
-
- protected boolean orderColumnOrdering = false;
- protected final JavaOrderColumn2_0 orderColumn;
-
- protected String specifiedMapKey;
- protected boolean noMapKey = false;
- protected boolean pkMapKey = false;
- protected boolean customMapKey = false;
-
-
- public GenericJavaOrderable(JavaAttributeMapping parent) {
- super(parent);
- this.orderColumn = ((JpaFactory2_0) getJpaFactory()).buildJavaOrderColumn(this, this);
- }
-
- public void initialize() {
- this.initializeOrdering();
- }
-
- public void update() {
- this.updateOrdering();
- }
-
- @Override
- public JavaAttributeMapping getParent() {
- return (JavaAttributeMapping) super.getParent();
- }
-
- protected JavaPersistentAttribute getPersistentAttribute() {
- return getParent().getPersistentAttribute();
- }
-
- protected JavaResourcePersistentAttribute getResourcePersistentAttribute() {
- return this.getPersistentAttribute().getResourcePersistentAttribute();
- }
-
-
- // ********** JavaBaseColumn.Owner implementation **********
-
- public Table getDbTable(String tableName) {
- return this.getTypeMapping().getDbTable(tableName);
- }
-
- public String getDefaultColumnName() {
- return getPersistentAttribute().getName() + "_ORDER"; //$NON-NLS-1$
- }
-
- public TypeMapping getTypeMapping() {
- return getPersistentAttribute().getTypeMapping();
- }
-
- // ********** order by **********
-
- public String getSpecifiedOrderBy() {
- return this.specifiedOrderBy;
- }
-
- public void setSpecifiedOrderBy(String orderBy) {
- String old = this.specifiedOrderBy;
- this.specifiedOrderBy = orderBy;
- OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation();
- if (orderBy == null) {
- if (orderByAnnotation != null) {
- this.removeOrderByAnnotation();
- }
- } else {
- if (orderByAnnotation == null) {
- orderByAnnotation = this.addOrderByAnnotation();
- }
- orderByAnnotation.setValue(orderBy);
- }
- this.firePropertyChanged(SPECIFIED_ORDER_BY_PROPERTY, old, orderBy);
- }
-
- protected void setSpecifiedOrderBy_(String orderBy) {
- String old = this.specifiedOrderBy;
- this.specifiedOrderBy = orderBy;
- this.firePropertyChanged(SPECIFIED_ORDER_BY_PROPERTY, old, orderBy);
- }
-
- protected void initializeOrdering() {
- OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation();
- OrderColumn2_0Annotation orderColumnAnnotation = this.getOrderColumnAnnotation();
- if (orderByAnnotation == null && orderColumnAnnotation == null) {
- this.noOrdering = true;
- } else if (orderByAnnotation != null){
- this.specifiedOrderBy = orderByAnnotation.getValue();
- if (this.specifiedOrderBy == null) {
- this.pkOrdering = true;
- } else {
- this.customOrdering = true;
- }
- } else {
- this.orderColumnOrdering = true;
- this.orderColumn.initialize(orderColumnAnnotation);
- }
- }
-
- protected void updateOrdering() {
- OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation();
- OrderColumn2_0Annotation orderColumnAnnotation = this.getOrderColumnAnnotation();
- if (orderByAnnotation == null && orderColumnAnnotation == null) {
- this.setSpecifiedOrderBy_(null);
- this.setNoOrdering_(true);
- this.setPkOrdering_(false);
- this.setCustomOrdering_(false);
- this.setOrderColumnOrdering_(false);
- } else if (orderByAnnotation != null) {
- String ob = orderByAnnotation.getValue();
- this.setSpecifiedOrderBy_(ob);
- this.setNoOrdering_(false);
- this.setPkOrdering_(ob == null);
- this.setCustomOrdering_(ob != null);
- this.setOrderColumnOrdering_(false);
- } else {
- this.setSpecifiedOrderBy_(null);
- this.setNoOrdering_(false);
- this.setPkOrdering_(false);
- this.setCustomOrdering_(false);
- this.setOrderColumnOrdering_(true);
- this.orderColumn.update(orderColumnAnnotation);
- }
- }
-
- protected OrderByAnnotation getOrderByAnnotation() {
- return (OrderByAnnotation) this.getResourcePersistentAttribute().getAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- }
-
- protected OrderByAnnotation addOrderByAnnotation() {
- return (OrderByAnnotation) this.getResourcePersistentAttribute().addAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- }
-
- protected void removeOrderByAnnotation() {
- this.getResourcePersistentAttribute().removeAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- }
-
-
- // ********** no ordering **********
-
- public boolean isNoOrdering() {
- return this.noOrdering;
- }
-
- public void setNoOrdering(boolean noOrdering) {
- boolean old = this.noOrdering;
- this.noOrdering = noOrdering;
- if (noOrdering) {
- if (this.getOrderByAnnotation() != null) {
- this.removeOrderByAnnotation();
- }
- if (this.getOrderColumnAnnotation() != null) {
- this.removeOrderColumnAnnotation();
- }
- } else {
- // the 'noOrdering' flag is cleared as a
- // side-effect of setting the other flags,
- // via a call to #setNoOrdering_(boolean)
- }
- this.firePropertyChanged(NO_ORDERING_PROPERTY, old, noOrdering);
- }
-
- protected void setNoOrdering_(boolean noOrdering) {
- boolean old = this.noOrdering;
- this.noOrdering = noOrdering;
- this.firePropertyChanged(NO_ORDERING_PROPERTY, old, noOrdering);
- }
-
-
- // ********** pk ordering **********
-
- public boolean isPkOrdering() {
- return this.pkOrdering;
- }
-
- public void setPkOrdering(boolean pkOrdering) {
- boolean old = this.pkOrdering;
- this.pkOrdering = pkOrdering;
- OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation();
- if (pkOrdering) {
- if (orderByAnnotation == null) {
- this.addOrderByAnnotation();
- } else {
- orderByAnnotation.setValue(null);
- }
- } else {
- // the 'pkOrdering' flag is cleared as a
- // side-effect of setting the other flags,
- // via a call to #setPkOrdering_(boolean)
- }
- this.firePropertyChanged(PK_ORDERING_PROPERTY, old, pkOrdering);
- }
-
- protected void setPkOrdering_(boolean pkOrdering) {
- boolean old = this.pkOrdering;
- this.pkOrdering = pkOrdering;
- this.firePropertyChanged(PK_ORDERING_PROPERTY, old, pkOrdering);
- }
-
-
- // ********** custom ordering **********
-
- public boolean isCustomOrdering() {
- return this.customOrdering;
- }
-
- public void setCustomOrdering(boolean customOrdering) {
- boolean old = this.customOrdering;
- this.customOrdering = customOrdering;
- if (customOrdering) {
- this.setSpecifiedOrderBy(""); //$NON-NLS-1$
- } else {
- // the 'customOrdering' flag is cleared as a
- // side-effect of setting the other flags,
- // via a call to #setCustomOrdering_(boolean)
- }
- this.firePropertyChanged(CUSTOM_ORDERING_PROPERTY, old, customOrdering);
- }
-
- protected void setCustomOrdering_(boolean customOrdering) {
- boolean old = this.customOrdering;
- this.customOrdering = customOrdering;
- this.firePropertyChanged(CUSTOM_ORDERING_PROPERTY, old, customOrdering);
- }
-
- // ********** order column 2.0 **********
-
- public boolean isOrderColumnOrdering() {
- return this.orderColumnOrdering;
- }
-
- public void setOrderColumnOrdering(boolean orderColumnOrdering) {
- boolean old = this.orderColumnOrdering;
- this.orderColumnOrdering = orderColumnOrdering;
- OrderColumn2_0Annotation orderColumnAnnotation = this.getOrderColumnAnnotation();
- if (orderColumnOrdering) {
- if (orderColumnAnnotation == null) {
- this.addOrderColumnAnnotation();
- }
- this.removeOrderByAnnotation();
- } else {
- removeOrderColumnAnnotation();
- }
- this.firePropertyChanged(ORDER_COLUMN_ORDERING_PROPERTY, old, orderColumnOrdering);
- }
-
- protected void setOrderColumnOrdering_(boolean orderColumnOrdering) {
- boolean old = this.orderColumnOrdering;
- this.orderColumnOrdering = orderColumnOrdering;
- this.firePropertyChanged(ORDER_COLUMN_ORDERING_PROPERTY, old, orderColumnOrdering);
- }
-
- public JavaOrderColumn2_0 getOrderColumn() {
- return this.orderColumn;
- }
-
- protected OrderColumn2_0Annotation getOrderColumnAnnotation() {
- return (OrderColumn2_0Annotation) this.getResourcePersistentAttribute().getAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME);
- }
-
- protected OrderColumn2_0Annotation addOrderColumnAnnotation() {
- return (OrderColumn2_0Annotation) this.getResourcePersistentAttribute().addAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME);
- }
-
- protected void removeOrderColumnAnnotation() {
- this.getResourcePersistentAttribute().removeAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME);
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.getOrderColumn().javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return null;
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = this.getOrderByAnnotationTextRange(astRoot);
- return (textRange != null) ? textRange : this.getParent().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 (getOrderColumnAnnotation() != null && getOrderByAnnotation() != null) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ORDER_COLUMN_AND_ORDER_BY_BOTH_SPECIFIED,
- new String[] {getPersistentAttribute().getName()},
- this.getParent(),
- this.getOrderByAnnotationTextRange(astRoot)
- )
- );
- }
- if (isOrderColumnOrdering()) {
- //TODO validation message if type is not List
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java
deleted file mode 100644
index 7d052c2afb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-
-/**
- * Generic Java persistent attribute
- */
-public class GenericJavaPersistentAttribute
- extends AbstractJavaPersistentAttribute
-{
-
- public GenericJavaPersistentAttribute(PersistentType parent, JavaResourcePersistentAttribute jrpa) {
- super(parent, jrpa);
- }
-
-
- // ********** AccessHolder implementation **********
-
- /**
- * GenericJavaPersistentAttribute does not support specified access (no access element in 1.0), so we return null
- */
- public AccessType getSpecifiedAccess() {
- return null;
- }
-
- public void setSpecifiedAccess(AccessType specifiedAccess) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentType.java
deleted file mode 100644
index a18bb0ff37..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentType.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaPersistentType;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-
-/**
- * JPA 1.0 Java persistent type.
- * The specified access is always null.
- */
-public class GenericJavaPersistentType
- extends AbstractJavaPersistentType
-{
-
- public GenericJavaPersistentType(PersistentType.Owner parent, JavaResourcePersistentType jrpt) {
- super(parent, jrpt);
- }
-
-
- // ********** access **********
-
- /**
- * GenericJavaPersistentType does not support specified access (no Access
- * annotation in 1.0), so we return null
- */
- @Override
- protected AccessType buildSpecifiedAccess() {
- return null;
- }
-
- /**
- * GenericJavaPersistentType does not support specified access
- * (no Access annotation in 1.0)
- */
- public void setSpecifiedAccess(AccessType specifiedAccess) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java
deleted file mode 100644
index bdc14fcb28..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.java.JavaBaseJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaNamedColumn;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-
-public class GenericJavaPrimaryKeyJoinColumn extends AbstractJavaNamedColumn<PrimaryKeyJoinColumnAnnotation>
- implements JavaPrimaryKeyJoinColumn
-{
- protected String specifiedReferencedColumnName;
-
- protected String defaultReferencedColumnName;
-
- public GenericJavaPrimaryKeyJoinColumn(JavaJpaContextNode parent, JavaBaseJoinColumn.Owner owner) {
- super(parent, owner);
- }
-
- @Override
- public void initialize(PrimaryKeyJoinColumnAnnotation column) {
- super.initialize(column);
- this.specifiedReferencedColumnName = this.getResourceReferencedColumnName();
- this.defaultReferencedColumnName = this.buildDefaultReferencedColumnName();
- }
-
- @Override
- public void update(PrimaryKeyJoinColumnAnnotation resourceColumn) {
- super.update(resourceColumn);
- this.setSpecifiedReferencedColumnName_(this.getResourceReferencedColumnName());
- this.setDefaultReferencedColumnName(this.buildDefaultReferencedColumnName());
- }
-
- //************** JavaNamedColumn implementation ***************
- @Override
- public JavaBaseJoinColumn.Owner getOwner() {
- return (JavaBaseJoinColumn.Owner) super.getOwner();
- }
-
- //************** BaseJoinColumn implementation ***************
-
- public String getReferencedColumnName() {
- return (this.specifiedReferencedColumnName == null) ? this.defaultReferencedColumnName : this.specifiedReferencedColumnName;
- }
-
- public String getSpecifiedReferencedColumnName() {
- return this.specifiedReferencedColumnName;
- }
-
- public void setSpecifiedReferencedColumnName(String newSpecifiedReferencedColumnName) {
- String oldSpecifiedReferencedColumnName = this.specifiedReferencedColumnName;
- this.specifiedReferencedColumnName = newSpecifiedReferencedColumnName;
- getResourceColumn().setReferencedColumnName(newSpecifiedReferencedColumnName);
- firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, oldSpecifiedReferencedColumnName, newSpecifiedReferencedColumnName);
- }
-
- protected void setSpecifiedReferencedColumnName_(String newSpecifiedReferencedColumnName) {
- String oldSpecifiedReferencedColumnName = this.specifiedReferencedColumnName;
- this.specifiedReferencedColumnName = newSpecifiedReferencedColumnName;
- firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, oldSpecifiedReferencedColumnName, newSpecifiedReferencedColumnName);
- }
-
- public String getDefaultReferencedColumnName() {
- return this.defaultReferencedColumnName;
- }
-
- protected void setDefaultReferencedColumnName(String newDefaultReferencedColumnName) {
- String oldDefaultReferencedColumnName = this.defaultReferencedColumnName;
- this.defaultReferencedColumnName = newDefaultReferencedColumnName;
- firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, oldDefaultReferencedColumnName, newDefaultReferencedColumnName);
- }
-
- public boolean isVirtual() {
- return getOwner().isVirtual(this);
- }
-
- public Column getReferencedDbColumn() {
- Table table = this.getReferencedColumnDbTable();
- return (table == null) ? null : table.getColumnForIdentifier(this.getReferencedColumnName());
- }
-
- public Table getReferencedColumnDbTable() {
- return getOwner().getReferencedColumnDbTable();
- }
-
- public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
- return this.getResourceColumn().referencedColumnNameTouches(pos, astRoot);
- }
-
- @Override
- public Iterator<String> connectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.connectedJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.referencedColumnNameTouches(pos, astRoot)) {
- return this.javaCandidateReferencedColumnNames(filter);
- }
- return null;
- }
-
- private Iterator<String> javaCandidateReferencedColumnNames(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.candidateReferencedColumnNames(filter));
- }
-
- private Iterator<String> candidateReferencedColumnNames(Filter<String> filter) {
- return new FilteringIterator<String, String>(this.candidateReferencedColumnNames(), filter);
- }
-
- private Iterator<String> candidateReferencedColumnNames() {
- Table table = this.getOwner().getReferencedColumnDbTable();
- return (table != null) ? table.sortedColumnIdentifiers() : EmptyIterator.<String> instance();
- }
-
- public boolean isReferencedColumnResolved() {
- return getReferencedDbColumn() != null;
- }
-
- public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) {
- return this.getResourceColumn().getReferencedColumnNameTextRange(astRoot);
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = getResourceColumn().getTextRange(astRoot);
- return (textRange != null) ? textRange : this.getOwner().getValidationTextRange(astRoot);
- }
-
- protected String getResourceReferencedColumnName() {
- return getResourceColumn().getReferencedColumnName();
- }
-
- //TODO not correct when we start supporting primaryKeyJoinColumns in 1-1 mappings
- protected String buildDefaultReferencedColumnName() {
- return buildDefaultName();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- super.toString(sb);
- sb.append("=>"); //$NON-NLS-1$
- sb.append(this.getReferencedColumnName());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaQueryContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaQueryContainer.java
deleted file mode 100644
index 3baaedc7bc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaQueryContainer.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.NamedNativeQuery;
-import org.eclipse.jpt.core.context.NamedQuery;
-import org.eclipse.jpt.core.context.Query;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaNamedNativeQuery;
-import org.eclipse.jpt.core.context.java.JavaNamedQuery;
-import org.eclipse.jpt.core.context.java.JavaQuery;
-import org.eclipse.jpt.core.context.java.JavaQueryContainer;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.NamedQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaQueryContainer extends AbstractJavaJpaContextNode
- implements JavaQueryContainer
-{
- protected JavaResourcePersistentMember javaResourcePersistentMember;
-
- protected final List<JavaNamedQuery> namedQueries;
-
- protected final List<JavaNamedNativeQuery> namedNativeQueries;
-
- public GenericJavaQueryContainer(JavaJpaContextNode parent) {
- super(parent);
- this.namedQueries = new ArrayList<JavaNamedQuery>();
- this.namedNativeQueries = new ArrayList<JavaNamedNativeQuery>();
- }
-
- @Override
- public JavaJpaContextNode getParent() {
- return (JavaJpaContextNode) super.getParent();
- }
-
-
- public ListIterator<JavaNamedQuery> namedQueries() {
- return new CloneListIterator<JavaNamedQuery>(this.namedQueries);
- }
-
- public int namedQueriesSize() {
- return this.namedQueries.size();
- }
-
- public JavaNamedQuery addNamedQuery(int index) {
- JavaNamedQuery namedQuery = getJpaFactory().buildJavaNamedQuery(this);
- this.namedQueries.add(index, namedQuery);
- NamedQueryAnnotation namedQueryAnnotation =
- (NamedQueryAnnotation) this.javaResourcePersistentMember.
- addAnnotation(
- index, NamedQueryAnnotation.ANNOTATION_NAME,
- NamedQueriesAnnotation.ANNOTATION_NAME);
- namedQuery.initialize(namedQueryAnnotation);
- fireItemAdded(NAMED_QUERIES_LIST, index, namedQuery);
- return namedQuery;
- }
-
- protected void addNamedQuery(int index, JavaNamedQuery namedQuery) {
- addItemToList(index, namedQuery, this.namedQueries, NAMED_QUERIES_LIST);
- }
-
- protected void addNamedQuery(JavaNamedQuery namedQuery) {
- this.addNamedQuery(this.namedQueries.size(), namedQuery);
- }
-
- public void removeNamedQuery(NamedQuery namedQuery) {
- removeNamedQuery(this.namedQueries.indexOf(namedQuery));
- }
-
- public void removeNamedQuery(int index) {
- JavaNamedQuery removedNamedQuery = this.namedQueries.remove(index);
- this.javaResourcePersistentMember.removeAnnotation(
- index, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
- fireItemRemoved(NAMED_QUERIES_LIST, index, removedNamedQuery);
- }
-
- protected void removeNamedQuery_(JavaNamedQuery namedQuery) {
- removeItemFromList(namedQuery, this.namedQueries, NAMED_QUERIES_LIST);
- }
-
- public void moveNamedQuery(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.namedQueries, targetIndex, sourceIndex);
- this.javaResourcePersistentMember.moveAnnotation(
- targetIndex, sourceIndex, NamedQueriesAnnotation.ANNOTATION_NAME);
- fireItemMoved(NAMED_QUERIES_LIST, targetIndex, sourceIndex);
- }
-
- public ListIterator<JavaNamedNativeQuery> namedNativeQueries() {
- return new CloneListIterator<JavaNamedNativeQuery>(this.namedNativeQueries);
- }
-
- public int namedNativeQueriesSize() {
- return this.namedNativeQueries.size();
- }
-
- public JavaNamedNativeQuery addNamedNativeQuery(int index) {
- JavaNamedNativeQuery namedNativeQuery = getJpaFactory().buildJavaNamedNativeQuery(this);
- this.namedNativeQueries.add(index, namedNativeQuery);
- NamedNativeQueryAnnotation namedNativeQueryAnnotation =
- (NamedNativeQueryAnnotation) this.javaResourcePersistentMember.
- addAnnotation(
- index, NamedNativeQueryAnnotation.ANNOTATION_NAME,
- NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- namedNativeQuery.initialize(namedNativeQueryAnnotation);
- fireItemAdded(NAMED_NATIVE_QUERIES_LIST, index, namedNativeQuery);
- return namedNativeQuery;
- }
-
- protected void addNamedNativeQuery(int index, JavaNamedNativeQuery namedNativeQuery) {
- addItemToList(index, namedNativeQuery, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
- }
-
- protected void addNamedNativeQuery(JavaNamedNativeQuery namedNativeQuery) {
- this.addNamedNativeQuery(this.namedNativeQueries.size(), namedNativeQuery);
- }
-
- public void removeNamedNativeQuery(NamedNativeQuery namedNativeQuery) {
- this.removeNamedNativeQuery(this.namedNativeQueries.indexOf(namedNativeQuery));
- }
-
- public void removeNamedNativeQuery(int index) {
- JavaNamedNativeQuery removedNamedNativeQuery = this.namedNativeQueries.remove(index);
- this.javaResourcePersistentMember.removeAnnotation(
- index, NamedNativeQueryAnnotation.ANNOTATION_NAME,
- NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- fireItemRemoved(NAMED_NATIVE_QUERIES_LIST, index, removedNamedNativeQuery);
- }
-
- protected void removeNamedNativeQuery_(JavaNamedNativeQuery namedNativeQuery) {
- removeItemFromList(namedNativeQuery, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
- }
-
- public void moveNamedNativeQuery(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.namedNativeQueries, targetIndex, sourceIndex);
- this.javaResourcePersistentMember.moveAnnotation(
- targetIndex, sourceIndex, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- fireItemMoved(NAMED_NATIVE_QUERIES_LIST, targetIndex, sourceIndex);
- }
-
-
-
- public void initialize(JavaResourcePersistentMember jrpm) {
- this.javaResourcePersistentMember = jrpm;
- this.initializeNamedQueries();
- this.initializeNamedNativeQueries();
- }
-
- protected void initializeNamedQueries() {
- for (Iterator<NestableAnnotation> stream = this.javaResourcePersistentMember.
- annotations(
- NamedQueryAnnotation.ANNOTATION_NAME,
- NamedQueriesAnnotation.ANNOTATION_NAME);
- stream.hasNext(); ) {
- this.namedQueries.add(buildNamedQuery((NamedQueryAnnotation) stream.next()));
- }
- }
-
- protected void initializeNamedNativeQueries() {
- for (Iterator<NestableAnnotation> stream = this.javaResourcePersistentMember.
- annotations(
- NamedNativeQueryAnnotation.ANNOTATION_NAME,
- NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- stream.hasNext(); ) {
- this.namedNativeQueries.add(buildNamedNativeQuery((NamedNativeQueryAnnotation) stream.next()));
- }
- }
-
- protected JavaNamedQuery buildNamedQuery(NamedQueryAnnotation namedQueryResource) {
- JavaNamedQuery namedQuery = getJpaFactory().buildJavaNamedQuery(this);
- namedQuery.initialize(namedQueryResource);
- return namedQuery;
- }
-
- protected JavaNamedNativeQuery buildNamedNativeQuery(NamedNativeQueryAnnotation namedNativeQueryResource) {
- JavaNamedNativeQuery namedNativeQuery = getJpaFactory().buildJavaNamedNativeQuery(this);
- namedNativeQuery.initialize(namedNativeQueryResource);
- return namedNativeQuery;
- }
-
- public void update(JavaResourcePersistentMember jrpm) {
- this.javaResourcePersistentMember = jrpm;
- this.updateNamedQueries();
- this.updateNamedNativeQueries();
- }
-
- protected void updateNamedQueries() {
- ListIterator<JavaNamedQuery> queries = namedQueries();
- Iterator<NestableAnnotation> resourceNamedQueries =
- this.javaResourcePersistentMember.annotations(
- NamedQueryAnnotation.ANNOTATION_NAME,
- NamedQueriesAnnotation.ANNOTATION_NAME);
-
- while (queries.hasNext()) {
- JavaNamedQuery namedQuery = queries.next();
- if (resourceNamedQueries.hasNext()) {
- namedQuery.update((NamedQueryAnnotation) resourceNamedQueries.next());
- }
- else {
- removeNamedQuery_(namedQuery);
- }
- }
-
- while (resourceNamedQueries.hasNext()) {
- addNamedQuery(buildNamedQuery((NamedQueryAnnotation) resourceNamedQueries.next()));
- }
- }
-
- protected void updateNamedNativeQueries() {
- ListIterator<JavaNamedNativeQuery> queries = namedNativeQueries();
- Iterator<NestableAnnotation> resourceNamedNativeQueries =
- this.javaResourcePersistentMember.annotations(
- NamedNativeQueryAnnotation.ANNOTATION_NAME,
- NamedNativeQueriesAnnotation.ANNOTATION_NAME);
-
- while (queries.hasNext()) {
- JavaNamedNativeQuery namedQuery = queries.next();
- if (resourceNamedNativeQueries.hasNext()) {
- namedQuery.update((NamedNativeQueryAnnotation) resourceNamedNativeQueries.next());
- }
- else {
- removeNamedNativeQuery_(namedQuery);
- }
- }
-
- while (resourceNamedNativeQueries.hasNext()) {
- addNamedNativeQuery(buildNamedNativeQuery((NamedNativeQueryAnnotation) resourceNamedNativeQueries.next()));
- }
- }
-
-
- //********** Validation ********************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.validateQueries(messages, astRoot);
- }
-
- protected void validateQueries(List<IMessage> messages, CompilationUnit astRoot) {
- for (Iterator<JavaQuery> localQueries = this.queries(); localQueries.hasNext(); ) {
- JavaQuery localQuery = localQueries.next();
- for (Iterator<Query> globalQueries = this.getPersistenceUnit().queries(); globalQueries.hasNext(); ) {
- if (localQuery.duplicates(globalQueries.next())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.QUERY_DUPLICATE_NAME,
- new String[] {localQuery.getName()},
- localQuery,
- localQuery.getNameTextRange(astRoot)
- )
- );
- }
- }
- }
- }
-
-
- @SuppressWarnings("unchecked")
- public Iterator<JavaQuery> queries() {
- return new CompositeIterator<JavaQuery>(this.namedNativeQueries(), this.namedQueries());
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.javaResourcePersistentMember.getTextRange(astRoot);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaQueryHint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaQueryHint.java
deleted file mode 100644
index e1e3b48891..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaQueryHint.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.QueryHint;
-import org.eclipse.jpt.core.context.java.JavaQuery;
-import org.eclipse.jpt.core.context.java.JavaQueryHint;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.resource.java.QueryHintAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class GenericJavaQueryHint extends AbstractJavaJpaContextNode implements JavaQueryHint
-{
- protected String name;
-
- protected String value;
-
- protected QueryHintAnnotation resourceQueryHint;
-
- public GenericJavaQueryHint(JavaQuery parent) {
- super(parent);
- }
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String newName) {
- String oldName = this.name;
- this.name = newName;
- this.resourceQueryHint.setName(newName);
- firePropertyChanged(QueryHint.NAME_PROPERTY, oldName, newName);
- }
-
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String newValue) {
- String oldValue = this.value;
- this.value = newValue;
- this.resourceQueryHint.setValue(newValue);
- firePropertyChanged(QueryHint.VALUE_PROPERTY, oldValue, newValue);
- }
-
-
- public void initialize(QueryHintAnnotation resourceQueryHint) {
- this.resourceQueryHint = resourceQueryHint;
- this.name = resourceQueryHint.getName();
- this.value = resourceQueryHint.getValue();
- }
-
- public void update(QueryHintAnnotation resourceQueryHint) {
- this.resourceQueryHint = resourceQueryHint;
- this.setName(resourceQueryHint.getName());
- this.setValue(resourceQueryHint.getValue());
- }
-
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.resourceQueryHint.getTextRange(astRoot);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java
deleted file mode 100644
index f39103bdf1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java
+++ /dev/null
@@ -1,398 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaBaseJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaSecondaryTable;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaTable;
-import org.eclipse.jpt.core.internal.resource.java.NullPrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-import org.eclipse.jpt.utility.internal.iterators.SingleElementListIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- *
- */
-public class GenericJavaSecondaryTable
- extends AbstractJavaTable
- implements JavaSecondaryTable
-{
- protected final List<JavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns;
- protected final JavaBaseJoinColumn.Owner primaryKeyJoinColumnOwner;
-
- protected JavaPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn;
-
- protected SecondaryTableAnnotation resourceSecondaryTable;
-
- public GenericJavaSecondaryTable(JavaEntity parent) {
- super(parent);
- this.specifiedPrimaryKeyJoinColumns = new ArrayList<JavaPrimaryKeyJoinColumn>();
- this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
- }
-
- protected JavaBaseJoinColumn.Owner buildPrimaryKeyJoinColumnOwner() {
- return new PrimaryKeyJoinColumnOwner();
- }
-
- @Override
- public JavaEntity getParent() {
- return (JavaEntity) super.getParent();
- }
-
-
- //***************** AbstractJavaTable implementation ********************
-
- @Override
- protected String getAnnotationName() {
- return SecondaryTableAnnotation.ANNOTATION_NAME;
- }
-
- @Override
- protected SecondaryTableAnnotation getAnnotation() {
- return this.resourceSecondaryTable;
- }
-
- public boolean isResourceSpecified() {
- return true;
- }
-
- // 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();
- }
-
-
- //***************** ISecondaryTable implementation ********************
-
- public ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
- return this.containsSpecifiedPrimaryKeyJoinColumns() ? this.specifiedPrimaryKeyJoinColumns() : this.defaultPrimaryKeyJoinColumns();
- }
-
- public int primaryKeyJoinColumnsSize() {
- return this.containsSpecifiedPrimaryKeyJoinColumns() ? this.specifiedPrimaryKeyJoinColumnsSize() : this.defaultPrimaryKeyJoinColumnsSize();
- }
-
- public ListIterator<JavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns() {
- return new CloneListIterator<JavaPrimaryKeyJoinColumn>(this.specifiedPrimaryKeyJoinColumns);
- }
-
- public int specifiedPrimaryKeyJoinColumnsSize() {
- return this.specifiedPrimaryKeyJoinColumns.size();
- }
-
- public boolean containsSpecifiedPrimaryKeyJoinColumns() {
- return !this.specifiedPrimaryKeyJoinColumns.isEmpty();
- }
-
- public JavaPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn() {
- return this.defaultPrimaryKeyJoinColumn;
- }
-
- protected void setDefaultPrimaryKeyJoinColumn(JavaPrimaryKeyJoinColumn newPkJoinColumn) {
- JavaPrimaryKeyJoinColumn oldPkJoinColumn = this.defaultPrimaryKeyJoinColumn;
- this.defaultPrimaryKeyJoinColumn = newPkJoinColumn;
- firePropertyChanged(DEFAULT_PRIMARY_KEY_JOIN_COLUMN, oldPkJoinColumn, newPkJoinColumn);
- }
-
- protected ListIterator<JavaPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns() {
- if (this.defaultPrimaryKeyJoinColumn != null) {
- return new SingleElementListIterator<JavaPrimaryKeyJoinColumn>(this.defaultPrimaryKeyJoinColumn);
- }
- return EmptyListIterator.instance();
- }
-
- protected int defaultPrimaryKeyJoinColumnsSize() {
- return (this.defaultPrimaryKeyJoinColumn == null) ? 0 : 1;
- }
-
- public JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
- // Clear out the default now so it doesn't get removed during an update and
- // cause change notifications to be sent to the UI in the wrong order.
- JavaPrimaryKeyJoinColumn oldDefault = this.defaultPrimaryKeyJoinColumn;
- this.defaultPrimaryKeyJoinColumn = null;
-
- JavaPrimaryKeyJoinColumn pkJoinColumn = this.getJpaFactory().buildJavaPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner);
- this.specifiedPrimaryKeyJoinColumns.add(index, pkJoinColumn);
- PrimaryKeyJoinColumnAnnotation pkJoinColumnAnnotation = this.resourceSecondaryTable.addPkJoinColumn(index);
- pkJoinColumn.initialize(pkJoinColumnAnnotation);
- this.fireItemAdded(SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, pkJoinColumn);
-
- this.firePropertyChanged(DEFAULT_PRIMARY_KEY_JOIN_COLUMN, oldDefault, null);
- return pkJoinColumn;
- }
-
- protected void addSpecifiedPrimaryKeyJoinColumn(int index, JavaPrimaryKeyJoinColumn primaryKeyJoinColumn) {
- addItemToList(index, primaryKeyJoinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- protected void addSpecifiedPrimaryKeyJoinColumn(JavaPrimaryKeyJoinColumn primaryKeyJoinColumn) {
- this.addSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.size(), primaryKeyJoinColumn);
- }
-
- public void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn joinColumn) {
- this.removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.indexOf(joinColumn));
- }
-
- public void removeSpecifiedPrimaryKeyJoinColumn(int index) {
- JavaPrimaryKeyJoinColumn removedPrimaryKeyJoinColumn = this.specifiedPrimaryKeyJoinColumns.remove(index);
- if (!containsSpecifiedPrimaryKeyJoinColumns()) {
- //create the defaultJoinColumn now or this will happen during project update
- //after removing the join column from the resource model. That causes problems
- //in the UI because the change notifications end up in the wrong order.
- this.defaultPrimaryKeyJoinColumn = buildPrimaryKeyJoinColumn(new NullPrimaryKeyJoinColumnAnnotation(this.resourceSecondaryTable));
- }
- this.resourceSecondaryTable.removePkJoinColumn(index);
- fireItemRemoved(SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, removedPrimaryKeyJoinColumn);
- if (this.defaultPrimaryKeyJoinColumn != null) {
- //fire change notification if a defaultJoinColumn was created above
- this.firePropertyChanged(Entity.DEFAULT_PRIMARY_KEY_JOIN_COLUMN, null, this.defaultPrimaryKeyJoinColumn);
- }
- }
-
- protected void removeSpecifiedPrimaryKeyJoinColumn_(JavaPrimaryKeyJoinColumn primaryKeyJoinColumn) {
- removeItemFromList(primaryKeyJoinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.specifiedPrimaryKeyJoinColumns, targetIndex, sourceIndex);
- this.resourceSecondaryTable.movePkJoinColumn(targetIndex, sourceIndex);
- fireItemMoved(SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
- }
-
- public JavaEntity getJavaEntity() {
- return getParent();
- }
-
-
- //********************* updating ************************
-
- public void initialize(SecondaryTableAnnotation secondaryTable) {
- super.initialize(secondaryTable);
- this.resourceSecondaryTable = secondaryTable;
- this.initializeSpecifiedPrimaryKeyJoinColumns(secondaryTable);
- this.initializeDefaultPrimaryKeyJoinColumn(secondaryTable);
- }
-
- protected void initializeSpecifiedPrimaryKeyJoinColumns(SecondaryTableAnnotation secondaryTable) {
- ListIterator<PrimaryKeyJoinColumnAnnotation> annotations = secondaryTable.pkJoinColumns();
-
- while(annotations.hasNext()) {
- this.specifiedPrimaryKeyJoinColumns.add(buildPrimaryKeyJoinColumn(annotations.next()));
- }
- }
-
- protected boolean shouldBuildDefaultPrimaryKeyJoinColumn() {
- return !containsSpecifiedPrimaryKeyJoinColumns();
- }
-
- protected void initializeDefaultPrimaryKeyJoinColumn(SecondaryTableAnnotation secondaryTable) {
- if (!shouldBuildDefaultPrimaryKeyJoinColumn()) {
- return;
- }
- this.defaultPrimaryKeyJoinColumn = buildPrimaryKeyJoinColumn(new NullPrimaryKeyJoinColumnAnnotation(secondaryTable));
- }
-
-
- public void update(SecondaryTableAnnotation sta) {
- this.resourceSecondaryTable = sta;
- super.update(sta);
- this.updateSpecifiedPrimaryKeyJoinColumns(sta);
- this.updateDefaultPrimaryKeyJoinColumn(sta);
- }
-
- protected void updateSpecifiedPrimaryKeyJoinColumns(SecondaryTableAnnotation sta) {
- ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns = specifiedPrimaryKeyJoinColumns();
- ListIterator<PrimaryKeyJoinColumnAnnotation> resourcePrimaryKeyJoinColumns = sta.pkJoinColumns();
-
- while (primaryKeyJoinColumns.hasNext()) {
- JavaPrimaryKeyJoinColumn primaryKeyJoinColumn = primaryKeyJoinColumns.next();
- if (resourcePrimaryKeyJoinColumns.hasNext()) {
- primaryKeyJoinColumn.update(resourcePrimaryKeyJoinColumns.next());
- }
- else {
- removeSpecifiedPrimaryKeyJoinColumn_(primaryKeyJoinColumn);
- }
- }
-
- while (resourcePrimaryKeyJoinColumns.hasNext()) {
- addSpecifiedPrimaryKeyJoinColumn(buildPrimaryKeyJoinColumn(resourcePrimaryKeyJoinColumns.next()));
- }
- }
-
- protected void updateDefaultPrimaryKeyJoinColumn(SecondaryTableAnnotation sta) {
- if (!shouldBuildDefaultPrimaryKeyJoinColumn()) {
- setDefaultPrimaryKeyJoinColumn(null);
- return;
- }
- if (getDefaultPrimaryKeyJoinColumn() == null) {
- this.setDefaultPrimaryKeyJoinColumn(buildPrimaryKeyJoinColumn(new NullPrimaryKeyJoinColumnAnnotation(sta)));
- }
- else {
- this.defaultPrimaryKeyJoinColumn.update(new NullPrimaryKeyJoinColumnAnnotation(sta));
- }
- }
-
- protected JavaPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(PrimaryKeyJoinColumnAnnotation resourcePrimaryKeyJoinColumn) {
- JavaPrimaryKeyJoinColumn primaryKeyJoinColumn = getJpaFactory().buildJavaPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner);
- primaryKeyJoinColumn.initialize(resourcePrimaryKeyJoinColumn);
- return primaryKeyJoinColumn;
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- if (this.connectionProfileIsActive()) {
- this.validateAgainstDatabase(messages, astRoot);
- }
- for (Iterator<JavaPrimaryKeyJoinColumn> stream = this.primaryKeyJoinColumns(); stream.hasNext(); ) {
- stream.next().validate(messages, reporter, astRoot);
- }
- }
-
- protected void validateAgainstDatabase(List<IMessage> messages, CompilationUnit astRoot) {
- if ( ! this.hasResolvedCatalog()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.SECONDARY_TABLE_UNRESOLVED_CATALOG,
- new String[] {this.getCatalog(), this.getName()},
- this,
- this.getCatalogTextRange(astRoot)
- )
- );
- return;
- }
-
- if ( ! this.hasResolvedSchema()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.SECONDARY_TABLE_UNRESOLVED_SCHEMA,
- new String[] {this.getSchema(), this.getName()},
- this,
- this.getSchemaTextRange(astRoot)
- )
- );
- return;
- }
-
- if ( ! this.isResolved()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.SECONDARY_TABLE_UNRESOLVED_NAME,
- new String[] {this.getName()},
- this,
- this.getNameTextRange(astRoot)
- )
- );
- return;
- }
- }
-
-
- // ********** code completion **********
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (JavaPrimaryKeyJoinColumn column : CollectionTools.iterable(this.primaryKeyJoinColumns())) {
- result = column.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
- public boolean isVirtual() {
- return false;
- }
-
-
- // ********** PK join column owner adapter **********
-
- protected class PrimaryKeyJoinColumnOwner
- implements JavaBaseJoinColumn.Owner
- {
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return GenericJavaSecondaryTable.this.getValidationTextRange(astRoot);
- }
-
- public TypeMapping getTypeMapping() {
- return GenericJavaSecondaryTable.this.getJavaEntity();
- }
-
- public Table getDbTable(String tableName) {
- return GenericJavaSecondaryTable.this.getDbTable();
- }
-
- public Table getReferencedColumnDbTable() {
- return getTypeMapping().getPrimaryDbTable();
- }
-
- public boolean isVirtual(BaseJoinColumn joinColumn) {
- return GenericJavaSecondaryTable.this.defaultPrimaryKeyJoinColumn == joinColumn;
- }
-
- public String getDefaultColumnName() {
- if (joinColumnsSize() != 1) {
- return null;
- }
- return getJavaEntity().getPrimaryKeyColumnName();
-
- }
-
- private int joinColumnsSize() {
- return GenericJavaSecondaryTable.this.primaryKeyJoinColumnsSize();
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaSequenceGenerator.java
deleted file mode 100644
index 66ff8640b4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaSequenceGenerator.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaSequenceGenerator;
-
-/**
- *
- */
-public class GenericJavaSequenceGenerator extends AbstractJavaSequenceGenerator
-{
-
- public GenericJavaSequenceGenerator(JavaJpaContextNode parent) {
- super(parent);
- }
-
- // ********** database stuff **********
-
- /**
- * The JPA spec does not allow a sequence to have a schema.
- */
- @Override
- protected String getSchema() {
- return this.getContextDefaultSchema();
- }
-
- /**
- * The JPA spec does not allow a sequence to have a catalog.
- */
- @Override
- protected String getCatalog() {
- return this.getContextDefaultCatalog();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTable.java
deleted file mode 100644
index ec81d5fb15..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTable.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.context.java.JavaTable;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaTable;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.TableAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaTable
- extends AbstractJavaTable
- implements JavaTable
-{
- protected JavaResourcePersistentMember resourcePersistentMember;
-
- public GenericJavaTable(JavaEntity parent) {
- super(parent);
- }
-
- public void initialize(JavaResourcePersistentMember pr) {
- this.resourcePersistentMember = pr;
- initialize(getAnnotation());
- }
-
- //query for the table resource every time on setters.
- //call one setter and the tableResource could change.
- //You could call more than one setter before this object has received any notification
- //from the java resource model
- @Override
- protected TableAnnotation getAnnotation() {
- //TODO get the NullTable from the resource model or build it here in the context model??
- return (TableAnnotation) this.resourcePersistentMember.
- getNonNullAnnotation(getAnnotationName());
- }
-
- public boolean isResourceSpecified() {
- return getAnnotation().isSpecified();
- }
-
- @Override
- protected String getAnnotationName() {
- return TableAnnotation.ANNOTATION_NAME;
- }
-
- @Override
- public JavaEntity getParent() {
- return (JavaEntity) super.getParent();
- }
-
- protected JavaEntity getJavaEntity() {
- return getParent();
- }
-
- @Override
- protected String buildDefaultName() {
- return this.getJavaEntity().getDefaultTableName();
- }
-
- /**
- * Just to remember:
- * Entity.getDefaultSchema()
- * check inheritance - get default schema from root
- * EntityMappings.getSchema()
- * check for specified schema
- * PersistenceUnit.getDefaultSchema()
- * OrmPersistenceUnitDefaults.getSchema()
- * JpaProject.getDefaultSchema()
- * check for user override project setting
- * Catalog.getDefaultSchema()
- * or
- * Database.getDefaultSchema()
- */
- @Override
- protected String buildDefaultSchema() {
- return this.getJavaEntity().getDefaultSchema();
- }
-
- @Override
- protected String buildDefaultCatalog() {
- return this.getJavaEntity().getDefaultCatalog();
- }
-
- public void update(JavaResourcePersistentMember jrpm) {
- this.resourcePersistentMember = jrpm;
- this.update(getAnnotation());
- }
-
-
- //******************* validation **********************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- if (this.connectionProfileIsActive()) {
- this.validateAgainstDatabase(messages, astRoot);
- }
- }
-
- protected void validateAgainstDatabase(List<IMessage> messages, CompilationUnit astRoot) {
- if ( ! this.hasResolvedCatalog()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.TABLE_UNRESOLVED_CATALOG,
- new String[] {this.getCatalog(), this.getName()},
- this,
- this.getCatalogTextRange(astRoot)
- )
- );
- return;
- }
-
- if ( ! this.hasResolvedSchema()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.TABLE_UNRESOLVED_SCHEMA,
- new String[] {this.getSchema(), this.getName()},
- this,
- this.getSchemaTextRange(astRoot)
- )
- );
- return;
- }
-
- if ( ! this.isResolved()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.TABLE_UNRESOLVED_NAME,
- new String[] {this.getName()},
- this,
- this.getNameTextRange(astRoot)
- )
- );
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTableGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTableGenerator.java
deleted file mode 100644
index bb598dfa4d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTableGenerator.java
+++ /dev/null
@@ -1,531 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaTableGenerator;
-import org.eclipse.jpt.core.context.java.JavaUniqueConstraint;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaGenerator;
-import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.db.Database;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.SchemaContainer;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-/**
- *
- */
-public class GenericJavaTableGenerator
- extends AbstractJavaGenerator
- 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 List<JavaUniqueConstraint> uniqueConstraints;
-
-
- // ********** constructor **********
-
- public GenericJavaTableGenerator(JavaJpaContextNode parent) {
- super(parent);
- this.uniqueConstraints = new ArrayList<JavaUniqueConstraint>();
- }
-
-
- // ********** table **********
-
- public String getTable() {
- return (this.specifiedTable != null) ? this.specifiedTable : this.defaultTable;
- }
-
- public String getSpecifiedTable() {
- return this.specifiedTable;
- }
-
- public void setSpecifiedTable(String table) {
- String old = this.specifiedTable;
- this.specifiedTable = table;
- this.getResourceGenerator().setTable(table);
- this.firePropertyChanged(SPECIFIED_TABLE_PROPERTY, old, table);
- }
-
- protected void setSpecifiedTable_(String table) {
- String old = this.specifiedTable;
- this.specifiedTable = table;
- this.firePropertyChanged(SPECIFIED_TABLE_PROPERTY, old, table);
- }
-
- /**
- * The default table is determined by the JPA implementation.
- */
- public String getDefaultTable() {
- return this.defaultTable;
- }
-
-
- // ********** schema **********
-
- @Override
- public String getSchema() {
- return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema;
- }
-
- public String getSpecifiedSchema() {
- return this.specifiedSchema;
- }
-
- public void setSpecifiedSchema(String schema) {
- String old = this.specifiedSchema;
- this.specifiedSchema = schema;
- this.getResourceGenerator().setSchema(schema);
- this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, 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);
- }
-
-
- // ********** catalog **********
-
- @Override
- public String getCatalog() {
- return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog;
- }
-
- public String getSpecifiedCatalog() {
- return this.specifiedCatalog;
- }
-
- public void setSpecifiedCatalog(String catalog) {
- String old = this.specifiedCatalog;
- this.specifiedCatalog = catalog;
- this.getResourceGenerator().setCatalog(catalog);
- this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, 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;
- firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog);
- }
-
-
- // ********** 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) {
- String old = this.specifiedPkColumnName;
- this.specifiedPkColumnName = name;
- this.getResourceGenerator().setPkColumnName(name);
- this.firePropertyChanged(SPECIFIED_PK_COLUMN_NAME_PROPERTY, old, name);
- }
-
- protected void setSpecifiedPkColumnName_(String name) {
- String old = this.specifiedPkColumnName;
- this.specifiedPkColumnName = name;
- this.firePropertyChanged(SPECIFIED_PK_COLUMN_NAME_PROPERTY, old, name);
- }
-
- /**
- * The default primary key column name is determined by the JPA
- * implementation.
- */
- public String getDefaultPkColumnName() {
- return this.defaultPkColumnName;
- }
-
-
- // ********** 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) {
- String old = this.specifiedValueColumnName;
- this.specifiedValueColumnName = name;
- this.getResourceGenerator().setValueColumnName(name);
- this.firePropertyChanged(SPECIFIED_VALUE_COLUMN_NAME_PROPERTY, old, 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;
- }
-
-
- // ********** 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) {
- String old = this.specifiedPkColumnValue;
- this.specifiedPkColumnValue = value;
- this.getResourceGenerator().setPkColumnValue(value);
- this.firePropertyChanged(SPECIFIED_PK_COLUMN_VALUE_PROPERTY, old, 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;
- }
-
-
- // ********** unique constraints **********
-
- public ListIterator<JavaUniqueConstraint> uniqueConstraints() {
- return new CloneListIterator<JavaUniqueConstraint>(this.uniqueConstraints);
- }
-
- public int uniqueConstraintsSize() {
- return this.uniqueConstraints.size();
- }
-
- public JavaUniqueConstraint addUniqueConstraint(int index) {
- JavaUniqueConstraint uniqueConstraint = getJpaFactory().buildJavaUniqueConstraint(this, this);
- this.uniqueConstraints.add(index, uniqueConstraint);
- UniqueConstraintAnnotation uniqueConstraintAnnotation = this.getResourceGenerator().addUniqueConstraint(index);
- uniqueConstraint.initialize(uniqueConstraintAnnotation);
- this.fireItemAdded(UNIQUE_CONSTRAINTS_LIST, index, uniqueConstraint);
- return uniqueConstraint;
- }
-
- public void removeUniqueConstraint(UniqueConstraint uniqueConstraint) {
- this.removeUniqueConstraint(this.uniqueConstraints.indexOf(uniqueConstraint));
- }
-
- public void removeUniqueConstraint(int index) {
- JavaUniqueConstraint uniqueConstraint = this.uniqueConstraints.remove(index);
- this.getResourceGenerator().removeUniqueConstraint(index);
- this.fireItemRemoved(UNIQUE_CONSTRAINTS_LIST, index, uniqueConstraint);
- }
-
- public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.uniqueConstraints, targetIndex, sourceIndex);
- this.getResourceGenerator().moveUniqueConstraint(targetIndex, sourceIndex);
- this.fireItemMoved(UNIQUE_CONSTRAINTS_LIST, targetIndex, sourceIndex);
- }
-
- protected void addUniqueConstraint(int index, JavaUniqueConstraint uniqueConstraint) {
- this.addItemToList(index, uniqueConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- }
-
- protected void addUniqueConstraint(JavaUniqueConstraint uniqueConstraint) {
- this.addUniqueConstraint(this.uniqueConstraints.size(), uniqueConstraint);
- }
-
- protected void removeUniqueConstraint_(JavaUniqueConstraint uniqueConstraint) {
- this.removeItemFromList(uniqueConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- }
-
-
- //******************* UniqueConstraint.Owner implementation ******************
-
- public Iterator<String> candidateUniqueConstraintColumnNames() {
- org.eclipse.jpt.db.Table dbTable = this.getDbTable();
- return (dbTable != null) ? dbTable.sortedColumnIdentifiers() : EmptyIterator.<String>instance();
- }
-
-
- // ********** resource => context **********
-
- public void initialize(TableGeneratorAnnotation tableGeneratorAnnotation) {
- super.initialize(tableGeneratorAnnotation);
- this.specifiedTable = tableGeneratorAnnotation.getTable();
- this.defaultSchema = this.buildDefaultSchema();
- this.specifiedSchema = tableGeneratorAnnotation.getSchema();
- this.defaultCatalog = this.buildDefaultCatalog();
- this.specifiedCatalog = tableGeneratorAnnotation.getCatalog();
- this.specifiedPkColumnName = tableGeneratorAnnotation.getPkColumnName();
- this.specifiedValueColumnName = tableGeneratorAnnotation.getValueColumnName();
- this.specifiedPkColumnValue = tableGeneratorAnnotation.getPkColumnValue();
- this.initializeUniqueConstraints(tableGeneratorAnnotation);
- }
-
- protected void initializeUniqueConstraints(TableGeneratorAnnotation tableGeneratorAnnotation) {
- for (Iterator<UniqueConstraintAnnotation> stream = tableGeneratorAnnotation.uniqueConstraints(); stream.hasNext(); ) {
- this.uniqueConstraints.add(this.buildUniqueConstraint(stream.next()));
- }
- }
-
- public void update(TableGeneratorAnnotation tableGeneratorAnnotation) {
- super.update(tableGeneratorAnnotation);
- this.setSpecifiedTable_(tableGeneratorAnnotation.getTable());
- this.setDefaultSchema(this.buildDefaultSchema());
- this.setSpecifiedSchema_(tableGeneratorAnnotation.getSchema());
- this.setDefaultCatalog(this.buildDefaultCatalog());
- this.setSpecifiedCatalog_(tableGeneratorAnnotation.getCatalog());
- this.setSpecifiedPkColumnName_(tableGeneratorAnnotation.getPkColumnName());
- this.setSpecifiedValueColumnName_(tableGeneratorAnnotation.getValueColumnName());
- this.setSpecifiedPkColumnValue_(tableGeneratorAnnotation.getPkColumnValue());
- this.updateUniqueConstraints(tableGeneratorAnnotation);
- }
-
- protected String buildDefaultSchema() {
- return this.getContextDefaultSchema();
- }
-
- protected String buildDefaultCatalog() {
- return this.getContextDefaultCatalog();
- }
-
- protected void updateUniqueConstraints(TableGeneratorAnnotation tableGeneratorAnnotation) {
- ListIterator<JavaUniqueConstraint> contextConstraints = this.uniqueConstraints();
- ListIterator<UniqueConstraintAnnotation> resourceConstraints = tableGeneratorAnnotation.uniqueConstraints();
-
- while (contextConstraints.hasNext()) {
- JavaUniqueConstraint uniqueConstraint = contextConstraints.next();
- if (resourceConstraints.hasNext()) {
- uniqueConstraint.update(resourceConstraints.next());
- }
- else {
- removeUniqueConstraint_(uniqueConstraint);
- }
- }
-
- while (resourceConstraints.hasNext()) {
- addUniqueConstraint(buildUniqueConstraint(resourceConstraints.next()));
- }
- }
-
- protected JavaUniqueConstraint buildUniqueConstraint(UniqueConstraintAnnotation uniqueConstraintAnnotation) {
- JavaUniqueConstraint uniqueConstraint = getJpaFactory().buildJavaUniqueConstraint(this, this);
- uniqueConstraint.initialize(uniqueConstraintAnnotation);
- return uniqueConstraint;
- }
-
-
- // ********** database stuff **********
-
- public Table getDbTable() {
- Schema dbSchema = this.getDbSchema();
- return (dbSchema == null) ? null : dbSchema.getTableForIdentifier(this.getTable());
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (JavaUniqueConstraint constraint : CollectionTools.iterable(this.uniqueConstraints())) {
- result = constraint.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * called if the database is connected:
- * table, schema, catalog, pkColumnName, valueColumnName
- */
- @Override
- public Iterator<String> connectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.connectedJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.tableTouches(pos, astRoot)) {
- return this.javaCandidateTables(filter);
- }
- if (this.schemaTouches(pos, astRoot)) {
- return this.javaCandidateSchemata(filter);
- }
- if (this.catalogTouches(pos, astRoot)) {
- return this.javaCandidateCatalogs(filter);
- }
- if (this.pkColumnNameTouches(pos, astRoot)) {
- return this.javaCandidateColumnNames(filter);
- }
- if (this.valueColumnNameTouches(pos, astRoot)) {
- return this.javaCandidateColumnNames(filter);
- }
- return null;
- }
-
- // ********** code assist: table
-
- protected boolean tableTouches(int pos, CompilationUnit astRoot) {
- return this.getResourceGenerator().tableTouches(pos, astRoot);
- }
-
- protected Iterator<String> javaCandidateTables(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.candidateTables(filter));
- }
-
- protected Iterator<String> candidateTables(Filter<String> filter) {
- return new FilteringIterator<String, String>(this.candidateTables(), filter);
- }
-
- protected Iterator<String> candidateTables() {
- Schema dbSchema = this.getDbSchema();
- return (dbSchema != null) ? dbSchema.sortedTableIdentifiers() : EmptyIterator.<String> instance();
- }
-
- // ********** code assist: schema
-
- protected boolean schemaTouches(int pos, CompilationUnit astRoot) {
- return this.getResourceGenerator().schemaTouches(pos, astRoot);
- }
-
- protected Iterator<String> javaCandidateSchemata(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.candidateSchemata(filter));
- }
-
- protected Iterator<String> candidateSchemata(Filter<String> filter) {
- return new FilteringIterator<String, String>(this.candidateSchemata(), filter);
- }
-
- protected Iterator<String> candidateSchemata() {
- SchemaContainer schemaContainer = this.getDbSchemaContainer();
- return (schemaContainer != null) ? schemaContainer.sortedSchemaIdentifiers() : EmptyIterator.<String> instance();
- }
-
- // ********** code assist: catalog
-
- protected boolean catalogTouches(int pos, CompilationUnit astRoot) {
- return this.getResourceGenerator().catalogTouches(pos, astRoot);
- }
-
- protected Iterator<String> javaCandidateCatalogs(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.candidateCatalogs(filter));
- }
-
- protected Iterator<String> candidateCatalogs(Filter<String> filter) {
- return new FilteringIterator<String, String>(this.candidateCatalogs(), filter);
- }
-
- protected Iterator<String> candidateCatalogs() {
- Database db = this.getDatabase();
- return (db != null) ? db.sortedCatalogIdentifiers() : EmptyIterator.<String> instance();
- }
-
- // ********** code assist: pkColumnName
-
- protected boolean pkColumnNameTouches(int pos, CompilationUnit astRoot) {
- return this.getResourceGenerator().pkColumnNameTouches(pos, astRoot);
- }
-
- protected Iterator<String> javaCandidateColumnNames(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.candidateColumnNames(filter));
- }
-
- protected Iterator<String> candidateColumnNames(Filter<String> filter) {
- return new FilteringIterator<String, String>(this.candidateColumnNames(), filter);
- }
-
- protected Iterator<String> candidateColumnNames() {
- Table table = this.getDbTable();
- return (table != null) ? table.sortedColumnIdentifiers() : EmptyIterator.<String> instance();
- }
-
- // ********** code assist: valueColumnName
-
- protected boolean valueColumnNameTouches(int pos, CompilationUnit astRoot) {
- return this.getResourceGenerator().valueColumnNameTouches(pos, astRoot);
- }
-
-
- // ********** misc **********
-
- @Override
- protected TableGeneratorAnnotation getResourceGenerator() {
- return (TableGeneratorAnnotation) super.getResourceGenerator();
- }
-
- public int getDefaultInitialValue() {
- return DEFAULT_INITIAL_VALUE;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java
deleted file mode 100644
index c52983e206..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.TemporalType;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaTemporalConverter;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class GenericJavaTemporalConverter extends AbstractJavaJpaContextNode
- implements JavaTemporalConverter
-{
- private TemporalType temporalType;
-
- private JavaResourcePersistentAttribute resourcePersistentAttribute;
-
- public GenericJavaTemporalConverter(JavaAttributeMapping parent, JavaResourcePersistentAttribute jrpa) {
- super(parent);
- this.initialize(jrpa);
- }
-
- @Override
- public JavaAttributeMapping getParent() {
- return (JavaAttributeMapping) super.getParent();
- }
-
- public String getType() {
- return Converter.TEMPORAL_CONVERTER;
- }
-
- protected String getAnnotationName() {
- return TemporalAnnotation.ANNOTATION_NAME;
- }
-
- public void addToResourceModel() {
- this.resourcePersistentAttribute.addAnnotation(getAnnotationName());
- }
-
- public void removeFromResourceModel() {
- this.resourcePersistentAttribute.removeAnnotation(getAnnotationName());
- }
-
- public TemporalType getTemporalType() {
- return this.temporalType;
- }
-
- public void setTemporalType(TemporalType newTemporalType) {
- TemporalType oldTemporalType = this.temporalType;
- this.temporalType = newTemporalType;
- this.getResourceTemporal().setValue(TemporalType.toJavaResourceModel(newTemporalType));
- firePropertyChanged(TEMPORAL_TYPE_PROPERTY, oldTemporalType, newTemporalType);
- }
-
- protected void setTemporalType_(TemporalType newTemporalType) {
- TemporalType oldTemporalType = this.temporalType;
- this.temporalType = newTemporalType;
- firePropertyChanged(TEMPORAL_TYPE_PROPERTY, oldTemporalType, newTemporalType);
- }
-
-
- protected TemporalAnnotation getResourceTemporal() {
- return (TemporalAnnotation) this.resourcePersistentAttribute.
- getAnnotation(getAnnotationName());
- }
-
- protected void initialize(JavaResourcePersistentAttribute jrpa) {
- this.resourcePersistentAttribute = jrpa;
- this.temporalType = this.temporalType(getResourceTemporal());
- }
-
- public void update(JavaResourcePersistentAttribute jrpa) {
- this.resourcePersistentAttribute = jrpa;
- this.setTemporalType_(this.temporalType(getResourceTemporal()));
- }
-
- protected TemporalType temporalType(TemporalAnnotation resourceTemporal) {
- return resourceTemporal == null ? null : TemporalType.fromJavaResourceModel(resourceTemporal.getValue());
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getResourceTemporal().getTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTransientMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTransientMapping.java
deleted file mode 100644
index 53f7a781d1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTransientMapping.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaTransientMapping;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMapping;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.resource.java.TransientAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-
-public class GenericJavaTransientMapping
- extends AbstractJavaAttributeMapping<TransientAnnotation>
- implements JavaTransientMapping
-{
- public GenericJavaTransientMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-
- public String getKey() {
- return MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String getAnnotationName() {
- return TransientAnnotation.ANNOTATION_NAME;
- }
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- }
-
-
- // ********** metamodel **********
-
- @Override
- public MetamodelField getMetamodelField() {
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java
deleted file mode 100644
index 64246c7f3d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaUniqueConstraint;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-public class GenericJavaUniqueConstraint extends AbstractJavaJpaContextNode
- implements JavaUniqueConstraint
-{
-
- protected final List<String> columnNames;
-
- protected UniqueConstraintAnnotation resourceUniqueConstraint;
-
- protected Owner owner;
- public GenericJavaUniqueConstraint(JavaJpaContextNode parent, Owner owner) {
- super(parent);
- this.owner = owner;
- this.columnNames = new ArrayList<String>();
- }
-
- public Owner getOwner() {
- return this.owner;
- }
-
- public ListIterator<String> columnNames() {
- return new CloneListIterator<String>(this.columnNames);
- }
-
- public int columnNamesSize() {
- return this.columnNames.size();
- }
-
- public void addColumnName(int index, String columnName) {
- this.columnNames.add(index, columnName);
- this.resourceUniqueConstraint.addColumnName(index, columnName);
- fireItemAdded(UniqueConstraint.COLUMN_NAMES_LIST, index, columnName);
- }
-
- protected void addColumnName_(int index, String columnName) {
- this.columnNames.add(index, columnName);
- fireItemAdded(UniqueConstraint.COLUMN_NAMES_LIST, index, columnName);
- }
-
- public void removeColumnName(String columnName) {
- this.removeColumnName(this.columnNames.indexOf(columnName));
- }
-
- public void removeColumnName(int index) {
- String removedColumnName = this.columnNames.remove(index);
- this.resourceUniqueConstraint.removeColumnName(index);
- fireItemRemoved(UniqueConstraint.COLUMN_NAMES_LIST, index, removedColumnName);
- }
-
- protected void removeColumnName_(int index) {
- String removedColumnName = this.columnNames.remove(index);
- fireItemRemoved(UniqueConstraint.COLUMN_NAMES_LIST, index, removedColumnName);
- }
-
- public void moveColumnName(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.columnNames, targetIndex, sourceIndex);
- this.resourceUniqueConstraint.moveColumnName(targetIndex, sourceIndex);
- fireItemMoved(UniqueConstraint.COLUMN_NAMES_LIST, targetIndex, sourceIndex);
- }
-
- public void initialize(UniqueConstraintAnnotation uca) {
- this.resourceUniqueConstraint = uca;
- this.initializeColumnNames(uca);
- }
-
- protected void initializeColumnNames(UniqueConstraintAnnotation uca) {
- ListIterator<String> annotationColumnNames = uca.columnNames();
-
- for (String resourceColumnName : CollectionTools.iterable(annotationColumnNames)) {
- this.columnNames.add(resourceColumnName);
- }
- }
-
- public void update(UniqueConstraintAnnotation uca) {
- this.resourceUniqueConstraint = uca;
- this.updateColumnNames(uca);
- }
-
- protected void updateColumnNames(UniqueConstraintAnnotation uca) {
- ListIterator<String> annotationColumnNames = uca.columnNames();
-
- int index = 0;
- for (String resourceColumnName : CollectionTools.iterable(annotationColumnNames)) {
- if (columnNamesSize() > index) {
- if (this.columnNames.get(index) != resourceColumnName) {
- addColumnName_(index, resourceColumnName);
- }
- }
- else {
- addColumnName_(index, resourceColumnName);
- }
- index++;
- }
-
- for ( ; index < columnNamesSize(); ) {
- removeColumnName_(index);
- }
- }
-
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.resourceUniqueConstraint.getTextRange(astRoot);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.columnNames);
- }
-
-
- // ********** code-assist **********
-
- @Override
- public Iterator<String> connectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.connectedJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.columnNamesTouches(pos, astRoot)) {
- return this.javaCandidateColumnNames(filter);
- }
- return null;
- }
-
- private boolean columnNamesTouches(int pos, CompilationUnit astRoot) {
- return this.resourceUniqueConstraint.columnNamesTouches(pos, astRoot);
- }
-
- private Iterator<String> javaCandidateColumnNames(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.candidateColumnNames(filter));
- }
-
- private Iterator<String> candidateColumnNames(Filter<String> filter) {
- return new FilteringIterator<String, String>(this.candidateColumnNames(), filter);
- }
-
- private Iterator<String> candidateColumnNames() {
- return this.getOwner().candidateUniqueConstraintColumnNames();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVersionMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVersionMapping.java
deleted file mode 100644
index 2c989ab68a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVersionMapping.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaVersionMapping;
-
-
-public class GenericJavaVersionMapping
- extends AbstractJavaVersionMapping
-{
-
- public GenericJavaVersionMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/NullJavaAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/NullJavaAssociationOverrideContainer.java
deleted file mode 100644
index 9905c47733..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/NullJavaAssociationOverrideContainer.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.ListIterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.AssociationOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-
-public class NullJavaAssociationOverrideContainer extends AbstractJavaJpaContextNode
- implements JavaAssociationOverrideContainer
-{
- protected final AssociationOverrideContainer.Owner owner;
-
- public NullJavaAssociationOverrideContainer(JavaJpaContextNode parent, AssociationOverrideContainer.Owner owner) {
- super(parent);
- this.owner = owner;
- }
-
- public void initialize(JavaResourcePersistentMember jrpm) {
- // no-op
- }
-
- public void update(JavaResourcePersistentMember jrpm) {
- // no-op
- }
-
- public Owner getOwner() {
- return this.owner;
- }
-
- public JavaAssociationOverride getAssociationOverrideNamed(String name) {
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public ListIterator<JavaAssociationOverride> associationOverrides() {
- return EmptyListIterator.instance();
- }
-
- public int associationOverridesSize() {
- return 0;
- }
-
- public ListIterator<JavaAssociationOverride> virtualAssociationOverrides() {
- return EmptyListIterator.instance();
- }
-
- public int virtualAssociationOverridesSize() {
- return 0;
- }
-
- public ListIterator<JavaAssociationOverride> specifiedAssociationOverrides() {
- return EmptyListIterator.instance();
- }
-
- public int specifiedAssociationOverridesSize() {
- return 0;
- }
-
- public void moveSpecifiedAssociationOverride(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
-
- //********** Validation ********************************************
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/VirtualAssociationOverride1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/VirtualAssociationOverride1_0Annotation.java
deleted file mode 100644
index 2738d5cfb1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/VirtualAssociationOverride1_0Annotation.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.internal.context.java.VirtualAssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-
-/**
- * javax.persistence.AssociationOverride
- */
-public class VirtualAssociationOverride1_0Annotation
- extends VirtualAssociationOverrideAnnotation
-{
-
- public VirtualAssociationOverride1_0Annotation(JavaResourcePersistentMember parent, String name, JoiningStrategy joiningStrategy) {
- super(parent, name, joiningStrategy);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericEntityMappings.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericEntityMappings.java
deleted file mode 100644
index 429d0b6cd2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericEntityMappings.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.orm.OrmXml;
-import org.eclipse.jpt.core.internal.context.orm.AbstractEntityMappings;
-import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
-
-public class GenericEntityMappings
- extends AbstractEntityMappings
-{
- public GenericEntityMappings(OrmXml parent, XmlEntityMappings resource) {
- super(parent, resource);
- }
-
-
- @Override
- protected String latestDocumentVersion() {
- return getJpaPlatform().getMostRecentSupportedResourceType(
- JptCorePlugin.ORM_XML_CONTENT_TYPE).getVersion();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java
deleted file mode 100644
index f8743f8ef4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.BaseOverride;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideRelationshipReference;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class GenericOrmAssociationOverride extends AbstractOrmXmlContextNode
- implements OrmAssociationOverride
-{
- protected final AssociationOverride.Owner owner;
-
- protected transient XmlAssociationOverride resourceAssociationOverride;
-
- protected String name;
-
- protected final OrmAssociationOverrideRelationshipReference relationshipReference;
-
-
- public GenericOrmAssociationOverride(OrmAssociationOverrideContainer parent, AssociationOverride.Owner owner, XmlAssociationOverride xmlAssociationOverride) {
- super(parent);
- this.owner = owner;
- this.relationshipReference = buildRelationshipReference(xmlAssociationOverride);
- this.resourceAssociationOverride = xmlAssociationOverride;
- this.name = xmlAssociationOverride.getName();
- }
-
- protected OrmAssociationOverrideRelationshipReference buildRelationshipReference(XmlAssociationOverride xmlAssociationOverride) {
- return getXmlContextNodeFactory().buildOrmAssociationOverrideRelationshipReference(this, xmlAssociationOverride);
- }
-
- public void initializeFrom(AssociationOverride oldAssociationOverride) {
- this.setName(oldAssociationOverride.getName());
- this.relationshipReference.initializeFrom(oldAssociationOverride.getRelationshipReference());
- }
-
- public boolean isVirtual() {
- return getOwner().isVirtual(this);
- }
-
- public OrmAssociationOverride setVirtual(boolean virtual) {
- return (OrmAssociationOverride) getOwner().setVirtual(virtual, this);
- }
-
- public Owner getOwner() {
- return this.owner;
- }
-
- public OrmAssociationOverrideRelationshipReference getRelationshipReference() {
- return this.relationshipReference;
- }
-
- // ********** AssociationOverride implementation **********
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String newName) {
- String oldName = this.name;
- this.name = newName;
- this.resourceAssociationOverride.setName(newName);
- firePropertyChanged(BaseOverride.NAME_PROPERTY, oldName, newName);
- }
-
- protected void setName_(String newName) {
- String oldName = this.name;
- this.name = newName;
- firePropertyChanged(BaseOverride.NAME_PROPERTY, oldName, newName);
- }
-
- public void update(XmlAssociationOverride xao) {
- this.resourceAssociationOverride = xao;
- this.setName_(xao.getName());
- this.relationshipReference.update(xao);
- }
-
- public TextRange getValidationTextRange() {
- return this.resourceAssociationOverride.getValidationTextRange();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java
deleted file mode 100644
index ea0ffe162d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java
+++ /dev/null
@@ -1,341 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.BaseOverride;
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.RelationshipReference;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.jpt.core.resource.orm.XmlAssociationOverrideContainer;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.CompositeListIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmAssociationOverrideContainer extends AbstractOrmXmlContextNode
- implements OrmAssociationOverrideContainer
-{
- protected final XmlAssociationOverrideContainer resourceAssociationOverrideContainer;
-
- protected final List<OrmAssociationOverride> specifiedAssociationOverrides;
-
- protected final List<OrmAssociationOverride> virtualAssociationOverrides;
-
- protected final OrmAssociationOverrideContainer.Owner owner;
-
- public GenericOrmAssociationOverrideContainer(XmlContextNode parent, OrmAssociationOverrideContainer.Owner owner, XmlAssociationOverrideContainer resource) {
- super(parent);
- this.owner = owner;
- this.resourceAssociationOverrideContainer = resource;
- this.specifiedAssociationOverrides = new ArrayList<OrmAssociationOverride>();
- this.virtualAssociationOverrides = new ArrayList<OrmAssociationOverride>();
- this.initializeSpecifiedAssociationOverrides();
- this.initializeVirtualAssociationOverrides();
- }
-
- public Owner getOwner() {
- return this.owner;
- }
-
- @SuppressWarnings("unchecked")
- public ListIterator<OrmAssociationOverride> associationOverrides() {
- return new CompositeListIterator<OrmAssociationOverride>(specifiedAssociationOverrides(), virtualAssociationOverrides());
- }
-
- public int associationOverridesSize() {
- return this.specifiedAssociationOverridesSize() + this.virtualAssociationOverridesSize();
- }
-
- public ListIterator<OrmAssociationOverride> virtualAssociationOverrides() {
- return new CloneListIterator<OrmAssociationOverride>(this.virtualAssociationOverrides);
- }
-
- public int virtualAssociationOverridesSize() {
- return this.virtualAssociationOverrides.size();
- }
-
- protected void addVirtualAssociationOverride(OrmAssociationOverride associationOverride) {
- addItemToList(associationOverride, this.virtualAssociationOverrides, VIRTUAL_ASSOCIATION_OVERRIDES_LIST);
- }
-
- protected void removeVirtualAssociationOverride(OrmAssociationOverride associationOverride) {
- removeItemFromList(associationOverride, this.virtualAssociationOverrides, VIRTUAL_ASSOCIATION_OVERRIDES_LIST);
- }
-
- protected OrmAssociationOverride setAssociationOverrideVirtual(boolean virtual, OrmAssociationOverride associationOverride) {
- if (virtual) {
- return setAssociationOverrideVirtual(associationOverride);
- }
- return setAssociationOverrideSpecified(associationOverride);
- }
-
- protected OrmAssociationOverride setAssociationOverrideVirtual(OrmAssociationOverride associationOverride) {
- int index = this.specifiedAssociationOverrides.indexOf(associationOverride);
- this.specifiedAssociationOverrides.remove(index);
- String associationOverrideName = associationOverride.getName();
- //add the virtual attribute override so that I can control the order that change notification is sent.
- //otherwise when we remove the annotation from java we will get an update and add the attribute override
- //during the udpate. This causes the UI to be flaky, since change notification might not occur in the correct order
- OrmAssociationOverride virtualAssociationOverride = null;
- if (associationOverrideName != null) {
- for (String name : CollectionTools.iterable(allOverridableAssociationNames())) {
- if (name.equals(associationOverrideName)) {
- //store the virtualAssociationOverride so we can fire change notification later
- virtualAssociationOverride = buildVirtualAssociationOverride(name);
- this.virtualAssociationOverrides.add(virtualAssociationOverride);
- }
- }
- }
-
- this.resourceAssociationOverrideContainer.getAssociationOverrides().remove(index);
- fireItemRemoved(SPECIFIED_ASSOCIATION_OVERRIDES_LIST, index, associationOverride);
-
- if (virtualAssociationOverride != null) {
- fireItemAdded(VIRTUAL_ASSOCIATION_OVERRIDES_LIST, virtualAssociationOverridesSize() - 1, virtualAssociationOverride);
- }
- return virtualAssociationOverride;
- }
-
- protected OrmAssociationOverride setAssociationOverrideSpecified(OrmAssociationOverride oldAssociationOverride) {
- int index = specifiedAssociationOverridesSize();
- XmlAssociationOverride xmlAssociationOverride = buildResourceAssociationOverride();
- OrmAssociationOverride newAssociationOverride = buildAssociationOverride(xmlAssociationOverride);
- this.specifiedAssociationOverrides.add(index, newAssociationOverride);
-
- this.resourceAssociationOverrideContainer.getAssociationOverrides().add(xmlAssociationOverride);
-
- int defaultIndex = this.virtualAssociationOverrides.indexOf(oldAssociationOverride);
- this.virtualAssociationOverrides.remove(defaultIndex);
-
- newAssociationOverride.initializeFrom(oldAssociationOverride);
-
- this.fireItemRemoved(VIRTUAL_ASSOCIATION_OVERRIDES_LIST, defaultIndex, oldAssociationOverride);
- this.fireItemAdded(SPECIFIED_ASSOCIATION_OVERRIDES_LIST, index, newAssociationOverride);
-
- return newAssociationOverride;
- }
-
- public ListIterator<OrmAssociationOverride> specifiedAssociationOverrides() {
- return new CloneListIterator<OrmAssociationOverride>(this.specifiedAssociationOverrides);
- }
-
- public int specifiedAssociationOverridesSize() {
- return this.specifiedAssociationOverrides.size();
- }
-
- protected void addSpecifiedAssociationOverride(int index, OrmAssociationOverride associationOverride) {
- addItemToList(index, associationOverride, this.specifiedAssociationOverrides, SPECIFIED_ASSOCIATION_OVERRIDES_LIST);
- }
-
- protected void addSpecifiedAssociationOverride(OrmAssociationOverride associationOverride) {
- this.addSpecifiedAssociationOverride(this.specifiedAssociationOverrides.size(), associationOverride);
- }
-
- protected void removeSpecifiedAssociationOverride_(OrmAssociationOverride associationOverride) {
- removeItemFromList(associationOverride, this.specifiedAssociationOverrides, SPECIFIED_ASSOCIATION_OVERRIDES_LIST);
- }
-
- public void moveSpecifiedAssociationOverride(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.specifiedAssociationOverrides, targetIndex, sourceIndex);
- this.resourceAssociationOverrideContainer.getAssociationOverrides().move(targetIndex, sourceIndex);
- fireItemMoved(SPECIFIED_ASSOCIATION_OVERRIDES_LIST, targetIndex, sourceIndex);
- }
-
- public OrmAssociationOverride getAssociationOverrideNamed(String name) {
- return (OrmAssociationOverride) getOverrideNamed(name, associationOverrides());
- }
-
- public boolean containsAssociationOverride(String name) {
- return containsOverride(name, associationOverrides());
- }
-
- public boolean containsSpecifiedAssociationOverride(String name) {
- return containsOverride(name, specifiedAssociationOverrides());
- }
-
- public boolean containsDefaultAssociationOverride(String name) {
- return containsOverride(name, virtualAssociationOverrides());
- }
-
- private BaseOverride getOverrideNamed(String name, ListIterator<? extends BaseOverride> overrides) {
- for (BaseOverride override : CollectionTools.iterable(overrides)) {
- String overrideName = override.getName();
- if (overrideName == null && name == null) {
- return override;
- }
- if (overrideName != null && overrideName.equals(name)) {
- return override;
- }
- }
- return null;
- }
-
- private boolean containsOverride(String name, ListIterator<? extends BaseOverride> overrides) {
- return getOverrideNamed(name, overrides) != null;
- }
-
-
- protected Iterator<String> allOverridableAssociationNames() {
- TypeMapping overridableTypeMapping = getOwner().getOverridableTypeMapping();
- if (overridableTypeMapping != null) {
- return overridableTypeMapping.allOverridableAssociationNames();
- }
- return EmptyIterator.instance();
- }
-
- protected void initializeVirtualAssociationOverrides() {
- for (String name : CollectionTools.iterable(allOverridableAssociationNames())) {
- OrmAssociationOverride ormAssociationOverride = getAssociationOverrideNamed(name);
- if (ormAssociationOverride == null) {
- this.virtualAssociationOverrides.add(buildVirtualAssociationOverride(name));
- }
- }
- }
-
- protected OrmAssociationOverride buildVirtualAssociationOverride(String name) {
- return buildAssociationOverride(buildVirtualXmlAssociationOverride(name));
- }
-
- protected XmlAssociationOverride buildVirtualXmlAssociationOverride(String name) {
- RelationshipReference relationshipReference = this.resolveAssociationOverrideRelationshipReference(name);
- return buildVirtualXmlAssociationOverride(name, relationshipReference.getPredominantJoiningStrategy());
- }
-
- protected XmlAssociationOverride buildVirtualXmlAssociationOverride(String name, JoiningStrategy joiningStrategy) {
- return getXmlContextNodeFactory().buildVirtualXmlAssociationOverride(name, getOwner().getTypeMapping(), joiningStrategy);
- }
-
- private RelationshipReference resolveAssociationOverrideRelationshipReference(String associationOverrideName) {
- return getOwner().resolveRelationshipReference(associationOverrideName);
- }
-
-
- protected void initializeSpecifiedAssociationOverrides() {
- for (XmlAssociationOverride associationOverride : this.resourceAssociationOverrideContainer.getAssociationOverrides()) {
- this.specifiedAssociationOverrides.add(buildAssociationOverride(associationOverride));
- }
- }
-
- public void update() {
- this.updateSpecifiedAssociationOverrides();
- this.updateVirtualAssociationOverrides();
- }
-
- protected void updateSpecifiedAssociationOverrides() {
- // make a copy of the XML overrides (to prevent ConcurrentModificationException)
- Iterator<XmlAssociationOverride> xmlOverrides = new CloneIterator<XmlAssociationOverride>(this.resourceAssociationOverrideContainer.getAssociationOverrides());
-
- for (Iterator<OrmAssociationOverride> contextOverrides = this.specifiedAssociationOverrides(); contextOverrides.hasNext(); ) {
- OrmAssociationOverride contextOverride = contextOverrides.next();
- if (xmlOverrides.hasNext()) {
- contextOverride.update(xmlOverrides.next());
- }
- else {
- removeSpecifiedAssociationOverride_(contextOverride);
- }
- }
-
- while (xmlOverrides.hasNext()) {
- addSpecifiedAssociationOverride(buildAssociationOverride(xmlOverrides.next()));
- }
- }
-
- protected void updateVirtualAssociationOverrides() {
- Iterator<String> overridableAssociations = allOverridableAssociationNames();
- ListIterator<OrmAssociationOverride> virtualAssociationOverridesCopy = virtualAssociationOverrides();
-
- for (String name : CollectionTools.iterable(overridableAssociations)) {
- OrmAssociationOverride ormAssociationOverride = getAssociationOverrideNamed(name);
- if (ormAssociationOverride != null && !ormAssociationOverride.isVirtual()) {
- continue;
- }
- if (ormAssociationOverride != null) {
- if (virtualAssociationOverridesCopy.hasNext()) {
- OrmAssociationOverride virtualAssociationOverride = virtualAssociationOverridesCopy.next();
- virtualAssociationOverride.update(buildVirtualXmlAssociationOverride(name));
- }
- else {
- addVirtualAssociationOverride(buildVirtualAssociationOverride(name));
- }
- }
- else {
- addVirtualAssociationOverride(buildVirtualAssociationOverride(name));
- }
- }
- for (OrmAssociationOverride virtualAssociationOverride : CollectionTools.iterable(virtualAssociationOverridesCopy)) {
- removeVirtualAssociationOverride(virtualAssociationOverride);
- }
- }
-
- protected OrmAssociationOverride buildAssociationOverride(XmlAssociationOverride associationOverride) {
- return getXmlContextNodeFactory().buildOrmAssociationOverride(this, buildAssociationOverrideOwner(), associationOverride);
- }
-
- protected XmlAssociationOverride buildResourceAssociationOverride() {
- return OrmFactory.eINSTANCE.createXmlAssociationOverride();
- }
-
- protected AssociationOverride.Owner buildAssociationOverrideOwner() {
- return new AssociationOverrideOwner();
- }
-
- //************ validation ***************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
-
- for (Iterator<OrmAssociationOverride> stream = this.associationOverrides(); stream.hasNext(); ) {
- stream.next().validate(messages, reporter);
- }
- }
-
- public TextRange getValidationTextRange() {
- return this.resourceAssociationOverrideContainer.getValidationTextRange();
- }
-
-
-
- class AssociationOverrideOwner implements AssociationOverride.Owner {
-
- public RelationshipMapping getRelationshipMapping(String attributeName) {
- return MappingTools.getRelationshipMapping(attributeName, getOwner().getOverridableTypeMapping());
- }
-
- public boolean isVirtual(BaseOverride override) {
- return GenericOrmAssociationOverrideContainer.this.virtualAssociationOverrides.contains(override);
- }
-
- public BaseOverride setVirtual(boolean virtual, BaseOverride override) {
- return GenericOrmAssociationOverrideContainer.this.setAssociationOverrideVirtual(virtual, (OrmAssociationOverride) override);
- }
-
- public TypeMapping getTypeMapping() {
- return getOwner().getTypeMapping();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideRelationshipReference.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideRelationshipReference.java
deleted file mode 100644
index 32e785991e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideRelationshipReference.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAssociationOverrideRelationshipReference;
-import org.eclipse.jpt.core.resource.orm.XmlAssociationOverride;
-
-public class GenericOrmAssociationOverrideRelationshipReference extends AbstractOrmAssociationOverrideRelationshipReference
-{
-
- public GenericOrmAssociationOverrideRelationshipReference(OrmAssociationOverride parent, XmlAssociationOverride xao) {
- super(parent, xao);
- }
-
- @Override
- protected JoiningStrategy calculatePredominantJoiningStrategy() {
- return this.joinColumnJoiningStrategy;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java
deleted file mode 100644
index 8ef7225e47..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.BaseOverride;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverride;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmColumn;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-
-public class GenericOrmAttributeOverride extends AbstractOrmXmlContextNode
- implements OrmAttributeOverride, OrmColumn.Owner
-{
-
- protected String name;
-
- private final Owner owner;
-
- protected XmlAttributeOverride resourceAttributeOverride;
-
-
- protected final OrmColumn column;
-
- public GenericOrmAttributeOverride(OrmAttributeOverrideContainer parent, AttributeOverride.Owner owner, XmlAttributeOverride resourceAttributeOverride) {
- super(parent);
- this.owner = owner;
- this.column = getXmlContextNodeFactory().buildOrmColumn(this, this);
- this.resourceAttributeOverride = resourceAttributeOverride;
- this.name = resourceAttributeOverride.getName();
- this.column.initialize(resourceAttributeOverride.getColumn());
- }
-
- @Override
- public XmlContextNode getParent() {
- return (XmlContextNode) super.getParent();
- }
-
- public OrmAttributeOverride setVirtual(boolean virtual) {
- return (OrmAttributeOverride) getOwner().setVirtual(virtual, this);
- }
-
- public Owner getOwner() {
- return this.owner;
- }
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String newName) {
- String oldName = this.name;
- this.name = newName;
- this.resourceAttributeOverride.setName(newName);
- firePropertyChanged(BaseOverride.NAME_PROPERTY, oldName, newName);
- }
-
- protected void setName_(String newName) {
- String oldName = this.name;
- this.name = newName;
- firePropertyChanged(BaseOverride.NAME_PROPERTY, oldName, newName);
- }
-
- public OrmColumn getColumn() {
- return this.column;
- }
-
- public TypeMapping getTypeMapping() {
- return getOwner().getTypeMapping();
- }
-
- public Table getDbTable(String tablename) {
- return this.getTypeMapping().getDbTable(getColumn().getTable());
- }
-
- public String getDefaultColumnName() {
- Column column = resolveOverridenColumn();
- if (column == null) {
- return null;
- }
- return column.getName();
- }
-
- public String getDefaultTableName() {
- Column column = resolveOverridenColumn();
- if (column == null) {
- return null;
- }
- String tableName = column.getSpecifiedTable();
- if (tableName != null) {
- return tableName;
- }
- return getOwner().getTypeMapping().getPrimaryTableName();
- }
-
- protected Column resolveOverridenColumn() {
- return getOwner().resolveOverridenColumn(getName());
- }
-
- public boolean isVirtual() {
- return getOwner().isVirtual(this);
- }
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.resourceAttributeOverride.getValidationTextRange();
- return textRange == null ? getParent().getValidationTextRange() : textRange;
- }
-
-
- //***************** IXmlColumn.Owner implementation ****************
-
- public XmlColumn getResourceColumn() {
- return this.resourceAttributeOverride.getColumn();
- }
-
- public void addResourceColumn() {
- this.resourceAttributeOverride.setColumn(OrmFactory.eINSTANCE.createXmlColumn());
- }
-
- public void removeResourceColumn() {
- this.resourceAttributeOverride.setColumn(null);
- }
-
-
- //***************** updating ****************
-
- public void update(XmlAttributeOverride xmlAttributeOverride) {
- this.resourceAttributeOverride = xmlAttributeOverride;
- this.setName_(xmlAttributeOverride.getName());
- this.column.update(xmlAttributeOverride.getColumn());
- }
-
- //****************** validation ********************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- if (this.connectionProfileIsActive()) {
- this.validateColumn(messages);
- }
- }
-
- protected void validateColumn(List<IMessage> messages) {
- String tableName = this.column.getTable();
- if (this.getTypeMapping().tableNameIsInvalid(tableName)) {
- if (this.isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_TABLE,
- new String[] {this.getName(), tableName, this.column.getName()},
- this.column,
- this.column.getTableTextRange()
- )
- );
- } else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_TABLE,
- new String[] {tableName, this.column.getName()},
- this.column,
- this.column.getTableTextRange()
- )
- );
- }
- return;
- }
-
- if ( ! this.column.isResolved() && this.column.getDbTable() != null) {
- if (this.isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME,
- new String[] {this.getName(), this.column.getName()},
- this.column,
- this.column.getNameTextRange()
- )
- );
- } else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {this.column.getName()},
- this.column,
- this.column.getNameTextRange()
- )
- );
- }
- }
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java
deleted file mode 100644
index fb50fd09e8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java
+++ /dev/null
@@ -1,357 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.BaseOverride;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverride;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.internal.context.orm.VirtualXmlAttributeOverride;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeOverrideContainer;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.CompositeListIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmAttributeOverrideContainer extends AbstractOrmXmlContextNode
- implements OrmAttributeOverrideContainer
-{
- private final XmlAttributeOverrideContainer resourceAttributeOverrideContainer;
-
- protected final List<OrmAttributeOverride> specifiedAttributeOverrides;
-
- protected final List<OrmAttributeOverride> virtualAttributeOverrides;
-
- protected final Owner owner;
-
- public GenericOrmAttributeOverrideContainer(XmlContextNode parent, Owner owner, XmlAttributeOverrideContainer resource) {
- super(parent);
- this.owner = owner;
- this.resourceAttributeOverrideContainer = resource;
- this.specifiedAttributeOverrides = new ArrayList<OrmAttributeOverride>();
- this.virtualAttributeOverrides = new ArrayList<OrmAttributeOverride>();
- this.initializeSpecifiedAttributeOverrides();
- this.initializeVirtualAttributeOverrides();
- }
-
- public void initializeFromAttributeOverrideContainer(OrmAttributeOverrideContainer oldContainer) {
- int index = 0;
- for (OrmAttributeOverride attributeOverride : CollectionTools.iterable(oldContainer.specifiedAttributeOverrides())) {
- OrmAttributeOverride newAttributeOverride = addSpecifiedAttributeOverride(index++);
- newAttributeOverride.setName(attributeOverride.getName());
- newAttributeOverride.getColumn().initializeFrom(attributeOverride.getColumn());
- }
- }
-
- public Owner getOwner() {
- return this.owner;
- }
-
- @SuppressWarnings("unchecked")
- public ListIterator<OrmAttributeOverride> attributeOverrides() {
- return new CompositeListIterator<OrmAttributeOverride>(specifiedAttributeOverrides(), virtualAttributeOverrides());
- }
-
- public int attributeOverridesSize() {
- return this.specifiedAttributeOverridesSize() + this.virtualAttributeOverridesSize();
- }
-
- public ListIterator<OrmAttributeOverride> virtualAttributeOverrides() {
- return new CloneListIterator<OrmAttributeOverride>(this.virtualAttributeOverrides);
- }
-
- public int virtualAttributeOverridesSize() {
- return this.virtualAttributeOverrides.size();
- }
-
- protected void addVirtualAttributeOverride(OrmAttributeOverride attributeOverride) {
- addItemToList(attributeOverride, this.virtualAttributeOverrides, VIRTUAL_ATTRIBUTE_OVERRIDES_LIST);
- }
-
- protected void removeVirtualAttributeOverride(OrmAttributeOverride attributeOverride) {
- removeItemFromList(attributeOverride, this.virtualAttributeOverrides, VIRTUAL_ATTRIBUTE_OVERRIDES_LIST);
- }
-
- protected OrmAttributeOverride setAttributeOverrideVirtual(boolean virtual, OrmAttributeOverride attributeOverride) {
- if (virtual) {
- return setAttributeOverrideVirtual(attributeOverride);
- }
- return setAttributeOverrideSpecified(attributeOverride);
- }
-
- protected OrmAttributeOverride setAttributeOverrideVirtual(OrmAttributeOverride attributeOverride) {
- int index = this.specifiedAttributeOverrides.indexOf(attributeOverride);
- this.specifiedAttributeOverrides.remove(index);
- String attributeOverrideName = attributeOverride.getName();
- //add the virtual attribute override so that I can control the order that change notification is sent.
- //otherwise when we remove the annotation from java we will get an update and add the attribute override
- //during the update. This causes the UI to be flaky, since change notification might not occur in the correct order
- OrmAttributeOverride virtualAttributeOverride = null;
- if (attributeOverrideName != null) {
- for (String name : CollectionTools.iterable(allOverridableAttributeNames())) {
- if (name.equals(attributeOverrideName)) {
- //store the virtualAttributeOverride so we can fire change notification later
- virtualAttributeOverride = buildVirtualAttributeOverride(name);
- this.virtualAttributeOverrides.add(virtualAttributeOverride);
- }
- }
- }
-
- this.resourceAttributeOverrideContainer.getAttributeOverrides().remove(index);
- fireItemRemoved(SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, index, attributeOverride);
-
- if (virtualAttributeOverride != null) {
- fireItemAdded(VIRTUAL_ATTRIBUTE_OVERRIDES_LIST, virtualAttributeOverridesSize() - 1, virtualAttributeOverride);
- }
- return virtualAttributeOverride;
- }
-
- protected OrmAttributeOverride setAttributeOverrideSpecified(OrmAttributeOverride oldAttributeOverride) {
- int index = specifiedAttributeOverridesSize();
- XmlAttributeOverride xmlAttributeOverride = OrmFactory.eINSTANCE.createXmlAttributeOverride();
- OrmAttributeOverride newAttributeOverride = getXmlContextNodeFactory().buildOrmAttributeOverride(this, createAttributeOverrideOwner(), xmlAttributeOverride);
- this.specifiedAttributeOverrides.add(index, newAttributeOverride);
-
- this.resourceAttributeOverrideContainer.getAttributeOverrides().add(xmlAttributeOverride);
-
- int defaultIndex = this.virtualAttributeOverrides.indexOf(oldAttributeOverride);
- this.virtualAttributeOverrides.remove(defaultIndex);
-
- newAttributeOverride.setName(oldAttributeOverride.getName());
- newAttributeOverride.getColumn().setSpecifiedName(oldAttributeOverride.getColumn().getName());
-
- this.fireItemRemoved(VIRTUAL_ATTRIBUTE_OVERRIDES_LIST, defaultIndex, oldAttributeOverride);
- this.fireItemAdded(SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, index, newAttributeOverride);
-
- return newAttributeOverride;
- }
-
- public ListIterator<OrmAttributeOverride> specifiedAttributeOverrides() {
- return new CloneListIterator<OrmAttributeOverride>(this.specifiedAttributeOverrides);
- }
-
- public int specifiedAttributeOverridesSize() {
- return this.specifiedAttributeOverrides.size();
- }
-
- protected OrmAttributeOverride addSpecifiedAttributeOverride(int index) {
- XmlAttributeOverride xmlAttributeOverride = OrmFactory.eINSTANCE.createXmlAttributeOverride();
- OrmAttributeOverride attributeOverride = buildAttributeOverride(xmlAttributeOverride);
- this.specifiedAttributeOverrides.add(index, attributeOverride);
- this.resourceAttributeOverrideContainer.getAttributeOverrides().add(index, xmlAttributeOverride);
- this.fireItemAdded(SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, index, attributeOverride);
- return attributeOverride;
- }
-
- protected void addSpecifiedAttributeOverride(int index, OrmAttributeOverride attributeOverride) {
- addItemToList(index, attributeOverride, this.specifiedAttributeOverrides, SPECIFIED_ATTRIBUTE_OVERRIDES_LIST);
- }
-
- protected void addSpecifiedAttributeOverride(OrmAttributeOverride attributeOverride) {
- this.addSpecifiedAttributeOverride(this.specifiedAttributeOverrides.size(), attributeOverride);
- }
-
- protected void removeSpecifiedAttributeOverride_(OrmAttributeOverride attributeOverride) {
- removeItemFromList(attributeOverride, this.specifiedAttributeOverrides, SPECIFIED_ATTRIBUTE_OVERRIDES_LIST);
- }
-
- public void moveSpecifiedAttributeOverride(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.specifiedAttributeOverrides, targetIndex, sourceIndex);
- this.resourceAttributeOverrideContainer.getAttributeOverrides().move(targetIndex, sourceIndex);
- fireItemMoved(SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, targetIndex, sourceIndex);
- }
-
- public OrmAttributeOverride getAttributeOverrideNamed(String name) {
- return (OrmAttributeOverride) getOverrideNamed(name, attributeOverrides());
- }
-
- public boolean containsAttributeOverride(String name) {
- return containsOverride(name, attributeOverrides());
- }
-
- public boolean containsDefaultAttributeOverride(String name) {
- return containsOverride(name, virtualAttributeOverrides());
- }
-
- public boolean containsSpecifiedAttributeOverride(String name) {
- return containsOverride(name, specifiedAttributeOverrides());
- }
-
- private BaseOverride getOverrideNamed(String name, ListIterator<? extends BaseOverride> overrides) {
- for (BaseOverride override : CollectionTools.iterable(overrides)) {
- String overrideName = override.getName();
- if (overrideName == null && name == null) {
- return override;
- }
- if (overrideName != null && overrideName.equals(name)) {
- return override;
- }
- }
- return null;
- }
-
- private boolean containsOverride(String name, ListIterator<? extends BaseOverride> overrides) {
- return getOverrideNamed(name, overrides) != null;
- }
-
- protected Iterator<String> allOverridableAttributeNames() {
- TypeMapping overridableTypeMapping = getOwner().getOverridableTypeMapping();
- if (overridableTypeMapping != null) {
- return overridableTypeMapping.allOverridableAttributeNames();
- }
- return EmptyIterator.instance();
- }
-
- protected void initializeVirtualAttributeOverrides() {
- for (String name : CollectionTools.iterable(allOverridableAttributeNames())) {
- OrmAttributeOverride ormAttributeOverride = getAttributeOverrideNamed(name);
- if (ormAttributeOverride == null) {
- this.virtualAttributeOverrides.add(buildVirtualAttributeOverride(name));
- }
- }
- }
-
- protected void initializeSpecifiedAttributeOverrides() {
- for (XmlAttributeOverride attributeOverride : this.resourceAttributeOverrideContainer.getAttributeOverrides()) {
- this.specifiedAttributeOverrides.add(buildAttributeOverride(attributeOverride));
- }
- }
-
- public void update() {
- this.updateSpecifiedAttributeOverrides();
- this.updateVirtualAttributeOverrides();
- }
-
- protected OrmAttributeOverride buildVirtualAttributeOverride(String name) {
- return buildAttributeOverride(buildVirtualXmlAttributeOverride(name));
- }
-
- protected XmlAttributeOverride buildVirtualXmlAttributeOverride(String name) {
- Column column = resolveAttributeOverrideMappingColumn(name);
- XmlColumn xmlColumn = getOwner().buildVirtualXmlColumn(column, name, getOwner().getTypeMapping().isMetadataComplete());
- return new VirtualXmlAttributeOverride(name, xmlColumn);
- }
-
- private Column resolveAttributeOverrideMappingColumn(String attributeOverrideName) {
- return getOwner().resolveOverridenColumn(attributeOverrideName);
- }
-
- protected void updateSpecifiedAttributeOverrides() {
- // make a copy of the XML overrides (to prevent ConcurrentModificationException)
- Iterator<XmlAttributeOverride> xmlOverrides = new CloneIterator<XmlAttributeOverride>(this.resourceAttributeOverrideContainer.getAttributeOverrides());
-
- for (Iterator<OrmAttributeOverride> contextOverrides = this.specifiedAttributeOverrides(); contextOverrides.hasNext(); ) {
- OrmAttributeOverride contextOverride = contextOverrides.next();
- if (xmlOverrides.hasNext()) {
- contextOverride.update(xmlOverrides.next());
- }
- else {
- removeSpecifiedAttributeOverride_(contextOverride);
- }
- }
-
- while (xmlOverrides.hasNext()) {
- addSpecifiedAttributeOverride(buildAttributeOverride(xmlOverrides.next()));
- }
- }
-
- protected void updateVirtualAttributeOverrides() {
- Iterator<String> overridableAttributes = allOverridableAttributeNames();
- ListIterator<OrmAttributeOverride> virtualAttributeOverridesCopy = virtualAttributeOverrides();
-
- for (String name : CollectionTools.iterable(overridableAttributes)) {
- OrmAttributeOverride ormAttributeOverride = getAttributeOverrideNamed(name);
- if (ormAttributeOverride != null && !ormAttributeOverride.isVirtual()) {
- continue;
- }
- if (ormAttributeOverride != null) {
- if (virtualAttributeOverridesCopy.hasNext()) {
- OrmAttributeOverride virtualAttributeOverride = virtualAttributeOverridesCopy.next();
- virtualAttributeOverride.update(buildVirtualXmlAttributeOverride(name));
- }
- else {
- addVirtualAttributeOverride(buildVirtualAttributeOverride(name));
- }
- }
- else {
- addVirtualAttributeOverride(buildVirtualAttributeOverride(name));
- }
- }
- for (OrmAttributeOverride virtualAttributeOverride : CollectionTools.iterable(virtualAttributeOverridesCopy)) {
- removeVirtualAttributeOverride(virtualAttributeOverride);
- }
- }
-
- protected OrmAttributeOverride buildAttributeOverride(XmlAttributeOverride attributeOverride) {
- return getXmlContextNodeFactory().buildOrmAttributeOverride(this, createAttributeOverrideOwner(), attributeOverride);
- }
-
- protected AttributeOverride.Owner createAttributeOverrideOwner() {
- return new AttributeOverrideOwner();
- }
-
-
- //************ validation ***************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
-
- for (Iterator<OrmAttributeOverride> stream = this.attributeOverrides(); stream.hasNext(); ) {
- stream.next().validate(messages, reporter);
- }
- }
-
- public TextRange getValidationTextRange() {
- return this.resourceAttributeOverrideContainer.getValidationTextRange();
- }
-
-
-
-
- class AttributeOverrideOwner implements AttributeOverride.Owner {
-
- public Column resolveOverridenColumn(String attributeName) {
- if (attributeName == null) {
- return null;
- }
- return GenericOrmAttributeOverrideContainer.this.resolveAttributeOverrideMappingColumn(attributeName);
- }
-
- public boolean isVirtual(BaseOverride override) {
- return GenericOrmAttributeOverrideContainer.this.virtualAttributeOverrides.contains(override);
- }
-
- public BaseOverride setVirtual(boolean virtual, BaseOverride override) {
- return GenericOrmAttributeOverrideContainer.this.setAttributeOverrideVirtual(virtual, (OrmAttributeOverride) override);
- }
-
- public TypeMapping getTypeMapping() {
- return getOwner().getTypeMapping();
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java
deleted file mode 100644
index 406105dc9f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmBasicMapping;
-import org.eclipse.jpt.core.resource.orm.XmlBasic;
-
-
-public class GenericOrmBasicMapping extends AbstractOrmBasicMapping<XmlBasic>
-{
-
- public GenericOrmBasicMapping(OrmPersistentAttribute parent, XmlBasic resourceMapping) {
- super(parent, resourceMapping);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmCascade.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmCascade.java
deleted file mode 100644
index 43d61cfcd0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmCascade.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.Cascade;
-import org.eclipse.jpt.core.context.orm.OrmCascade;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipMapping;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.resource.orm.AbstractXmlRelationshipMapping;
-import org.eclipse.jpt.core.resource.orm.CascadeType;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.utility.TextRange;
-
-
-public class GenericOrmCascade extends AbstractOrmXmlContextNode implements OrmCascade
-{
- protected boolean all;
-
- protected boolean persist;
-
- protected boolean merge;
-
- protected boolean remove;
-
- protected boolean refresh;
-
-
- protected final AbstractXmlRelationshipMapping relationshipMapping;
-
- public GenericOrmCascade(OrmRelationshipMapping parent, AbstractXmlRelationshipMapping relationshipMapping) {
- super(parent);
- this.relationshipMapping = relationshipMapping;
- CascadeType cascade = getResourceCascade();
- this.all = this.getResourceAll(cascade);
- this.persist = this.getResourcePersist(cascade);
- this.merge = this.getResourceMerge(cascade);
- this.remove = this.getResourceRemove(cascade);
- this.refresh = this.getResourceRefresh(cascade);
- }
-
- public void initializeFrom(Cascade oldCascade) {
- setAll(oldCascade.isAll());
- setPersist(oldCascade.isPersist());
- setMerge(oldCascade.isMerge());
- setRemove(oldCascade.isRemove());
- setRefresh(oldCascade.isRefresh());
- }
-
- public boolean isAll() {
- return this.all;
- }
-
- public void setAll(boolean newAll) {
- boolean oldAll = this.all;
- this.all = newAll;
- if (oldAll != newAll) {
- if (this.getResourceCascade() != null) {
- this.getResourceCascade().setCascadeAll(newAll);
- if (this.getResourceCascade().isUnset()) {
- removeResourceCascade();
- }
- }
- else if (newAll != false) {
- addResourceCascade();
- getResourceCascade().setCascadeAll(newAll);
- }
- }
- firePropertyChanged(ALL_PROPERTY, oldAll, newAll);
- }
-
- protected void setAll_(boolean newAll) {
- boolean oldAll = this.all;
- this.all = newAll;
- firePropertyChanged(ALL_PROPERTY, oldAll, newAll);
- }
-
- public boolean isPersist() {
- return this.persist;
- }
-
- public void setPersist(boolean newPersist) {
- boolean oldPersist = this.persist;
- this.persist = newPersist;
- if (oldPersist != newPersist) {
- if (this.getResourceCascade() != null) {
- this.getResourceCascade().setCascadePersist(newPersist);
- if (this.getResourceCascade().isUnset()) {
- removeResourceCascade();
- }
- }
- else if (newPersist != false) {
- addResourceCascade();
- getResourceCascade().setCascadePersist(newPersist);
- }
- }
- firePropertyChanged(PERSIST_PROPERTY, oldPersist, newPersist);
- }
-
- protected void setPersist_(boolean newPersist) {
- boolean oldPersist = this.persist;
- this.persist = newPersist;
- firePropertyChanged(PERSIST_PROPERTY, oldPersist, newPersist);
- }
-
-
- public boolean isMerge() {
- return this.merge;
- }
-
- public void setMerge(boolean newMerge) {
- boolean oldMerge = this.merge;
- this.merge = newMerge;
- if (oldMerge != newMerge) {
- if (this.getResourceCascade() != null) {
- this.getResourceCascade().setCascadeMerge(newMerge);
- if (this.getResourceCascade().isUnset()) {
- removeResourceCascade();
- }
- }
- else if (newMerge != false) {
- addResourceCascade();
- getResourceCascade().setCascadeMerge(newMerge);
- }
- }
- firePropertyChanged(MERGE_PROPERTY, oldMerge, newMerge);
- }
-
- protected void setMerge_(boolean newMerge) {
- boolean oldMerge = this.merge;
- this.merge = newMerge;
- firePropertyChanged(MERGE_PROPERTY, oldMerge, newMerge);
- }
-
- public boolean isRemove() {
- return this.remove;
- }
-
- public void setRemove(boolean newRemove) {
- boolean oldRemove = this.remove;
- this.remove = newRemove;
- if (oldRemove != newRemove) {
- if (this.getResourceCascade() != null) {
- this.getResourceCascade().setCascadeRemove(newRemove);
- if (this.getResourceCascade().isUnset()) {
- removeResourceCascade();
- }
- }
- else if (newRemove != false) {
- addResourceCascade();
- getResourceCascade().setCascadeRemove(newRemove);
- }
- }
- firePropertyChanged(REMOVE_PROPERTY, oldRemove, newRemove);
- }
-
- protected void setRemove_(boolean newRemove) {
- boolean oldRemove = this.remove;
- this.remove = newRemove;
- firePropertyChanged(REMOVE_PROPERTY, oldRemove, newRemove);
- }
-
- public boolean isRefresh() {
- return this.refresh;
- }
-
- public void setRefresh(boolean newRefresh) {
- boolean oldRefresh = this.refresh;
- this.refresh = newRefresh;
- if (oldRefresh != newRefresh) {
- if (this.getResourceCascade() != null) {
- this.getResourceCascade().setCascadeRefresh(newRefresh);
- if (this.getResourceCascade().isUnset()) {
- removeResourceCascade();
- }
- }
- else if (newRefresh != false) {
- addResourceCascade();
- getResourceCascade().setCascadeRefresh(newRefresh);
- }
- }
- firePropertyChanged(REFRESH_PROPERTY, oldRefresh, newRefresh);
- }
-
- protected void setRefresh_(boolean newRefresh) {
- boolean oldRefresh = this.refresh;
- this.refresh = newRefresh;
- firePropertyChanged(REFRESH_PROPERTY, oldRefresh, newRefresh);
- }
-
-
- protected CascadeType getResourceCascade() {
- return this.relationshipMapping.getCascade();
- }
-
- protected void removeResourceCascade() {
- this.relationshipMapping.setCascade(null);
- }
-
- protected void addResourceCascade() {
- this.relationshipMapping.setCascade(OrmFactory.eINSTANCE.createCascadeType());
- }
-
- public void update() {
- CascadeType cascade = getResourceCascade();
- this.setAll_(this.getResourceAll(cascade));
- this.setPersist_(this.getResourcePersist(cascade));
- this.setMerge_(this.getResourceMerge(cascade));
- this.setRemove_(this.getResourceRemove(cascade));
- this.setRefresh_(this.getResourceRefresh(cascade));
- }
-
- protected boolean getResourceAll(CascadeType cascade) {
- return cascade == null ? false : cascade.isCascadeAll();
- }
-
- protected boolean getResourcePersist(CascadeType cascade) {
- return cascade == null ? false : cascade.isCascadePersist();
- }
-
- protected boolean getResourceMerge(CascadeType cascade) {
- return cascade == null ? false : cascade.isCascadeMerge();
- }
-
- protected boolean getResourceRemove(CascadeType cascade) {
- return cascade == null ? false : cascade.isCascadeRemove();
- }
-
- protected boolean getResourceRefresh(CascadeType cascade) {
- return cascade == null ? false : cascade.isCascadeRefresh();
- }
-
- public TextRange getValidationTextRange() {
- return this.getResourceCascade().getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmColumn.java
deleted file mode 100644
index ef90cfc1df..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmColumn.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0, which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmColumn;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmBaseColumn;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-
-public class GenericOrmColumn extends AbstractOrmBaseColumn<XmlColumn> implements OrmColumn
-{
- protected Integer specifiedLength;
-
- protected Integer specifiedPrecision;
-
- protected Integer specifiedScale;
-
- public GenericOrmColumn(XmlContextNode parent, OrmColumn.Owner owner) {
- super(parent, owner);
- }
-
- @Override
- public OrmColumn.Owner getOwner() {
- return (OrmColumn.Owner) super.getOwner();
- }
-
- public void initializeFrom(Column oldColumn) {
- super.initializeFrom(oldColumn);
- setSpecifiedLength(oldColumn.getSpecifiedLength());
- setSpecifiedPrecision(oldColumn.getSpecifiedPrecision());
- setSpecifiedScale(oldColumn.getSpecifiedScale());
- }
-
- public int getLength() {
- return (this.getSpecifiedLength() == null) ? getDefaultLength() : this.getSpecifiedLength().intValue();
- }
-
- public int getDefaultLength() {
- return Column.DEFAULT_LENGTH;
- }
-
- public Integer getSpecifiedLength() {
- return this.specifiedLength;
- }
-
- public void setSpecifiedLength(Integer newSpecifiedLength) {
- Integer oldSpecifiedLength = this.specifiedLength;
- this.specifiedLength = newSpecifiedLength;
- if (this.valuesAreDifferent(oldSpecifiedLength, newSpecifiedLength)) {
- if (this.getResourceColumn() != null) {
- this.getResourceColumn().setLength(newSpecifiedLength);
- this.removeResourceColumnIfFeaturesUnset();
- }
- else if (newSpecifiedLength != null) {
- addResourceColumn();
- getResourceColumn().setLength(newSpecifiedLength);
- }
- }
- firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, oldSpecifiedLength, newSpecifiedLength);
- }
-
- protected void setSpecifiedLength_(Integer newSpecifiedLength) {
- Integer oldSpecifiedLength = this.specifiedLength;
- this.specifiedLength = newSpecifiedLength;
- firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, oldSpecifiedLength, newSpecifiedLength);
- }
-
- public int getPrecision() {
- return (this.getSpecifiedPrecision() == null) ? getDefaultPrecision() : this.getSpecifiedPrecision().intValue();
- }
-
- public int getDefaultPrecision() {
- return Column.DEFAULT_PRECISION;
- }
-
- public Integer getSpecifiedPrecision() {
- return this.specifiedPrecision;
- }
-
- public void setSpecifiedPrecision(Integer newSpecifiedPrecision) {
- Integer oldSpecifiedPrecision = this.specifiedPrecision;
- this.specifiedPrecision = newSpecifiedPrecision;
- if (this.valuesAreDifferent(oldSpecifiedPrecision, newSpecifiedPrecision)) {
- if (this.getResourceColumn() != null) {
- this.getResourceColumn().setPrecision(newSpecifiedPrecision);
- this.removeResourceColumnIfFeaturesUnset();
- }
- else if (newSpecifiedPrecision != null) {
- addResourceColumn();
- getResourceColumn().setPrecision(newSpecifiedPrecision);
- }
- }
- firePropertyChanged(SPECIFIED_PRECISION_PROPERTY, oldSpecifiedPrecision, newSpecifiedPrecision);
- }
-
- protected void setSpecifiedPrecision_(Integer newSpecifiedPrecision) {
- Integer oldSpecifiedPrecision = this.specifiedPrecision;
- this.specifiedPrecision = newSpecifiedPrecision;
- firePropertyChanged(SPECIFIED_PRECISION_PROPERTY, oldSpecifiedPrecision, newSpecifiedPrecision);
- }
-
- public int getScale() {
- return (this.getSpecifiedScale() == null) ? getDefaultScale() : this.getSpecifiedScale().intValue();
- }
-
- public int getDefaultScale() {
- return Column.DEFAULT_SCALE;
- }
-
- public Integer getSpecifiedScale() {
- return this.specifiedScale;
- }
-
- public void setSpecifiedScale(Integer newSpecifiedScale) {
- Integer oldSpecifiedScale = this.specifiedScale;
- this.specifiedScale = newSpecifiedScale;
- if (this.valuesAreDifferent(oldSpecifiedScale, newSpecifiedScale)) {
- if (this.getResourceColumn() != null) {
- this.getResourceColumn().setScale(newSpecifiedScale);
- this.removeResourceColumnIfFeaturesUnset();
- }
- else if (newSpecifiedScale != null) {
- addResourceColumn();
- getResourceColumn().setScale(newSpecifiedScale);
- }
- }
- firePropertyChanged(SPECIFIED_SCALE_PROPERTY, oldSpecifiedScale, newSpecifiedScale);
- }
-
- protected void setSpecifiedScale_(Integer newSpecifiedScale) {
- Integer oldSpecifiedScale = this.specifiedScale;
- this.specifiedScale = newSpecifiedScale;
- firePropertyChanged(SPECIFIED_SCALE_PROPERTY, oldSpecifiedScale, newSpecifiedScale);
- }
-
- @Override
- protected XmlColumn getResourceColumn() {
- return getOwner().getResourceColumn();
- }
-
- @Override
- protected void addResourceColumn() {
- getOwner().addResourceColumn();
- }
-
- @Override
- protected void removeResourceColumn() {
- getOwner().removeResourceColumn();
- }
-
- @Override
- public void initialize(XmlColumn column) {
- super.initialize(column);
- this.specifiedLength = this.getResourceLength(column);
- this.specifiedPrecision = this.getResourcePrecision(column);
- this.specifiedScale = this.getResourceScale(column);
- }
-
- @Override
- public void update(XmlColumn column) {
- super.update(column);
- this.setSpecifiedLength_(this.getResourceLength(column));
- this.setSpecifiedPrecision_(this.getResourcePrecision(column));
- this.setSpecifiedScale_(this.getResourceScale(column));
- }
-
- protected Integer getResourceLength(XmlColumn column) {
- return column == null ? null : column.getLength();
- }
-
- protected Integer getResourcePrecision(XmlColumn column) {
- return column == null ? null : column.getPrecision();
- }
-
- protected Integer getResourceScale(XmlColumn column) {
- return column == null ? null : column.getScale();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java
deleted file mode 100644
index ab4649463a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0, which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.List;
-
-import org.eclipse.jpt.core.context.DiscriminatorColumn;
-import org.eclipse.jpt.core.context.DiscriminatorType;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmDiscriminatorColumn;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmNamedColumn;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlDiscriminatorColumn;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmDiscriminatorColumn extends AbstractOrmNamedColumn<XmlDiscriminatorColumn>
- implements OrmDiscriminatorColumn
-{
-
- protected DiscriminatorType specifiedDiscriminatorType;
-
- protected DiscriminatorType defaultDiscriminatorType;
-
- protected Integer specifiedLength;
-
- protected int defaultLength;
-
- protected XmlEntity entity;
-
- public GenericOrmDiscriminatorColumn(XmlContextNode parent, OrmDiscriminatorColumn.Owner owner) {
- super(parent, owner);
- }
-
- @Override
- public OrmDiscriminatorColumn.Owner getOwner() {
- return (OrmDiscriminatorColumn.Owner) super.getOwner();
- }
-
- public DiscriminatorType getDiscriminatorType() {
- return (this.getSpecifiedDiscriminatorType() == null) ? this.getDefaultDiscriminatorType() : this.getSpecifiedDiscriminatorType();
- }
-
- public DiscriminatorType getDefaultDiscriminatorType() {
- return this.defaultDiscriminatorType;
- }
-
- protected void setDefaultDiscriminatorType(DiscriminatorType discriminatorType) {
- DiscriminatorType old = this.defaultDiscriminatorType;
- this.defaultDiscriminatorType = discriminatorType;
- firePropertyChanged(DEFAULT_DISCRIMINATOR_TYPE_PROPERTY, old, discriminatorType);
- }
-
- public DiscriminatorType getSpecifiedDiscriminatorType() {
- return this.specifiedDiscriminatorType;
- }
-
- public void setSpecifiedDiscriminatorType(DiscriminatorType newSpecifiedDiscriminatorType) {
- DiscriminatorType oldDiscriminatorType = this.specifiedDiscriminatorType;
- this.specifiedDiscriminatorType = newSpecifiedDiscriminatorType;
- if (oldDiscriminatorType != newSpecifiedDiscriminatorType) {
- if (this.getResourceColumn() != null) {
- this.getResourceColumn().setDiscriminatorType(DiscriminatorType.toOrmResourceModel(newSpecifiedDiscriminatorType));
- this.removeResourceColumnIfFeaturesUnset();
- }
- else if (newSpecifiedDiscriminatorType != null) {
- addResourceColumn();
- this.getResourceColumn().setDiscriminatorType(DiscriminatorType.toOrmResourceModel(newSpecifiedDiscriminatorType));
- }
- }
- firePropertyChanged(DiscriminatorColumn.SPECIFIED_DISCRIMINATOR_TYPE_PROPERTY, oldDiscriminatorType, newSpecifiedDiscriminatorType);
- }
-
- protected void setSpecifiedDiscriminatorType_(DiscriminatorType newSpecifiedDiscriminatorType) {
- DiscriminatorType oldDiscriminatorType = this.specifiedDiscriminatorType;
- this.specifiedDiscriminatorType = newSpecifiedDiscriminatorType;
- firePropertyChanged(DiscriminatorColumn.SPECIFIED_DISCRIMINATOR_TYPE_PROPERTY, oldDiscriminatorType, newSpecifiedDiscriminatorType);
- }
-
- public int getLength() {
- return (this.getSpecifiedLength() == null) ? this.getDefaultLength() : this.getSpecifiedLength().intValue();
- }
-
- public int getDefaultLength() {
- return this.defaultLength;
- }
-
- protected void setDefaultLength(int defaultLength) {
- int old = this.defaultLength;
- this.defaultLength = defaultLength;
- firePropertyChanged(DEFAULT_LENGTH_PROPERTY, old, defaultLength);
- }
-
- public Integer getSpecifiedLength() {
- return this.specifiedLength;
- }
-
- public void setSpecifiedLength(Integer newSpecifiedLength) {
- Integer oldSpecifiedLength = this.specifiedLength;
- this.specifiedLength = newSpecifiedLength;
- if (this.valuesAreDifferent(oldSpecifiedLength, newSpecifiedLength)) {
- if (this.getResourceColumn() != null) {
- this.getResourceColumn().setLength(newSpecifiedLength);
- this.removeResourceColumnIfFeaturesUnset();
- }
- else if (newSpecifiedLength != null) {
- addResourceColumn();
- getResourceColumn().setLength(newSpecifiedLength);
- }
- }
- firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, oldSpecifiedLength, newSpecifiedLength);
- }
-
- protected void setSpecifiedLength_(Integer newSpecifiedLength) {
- Integer oldSpecifiedLength = this.specifiedLength;
- this.specifiedLength = newSpecifiedLength;
- firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, oldSpecifiedLength, newSpecifiedLength);
- }
-
-
- @Override
- public XmlDiscriminatorColumn getResourceColumn() {
- return this.entity.getDiscriminatorColumn();
- }
-
- @Override
- protected void addResourceColumn() {
- this.entity.setDiscriminatorColumn(OrmFactory.eINSTANCE.createXmlDiscriminatorColumn());
- }
-
- @Override
- protected void removeResourceColumn() {
- this.entity.setDiscriminatorColumn(null);
- }
-
- public boolean isResourceSpecified() {
- return getResourceColumn() != null;
- }
-
- public void initialize(XmlEntity xmlEntity) {
- this.entity = xmlEntity;
- this.initialize(this.getResourceColumn());
- }
-
- public void update(XmlEntity xmlEntity) {
- this.entity = xmlEntity;
- this.update(this.getResourceColumn());
- }
-
-
- @Override
- protected void initialize(XmlDiscriminatorColumn column) {
- super.initialize(column);
- this.defaultDiscriminatorType = this.buildDefaultDiscriminatorType();
- this.defaultLength = this.buildDefaultLength();
- this.specifiedLength = this.getResourceLength(column);
- this.specifiedDiscriminatorType = this.getResourceDiscriminatorType(column);
- }
-
- @Override
- protected void update(XmlDiscriminatorColumn column) {
- //don't call super because postUpdate() handles updating the default column name
- this.setSpecifiedName_(this.getResourceColumnName(column));
- this.setColumnDefinition_(this.getResourceColumnDefinition(column));
- this.setSpecifiedLength_(this.getResourceLength(column));
- this.setSpecifiedDiscriminatorType_(this.getResourceDiscriminatorType(column));
- }
-
- @Override
- /**
- * Using postUpdate since these defaults are dependent on the entity hierarchy
- */
- public void postUpdate() {
- super.postUpdate();
- this.setDefaultName(this.buildDefaultName());
- this.setDefaultDiscriminatorType(this.buildDefaultDiscriminatorType());
- this.setDefaultLength(this.buildDefaultLength());
- }
-
- protected Integer getResourceLength(XmlDiscriminatorColumn column) {
- return column == null ? null : column.getLength();
- }
-
- protected DiscriminatorType getResourceDiscriminatorType(XmlDiscriminatorColumn column) {
- return column == null ? null : DiscriminatorType.fromOrmResourceModel(column.getDiscriminatorType());
- }
-
- protected int buildDefaultLength() {
- return this.getOwner().getDefaultLength();
- }
-
- protected DiscriminatorType buildDefaultDiscriminatorType() {
- return this.getOwner().getDefaultDiscriminatorType();
- }
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- if (this.connectionProfileIsActive()) {
- if ( ! this.isResolved()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.DISCRIMINATOR_COLUMN_UNRESOLVED_NAME,
- new String[] {this.getName()},
- this,
- this.getNameTextRange()
- )
- );
- }
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java
deleted file mode 100644
index f0c0c8d0a5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Oracle. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmEmbeddable;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaEmbeddable;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddable;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-
-
-public class GenericOrmEmbeddable
- extends AbstractOrmEmbeddable
-{
- public GenericOrmEmbeddable(OrmPersistentType parent, XmlEmbeddable resourceMapping) {
- super(parent, resourceMapping);
- }
-
- @Override
- public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
- return ArrayTools.contains(GenericJavaEmbeddable.ALLOWED_ATTRIBUTE_MAPPING_KEYS, attributeMappingKey);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java
deleted file mode 100644
index e14c322340..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddedIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmBaseEmbeddedMapping;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddedId;
-
-
-public class GenericOrmEmbeddedIdMapping
- extends AbstractOrmBaseEmbeddedMapping<XmlEmbeddedId>
- implements OrmEmbeddedIdMapping
-{
-
- public GenericOrmEmbeddedIdMapping(OrmPersistentAttribute parent, XmlEmbeddedId resourceMapping) {
- super(parent, resourceMapping);
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmEmbeddedIdMapping(this);
- }
-
- public int getXmlSequence() {
- return 10;
- }
-
- //*************** AttributeMapping implementation *********************
-
- public String getKey() {
- return MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- public boolean isIdMapping() {
- return true;
- }
-
- public void addToResourceModel(Attributes resourceAttributes) {
- resourceAttributes.getEmbeddedIds().add(this.resourceAttributeMapping);
- }
-
- public void removeFromResourceModel(Attributes resourceAttributes) {
- resourceAttributes.getEmbeddedIds().remove(this.resourceAttributeMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java
deleted file mode 100644
index 9237b1553f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmEmbeddedMapping;
-import org.eclipse.jpt.core.resource.orm.XmlEmbedded;
-
-
-public class GenericOrmEmbeddedMapping
- extends AbstractOrmEmbeddedMapping<XmlEmbedded>
-{
-
- public GenericOrmEmbeddedMapping(OrmPersistentAttribute parent, XmlEmbedded resourceMapping) {
- super(parent, resourceMapping);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEntity.java
deleted file mode 100644
index 867a738828..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEntity.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmEntity;
-import org.eclipse.jpt.core.jpa2.context.CacheableHolder2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory;
-import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-
-public class GenericOrmEntity
- extends AbstractOrmEntity
-
-{
-
- protected final OrmCacheable2_0 cacheable;
-
- public GenericOrmEntity(OrmPersistentType parent, XmlEntity resourceMapping) {
- super(parent, resourceMapping);
- this.cacheable = ((OrmXml2_0ContextNodeFactory) getXmlContextNodeFactory()).buildOrmCacheable(this, resourceMapping);
- }
-
- public OrmCacheable2_0 getCacheable() {
- return this.cacheable;
- }
-
- public boolean calculateDefaultCacheable() {
- if (!isMetadataComplete()) {
- CacheableHolder2_0 javaEntity = (CacheableHolder2_0) getJavaEntity();
- if (javaEntity != null) {
- return javaEntity.getCacheable().isCacheable();
- }
- }
-
- CacheableHolder2_0 parentEntity = (CacheableHolder2_0) getParentEntity();
- if (parentEntity != null) {
- return parentEntity.getCacheable().isCacheable();
- }
- return ((PersistenceUnit2_0) getPersistenceUnit()).calculateDefaultCacheable();
- }
-
- @Override
- public void update() {
- super.update();
- getCacheable().update();
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java
deleted file mode 100644
index 24a8209eff..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.EnumType;
-import org.eclipse.jpt.core.context.EnumeratedConverter;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmConverter;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class GenericOrmEnumeratedConverter extends AbstractOrmXmlContextNode
- implements EnumeratedConverter, OrmConverter
-{
- private EnumType specifiedEnumType;
-
- private XmlConvertibleMapping resourceConvertibleMapping;
-
- public GenericOrmEnumeratedConverter(OrmAttributeMapping parent, XmlConvertibleMapping resourceMapping) {
- super(parent);
- this.initialize(resourceMapping);
- }
-
- @Override
- public OrmAttributeMapping getParent() {
- return (OrmAttributeMapping) super.getParent();
- }
-
- public String getType() {
- return Converter.ENUMERATED_CONVERTER;
- }
-
- public EnumType getEnumType() {
- return getSpecifiedEnumType() == null ? getDefaultEnumType() : getSpecifiedEnumType();
- }
-
- public EnumType getDefaultEnumType() {
- //there is no default enumType in xml, if you specify the enumerated element, you must
- //specify either ORDINAL or STRING
- return null;
- }
-
- public EnumType getSpecifiedEnumType() {
- return this.specifiedEnumType;
- }
-
- public void setSpecifiedEnumType(EnumType newSpecifiedEnumType) {
- EnumType oldSpecifiedEnumType = this.specifiedEnumType;
- this.specifiedEnumType = newSpecifiedEnumType;
- this.resourceConvertibleMapping.setEnumerated(EnumType.toOrmResourceModel(newSpecifiedEnumType));
- firePropertyChanged(EnumeratedConverter.SPECIFIED_ENUM_TYPE_PROPERTY, oldSpecifiedEnumType, newSpecifiedEnumType);
- }
-
- protected void setSpecifiedEnumType_(EnumType newSpecifiedEnumType) {
- EnumType oldSpecifiedEnumType = this.specifiedEnumType;
- this.specifiedEnumType = newSpecifiedEnumType;
- firePropertyChanged(EnumeratedConverter.SPECIFIED_ENUM_TYPE_PROPERTY, oldSpecifiedEnumType, newSpecifiedEnumType);
- }
-
- protected void initialize(XmlConvertibleMapping resourceConvertibleMapping) {
- this.resourceConvertibleMapping = resourceConvertibleMapping;
- this.specifiedEnumType = this.specifiedEnumType();
- }
-
- public void update() {
- this.setSpecifiedEnumType_(this.specifiedEnumType());
- }
-
- protected EnumType specifiedEnumType() {
- return EnumType.fromOrmResourceModel(this.resourceConvertibleMapping.getEnumerated());
- }
-
- public TextRange getValidationTextRange() {
- return this.resourceConvertibleMapping.getEnumeratedTextRange();
- }
-
- public void addToResourceModel() {
- this.resourceConvertibleMapping.setEnumerated(org.eclipse.jpt.core.resource.orm.EnumType.ORDINAL);
- }
-
- public void removeFromResourceModel() {
- this.resourceConvertibleMapping.setEnumerated(null);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java
deleted file mode 100644
index 860d5a8f61..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jpt.core.context.GeneratedValue;
-import org.eclipse.jpt.core.context.GenerationType;
-import org.eclipse.jpt.core.context.Generator;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmGeneratedValue;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.XmlGeneratedValue;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- *
- */
-public class GenericOrmGeneratedValue
- extends AbstractOrmXmlContextNode
- implements OrmGeneratedValue
-{
- protected XmlGeneratedValue resourceGeneratedValue;
-
- protected GenerationType specifiedStrategy;
-
- protected String specifiedGenerator;
- protected String defaultGenerator;
-
-
- public GenericOrmGeneratedValue(XmlContextNode parent, XmlGeneratedValue resourceGeneratedValue) {
- super(parent);
- this.initialize(resourceGeneratedValue);
- }
-
- protected void initialize(XmlGeneratedValue xmlGeneratedValue) {
- this.resourceGeneratedValue = xmlGeneratedValue;
- this.specifiedStrategy = this.buildStrategy();
- this.specifiedGenerator = xmlGeneratedValue.getGenerator();
- //TODO
- this.defaultGenerator = null;
- }
-
- @Override
- public XmlContextNode getParent() {
- return (XmlContextNode) super.getParent();
- }
-
-
- // ********** strategy **********
-
- public GenerationType getStrategy() {
- return (this.specifiedStrategy != null) ? this.specifiedStrategy : this.getDefaultStrategy();
- }
-
- public GenerationType getDefaultStrategy() {
- return GeneratedValue.DEFAULT_STRATEGY;
- }
-
- public GenerationType getSpecifiedStrategy() {
- return this.specifiedStrategy;
- }
-
- public void setSpecifiedStrategy(GenerationType strategy) {
- GenerationType old = this.specifiedStrategy;
- this.specifiedStrategy = strategy;
- this.resourceGeneratedValue.setStrategy(GenerationType.toOrmResourceModel(strategy));
- this.firePropertyChanged(SPECIFIED_STRATEGY_PROPERTY, old, strategy);
- }
-
- protected void setSpecifiedStrategy_(GenerationType strategy) {
- GenerationType old = this.specifiedStrategy;
- this.specifiedStrategy = strategy;
- this.firePropertyChanged(SPECIFIED_STRATEGY_PROPERTY, old, strategy);
- }
-
-
- // ********** generator **********
-
- public String getGenerator() {
- return (this.specifiedGenerator != null) ? this.specifiedGenerator : this.defaultGenerator;
- }
-
- 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);
- }
-
- public String getSpecifiedGenerator() {
- return this.specifiedGenerator;
- }
-
- public void setSpecifiedGenerator(String generator) {
- String old = this.specifiedGenerator;
- this.specifiedGenerator = generator;
- this.resourceGeneratedValue.setGenerator(generator);
- this.firePropertyChanged(SPECIFIED_GENERATOR_PROPERTY, old, generator);
- }
-
- protected void setSpecifiedGenerator_(String generator) {
- String old = this.specifiedGenerator;
- this.specifiedGenerator = generator;
- this.firePropertyChanged(SPECIFIED_GENERATOR_PROPERTY, old, generator);
- }
-
-
- // ********** text ranges **********
-
- public TextRange getValidationTextRange() {
- TextRange validationTextRange = this.resourceGeneratedValue.getValidationTextRange();
- return validationTextRange != null ? validationTextRange : getParent().getValidationTextRange();
- }
-
- public TextRange getGeneratorTextRange() {
- TextRange textRange = this.resourceGeneratedValue.getGeneratorTextRange();
- return textRange != null ? textRange : getValidationTextRange();
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
-
- String generator = this.getGenerator();
- if (generator == null) {
- return;
- }
-
- for (Iterator<Generator> stream = this.getPersistenceUnit().generators(); stream.hasNext(); ) {
- if (generator.equals(stream.next().getName())) {
- return;
- }
- }
-
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ID_MAPPING_UNRESOLVED_GENERATOR_NAME,
- new String[] {generator},
- this.getParent(),
- this.getGeneratorTextRange()
- )
- );
- }
-
-
- // ********** update from resource model **********
-
- public void update(XmlGeneratedValue xmlGeneratedValue) {
- this.resourceGeneratedValue = xmlGeneratedValue;
- this.setSpecifiedStrategy_(this.buildStrategy());
- this.setSpecifiedGenerator_(xmlGeneratedValue.getGenerator());
- //TODO
- this.setDefaultGenerator(null);
- }
-
- protected GenerationType buildStrategy() {
- return GenerationType.fromOrmResourceModel(this.resourceGeneratedValue.getStrategy());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java
deleted file mode 100644
index 2ec03ec9a1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jpt.core.context.Generator;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmGenerator;
-import org.eclipse.jpt.core.context.orm.OrmGeneratorContainer;
-import org.eclipse.jpt.core.context.orm.OrmSequenceGenerator;
-import org.eclipse.jpt.core.context.orm.OrmTableGenerator;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlGeneratorContainer;
-import org.eclipse.jpt.core.resource.orm.XmlSequenceGenerator;
-import org.eclipse.jpt.core.resource.orm.XmlTableGenerator;
-import org.eclipse.jpt.core.utility.TextRange;
-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 OrmSequenceGenerator sequenceGenerator;
-
- protected OrmTableGenerator tableGenerator;
-
- protected final XmlGeneratorContainer resourceGeneratorContainer;
-
- public GenericOrmGeneratorContainer(XmlContextNode parent, XmlGeneratorContainer resourceGeneratorContainer) {
- super(parent);
- this.resourceGeneratorContainer = resourceGeneratorContainer;
- this.initializeSequenceGenerator();
- this.initializeTableGenerator();
- }
-
- public OrmSequenceGenerator addSequenceGenerator() {
- if (getSequenceGenerator() != null) {
- throw new IllegalStateException("sequenceGenerator already exists"); //$NON-NLS-1$
- }
- XmlSequenceGenerator resourceSequenceGenerator = buildResourceSequenceGenerator();
- this.sequenceGenerator = buildSequenceGenerator(resourceSequenceGenerator);
- this.resourceGeneratorContainer.setSequenceGenerator(resourceSequenceGenerator);
- firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, null, this.sequenceGenerator);
- return this.sequenceGenerator;
- }
-
- public void removeSequenceGenerator() {
- if (getSequenceGenerator() == null) {
- throw new IllegalStateException("sequenceGenerator does not exist, cannot be removed"); //$NON-NLS-1$
- }
- OrmSequenceGenerator oldSequenceGenerator = this.sequenceGenerator;
- this.sequenceGenerator = null;
- this.resourceGeneratorContainer.setSequenceGenerator(null);
- firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, oldSequenceGenerator, null);
- }
-
- public OrmSequenceGenerator getSequenceGenerator() {
- return this.sequenceGenerator;
- }
-
- protected void setSequenceGenerator(OrmSequenceGenerator newSequenceGenerator) {
- OrmSequenceGenerator oldSequenceGenerator = this.sequenceGenerator;
- this.sequenceGenerator = newSequenceGenerator;
- firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, oldSequenceGenerator, newSequenceGenerator);
- }
-
- public OrmTableGenerator addTableGenerator() {
- if (getTableGenerator() != null) {
- throw new IllegalStateException("tableGenerator already exists"); //$NON-NLS-1$
- }
- XmlTableGenerator resourceTableGenerator = buildResourceTableGenerator();
- this.tableGenerator = buildTableGenerator(resourceTableGenerator);
- this.resourceGeneratorContainer.setTableGenerator(resourceTableGenerator);
- firePropertyChanged(TABLE_GENERATOR_PROPERTY, null, this.tableGenerator);
- return this.tableGenerator;
- }
-
- public void removeTableGenerator() {
- if (getTableGenerator() == null) {
- throw new IllegalStateException("tableGenerator does not exist, cannot be removed"); //$NON-NLS-1$
- }
- OrmTableGenerator oldTableGenerator = this.tableGenerator;
- this.tableGenerator = null;
- this.resourceGeneratorContainer.setTableGenerator(null);
- firePropertyChanged(TABLE_GENERATOR_PROPERTY, oldTableGenerator, null);
- }
-
- public OrmTableGenerator getTableGenerator() {
- return this.tableGenerator;
- }
-
- protected void setTableGenerator(OrmTableGenerator newTableGenerator) {
- OrmTableGenerator oldTableGenerator = this.tableGenerator;
- this.tableGenerator = newTableGenerator;
- firePropertyChanged(TABLE_GENERATOR_PROPERTY, oldTableGenerator, newTableGenerator);
- }
-
- protected void initializeSequenceGenerator() {
- if (this.resourceGeneratorContainer.getSequenceGenerator() != null) {
- this.sequenceGenerator = buildSequenceGenerator(this.resourceGeneratorContainer.getSequenceGenerator());
- }
- }
-
- protected XmlSequenceGenerator buildResourceSequenceGenerator() {
- return OrmFactory.eINSTANCE.createXmlSequenceGenerator();
- }
-
- protected OrmSequenceGenerator buildSequenceGenerator(XmlSequenceGenerator resourceSequenceGenerator) {
- return getXmlContextNodeFactory().buildOrmSequenceGenerator(this, resourceSequenceGenerator);
- }
-
- protected void initializeTableGenerator() {
- if (this.resourceGeneratorContainer.getTableGenerator() != null) {
- this.tableGenerator = buildTableGenerator(this.resourceGeneratorContainer.getTableGenerator());
- }
- }
-
- protected XmlTableGenerator buildResourceTableGenerator() {
- return OrmFactory.eINSTANCE.createXmlTableGenerator();
- }
-
- protected OrmTableGenerator buildTableGenerator(XmlTableGenerator resourceTableGenerator) {
- return getXmlContextNodeFactory().buildOrmTableGenerator(this, resourceTableGenerator);
- }
-
- public void update() {
- this.updateSequenceGenerator();
- this.updateTableGenerator();
- }
-
- protected void updateSequenceGenerator() {
- if (this.resourceGeneratorContainer.getSequenceGenerator() == null) {
- if (getSequenceGenerator() != null) {
- setSequenceGenerator(null);
- }
- }
- else {
- if (getSequenceGenerator() == null) {
- setSequenceGenerator(buildSequenceGenerator(this.resourceGeneratorContainer.getSequenceGenerator()));
- }
- else {
- getSequenceGenerator().update(this.resourceGeneratorContainer.getSequenceGenerator());
- }
- }
- }
-
- protected void updateTableGenerator() {
- if (this.resourceGeneratorContainer.getTableGenerator() == null) {
- if (getTableGenerator() != null) {
- setTableGenerator(null);
- }
- }
- else {
- if (getTableGenerator() == null) {
- setTableGenerator(buildTableGenerator(this.resourceGeneratorContainer.getTableGenerator()));
- }
- else {
- getTableGenerator().update(this.resourceGeneratorContainer.getTableGenerator());
- }
- }
- }
-
- // **************** validation *********************************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.validateGenerators(messages);
- }
-
- protected void validateGenerators(List<IMessage> messages) {
- for (Iterator<OrmGenerator> localGenerators = this.generators(); localGenerators.hasNext(); ) {
- OrmGenerator localGenerator = localGenerators.next();
- for (Iterator<Generator> globalGenerators = this.getPersistenceUnit().generators(); globalGenerators.hasNext(); ) {
- if (localGenerator.duplicates(globalGenerators.next())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.GENERATOR_DUPLICATE_NAME,
- new String[] {localGenerator.getName()},
- localGenerator,
- localGenerator.getNameTextRange()
- )
- );
- }
- }
- }
- }
-
- protected Iterator<OrmGenerator> generators() {
- ArrayList<OrmGenerator> generators = new ArrayList<OrmGenerator>();
- this.addGeneratorsTo(generators);
- return generators.iterator();
- }
-
- protected void addGeneratorsTo(ArrayList<OrmGenerator> generators) {
- if (this.sequenceGenerator != null) {
- generators.add(this.sequenceGenerator);
- }
- if (this.tableGenerator != null) {
- generators.add(this.tableGenerator);
- }
- }
-
- public TextRange getValidationTextRange() {
- return this.resourceGeneratorContainer.getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmIdMapping.java
deleted file mode 100644
index 7675b12575..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmIdMapping.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmIdMapping;
-import org.eclipse.jpt.core.resource.orm.XmlId;
-
-public class GenericOrmIdMapping extends AbstractOrmIdMapping<XmlId>
-{
-
- public GenericOrmIdMapping(OrmPersistentAttribute parent, XmlId resourceMapping) {
- super(parent, resourceMapping);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java
deleted file mode 100644
index ac81567c05..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.List;
-
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipMapping;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmBaseColumn;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmJoinColumn extends AbstractOrmBaseColumn<XmlJoinColumn> implements OrmJoinColumn
-{
-
- protected String specifiedReferencedColumnName;
-
- protected String defaultReferencedColumnName;
-
- protected XmlJoinColumn resourceJoinColumn;
-
- public GenericOrmJoinColumn(XmlContextNode parent, OrmJoinColumn.Owner owner, XmlJoinColumn resourceJoinColumn) {
- super(parent, owner);
- this.initialize(resourceJoinColumn);
- }
-
- public void initializeFrom(JoinColumn oldColumn) {
- super.initializeFrom(oldColumn);
- setSpecifiedReferencedColumnName(oldColumn.getSpecifiedReferencedColumnName());
- }
-
- public String getReferencedColumnName() {
- return (this.getSpecifiedReferencedColumnName() == null) ? getDefaultReferencedColumnName() : this.getSpecifiedReferencedColumnName();
- }
-
- public String getSpecifiedReferencedColumnName() {
- return this.specifiedReferencedColumnName;
- }
-
- public void setSpecifiedReferencedColumnName(String newSpecifiedReferencedColumnName) {
- String oldSpecifiedReferencedColumnName = this.specifiedReferencedColumnName;
- this.specifiedReferencedColumnName = newSpecifiedReferencedColumnName;
- getResourceColumn().setReferencedColumnName(newSpecifiedReferencedColumnName);
- firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, oldSpecifiedReferencedColumnName, newSpecifiedReferencedColumnName);
- }
-
- protected void setSpecifiedReferencedColumnName_(String newSpecifiedReferencedColumnName) {
- String oldSpecifiedReferencedColumnName = this.specifiedReferencedColumnName;
- this.specifiedReferencedColumnName = newSpecifiedReferencedColumnName;
- firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, oldSpecifiedReferencedColumnName, newSpecifiedReferencedColumnName);
- }
-
- public String getDefaultReferencedColumnName() {
- return this.defaultReferencedColumnName;
- }
-
- protected void setDefaultReferencedColumnName(String newDefaultReferencedColumnName) {
- String oldDefaultReferencedColumnName = this.defaultReferencedColumnName;
- this.defaultReferencedColumnName = newDefaultReferencedColumnName;
- firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, oldDefaultReferencedColumnName, newDefaultReferencedColumnName);
- }
-
- public boolean isVirtual() {
- return getOwner().isVirtual(this);
- }
-
- @Override
- public OrmJoinColumn.Owner getOwner() {
- return (OrmJoinColumn.Owner) this.owner;
- }
-
- public Table getReferencedColumnDbTable() {
- return getOwner().getReferencedColumnDbTable();
- }
-
- public Column getReferencedDbColumn() {
- Table table = getReferencedColumnDbTable();
- return (table == null) ? null : table.getColumnForIdentifier(getReferencedColumnName());
- }
-
- public boolean isReferencedColumnResolved() {
- return getReferencedDbColumn() != null;
- }
-
- public TextRange getReferencedColumnNameTextRange() {
- if (getResourceColumn() != null) {
- TextRange textRange = getResourceColumn().getReferencedColumnNameTextRange();
- if (textRange != null) {
- return textRange;
- }
- }
- return getOwner().getValidationTextRange();
- }
-
-
- @Override
- protected XmlJoinColumn getResourceColumn() {
- return this.resourceJoinColumn;
- }
-
- @Override
- protected void addResourceColumn() {
- //joinColumns are part of a collection, the join-column element will be removed/added
- //when the XmlJoinColumn is removed/added to the XmlEntity collection
- }
-
- @Override
- protected void removeResourceColumn() {
- //joinColumns are part of a collection, the pk-join-column element will be removed/added
- //when the XmlJoinColumn is removed/added to the XmlEntity collection
- }
-
-
- @Override
- protected void initialize(XmlJoinColumn xjc) {
- this.resourceJoinColumn = xjc;
- super.initialize(xjc);
- this.specifiedReferencedColumnName = buildSpecifiedReferencedColumnName(xjc);
- this.defaultReferencedColumnName = buildDefaultReferencedColumnName();
- }
-
- @Override
- public void update(XmlJoinColumn xjc) {
- this.resourceJoinColumn = xjc;
- super.update(xjc);
- this.setSpecifiedReferencedColumnName_(buildSpecifiedReferencedColumnName(xjc));
- this.setDefaultReferencedColumnName(buildDefaultReferencedColumnName());
- }
-
- protected String buildSpecifiedReferencedColumnName(XmlJoinColumn xjc) {
- return (xjc == null) ? null : xjc.getReferencedColumnName();
- }
-
- @Override
- protected String buildDefaultName() {
- return MappingTools.buildJoinColumnDefaultName(this);
- }
-
- protected String buildDefaultReferencedColumnName() {
- return MappingTools.buildJoinColumnDefaultReferencedColumnName(this.getOwner());
- }
-
-
- //******************* validation ***********************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- validateName(messages);
- validateReferencedColumnName(messages);
- }
-
- protected void validateName(List<IMessage> messages) {
- if ( ! this.isResolved() && getDbTable() != null) {
- if (getName() != null) {
- messages.add(this.buildUnresolvedMessage());
- }
- else if (getOwner().joinColumnsSize() > 1) {
-
- }
- }
- }
-
- protected void validateReferencedColumnName(List<IMessage> messages) {
- if ( ! this.isReferencedColumnResolved() && getReferencedColumnDbTable() != null) {
- if (getReferencedColumnName() != null) {
- messages.add(this.buildUnresolvedMessage());
- }
- else if (getOwner().joinColumnsSize() > 1) {
-
- }
- }
- }
-
- protected IMessage buildUnresolvedMessage() {
- OrmRelationshipMapping mapping = (OrmRelationshipMapping) this.getOwner().getRelationshipMapping();
- return mapping.getPersistentAttribute().isVirtual() ? this.buildVirtualUnresolvedNameMessage(mapping) : this.buildNonVirtualUnresolvedNameMessage();
- }
-
- protected IMessage buildVirtualUnresolvedNameMessage(OrmRelationshipMapping mapping) {
- return this.buildMessage(
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME,
- new String[] {mapping.getName(), this.getName()},
- this.getNameTextRange()
- );
- }
-
- protected IMessage buildNonVirtualUnresolvedNameMessage() {
- return this.buildMessage(
- JpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {this.getName()},
- this.getNameTextRange()
- );
- }
-
- protected IMessage buildUnresolvedReferenceColumnNameMessage() {
- OrmRelationshipMapping mapping = (OrmRelationshipMapping) this.getOwner().getRelationshipMapping();
- return mapping.getPersistentAttribute().isVirtual() ? this.buildVirtualUnresolvedReferenceColumnNameMessage(mapping) : this.buildNonVirtualUnresolvedReferenceColumnNameMessage();
- }
-
- protected IMessage buildVirtualUnresolvedReferenceColumnNameMessage(OrmRelationshipMapping mapping) {
- return this.buildMessage(
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME,
- new String[] {mapping.getName(), this.getName()},
- this.getReferencedColumnNameTextRange()
- );
- }
-
- protected IMessage buildNonVirtualUnresolvedReferenceColumnNameMessage() {
- return this.buildMessage(
- JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME,
- new String[] {this.getName()},
- this.getReferencedColumnNameTextRange()
- );
- }
-
- protected IMessage buildMessage(String msgID, String[] parms, TextRange textRange) {
- return DefaultJpaValidationMessages.buildMessage(IMessage.HIGH_SEVERITY, msgID, parms, this, textRange);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinTable.java
deleted file mode 100644
index 3ef58d4473..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinTable.java
+++ /dev/null
@@ -1,765 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jpt.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmJoinTable;
-import org.eclipse.jpt.core.context.orm.OrmJoinTableJoiningStrategy;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmTable;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-import org.eclipse.jpt.utility.internal.iterators.SingleElementListIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * orm.xml join table
- */
-public class GenericOrmJoinTable
- extends AbstractOrmTable
- implements OrmJoinTable
-{
- protected OrmJoinColumn defaultJoinColumn;
-
- protected final Vector<OrmJoinColumn> specifiedJoinColumns = new Vector<OrmJoinColumn>();
- protected final OrmJoinColumn.Owner joinColumnOwner;
-
- protected OrmJoinColumn defaultInverseJoinColumn;
-
- protected final Vector<OrmJoinColumn> specifiedInverseJoinColumns = new Vector<OrmJoinColumn>();
- protected final OrmJoinColumn.Owner inverseJoinColumnOwner;
-
-
- public GenericOrmJoinTable(OrmJoinTableJoiningStrategy parent, XmlJoinTable resourceJoinTable) {
- super(parent);
- this.joinColumnOwner = this.buildJoinColumnOwner();
- this.inverseJoinColumnOwner = this.buildInverseJoinColumnOwner();
- this.initialize(resourceJoinTable);
- }
-
- protected OrmJoinColumn.Owner buildJoinColumnOwner() {
- return new JoinColumnOwner();
- }
-
- protected OrmJoinColumn.Owner buildInverseJoinColumnOwner() {
- return new InverseJoinColumnOwner();
- }
-
- public RelationshipMapping getRelationshipMapping() {
- return getParent().getRelationshipReference().getRelationshipMapping();
- }
-
- public void initializeFrom(JoinTable oldJoinTable) {
- super.initializeFrom(oldJoinTable);
- for (Iterator<OrmJoinColumn> stream = oldJoinTable.specifiedJoinColumns(); stream.hasNext(); ) {
- this.addSpecifiedJoinColumnFrom(stream.next());
- }
- for (Iterator<OrmJoinColumn> stream = oldJoinTable.specifiedInverseJoinColumns(); stream.hasNext(); ) {
- this.addSpecifiedInverseJoinColumnFrom(stream.next());
- }
- }
-
- protected void initialize(XmlJoinTable joinTable) {
- super.initialize(joinTable);
- this.initializeSpecifiedJoinColumns(joinTable);
- this.initializeDefaultJoinColumn();
- this.initializeSpecifiedInverseJoinColumns(joinTable);
- this.initializeDefaultInverseJoinColumn();
- }
-
- public void update() {
- this.update(this.getResourceTable());
- }
-
- protected void update(XmlJoinTable joinTable) {
- super.update(joinTable);
- this.updateSpecifiedJoinColumns(joinTable);
- this.updateDefaultJoinColumn();
- this.updateSpecifiedInverseJoinColumns(joinTable);
- this.updateDefaultInverseJoinColumn();
- }
-
-
- // ********** AbstractOrmTable implementation **********
-
- @Override
- public OrmJoinTableJoiningStrategy getParent() {
- return (OrmJoinTableJoiningStrategy) super.getParent();
- }
-
- @Override
- protected String buildDefaultName() {
- return this.getParent().getJoinTableDefaultName();
- }
-
- /**
- * if the join table is on the "mappedBy" side, it's bogus;
- * so don't give it a default schema
- */
- @Override
- protected String buildDefaultSchema() {
- return this.getContextDefaultSchema();
- }
-
- @Override
- protected String buildDefaultCatalog() {
- return this.getContextDefaultCatalog();
- }
-
- @Override
- protected XmlJoinTable getResourceTable() {
- return this.getParent().getResourceJoinTable();
- }
-
- @Override
- protected XmlJoinTable addResourceTable() {
- return getParent().addResourceJoinTable();
- }
-
- @Override
- protected void removeResourceTable() {
- getParent().removeResourceJoinTable();
- }
-
-
- // ********** join columns **********
-
- public ListIterator<OrmJoinColumn> joinColumns() {
- return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumns() : this.defaultJoinColumns();
- }
-
- public int joinColumnsSize() {
- return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.defaultJoinColumnsSize();
- }
-
- public void convertDefaultToSpecifiedJoinColumn() {
- MappingTools.convertJoinTableDefaultToSpecifiedJoinColumn(this);
- }
-
-
- // ********** default join column **********
-
- public OrmJoinColumn getDefaultJoinColumn() {
- return this.defaultJoinColumn;
- }
-
- protected void setDefaultJoinColumn(OrmJoinColumn defaultJoinColumn) {
- OrmJoinColumn old = this.defaultJoinColumn;
- this.defaultJoinColumn = defaultJoinColumn;
- this.firePropertyChanged(DEFAULT_JOIN_COLUMN, old, defaultJoinColumn);
- }
-
- protected ListIterator<OrmJoinColumn> defaultJoinColumns() {
- if (this.defaultJoinColumn != null) {
- return new SingleElementListIterator<OrmJoinColumn>(this.defaultJoinColumn);
- }
- return EmptyListIterator.instance();
- }
-
- protected int defaultJoinColumnsSize() {
- return (this.defaultJoinColumn == null) ? 0 : 1;
- }
-
- protected void initializeDefaultJoinColumn() {
- if (this.shouldBuildDefaultJoinColumn()) {
- this.defaultJoinColumn = this.buildJoinColumn(null);
- }
- }
-
- protected void updateDefaultJoinColumn() {
- if (this.shouldBuildDefaultJoinColumn()) {
- if (this.defaultJoinColumn == null) {
- this.setDefaultJoinColumn(this.buildJoinColumn(null));
- } else {
- this.defaultJoinColumn.update(null);
- }
- } else {
- this.setDefaultJoinColumn(null);
- }
- }
-
- protected boolean shouldBuildDefaultJoinColumn() {
- return ! this.hasSpecifiedJoinColumns();
- }
-
-
- // ********** specified join columns **********
-
- public ListIterator<OrmJoinColumn> specifiedJoinColumns() {
- return new CloneListIterator<OrmJoinColumn>(this.specifiedJoinColumns);
- }
-
- public int specifiedJoinColumnsSize() {
- return this.specifiedJoinColumns.size();
- }
-
- public boolean hasSpecifiedJoinColumns() {
- return this.specifiedJoinColumns.size() != 0;
- }
-
- protected void addSpecifiedJoinColumnFrom(OrmJoinColumn oldJoinColumn) {
- OrmJoinColumn newJoinColumn = this.addSpecifiedJoinColumn(this.specifiedJoinColumns.size());
- newJoinColumn.initializeFrom(oldJoinColumn);
- }
-
- public OrmJoinColumn addSpecifiedJoinColumn(int index) {
- if (this.getResourceTable() == null) {
- this.addResourceTable();
- }
- XmlJoinColumn xmlJoinColumn = OrmFactory.eINSTANCE.createXmlJoinColumn();
- OrmJoinColumn joinColumn = this.buildJoinColumn(xmlJoinColumn);
- this.specifiedJoinColumns.add(index, joinColumn);
- this.getResourceTable().getJoinColumns().add(index, xmlJoinColumn);
- this.fireItemAdded(SPECIFIED_JOIN_COLUMNS_LIST, index, joinColumn);
- return joinColumn;
- }
-
- protected void addSpecifiedJoinColumn(int index, OrmJoinColumn joinColumn) {
- this.addItemToList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- }
-
- protected void addSpecifiedJoinColumn(OrmJoinColumn joinColumn) {
- this.addSpecifiedJoinColumn(this.specifiedJoinColumns.size(), joinColumn);
- }
-
- public void removeSpecifiedJoinColumn(JoinColumn joinColumn) {
- this.removeSpecifiedJoinColumn(this.specifiedJoinColumns.indexOf(joinColumn));
- }
-
- public void removeSpecifiedJoinColumn(int index) {
- OrmJoinColumn removedJoinColumn = this.specifiedJoinColumns.remove(index);
- if ( ! this.hasSpecifiedJoinColumns()) {
- //create the defaultJoinColumn now or this will happen during project update
- //after removing the join column from the resource model. That causes problems
- //in the UI because the change notifications end up in the wrong order.
- this.defaultJoinColumn = this.buildJoinColumn(null);
- }
- this.getResourceTable().getJoinColumns().remove(index);
- this.fireItemRemoved(SPECIFIED_JOIN_COLUMNS_LIST, index, removedJoinColumn);
- if (this.defaultJoinColumn != null) {
- //fire change notification if a defaultJoinColumn was created above
- this.firePropertyChanged(DEFAULT_JOIN_COLUMN, null, this.defaultJoinColumn);
- }
- }
-
- protected void removeSpecifiedJoinColumn_(OrmJoinColumn joinColumn) {
- this.removeItemFromList(joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- }
-
- public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.specifiedJoinColumns, targetIndex, sourceIndex);
- this.getResourceTable().getJoinColumns().move(targetIndex, sourceIndex);
- this.fireItemMoved(SPECIFIED_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
- }
-
- public void clearSpecifiedJoinColumns() {
- this.specifiedJoinColumns.clear();
- this.defaultJoinColumn = this.buildJoinColumn(null);
- this.getResourceTable().getJoinColumns().clear();
- this.fireListCleared(SPECIFIED_JOIN_COLUMNS_LIST);
- this.firePropertyChanged(DEFAULT_JOIN_COLUMN, null, this.defaultJoinColumn);
- }
-
- protected OrmJoinColumn buildJoinColumn(XmlJoinColumn resourceJoinColumn) {
- return this.buildJoinColumn(resourceJoinColumn, this.joinColumnOwner);
- }
-
- protected void initializeSpecifiedJoinColumns(XmlJoinTable xmlJoinTable) {
- if (xmlJoinTable != null) {
- for (XmlJoinColumn xmlJoinColumn : xmlJoinTable.getJoinColumns()) {
- this.specifiedJoinColumns.add(this.buildJoinColumn(xmlJoinColumn));
- }
- }
- }
-
- protected void updateSpecifiedJoinColumns(XmlJoinTable xmlJoinTable) {
- Iterator<XmlJoinColumn> xmlJoinColumns = this.xmlJoinColumns(xmlJoinTable);
-
- for (Iterator<OrmJoinColumn> contextJoinColumns = this.specifiedJoinColumns(); contextJoinColumns.hasNext(); ) {
- OrmJoinColumn contextJoinColumn = contextJoinColumns.next();
- if (xmlJoinColumns.hasNext()) {
- contextJoinColumn.update(xmlJoinColumns.next());
- } else {
- this.removeSpecifiedJoinColumn_(contextJoinColumn);
- }
- }
-
- while (xmlJoinColumns.hasNext()) {
- this.addSpecifiedJoinColumn(this.buildJoinColumn(xmlJoinColumns.next()));
- }
- }
-
- protected Iterator<XmlJoinColumn> xmlJoinColumns(XmlJoinTable xmlJoinTable) {
- // make a copy of the XML join columns (to prevent ConcurrentModificationException)
- return (xmlJoinTable == null) ? EmptyIterator.<XmlJoinColumn>instance()
- : new CloneIterator<XmlJoinColumn>(xmlJoinTable.getJoinColumns());
- }
-
-
- // ********** inverse join columns **********
-
- public ListIterator<OrmJoinColumn> inverseJoinColumns() {
- return this.hasSpecifiedInverseJoinColumns() ? this.specifiedInverseJoinColumns() : this.defaultInverseJoinColumns();
- }
-
- public int inverseJoinColumnsSize() {
- return this.hasSpecifiedInverseJoinColumns() ? this.specifiedInverseJoinColumnsSize() : this.defaultInverseJoinColumnsSize();
- }
-
- public void convertDefaultToSpecifiedInverseJoinColumn() {
- MappingTools.convertJoinTableDefaultToSpecifiedInverseJoinColumn(this);
- }
-
-
- // ********** default inverse join column **********
-
- public OrmJoinColumn getDefaultInverseJoinColumn() {
- return this.defaultInverseJoinColumn;
- }
-
- protected void setDefaultInverseJoinColumn(OrmJoinColumn defaultInverseJoinColumn) {
- OrmJoinColumn old = this.defaultInverseJoinColumn;
- this.defaultInverseJoinColumn = defaultInverseJoinColumn;
- this.firePropertyChanged(DEFAULT_INVERSE_JOIN_COLUMN, old, defaultInverseJoinColumn);
- }
-
- protected ListIterator<OrmJoinColumn> defaultInverseJoinColumns() {
- if (this.defaultInverseJoinColumn != null) {
- return new SingleElementListIterator<OrmJoinColumn>(this.defaultInverseJoinColumn);
- }
- return EmptyListIterator.instance();
- }
-
- protected int defaultInverseJoinColumnsSize() {
- return (this.defaultInverseJoinColumn == null) ? 0 : 1;
- }
-
- protected void initializeDefaultInverseJoinColumn() {
- if (this.shouldBuildDefaultInverseJoinColumn()) {
- this.defaultInverseJoinColumn = this.buildInverseJoinColumn(null);
- }
- }
-
- protected void updateDefaultInverseJoinColumn() {
- if (this.shouldBuildDefaultInverseJoinColumn()) {
- if (this.defaultInverseJoinColumn == null) {
- this.setDefaultInverseJoinColumn(this.buildInverseJoinColumn(null));
- } else {
- this.defaultInverseJoinColumn.update(null);
- }
- } else {
- this.setDefaultInverseJoinColumn(null);
- }
- }
-
- protected boolean shouldBuildDefaultInverseJoinColumn() {
- return ! this.hasSpecifiedInverseJoinColumns();
- }
-
-
- // ********** specified inverse join columns **********
-
- public ListIterator<OrmJoinColumn> specifiedInverseJoinColumns() {
- return new CloneListIterator<OrmJoinColumn>(this.specifiedInverseJoinColumns);
- }
-
- public int specifiedInverseJoinColumnsSize() {
- return this.specifiedInverseJoinColumns.size();
- }
-
- public boolean hasSpecifiedInverseJoinColumns() {
- return !this.specifiedInverseJoinColumns.isEmpty();
- }
-
- protected void addSpecifiedInverseJoinColumnFrom(OrmJoinColumn oldJoinColumn) {
- OrmJoinColumn newJoinColumn = this.addSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumns.size());
- newJoinColumn.initializeFrom(oldJoinColumn);
- }
-
- public OrmJoinColumn addSpecifiedInverseJoinColumn(int index) {
- if (this.getResourceTable() == null) {
- this.addResourceTable();
- }
- XmlJoinColumn xmlJoinColumn = OrmFactory.eINSTANCE.createXmlJoinColumn();
- OrmJoinColumn joinColumn = this.buildInverseJoinColumn(xmlJoinColumn);
- this.specifiedInverseJoinColumns.add(index, joinColumn);
- this.getResourceTable().getInverseJoinColumns().add(index, xmlJoinColumn);
- this.fireItemAdded(SPECIFIED_INVERSE_JOIN_COLUMNS_LIST, index, joinColumn);
- return joinColumn;
- }
-
- protected void addSpecifiedInverseJoinColumn(int index, OrmJoinColumn joinColumn) {
- this.addItemToList(index, joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
- }
-
- protected void addSpecifiedInverseJoinColumn(OrmJoinColumn joinColumn) {
- this.addSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumns.size(), joinColumn);
- }
-
- public void removeSpecifiedInverseJoinColumn(JoinColumn joinColumn) {
- this.removeSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumns.indexOf(joinColumn));
- }
-
- public void removeSpecifiedInverseJoinColumn(int index) {
- OrmJoinColumn removedJoinColumn = this.specifiedInverseJoinColumns.remove(index);
- if ( ! this.hasSpecifiedInverseJoinColumns()) {
- //create the defaultInverseJoinColumn now or this will happen during project update
- //after removing the join column from the resource model. That causes problems
- //in the UI because the change notifications end up in the wrong order.
- this.defaultInverseJoinColumn = this.buildInverseJoinColumn(null);
- }
- this.getResourceTable().getInverseJoinColumns().remove(index);
- this.fireItemRemoved(SPECIFIED_INVERSE_JOIN_COLUMNS_LIST, index, removedJoinColumn);
- if (this.defaultInverseJoinColumn != null) {
- //fire change notification if a defaultJoinColumn was created above
- this.firePropertyChanged(DEFAULT_INVERSE_JOIN_COLUMN, null, this.defaultInverseJoinColumn);
- }
- }
-
- protected void removeSpecifiedInverseJoinColumn_(OrmJoinColumn joinColumn) {
- this.removeItemFromList(joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
- }
-
- public void moveSpecifiedInverseJoinColumn(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.specifiedInverseJoinColumns, targetIndex, sourceIndex);
- this.getResourceTable().getInverseJoinColumns().move(targetIndex, sourceIndex);
- this.fireItemMoved(SPECIFIED_INVERSE_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
- }
-
- public void clearSpecifiedInverseJoinColumns() {
- this.specifiedInverseJoinColumns.clear();
- this.defaultInverseJoinColumn = this.buildInverseJoinColumn(null);
- this.getResourceTable().getInverseJoinColumns().clear();
- this.fireListCleared(SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
- this.firePropertyChanged(DEFAULT_INVERSE_JOIN_COLUMN, null, this.defaultInverseJoinColumn);
- }
-
- protected OrmJoinColumn buildInverseJoinColumn(XmlJoinColumn resourceJoinColumn) {
- return this.buildJoinColumn(resourceJoinColumn, this.inverseJoinColumnOwner);
- }
-
- protected void initializeSpecifiedInverseJoinColumns(XmlJoinTable xmlJoinTable) {
- if (xmlJoinTable != null) {
- for (XmlJoinColumn xmlJoinColumn : xmlJoinTable.getInverseJoinColumns()) {
- this.specifiedInverseJoinColumns.add(this.buildInverseJoinColumn(xmlJoinColumn));
- }
- }
- }
-
- protected void updateSpecifiedInverseJoinColumns(XmlJoinTable xmlJoinTable) {
- Iterator<XmlJoinColumn> xmlJoinColumns = this.xmlInverseJoinColumns(xmlJoinTable);
-
- for (ListIterator<OrmJoinColumn> contextJoinColumns = this.specifiedInverseJoinColumns(); contextJoinColumns.hasNext(); ) {
- OrmJoinColumn contextColumn = contextJoinColumns.next();
- if (xmlJoinColumns.hasNext()) {
- contextColumn.update(xmlJoinColumns.next());
- } else {
- this.removeSpecifiedInverseJoinColumn_(contextColumn);
- }
- }
-
- while (xmlJoinColumns.hasNext()) {
- this.addSpecifiedInverseJoinColumn(this.buildInverseJoinColumn(xmlJoinColumns.next()));
- }
- }
-
- protected Iterator<XmlJoinColumn> xmlInverseJoinColumns(XmlJoinTable xmlJoinTable) {
- // make a copy of the XML join columns (to prevent ConcurrentModificationException)
- return (xmlJoinTable == null) ? EmptyIterator.<XmlJoinColumn>instance()
- : new CloneIterator<XmlJoinColumn>(xmlJoinTable.getInverseJoinColumns());
- }
-
-
- // ********** misc **********
-
- protected OrmJoinColumn buildJoinColumn(XmlJoinColumn resourceJoinColumn, OrmJoinColumn.Owner owner) {
- return this.getXmlContextNodeFactory().buildOrmJoinColumn(this, owner, resourceJoinColumn);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- if (this.connectionProfileIsActive()) {
- this.validateAgainstDatabase(messages, reporter);
- }
- }
-
- protected void validateAgainstDatabase(List<IMessage> messages, IReporter reporter) {
- RelationshipMapping mapping = this.getRelationshipMapping();
-
- if ( ! this.hasResolvedCatalog()) {
- if (mapping.getPersistentAttribute().isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_CATALOG,
- new String[] {mapping.getName(), this.getCatalog(), this.getName()},
- this,
- this.getCatalogTextRange()
- )
- );
-
- } else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_TABLE_UNRESOLVED_CATALOG,
- new String[] {this.getCatalog(), this.getName()},
- this,
- this.getCatalogTextRange()
- )
- );
- }
- return;
- }
-
- if ( ! this.hasResolvedSchema()) {
- if (mapping.getPersistentAttribute().isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_SCHEMA,
- new String[] {mapping.getName(), this.getSchema(), this.getName()},
- this,
- this.getSchemaTextRange()
- )
- );
- } else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_TABLE_UNRESOLVED_SCHEMA,
- new String[] {this.getSchema(), this.getName()},
- this,
- this.getSchemaTextRange()
- )
- );
- }
- return;
- }
- if ( ! this.isResolved()) {
- if (getName() != null) { //if name is null, the validation will be handled elsewhere, such as the target entity is not defined
- if (mapping.getPersistentAttribute().isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_NAME,
- new String[] {mapping.getName(), this.getName()},
- this,
- this.getNameTextRange()
- )
- );
- }
- else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.JOIN_TABLE_UNRESOLVED_NAME,
- new String[] {this.getName()},
- this,
- this.getNameTextRange())
- );
- }
- }
- return;
- }
-
- this.validateJoinColumns(this.joinColumns(), messages, reporter);
- this.validateJoinColumns(this.inverseJoinColumns(), messages, reporter);
- }
-
- protected void validateJoinColumns(Iterator<OrmJoinColumn> joinColumns, List<IMessage> messages, IReporter reporter) {
- while (joinColumns.hasNext()) {
- joinColumns.next().validate(messages, reporter);
- }
- }
-
-
- // ********** join column owner adapters **********
-
- /**
- * just a little common behavior
- */
- protected abstract class AbstractJoinColumnOwner
- implements OrmJoinColumn.Owner
- {
- protected AbstractJoinColumnOwner() {
- super();
- }
-
- public TypeMapping getTypeMapping() {
- return GenericOrmJoinTable.this.getParent().getRelationshipReference().getTypeMapping();
- }
-
- public RelationshipMapping getRelationshipMapping() {
- return GenericOrmJoinTable.this.getRelationshipMapping();
- }
-
- /**
- * the default table name is always valid and a specified table name
- * is prohibited (which will be handled elsewhere)
- */
- public boolean tableNameIsInvalid(String tableName) {
- return false;
- }
-
- /**
- * the join column can only be on the join table itself
- */
- public boolean tableIsAllowed() {
- return false;
- }
-
- public org.eclipse.jpt.db.Table getDbTable(String tableName) {
- String joinTableName = GenericOrmJoinTable.this.getName();
- return (joinTableName == null) ? null : (joinTableName.equals(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();
- }
- }
-
-
- /**
- * owner for "back-pointer" JoinColumns;
- * these point at the source/owning entity
- */
- protected class JoinColumnOwner
- extends AbstractJoinColumnOwner
- {
- protected JoinColumnOwner() {
- super();
- }
-
- public Entity getTargetEntity() {
- return GenericOrmJoinTable.this.getParent().getRelationshipReference().getEntity();
- }
-
- public String getAttributeName() {
- Entity targetEntity = GenericOrmJoinTable.this.getRelationshipMapping().getResolvedTargetEntity();
- if (targetEntity == null) {
- return null;
- }
- for (PersistentAttribute each : CollectionTools.iterable(targetEntity.getPersistentType().allAttributes())) {
- if (each.getMapping().isOwnedBy(this.getRelationshipMapping())) {
- return each.getName();
- }
- }
- return null;
- }
-
- @Override
- public org.eclipse.jpt.db.Table getDbTable(String tableName) {
- org.eclipse.jpt.db.Table dbTable = super.getDbTable(tableName);
- return (dbTable != null) ? dbTable : this.getTypeMapping().getDbTable(tableName);
- }
-
- public org.eclipse.jpt.db.Table getReferencedColumnDbTable() {
- return getTypeMapping().getPrimaryDbTable();
- }
-
- public boolean isVirtual(BaseJoinColumn joinColumn) {
- return GenericOrmJoinTable.this.defaultJoinColumn == joinColumn;
- }
-
- public String getDefaultColumnName() {
- //built in MappingTools.buildJoinColumnDefaultName()
- return null;
- }
-
- public int joinColumnsSize() {
- return GenericOrmJoinTable.this.joinColumnsSize();
- }
- }
-
-
- /**
- * owner for "forward-pointer" JoinColumns;
- * these point at the target/inverse entity
- */
- protected class InverseJoinColumnOwner
- extends AbstractJoinColumnOwner
- {
- protected InverseJoinColumnOwner() {
- super();
- }
-
- public Entity getTargetEntity() {
- return GenericOrmJoinTable.this.getRelationshipMapping().getResolvedTargetEntity();
- }
-
- public String getAttributeName() {
- return GenericOrmJoinTable.this.getRelationshipMapping().getName();
- }
-
- @Override
- public org.eclipse.jpt.db.Table getDbTable(String tableName) {
- org.eclipse.jpt.db.Table dbTable = super.getDbTable(tableName);
- if (dbTable != null) {
- return dbTable;
- }
- Entity targetEntity = this.getTargetEntity();
- return (targetEntity == null) ? null : targetEntity.getDbTable(tableName);
- }
-
- public org.eclipse.jpt.db.Table getReferencedColumnDbTable() {
- Entity targetEntity = this.getTargetEntity();
- return (targetEntity == null) ? null : targetEntity.getPrimaryDbTable();
- }
-
- public boolean isVirtual(BaseJoinColumn joinColumn) {
- return GenericOrmJoinTable.this.defaultInverseJoinColumn == joinColumn;
- }
-
- public String getDefaultColumnName() {
- //built in MappingTools.buildJoinColumnDefaultName()
- return null;
- }
-
- public int joinColumnsSize() {
- return GenericOrmJoinTable.this.inverseJoinColumnsSize();
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmLobConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmLobConverter.java
deleted file mode 100644
index 42fd684272..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmLobConverter.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.LobConverter;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmConverter;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class GenericOrmLobConverter extends AbstractOrmXmlContextNode
- implements LobConverter, OrmConverter
-{
- private XmlConvertibleMapping resourceConvertibleMapping;
-
- public GenericOrmLobConverter(OrmAttributeMapping parent, XmlConvertibleMapping resourceMapping) {
- super(parent);
- this.initialize(resourceMapping);
- }
-
- @Override
- public OrmAttributeMapping getParent() {
- return (OrmAttributeMapping) super.getParent();
- }
-
- public String getType() {
- return Converter.LOB_CONVERTER;
- }
-
- public void initialize(XmlConvertibleMapping resourceConvertibleMapping) {
- this.resourceConvertibleMapping = resourceConvertibleMapping;
- }
-
- public void update() {
- //do nothing
- }
-
- public TextRange getValidationTextRange() {
- return this.resourceConvertibleMapping.getLobTextRange();
- }
-
- public void addToResourceModel() {
- this.resourceConvertibleMapping.setLob(true);
- }
-
- public void removeFromResourceModel() {
- this.resourceConvertibleMapping.setLob(false);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java
deleted file mode 100644
index 517a92c340..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0, which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmManyToManyMapping;
-import org.eclipse.jpt.core.resource.orm.XmlManyToMany;
-
-public class GenericOrmManyToManyMapping
- extends AbstractOrmManyToManyMapping<XmlManyToMany>
-{
- public GenericOrmManyToManyMapping(OrmPersistentAttribute parent, XmlManyToMany resourceMapping) {
- super(parent, resourceMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java
deleted file mode 100644
index 022dca900a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmManyToOneMapping;
-import org.eclipse.jpt.core.resource.orm.XmlManyToOne;
-
-public class GenericOrmManyToOneMapping
- extends AbstractOrmManyToOneMapping<XmlManyToOne>
-{
- public GenericOrmManyToOneMapping(OrmPersistentAttribute parent, XmlManyToOne resourceMapping) {
- super(parent, resourceMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java
deleted file mode 100644
index bbb9ea11cf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmMappedSuperclass;
-import org.eclipse.jpt.core.resource.orm.XmlMappedSuperclass;
-
-
-public class GenericOrmMappedSuperclass extends AbstractOrmMappedSuperclass
-{
-
- public GenericOrmMappedSuperclass(OrmPersistentType parent, XmlMappedSuperclass resourceMapping) {
- super(parent, resourceMapping);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java
deleted file mode 100644
index 43fa8e2a73..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.NamedNativeQuery;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmNamedNativeQuery;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmQuery;
-import org.eclipse.jpt.core.resource.orm.XmlNamedNativeQuery;
-
-
-public class GenericOrmNamedNativeQuery extends AbstractOrmQuery<XmlNamedNativeQuery>
- implements OrmNamedNativeQuery
-{
-
- protected String resultClass;
-
- protected String resultSetMapping;
-
-
- public GenericOrmNamedNativeQuery(XmlContextNode parent, XmlNamedNativeQuery resourceQuery) {
- super(parent, resourceQuery);
- }
-
- public char getResultClassEnclosingTypeSeparator() {
- return '$';
- }
-
- public String getResultClass() {
- return this.resultClass;
- }
-
- public void setResultClass(String newResultClass) {
- String oldResultClass = this.resultClass;
- this.resultClass = newResultClass;
- getResourceQuery().setResultClass(newResultClass);
- firePropertyChanged(NamedNativeQuery.RESULT_CLASS_PROPERTY, oldResultClass, newResultClass);
- }
-
- public String getResultSetMapping() {
- return this.resultSetMapping;
- }
-
- public void setResultSetMapping(String newResultSetMapping) {
- String oldResultSetMapping = this.resultSetMapping;
- this.resultSetMapping = newResultSetMapping;
- getResourceQuery().setResultSetMapping(newResultSetMapping);
- firePropertyChanged(NamedNativeQuery.RESULT_SET_MAPPING_PROPERTY, oldResultSetMapping, newResultSetMapping);
- }
-
-
- @Override
- protected void initialize(XmlNamedNativeQuery resourceQuery) {
- super.initialize(resourceQuery);
- this.resultClass = resourceQuery.getResultClass();
- this.resultSetMapping = resourceQuery.getResultSetMapping();
- }
-
- @Override
- public void update(XmlNamedNativeQuery resourceQuery) {
- super.update(resourceQuery);
- this.setResultClass(resourceQuery.getResultClass());
- this.setResultSetMapping(resourceQuery.getResultSetMapping());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java
deleted file mode 100644
index cba78423e0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmNamedQuery;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmQuery;
-import org.eclipse.jpt.core.resource.orm.XmlNamedQuery;
-
-
-public class GenericOrmNamedQuery extends AbstractOrmQuery<XmlNamedQuery> implements OrmNamedQuery
-{
-
- public GenericOrmNamedQuery(XmlContextNode parent, XmlNamedQuery resourceNamedQuery) {
- super(parent, resourceNamedQuery);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java
deleted file mode 100644
index 90fab75123..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAttributeMapping;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.core.resource.orm.XmlNullAttributeMapping;
-
-
-public class GenericOrmNullAttributeMapping
- extends AbstractOrmAttributeMapping<XmlNullAttributeMapping>
-{
-
- public GenericOrmNullAttributeMapping(OrmPersistentAttribute parent, XmlNullAttributeMapping resourceMapping) {
- super(parent, resourceMapping);
- }
-
- public int getXmlSequence() {
- return -1;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmAttributeMapping(this);
- }
-
- public String getKey() {
- return null;
- }
-
- public void addToResourceModel(Attributes resourceAttributes) {
- throw new UnsupportedOperationException();
- }
-
- public void removeFromResourceModel(Attributes resourceAttributes) {
- throw new UnsupportedOperationException();
- }
-
- // ********** metamodel **********
-
- @Override
- public MetamodelField getMetamodelField() {
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNullConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNullConverter.java
deleted file mode 100644
index 4bd82741ee..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNullConverter.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmConverter;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class GenericOrmNullConverter extends AbstractOrmXmlContextNode
- implements OrmConverter
-{
-
- public GenericOrmNullConverter(OrmAttributeMapping parent) {
- super(parent);
- }
-
- @Override
- public OrmAttributeMapping getParent() {
- return (OrmAttributeMapping) super.getParent();
- }
-
- public String getType() {
- return Converter.NO_CONVERTER;
- }
-
- public TextRange getValidationTextRange() {
- return null;
- }
-
- public void update() {
- // do nothing, null implementation
- }
-
- public void addToResourceModel() {
- // do nothing, null implementation
- }
-
- public void removeFromResourceModel() {
- // do nothing, null implementation
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java
deleted file mode 100644
index facb180a33..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0, which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipReference;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmOneToManyMapping;
-import org.eclipse.jpt.core.resource.orm.XmlOneToMany;
-
-
-public class GenericOrmOneToManyMapping extends AbstractOrmOneToManyMapping<XmlOneToMany>
-{
-
- public GenericOrmOneToManyMapping(OrmPersistentAttribute parent, XmlOneToMany resourceMapping) {
- super(parent, resourceMapping);
- }
-
- @Override
- protected OrmRelationshipReference buildRelationshipReference() {
- return new GenericOrmOneToManyRelationshipReference(this, this.resourceAttributeMapping);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOneToManyRelationshipReference.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOneToManyRelationshipReference.java
deleted file mode 100644
index 81e6dfcc21..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOneToManyRelationshipReference.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.orm.OrmOneToManyMapping;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmOneToManyRelationshipReference;
-import org.eclipse.jpt.core.resource.orm.XmlOneToMany;
-
-public class GenericOrmOneToManyRelationshipReference
- extends AbstractOrmOneToManyRelationshipReference
-{
-
- public GenericOrmOneToManyRelationshipReference(
- OrmOneToManyMapping parent, XmlOneToMany resource) {
- super(parent, resource);
- }
-
- @Override
- protected JoiningStrategy calculatePredominantJoiningStrategy() {
- if (this.mappedByJoiningStrategy.getMappedByAttribute() != null) {
- return this.mappedByJoiningStrategy;
- }
- return this.joinTableJoiningStrategy;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java
deleted file mode 100644
index 1b7a9a28d7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmOneToOneMapping;
-import org.eclipse.jpt.core.resource.orm.XmlOneToOne;
-
-
-public class GenericOrmOneToOneMapping
- extends AbstractOrmOneToOneMapping<XmlOneToOne>
-{
-
- // ********** constructor **********
- public GenericOrmOneToOneMapping(OrmPersistentAttribute parent, XmlOneToOne resourceMapping) {
- super(parent, resourceMapping);
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOrderable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOrderable.java
deleted file mode 100644
index 94b9e13562..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOrderable.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrderColumn2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrderable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlOrderColumn;
-import org.eclipse.jpt.core.resource.orm.XmlOrderable;
-import org.eclipse.jpt.core.resource.orm.v2_0.XmlOrderable_2_0;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * ORM multi-relationship (m:m, 1:m) mapping
- */
-public class GenericOrmOrderable
- extends AbstractOrmXmlContextNode
- implements OrmOrderable2_0
-{
- protected String specifiedOrderBy;
- protected boolean noOrdering = false;
- protected boolean pkOrdering = false;
- protected boolean customOrdering = false;
-
- protected boolean orderColumnOrdering = false;
- protected final OrmOrderColumn2_0 orderColumn;
-
-
- protected String specifiedMapKey;
- protected boolean noMapKey = false;
- protected boolean pkMapKey = false;
- protected boolean customMapKey = false;
-
-
- public GenericOrmOrderable(OrmAttributeMapping parent) {
- super(parent);
- this.orderColumn = ((OrmXml2_0ContextNodeFactory) getXmlContextNodeFactory()).buildOrmOrderColumn(this, this);
- this.initializeOrdering();
- }
-
- public void update() {
- this.updateOrdering();
- }
-
- @Override
- public OrmAttributeMapping getParent() {
- return (OrmAttributeMapping) super.getParent();
- }
-
- protected OrmPersistentAttribute getPersistentAttribute() {
- return getParent().getPersistentAttribute();
- }
-
- protected XmlOrderable getResourceOrderable() {
- return (XmlOrderable) getParent().getResourceAttributeMapping();
- }
-
- // **************** order by ***********************************************
-
- public String getSpecifiedOrderBy() {
- return this.specifiedOrderBy;
- }
-
- public void setSpecifiedOrderBy(String orderBy) {
- String old = this.specifiedOrderBy;
- this.specifiedOrderBy = orderBy;
- this.getResourceOrderable().setOrderBy(orderBy);
- this.firePropertyChanged(SPECIFIED_ORDER_BY_PROPERTY, old, orderBy);
- }
-
- protected void setSpecifiedOrderBy_(String orderBy) {
- String old = this.specifiedOrderBy;
- this.specifiedOrderBy = orderBy;
- this.firePropertyChanged(SPECIFIED_ORDER_BY_PROPERTY, old, orderBy);
- }
-
- protected void initializeOrdering() {
- this.specifiedOrderBy = this.getXmlOrderBy();
- XmlOrderColumn resourceOrderColumn = getXmlOrderColumn();
- if (this.specifiedOrderBy == null && resourceOrderColumn == null) {
- this.noOrdering = true;
- } else if (this.specifiedOrderBy != null && this.specifiedOrderBy.equals("")) { //$NON-NLS-1$
- this.pkOrdering = true;
- } else if (resourceOrderColumn == null) {
- this.customOrdering = true;
- } else {
- this.orderColumnOrdering = true;
- }
- }
-
- protected void updateOrdering() {
- this.setSpecifiedOrderBy_(this.getXmlOrderBy());
- XmlOrderColumn resourceOrderColumn = getXmlOrderColumn();
- if (this.specifiedOrderBy == null && resourceOrderColumn == null) {
- this.setNoOrdering_(true);
- this.setPkOrdering_(false);
- this.setCustomOrdering_(false);
- this.setOrderColumnOrdering_(false);
- } else if (this.specifiedOrderBy != null && this.specifiedOrderBy.equals("")) { //$NON-NLS-1$
- this.setNoOrdering_(false);
- this.setPkOrdering_(true);
- this.setCustomOrdering_(false);
- this.setOrderColumnOrdering_(false);
- } else if (resourceOrderColumn == null){
- this.setNoOrdering_(false);
- this.setPkOrdering_(false);
- this.setCustomOrdering_(true);
- this.setOrderColumnOrdering_(false);
- } else {
- this.setNoOrdering_(false);
- this.setPkOrdering_(false);
- this.setCustomOrdering_(false);
- this.setOrderColumnOrdering_(true);
- }
- this.orderColumn.update(this.getResourceOrderable());
- }
-
- protected String getXmlOrderBy() {
- return this.getResourceOrderable().getOrderBy();
- }
-
- protected XmlOrderColumn getXmlOrderColumn() {
- return ((XmlOrderable_2_0) this.getResourceOrderable()).getOrderColumn();
- }
-
- // **************** no ordering ***********************************************
-
- public boolean isNoOrdering() {
- return this.noOrdering;
- }
-
- public void setNoOrdering(boolean noOrdering) {
- boolean old = this.noOrdering;
- this.noOrdering = noOrdering;
- if (noOrdering) {
- this.getResourceOrderable().setOrderBy(null);
- this.removeXmlOrderColumn();
- }
- this.firePropertyChanged(NO_ORDERING_PROPERTY, old, noOrdering);
- }
-
- protected void setNoOrdering_(boolean noOrdering) {
- boolean old = this.noOrdering;
- this.noOrdering = noOrdering;
- this.firePropertyChanged(NO_ORDERING_PROPERTY, old, noOrdering);
- }
-
-
- // **************** pk ordering ***********************************************
-
- public boolean isPkOrdering() {
- return this.pkOrdering;
- }
-
- public void setPkOrdering(boolean pkOrdering) {
- boolean old = this.pkOrdering;
- this.pkOrdering = pkOrdering;
- if (pkOrdering) {
- this.getResourceOrderable().setOrderBy(""); //$NON-NLS-1$
- this.removeXmlOrderColumn();
- }
- this.firePropertyChanged(PK_ORDERING_PROPERTY, old, pkOrdering);
- }
-
- protected void setPkOrdering_(boolean pkOrdering) {
- boolean old = this.pkOrdering;
- this.pkOrdering = pkOrdering;
- this.firePropertyChanged(PK_ORDERING_PROPERTY, old, pkOrdering);
- }
-
-
- // **************** custom ordering ***********************************************
-
- public boolean isCustomOrdering() {
- return this.customOrdering;
- }
-
- public void setCustomOrdering(boolean customOrdering) {
- boolean old = this.customOrdering;
- this.customOrdering = customOrdering;
- if (customOrdering) {
- this.setSpecifiedOrderBy(""); //$NON-NLS-1$
- this.removeXmlOrderColumn();
- }
- this.firePropertyChanged(CUSTOM_ORDERING_PROPERTY, old, customOrdering);
- }
-
- protected void setCustomOrdering_(boolean customOrdering) {
- boolean old = this.customOrdering;
- this.customOrdering = customOrdering;
- this.firePropertyChanged(CUSTOM_ORDERING_PROPERTY, old, customOrdering);
- }
-
- // **************** order column ordering ***********************************************
-
- public boolean isOrderColumnOrdering() {
- return this.orderColumnOrdering;
- }
-
- public void setOrderColumnOrdering(boolean orderColumnOrdering) {
- boolean old = this.orderColumnOrdering;
- this.orderColumnOrdering = orderColumnOrdering;
- if (orderColumnOrdering) {
- this.getResourceOrderable().setOrderBy(null);
- addXmlOrderColumn();
- }
- this.firePropertyChanged(ORDER_COLUMN_ORDERING_PROPERTY, old, orderColumnOrdering);
- }
-
- protected void setOrderColumnOrdering_(boolean orderColumnOrdering) {
- boolean old = this.orderColumnOrdering;
- this.orderColumnOrdering = orderColumnOrdering;
- this.firePropertyChanged(ORDER_COLUMN_ORDERING_PROPERTY, old, orderColumnOrdering);
- }
-
- public OrmOrderColumn2_0 getOrderColumn() {
- return this.orderColumn;
- }
-
- protected void addXmlOrderColumn() {
- ((XmlOrderable_2_0) getResourceOrderable()).setOrderColumn(OrmFactory.eINSTANCE.createXmlOrderColumn());
- }
-
- protected void removeXmlOrderColumn() {
- ((XmlOrderable_2_0) getResourceOrderable()).setOrderColumn(null);
- }
-
-
- // ********** OrderColumn OrmBaseColumn.Owner implementation **********
-
- public Table getDbTable(String tableName) {
- return this.getTypeMapping().getDbTable(tableName);
- }
-
- public String getDefaultColumnName() {
- return getPersistentAttribute().getName() + "_ORDER"; //$NON-NLS-1$
- }
-
- public TypeMapping getTypeMapping() {
- return getPersistentAttribute().getTypeMapping();
- }
-
-
- // ********** Validation **********
-
- public TextRange getValidationTextRange() {
- return getResourceOrderable().getValidationTextRange();
- }
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- if (isOrderColumnOrdering()) {
- //TODO validation message if type is not List
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java
deleted file mode 100644
index 282848d631..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.List;
-
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-
-public class GenericOrmPersistentAttribute extends AbstractOrmPersistentAttribute
-{
-
- public GenericOrmPersistentAttribute(OrmPersistentType parent, Owner owner, XmlAttributeMapping resourceMapping) {
- super(parent, owner, resourceMapping);
- }
-
- //****************** AccessHolder implementation *******************
-
- /**
- * GenericOrmPersistentAttribute does not support specified access (no access element in 1.0), so we return null
- */
- public AccessType getSpecifiedAccess() {
- return null;
- }
-
- public void setSpecifiedAccess(AccessType newSpecifiedAccess) {
- throw new UnsupportedOperationException("specifiedAccess is not supported for GenericOrmPersistentAttribute"); //$NON-NLS-1$
- }
-
- @Override
- protected void validateAttribute(List<IMessage> messages) {
- super.validateAttribute(messages);
- if (this.javaPersistentAttribute != null) {
- JavaPersistentType javaPersistentType = getPersistentType().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.getPersistentType().getMapping().getClass_()},
- this.attributeMapping,
- this.attributeMapping.getNameTextRange()
- )
- );
- }
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentType.java
deleted file mode 100644
index 768a1d8082..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentType.java
+++ /dev/null
@@ -1,1058 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.EntityMappings;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmStructureNodes;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
-import org.eclipse.jpt.core.jpa2.context.PersistentType2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmPersistentType2_0;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlTypeMapping;
-import org.eclipse.jpt.core.resource.xml.EmfTools;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.ClassTools;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterators.ChainIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.CompositeListIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * ORM persistent type:<ul>
- * <li>mapping
- * <li>access
- * <li>attributes
- * <li>super persistent type
- * <li>Java persistent type
- * </ul>
- */
-public class GenericOrmPersistentType
- extends AbstractOrmXmlContextNode
- implements OrmPersistentType2_0
-{
- protected OrmTypeMapping mapping;
-
- protected AccessType defaultAccess;
-
- protected AccessType specifiedAccess;
-
- protected final Vector<OrmPersistentAttribute> specifiedAttributes = new Vector<OrmPersistentAttribute>();
-
- protected final Vector<OrmPersistentAttribute> virtualAttributes = new Vector<OrmPersistentAttribute>();
-
- protected PersistentType superPersistentType;
-
- protected JavaPersistentType javaPersistentType;
-
- protected final PersistentType2_0.MetamodelSynchronizer metamodelSynchronizer;
-
-
- public GenericOrmPersistentType(EntityMappings parent, XmlTypeMapping resourceMapping) {
- super(parent);
- this.mapping = this.buildMapping(resourceMapping);
- this.specifiedAccess = this.buildSpecifiedAccess();
- this.defaultAccess = this.buildDefaultAccess();
- this.javaPersistentType = this.buildJavaPersistentType();
- this.superPersistentType = this.buildSuperPersistentType();
- this.initializeAttributes();
- this.metamodelSynchronizer = this.buildMetamodelSynchronizer();
- }
-
- protected PersistentType2_0.MetamodelSynchronizer buildMetamodelSynchronizer() {
- return ((JpaFactory2_0) this.getJpaFactory()).buildPersistentTypeMetamodelSynchronizer(this);
- }
-
-
- // ********** update **********
-
- public void update() {
- this.setSpecifiedAccess(this.buildSpecifiedAccess());
- this.setDefaultAccess(this.buildDefaultAccess());
- this.mapping.update();
- this.updateJavaPersistentType();
- this.updateSuperPersistentType();
- this.updateAttributes();
- }
-
- @Override
- public void postUpdate() {
- super.postUpdate();
- if (this.javaPersistentType != null) {
- this.javaPersistentType.postUpdate();
- }
- this.mapping.postUpdate();
- for (PersistentAttribute attribute : this.getAttributes()) {
- attribute.postUpdate();
- }
- }
-
-
- // ********** name **********
-
- public String getName() {
- return this.mapping.getClass_();
- }
-
- public String getShortName(){
- String className = this.getName();
- return (className == null) ? null : ClassTools.shortNameForClassNamed(className);
- }
-
-
- // ********** mapping **********
-
- public OrmTypeMapping getMapping() {
- return this.mapping;
- }
-
- public void setMappingKey(String newMappingKey) {
- if (this.valuesAreEqual(this.getMappingKey(), newMappingKey)) {
- return;
- }
- OrmTypeMapping oldMapping = this.mapping;
- OrmTypeMappingDefinition mappingDefinition = this.getMappingFileDefinition().getOrmTypeMappingDefinition(newMappingKey);
- XmlTypeMapping resourceTypeMapping = mappingDefinition.buildResourceMapping(this.getResourceNodeFactory());
- this.mapping = this.buildMapping(resourceTypeMapping);
- this.getEntityMappings().changeMapping(this, oldMapping, this.mapping);
- this.firePropertyChanged(MAPPING_PROPERTY, oldMapping, this.mapping);
- }
-
- protected OrmTypeMapping buildMapping(XmlTypeMapping resourceMapping) {
- OrmTypeMappingDefinition mappingDefintion = this.getMappingFileDefinition().getOrmTypeMappingDefinition(resourceMapping.getMappingKey());
- return mappingDefintion.buildContextMapping(this, resourceMapping, this.getXmlContextNodeFactory());
- }
-
-
- // ********** access **********
-
- public AccessType getAccess() {
- return (this.specifiedAccess != null) ? this.specifiedAccess : this.defaultAccess;
- }
-
- public AccessType getDefaultAccess() {
- return this.defaultAccess;
- }
-
- protected void setDefaultAccess(AccessType defaultAccess) {
- AccessType old = this.defaultAccess;
- this.defaultAccess = defaultAccess;
- this.firePropertyChanged(DEFAULT_ACCESS_PROPERTY, old, defaultAccess);
- }
-
- public AccessType getSpecifiedAccess() {
- return this.specifiedAccess;
- }
-
- public void setSpecifiedAccess(AccessType specifiedAccess) {
- AccessType old = this.specifiedAccess;
- this.specifiedAccess = specifiedAccess;
- this.getResourceTypeMapping().setAccess(AccessType.toOrmResourceModel(specifiedAccess));
- this.firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, old, specifiedAccess);
- }
-
- protected AccessType buildDefaultAccess() {
- if ( ! this.mapping.isMetadataComplete()) {
- if (this.javaPersistentType != null) {
- if (this.javaPersistentTypeHasSpecifiedAccess()) {
- return this.javaPersistentType.getAccess();
- }
- if (this.superPersistentType != null) {
- return this.superPersistentType.getAccess();
- }
- }
- }
- AccessType access = this.getMappingFileRoot().getAccess();
- return (access != null) ? access : AccessType.FIELD; //default to FIELD if no specified access found
- }
-
- protected boolean javaPersistentTypeHasSpecifiedAccess() {
- return (this.javaPersistentType.getSpecifiedAccess() != null) ||
- this.javaPersistentType.hasAnyAnnotatedAttributes();
- }
-
- public AccessType getOwnerOverrideAccess() {
- return this.getEntityMappings().getOverridePersistentTypeAccess();
- }
-
- public AccessType getOwnerDefaultAccess() {
- return this.getEntityMappings().getDefaultPersistentTypeAccess();
- }
-
- protected AccessType buildSpecifiedAccess() {
- return AccessType.fromOrmResourceModel(this.getResourceTypeMapping().getAccess());
- }
-
-
- // ********** attributes **********
-
- @SuppressWarnings("unchecked")
- public ListIterator<OrmPersistentAttribute> attributes() {
- return new CompositeListIterator<OrmPersistentAttribute>(this.specifiedAttributes(), this.virtualAttributes());
- }
-
- @SuppressWarnings("unchecked")
- protected Iterable<OrmPersistentAttribute> getAttributes() {
- return new CompositeIterable<OrmPersistentAttribute>(this.getSpecifiedAttributes(), this.getVirtualAttributes());
- }
-
- public int attributesSize() {
- return this.specifiedAttributesSize() + this.virtualAttributesSize();
- }
-
- public Iterator<String> allAttributeNames() {
- return this.attributeNames(this.allAttributes());
- }
-
- public Iterator<PersistentAttribute> allAttributes() {
- return new CompositeIterator<PersistentAttribute>(
- new TransformationIterator<PersistentType, Iterator<PersistentAttribute>>(this.inheritanceHierarchy()) {
- @Override
- protected Iterator<PersistentAttribute> transform(PersistentType pt) {
- return pt.attributes();
- }
- }
- );
- }
-
- protected Iterator<OrmPersistentAttribute> attributesNamed(final String attributeName) {
- return new FilteringIterator<OrmPersistentAttribute, OrmPersistentAttribute>(this.attributes()) {
- @Override
- protected boolean accept(OrmPersistentAttribute o) {
- return Tools.valuesAreEqual(attributeName, o.getName());
- }
- };
- }
-
- public OrmPersistentAttribute getAttributeNamed(String attributeName) {
- Iterator<OrmPersistentAttribute> stream = this.attributesNamed(attributeName);
- return (stream.hasNext()) ? stream.next() : null;
- }
-
- public PersistentAttribute resolveAttribute(String attributeName) {
- Iterator<OrmPersistentAttribute> attributes = this.attributesNamed(attributeName);
- if (attributes.hasNext()) {
- OrmPersistentAttribute attribute = attributes.next();
- return attributes.hasNext() ? null /* more than one */: attribute;
- }
- return (this.superPersistentType == null) ? null : this.superPersistentType.resolveAttribute(attributeName);
- }
-
- public Iterator<String> attributeNames() {
- return this.attributeNames(this.attributes());
- }
-
- protected Iterator<String> attributeNames(Iterator<? extends PersistentAttribute> attrs) {
- return new TransformationIterator<PersistentAttribute, String>(attrs) {
- @Override
- protected String transform(PersistentAttribute attribute) {
- return attribute.getName();
- }
- };
- }
-
- protected void initializeAttributes() {
- this.initializeSpecifiedAttributes();
- this.initializeVirtualAttributes();
- }
-
- protected void updateAttributes() {
- this.updateSpecifiedAttributes();
- this.updateVirtualAttributes();
- }
-
- protected Iterator<JavaResourcePersistentAttribute> javaPersistentAttributes() {
- return (this.javaPersistentType == null) ?
- EmptyListIterator.<JavaResourcePersistentAttribute>instance() :
- this.javaPersistentAttributes(this.javaPersistentType.getResourcePersistentType());
- }
-
- protected Iterator<JavaResourcePersistentAttribute> javaPersistentAttributes(JavaResourcePersistentType resourcePersistentType) {
- AccessType access = this.specifiedAccess;
- if (access == null && ! this.mapping.isMetadataComplete()) {
- access = this.getJavaPersistentType().getSpecifiedAccess();
- }
- if (access == null) {
- access = this.defaultAccess;
- }
- return resourcePersistentType.persistableAttributes(AccessType.toJavaResourceModel(access));
- }
-
-
- // ********** specified attributes **********
-
- public ListIterator<OrmPersistentAttribute> specifiedAttributes() {
- return new CloneListIterator<OrmPersistentAttribute>(this.specifiedAttributes);
- }
-
- protected Iterable<OrmPersistentAttribute> getSpecifiedAttributes() {
- return new LiveCloneIterable<OrmPersistentAttribute>(this.specifiedAttributes);
- }
-
- public int specifiedAttributesSize() {
- return this.specifiedAttributes.size();
- }
-
- protected OrmPersistentAttribute getSpecifiedAttributeFor(final JavaResourcePersistentAttribute jrpa) {
- for (OrmPersistentAttribute attribute : this.getSpecifiedAttributes()) {
- JavaPersistentAttribute javaAttribute = attribute.getJavaPersistentAttribute();
- if ((javaAttribute != null) && (javaAttribute.getResourcePersistentAttribute() == jrpa)) {
- return attribute;
- }
- }
- return null;
- }
-
- public OrmPersistentAttribute addSpecifiedAttribute(String mappingKey, String attributeName) {
- Attributes resourceAttributes = this.getResourceAttributes();
- if (resourceAttributes == null) {
- resourceAttributes = this.createResourceAttributes();
- this.mapping.getResourceTypeMapping().setAttributes(resourceAttributes);
- }
-
- OrmAttributeMappingDefinition mappingDefintion = this.getMappingFileDefinition().getOrmAttributeMappingDefinition(mappingKey);
- XmlAttributeMapping resourceMapping = mappingDefintion.buildResourceMapping(getResourceNodeFactory());
- OrmPersistentAttribute persistentAttribute = this.buildSpecifiedAttribute(resourceMapping);
- int index = this.getSpecifiedAttributeInsertionIndex(persistentAttribute);
- this.specifiedAttributes.add(index, persistentAttribute);
- persistentAttribute.getMapping().addToResourceModel(resourceAttributes);
-
- persistentAttribute.getSpecifiedMapping().setName(attributeName);
- this.fireItemAdded(ATTRIBUTES_LIST, index, persistentAttribute);
- return persistentAttribute;
- }
-
- public void changeMapping(OrmPersistentAttribute ormPersistentAttribute, OrmAttributeMapping oldMapping, OrmAttributeMapping newMapping) {
- int sourceIndex = this.specifiedAttributes.indexOf(ormPersistentAttribute);
- this.specifiedAttributes.remove(sourceIndex);
- oldMapping.removeFromResourceModel(this.getResourceAttributes());
- int targetIndex = getSpecifiedAttributeInsertionIndex(ormPersistentAttribute);
- this.specifiedAttributes.add(targetIndex, ormPersistentAttribute);
- newMapping.addToResourceModel(this.getResourceAttributes());
- oldMapping.initializeOn(newMapping);
- this.fireItemMoved(ATTRIBUTES_LIST, targetIndex, sourceIndex);
- }
-
- public void makeAttributeSpecified(OrmPersistentAttribute ormPersistentAttribute) {
- this.makeAttributeSpecified(ormPersistentAttribute, ormPersistentAttribute.getMappingKey());
- }
-
- public void makeAttributeSpecified(OrmPersistentAttribute ormPersistentAttribute, String mappingKey) {
- if ( ! ormPersistentAttribute.isVirtual()) {
- throw new IllegalStateException("Attribute is already specified"); //$NON-NLS-1$
- }
- if (this.valuesAreEqual(mappingKey, MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY)) {
- throw new IllegalStateException("Use makePersistentAttributeSpecified(OrmPersistentAttribute, String) instead and specify a mapping type"); //$NON-NLS-1$
- }
-
- Attributes resourceAttributes = this.getResourceAttributes();
- if (resourceAttributes == null) {
- resourceAttributes = this.createResourceAttributes();
- this.mapping.getResourceTypeMapping().setAttributes(resourceAttributes);
- }
-
- OrmAttributeMappingDefinition mappingDefintion = this.getMappingFileDefinition().getOrmAttributeMappingDefinition(mappingKey);
- XmlAttributeMapping resourceMapping = mappingDefintion.buildResourceMapping(getResourceNodeFactory());
-
- OrmPersistentAttribute newAttribute = this.buildSpecifiedAttribute(resourceMapping);
- int insertionIndex = this.getSpecifiedAttributeInsertionIndex(newAttribute);
- this.specifiedAttributes.add(insertionIndex, newAttribute);
- newAttribute.getMapping().addToResourceModel(resourceAttributes);
-
- int removalIndex = this.virtualAttributes.indexOf(ormPersistentAttribute);
- this.virtualAttributes.remove(ormPersistentAttribute);
- newAttribute.getSpecifiedMapping().setName(ormPersistentAttribute.getName());
- if (ormPersistentAttribute.getJavaPersistentAttribute().getSpecifiedAccess() != null) {
- newAttribute.setSpecifiedAccess(ormPersistentAttribute.getJavaPersistentAttribute().getSpecifiedAccess());
- }
-
- this.fireItemAdded(ATTRIBUTES_LIST, insertionIndex, newAttribute);
- this.fireItemRemoved(VIRTUAL_ATTRIBUTES_LIST, removalIndex, ormPersistentAttribute);
- }
-
- protected int getSpecifiedAttributeInsertionIndex(OrmPersistentAttribute specifiedAttribute) {
- return CollectionTools.insertionIndexOf(this.specifiedAttributes, specifiedAttribute, this.getAttributeComparator());
- }
-
- protected Comparator<OrmPersistentAttribute> getAttributeComparator() {
- return ATTRIBUTE_COMPARATOR;
- }
-
- protected static final Comparator<OrmPersistentAttribute> ATTRIBUTE_COMPARATOR =
- new Comparator<OrmPersistentAttribute>() {
- public int compare(OrmPersistentAttribute o1, OrmPersistentAttribute o2) {
- int o1Sequence = o1.getMapping().getXmlSequence();
- int o2Sequence = o2.getMapping().getXmlSequence();
- return (o1Sequence == o2Sequence) ? 0 : (o1Sequence < o2Sequence) ? -1 : 1;
- }
- };
-
- protected Attributes getResourceAttributes() {
- return this.getResourceTypeMapping().getAttributes();
- }
-
- protected Attributes createResourceAttributes() {
- return EmfTools.create(this.getResourceNodeFactory(), OrmPackage.eINSTANCE.getAttributes(), Attributes.class);
- }
-
- protected void initializeSpecifiedAttributes() {
- Attributes attributes = this.getResourceAttributes();
- if (attributes == null) {
- return;
- }
- for (XmlAttributeMapping resourceMapping : attributes.getAttributeMappings()) {
- this.addSpecifiedAttribute(resourceMapping);
- }
- }
-
- protected void updateSpecifiedAttributes() {
- Attributes attributes = this.getResourceAttributes();
- Collection<OrmPersistentAttribute> contextAttributesToRemove = CollectionTools.collection(this.specifiedAttributes());
- Collection<OrmPersistentAttribute> contextAttributesToUpdate = new ArrayList<OrmPersistentAttribute>();
- int resourceIndex = 0;
-
- if (attributes != null) {
- for (XmlAttributeMapping resourceMapping : attributes.getAttributeMappings()) {
- boolean contextAttributeFound = false;
- for (OrmPersistentAttribute contextAttribute : contextAttributesToRemove) {
- if (contextAttribute.getMapping().getResourceAttributeMapping() == resourceMapping) {
- this.moveSpecifiedAttribute_(resourceIndex, contextAttribute);
- contextAttributesToRemove.remove(contextAttribute);
- contextAttributesToUpdate.add(contextAttribute);
- contextAttributeFound = true;
- break;
- }
- }
- if ( ! contextAttributeFound) {
- OrmPersistentAttribute ormPersistentAttribute = this.addSpecifiedAttribute(resourceMapping);
- this.fireItemAdded(ATTRIBUTES_LIST, specifiedAttributesSize(), ormPersistentAttribute);
- }
- resourceIndex++;
- }
- }
- for (OrmPersistentAttribute contextAttribute : contextAttributesToRemove) {
- this.removeSpecifiedAttribute_(contextAttribute);
- }
- //first handle adding/removing of the persistent attributes, then update the others last,
- //this causes less churn in the update process
- for (OrmPersistentAttribute contextAttribute : contextAttributesToUpdate) {
- contextAttribute.update();
- }
- }
-
- protected void removeSpecifiedAttribute_(OrmPersistentAttribute ormPersistentAttribute) {
- this.removeItemFromList(ormPersistentAttribute, this.specifiedAttributes, ATTRIBUTES_LIST);
- }
-
- //not firing change notification so this can be reused in initialize and update
- protected OrmPersistentAttribute addSpecifiedAttribute(XmlAttributeMapping resourceMapping) {
- OrmPersistentAttribute ormPersistentAttribute = this.buildSpecifiedAttribute(resourceMapping);
- this.specifiedAttributes.add(ormPersistentAttribute);
- return ormPersistentAttribute;
- }
-
- protected void moveSpecifiedAttribute_(int index, OrmPersistentAttribute attribute) {
- this.moveItemInList(index, this.specifiedAttributes.indexOf(attribute), this.specifiedAttributes, ATTRIBUTES_LIST);
- }
-
- public void removeSpecifiedAttribute(OrmPersistentAttribute ormPersistentAttribute) {
- int index = this.specifiedAttributes.indexOf(ormPersistentAttribute);
- this.specifiedAttributes.remove(ormPersistentAttribute);
- ormPersistentAttribute.getMapping().removeFromResourceModel(this.getResourceAttributes());
- if (this.getResourceAttributes().isUnset()) {
- this.mapping.getResourceTypeMapping().setAttributes(null);
- }
- this.fireItemRemoved(ATTRIBUTES_LIST, index, ormPersistentAttribute);
- }
-
- protected OrmPersistentAttribute buildSpecifiedAttribute(XmlAttributeMapping resourceMapping) {
- return this.buildOrmPersistentAttribute(this.buildSpecifiedAttributeOwner(), resourceMapping);
- }
-
- protected OrmPersistentAttribute.Owner buildSpecifiedAttributeOwner() {
- return new SpecifiedAttributeOwner();
- }
-
- protected JavaPersistentAttribute buildJavaPersistentAttribute(JavaResourcePersistentAttribute jrpa) {
- return this.getJpaFactory().buildJavaPersistentAttribute(this, jrpa);
- }
-
-
- // ********** virtual attributes **********
-
- public ListIterator<OrmPersistentAttribute> virtualAttributes() {
- return new CloneListIterator<OrmPersistentAttribute>(this.virtualAttributes);
- }
-
- protected Iterable<OrmPersistentAttribute> getVirtualAttributes() {
- return new LiveCloneIterable<OrmPersistentAttribute>(this.virtualAttributes);
- }
-
- public int virtualAttributesSize() {
- return this.virtualAttributes.size();
- }
-
- protected void addVirtualAttribute(OrmPersistentAttribute virtualAttribute) {
- this.addItemToList(virtualAttribute, this.virtualAttributes, VIRTUAL_ATTRIBUTES_LIST);
- }
-
- protected void removeVirtualAttribute(OrmPersistentAttribute virtualAttribute) {
- this.removeItemFromList(virtualAttribute, this.virtualAttributes, VIRTUAL_ATTRIBUTES_LIST);
- }
-
- protected void moveVirtualAttribute_(int index, OrmPersistentAttribute virtualAttribute) {
- this.moveItemInList(index, this.virtualAttributes.indexOf(virtualAttribute), this.virtualAttributes, VIRTUAL_ATTRIBUTES_LIST);
- }
-
- public boolean containsVirtualAttribute(OrmPersistentAttribute ormPersistentAttribute) {
- return this.virtualAttributes.contains(ormPersistentAttribute);
- }
-
- public void makeAttributeVirtual(OrmPersistentAttribute ormPersistentAttribute) {
- if (ormPersistentAttribute.isVirtual()) {
- throw new IllegalStateException("Attribute is already virtual"); //$NON-NLS-1$
- }
- JavaPersistentAttribute javaPersistentAttribute = ormPersistentAttribute.getJavaPersistentAttribute();
- OrmPersistentAttribute virtualAttribute = null;
- if (javaPersistentAttribute != null) {
- virtualAttribute = this.addVirtualAttribute(javaPersistentAttribute.getResourcePersistentAttribute());
- }
- this.removeSpecifiedAttribute(ormPersistentAttribute);
- if (virtualAttribute != null) {
- this.fireItemAdded(VIRTUAL_ATTRIBUTES_LIST, virtualAttributesSize() - 1, virtualAttribute);
- }
- }
-
- protected void initializeVirtualAttributes() {
- for (Iterator<JavaResourcePersistentAttribute> stream = this.javaPersistentAttributes(); stream.hasNext(); ) {
- JavaResourcePersistentAttribute javaResourceAttribute = stream.next();
- if (this.getSpecifiedAttributeFor(javaResourceAttribute) == null) {
- this.addVirtualAttribute(javaResourceAttribute);
- }
- }
- }
-
- protected void updateVirtualAttributes() {
- Collection<OrmPersistentAttribute> contextAttributesToRemove = CollectionTools.collection(this.virtualAttributes());
- Collection<OrmPersistentAttribute> contextAttributesToUpdate = new ArrayList<OrmPersistentAttribute>();
- int resourceIndex = 0;
-
- for (Iterator<JavaResourcePersistentAttribute> stream = this.javaPersistentAttributes(); stream.hasNext(); ) {
- JavaResourcePersistentAttribute javaResourceAttribute = stream.next();
- OrmPersistentAttribute specifiedAttribute = this.getSpecifiedAttributeFor(javaResourceAttribute);
- if (specifiedAttribute == null) {
- JavaPersistentAttribute javaAttribute = this.getJpaFactory().buildJavaPersistentAttribute(this, javaResourceAttribute);
- JavaAttributeMapping javaAttributeMapping = javaAttribute.getMapping();
- if (this.mapping.isMetadataComplete()) {
- javaAttributeMapping = javaAttribute.getDefaultMapping();
- }
- boolean contextAttributeFound = false;
- for (OrmPersistentAttribute contextAttribute : contextAttributesToRemove) {
- JavaPersistentAttribute javaPersistentAttribute = contextAttribute.getJavaPersistentAttribute();
- if (javaPersistentAttribute.getResourcePersistentAttribute() == javaResourceAttribute) {
- if (this.valuesAreEqual(contextAttribute.getMappingKey(), javaAttributeMapping.getKey())) {
- //the mapping key would change if metaDataComplete flag changes, rebuild the orm attribute
- this.moveVirtualAttribute_(resourceIndex, contextAttribute);
- contextAttributesToRemove.remove(contextAttribute);
- contextAttributesToUpdate.add(contextAttribute);
- contextAttributeFound = true;
- break;
- }
- }
- }
- if ( ! contextAttributeFound) {
- OrmPersistentAttribute virtualAttribute = this.addVirtualAttribute(javaAttributeMapping);
- this.fireItemAdded(VIRTUAL_ATTRIBUTES_LIST, virtualAttributesSize() - 1, virtualAttribute);
- }
- resourceIndex++;
- }
- }
-
- for (OrmPersistentAttribute contextAttribute : contextAttributesToRemove) {
- this.removeVirtualAttribute(contextAttribute);
- }
- //first handle adding/removing of the persistent attributes, then update the others last,
- //this causes less churn in the update process
- for (OrmPersistentAttribute contextAttribute : contextAttributesToUpdate) {
- contextAttribute.update();
- }
- }
-
- protected OrmPersistentAttribute addVirtualAttribute(JavaResourcePersistentAttribute resourceAttribute) {
- JavaPersistentAttribute javaAttribute = this.getJpaFactory().buildJavaPersistentAttribute(this, resourceAttribute);
- JavaAttributeMapping javaAttributeMapping = javaAttribute.getMapping();
- if (this.mapping.isMetadataComplete()) {
- javaAttributeMapping = javaAttribute.getDefaultMapping();
- }
- return this.addVirtualAttribute(javaAttributeMapping);
- }
-
- //not firing change notification so this can be reused in initialize and update
- protected OrmPersistentAttribute addVirtualAttribute(JavaAttributeMapping javaAttributeMapping) {
- OrmAttributeMappingDefinition mappingDefintion = this.getMappingFileDefinition().getOrmAttributeMappingDefinition(javaAttributeMapping.getKey());
- XmlAttributeMapping resourceMapping = mappingDefintion.buildVirtualResourceMapping(this.mapping, javaAttributeMapping, this.getXmlContextNodeFactory());
- OrmPersistentAttribute virtualAttribute = this.buildVirtualOrmPersistentAttribute(javaAttributeMapping, resourceMapping);
- this.virtualAttributes.add(virtualAttribute);
- return virtualAttribute;
- }
-
- protected OrmPersistentAttribute buildVirtualOrmPersistentAttribute(JavaAttributeMapping javaAttributeMapping, XmlAttributeMapping resourceMapping) {
- return this.buildOrmPersistentAttribute(this.buildVirtualAttributeOwner(javaAttributeMapping.getPersistentAttribute()), resourceMapping);
- }
-
- protected OrmPersistentAttribute buildOrmPersistentAttribute(OrmPersistentAttribute.Owner owner, XmlAttributeMapping resourceMapping) {
- return this.getXmlContextNodeFactory().buildOrmPersistentAttribute(this, owner, resourceMapping);
- }
-
- protected OrmPersistentAttribute.Owner buildVirtualAttributeOwner(final JavaPersistentAttribute javaPersistentAttribute) {
- return new OrmPersistentAttribute.Owner() {
- public JavaPersistentAttribute findJavaPersistentAttribute(OrmPersistentAttribute ormPersistentAttribute) {
- return javaPersistentAttribute;
- }
-
- public void updateJavaPersistentAttribute() {
- //update the attribute, since we own it and it will not get updated otherwise
- javaPersistentAttribute.update();
- }
- };
- }
-
-
- // ********** 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 JavaPersistentType buildJavaPersistentType() {
- JavaResourcePersistentType jrpt = this.getJavaResourcePersistentType();
- return (jrpt == null) ? null : this.buildJavaPersistentType(jrpt);
- }
-
- protected JavaResourcePersistentType getJavaResourcePersistentType() {
- String className = this.getName();
- if (className == null) {
- return null;
- }
- className = className.replace('$', '.');
-
- // first try to resolve using only the locally specified name...
- JavaResourcePersistentType jrpt = this.getJavaResourcePersistentType(className);
- if (jrpt != null) {
- return jrpt;
- }
-
- // ...then try to resolve by prepending the global package name
- String defaultPackage = this.getDefaultPackage();
- if (defaultPackage == null) {
- return null;
- }
- return this.getJavaResourcePersistentType(defaultPackage + '.' + className);
- }
-
- protected JavaResourcePersistentType getJavaResourcePersistentType(String className) {
- return this.getJpaProject().getJavaResourcePersistentType(className);
- }
-
- protected JavaPersistentType buildJavaPersistentType(JavaResourcePersistentType jrpt) {
- return getJpaFactory().buildJavaPersistentType(this, jrpt);
- }
-
- protected void updateJavaPersistentType() {
- JavaResourcePersistentType jrpt = this.getJavaResourcePersistentType();
- if (jrpt == null) {
- this.setJavaPersistentType(null);
- } else {
- if (this.javaPersistentType == null) {
- this.setJavaPersistentType(this.buildJavaPersistentType(jrpt));
- } else {
- this.javaPersistentType.update(jrpt);
- }
- }
- }
-
-
- // ********** super persistent type **********
-
- public PersistentType getSuperPersistentType() {
- return this.superPersistentType;
- }
-
- protected void setSuperPersistentType(PersistentType superPersistentType) {
- PersistentType old = this.superPersistentType;
- this.superPersistentType = superPersistentType;
- this.firePropertyChanged(SUPER_PERSISTENT_TYPE_PROPERTY, old, superPersistentType);
- }
-
- protected void updateSuperPersistentType() {
- PersistentType spt = this.buildSuperPersistentType();
- // check for circular inheritance
- if ((spt == null) || CollectionTools.contains(spt.inheritanceHierarchy(), this)) {
- this.setSuperPersistentType(null);
- } else {
- this.setSuperPersistentType(spt);
- }
- }
-
- protected PersistentType buildSuperPersistentType() {
- return (this.javaPersistentType == null) ? null : this.javaPersistentType.getSuperPersistentType();
- }
-
-
- // ********** inheritance **********
-
- public Iterator<PersistentType> inheritanceHierarchy() {
- return this.inheritanceHierarchyOf(this);
- }
-
- public Iterator<PersistentType> ancestors() {
- return this.inheritanceHierarchyOf(this.superPersistentType);
- }
-
- protected Iterator<PersistentType> inheritanceHierarchyOf(PersistentType start) {
- // using a chain iterator to traverse up the inheritance tree
- return new ChainIterator<PersistentType>(start) {
- @Override
- protected PersistentType nextLink(PersistentType persistentType) {
- return persistentType.getSuperPersistentType();
- }
- };
- }
-
-
- // ********** metamodel **********
-
- public IFile getMetamodelFile() {
- return (this.javaPersistentType == null) ? null : this.metamodelSynchronizer.getFile();
- }
-
- public void initializeMetamodel() {
- // do nothing - probably shouldn't be called...
- }
-
- /**
- * All orm.xml persistent types must be able to generate a static metamodel
- * because 1.0 orm.xml files can be referenced from 2.0 persistence.xml files.
- */
- public void synchronizeMetamodel() {
- if (this.javaPersistentType != null) {
- this.metamodelSynchronizer.synchronize();
- }
- }
-
- public void disposeMetamodel() {
- // do nothing - probably shouldn't be called...
- }
-
-
- // ********** JpaStructureNode implementation **********
-
- public String getId() {
- return OrmStructureNodes.PERSISTENT_TYPE_ID;
- }
-
- public JpaStructureNode getStructureNode(int textOffset) {
- for (OrmPersistentAttribute attribute : 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();
- }
- }
-
-
- // ********** PersistentType.Owner implementation **********
-
- public AccessType getOverridePersistentTypeAccess() {
- if (this.specifiedAccess != null) {
- return this.specifiedAccess;
- }
-
- if (this.superPersistentType instanceof OrmPersistentType) {
- AccessType accessType = ((OrmPersistentType) this.superPersistentType).getSpecifiedAccess();
- if (accessType != null) {
- return accessType;
- }
- }
-
- if (this.mapping.isMetadataComplete()) {
- AccessType accessType = this.getOwnerDefaultAccess();
- if (accessType != null) {
- return accessType;
- }
- }
-
- // no override access type
- return null;
- }
-
- public AccessType getDefaultPersistentTypeAccess() {
- if (this.superPersistentType instanceof OrmPersistentType) {
- AccessType accessType = ((OrmPersistentType) this.superPersistentType).getDefaultAccess();
- if (accessType != null) {
- return accessType;
- }
- }
-
- return this.getOwnerDefaultAccess();
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.validateClass(messages);
- this.validateMapping(messages, reporter);
- this.validateAttributes(messages, reporter);
- }
-
- protected void validateClass(List<IMessage> messages) {
- if (this.javaPersistentType == null) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENT_TYPE_UNRESOLVED_CLASS,
- new String[] {this.getName()},
- this,
- this.mapping.getClassTextRange()
- )
- );
- }
- }
-
- protected void validateMapping(List<IMessage> messages, IReporter reporter) {
- try {
- this.mapping.validate(messages, reporter);
- } catch(Throwable t) {
- JptCorePlugin.log(t);
- }
- }
-
- protected void validateAttributes(List<IMessage> messages, IReporter reporter) {
- for (Iterator<OrmPersistentAttribute> stream = this.attributes(); stream.hasNext(); ) {
- this.validateAttribute(stream.next(), messages, reporter);
- }
- }
-
- protected void validateAttribute(OrmPersistentAttribute attribute, List<IMessage> messages, IReporter reporter) {
- try {
- attribute.validate(messages, reporter);
- } catch(Throwable t) {
- JptCorePlugin.log(t);
- }
- }
-
- public TextRange getValidationTextRange() {
- return this.mapping.getValidationTextRange();
- }
-
-
- // ********** misc **********
-
- @Override
- public EntityMappings getParent() {
- return (EntityMappings) super.getParent();
- }
-
- public String getDefaultPackage() {
- return this.getEntityMappings().getDefaultPersistentTypePackage();
- }
-
- public boolean isDefaultMetadataComplete() {
- return this.getEntityMappings().isDefaultPersistentTypeMetadataComplete();
- }
-
- public boolean isFor(String typeName) {
- String className = this.getName();
- if (className == null) {
- return false;
- }
- if (className.equals(typeName)) {
- return true;
- }
- String defaultPackage = this.getDefaultPackage();
- if (defaultPackage == null) {
- return false;
- }
- return (defaultPackage + '.' + className).equals(typeName);
- }
-
- public boolean contains(int textOffset) {
- return this.mapping.containsOffset(textOffset);
- }
-
- public void classChanged(String oldClass, String newClass) {
- this.firePropertyChanged(NAME_PROPERTY, oldClass, newClass);
- }
-
- public boolean isMapped() {
- return true;
- }
-
- public String getMappingKey() {
- return this.mapping.getKey();
- }
-
- protected EntityMappings getEntityMappings() {
- return this.getParent();
- }
-
- protected XmlTypeMapping getResourceTypeMapping() {
- return this.mapping.getResourceTypeMapping();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getName());
- }
-
-
- // ********** specified persistent attribute owner **********
-
- protected class SpecifiedAttributeOwner
- implements OrmPersistentAttribute.Owner
- {
- private JavaPersistentAttribute cachedJavaPersistentAttribute;
-
- public SpecifiedAttributeOwner() {
- super();
- }
-
- public JavaPersistentAttribute findJavaPersistentAttribute(OrmPersistentAttribute ormPersistentAttribute) {
- if (GenericOrmPersistentType.this.javaPersistentType == null) {
- return null;
- }
- String ormName = ormPersistentAttribute.getName();
- if (ormName == null) {
- return null;
- }
- AccessType ormAccess = ormPersistentAttribute.getAccess();
-
- JavaPersistentAttribute javaPersistentAttribute = this.findExistingJavaPersistentAttribute(ormName);
- if ((javaPersistentAttribute != null) && (javaPersistentAttribute.getAccess() == ormAccess)) {
- this.cachedJavaPersistentAttribute = null; // we only want to cache the persistent attribute if we build it
- return javaPersistentAttribute;
- }
-
- // if 'javaPersistentAttribute' is null, it might exist in a superclass that is not persistent, we need to build it ourselves.
- // if access is different, we won't be able to find the corresponding java persistent attribute, it won't exist so we build it ourselves
- return this.buildJavaPersistentAttribute(ormName, ormAccess);
- }
-
- protected JavaPersistentAttribute findExistingJavaPersistentAttribute(String attributeName) {
- return GenericOrmPersistentType.this.javaPersistentType.getAttributeNamed(attributeName);
- }
-
- protected JavaPersistentAttribute buildJavaPersistentAttribute(String ormName, AccessType ormAccess) {
- JavaResourcePersistentAttribute jrpa = this.getJavaResourcePersistentAttribute(this.getJavaResourcePersistentType(), ormName, ormAccess);
- if (this.cachedJavaPersistentAttribute != null &&
- this.cachedJavaPersistentAttribute.getResourcePersistentAttribute() == jrpa) {
- return this.cachedJavaPersistentAttribute;
- }
- return this.cachedJavaPersistentAttribute = (jrpa == null) ? null : GenericOrmPersistentType.this.buildJavaPersistentAttribute(jrpa);
- }
-
- protected JavaResourcePersistentType getJavaResourcePersistentType() {
- return GenericOrmPersistentType.this.javaPersistentType.getResourcePersistentType();
- }
-
- protected JavaResourcePersistentAttribute getJavaResourcePersistentAttribute(JavaResourcePersistentType javaResourcePersistentType, String ormName, AccessType ormAccess) {
- for (Iterator<JavaResourcePersistentAttribute> stream = this.attributes(javaResourcePersistentType, ormAccess); stream.hasNext(); ) {
- JavaResourcePersistentAttribute jrpa = stream.next();
- if (jrpa.getName().equals(ormName)) {
- return jrpa;
- }
- }
- // climb up inheritance hierarchy
- String superclassName = javaResourcePersistentType.getSuperclassQualifiedName();
- if (superclassName == null) {
- return null;
- }
- JavaResourcePersistentType superclass = GenericOrmPersistentType.this.getJavaResourcePersistentType(superclassName);
- if (superclass == null) {
- return null;
- }
- // recurse
- return this.getJavaResourcePersistentAttribute(superclass, ormName, ormAccess);
- }
-
- protected Iterator<JavaResourcePersistentAttribute> attributes(JavaResourcePersistentType javaResourcePersistentType, AccessType ormAccess) {
- return (ormAccess == AccessType.PROPERTY) ? javaResourcePersistentType.persistableProperties() : javaResourcePersistentType.persistableFields();
- }
-
- public void updateJavaPersistentAttribute() {
- if (this.cachedJavaPersistentAttribute != null) {
- this.cachedJavaPersistentAttribute.update();
- }
- //else {
- //don't update, we don't own the java persistent attribute,
- //it will be updated through the java context model
- //}
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java
deleted file mode 100644
index 191a210112..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmBaseJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmNamedColumn;
-import org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.db.Table;
-
-public class GenericOrmPrimaryKeyJoinColumn extends AbstractOrmNamedColumn<XmlPrimaryKeyJoinColumn>
- implements OrmPrimaryKeyJoinColumn
-{
- protected String specifiedReferencedColumnName;
-
- protected String defaultReferencedColumnName;
-
- protected XmlPrimaryKeyJoinColumn resourcePkJoinColumn;
-
- public GenericOrmPrimaryKeyJoinColumn(XmlContextNode parent, OrmBaseJoinColumn.Owner owner, XmlPrimaryKeyJoinColumn resourcePkJoinColumn) {
- super(parent, owner);
- this.initialize(resourcePkJoinColumn);
- }
-
- public void initializeFrom(PrimaryKeyJoinColumn oldPkJoinColumn) {
- super.initializeFrom(oldPkJoinColumn);
- setSpecifiedReferencedColumnName(oldPkJoinColumn.getSpecifiedReferencedColumnName());
- }
-
- @Override
- protected XmlPrimaryKeyJoinColumn getResourceColumn() {
- return this.resourcePkJoinColumn;
- }
-
- @Override
- protected void addResourceColumn() {
- //primaryKeyJoinColumns are part of a collection, the pk-join-column element will be removed/added
- //when the XmlPrimaryKeyJoinColumn is removed/added to the XmlEntity collection
- }
-
- @Override
- protected void removeResourceColumn() {
- //primaryKeyJoinColumns are part of a collection, the pk-join-column element will be removed/added
- //when the XmlPrimaryKeyJoinColumn is removed/added to the XmlEntity collection
- }
-
- public String getReferencedColumnName() {
- return (this.getSpecifiedReferencedColumnName() == null) ? getDefaultReferencedColumnName() : this.getSpecifiedReferencedColumnName();
- }
-
- public String getSpecifiedReferencedColumnName() {
- return this.specifiedReferencedColumnName;
- }
-
- public void setSpecifiedReferencedColumnName(String newSpecifiedReferencedColumnName) {
- String oldSpecifiedReferencedColumnName = this.specifiedReferencedColumnName;
- this.specifiedReferencedColumnName = newSpecifiedReferencedColumnName;
- getResourceColumn().setReferencedColumnName(newSpecifiedReferencedColumnName);
- firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, oldSpecifiedReferencedColumnName, newSpecifiedReferencedColumnName);
- }
-
- protected void setSpecifiedReferencedColumnName_(String newSpecifiedReferencedColumnName) {
- String oldSpecifiedReferencedColumnName = this.specifiedReferencedColumnName;
- this.specifiedReferencedColumnName = newSpecifiedReferencedColumnName;
- firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, oldSpecifiedReferencedColumnName, newSpecifiedReferencedColumnName);
- }
-
- public String getDefaultReferencedColumnName() {
- return this.defaultReferencedColumnName;
- }
-
- protected void setDefaultReferencedColumnName(String newDefaultReferencedColumnName) {
- String oldDefaultReferencedColumnName = this.defaultReferencedColumnName;
- this.defaultReferencedColumnName = newDefaultReferencedColumnName;
- firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, oldDefaultReferencedColumnName, newDefaultReferencedColumnName);
- }
-
- @Override
- public OrmBaseJoinColumn.Owner getOwner() {
- return (OrmBaseJoinColumn.Owner) this.owner;
- }
-
- public Column getReferencedDbColumn() {
- Table table = this.getReferencedColumnDbTable();
- return (table == null) ? null : table.getColumnForIdentifier(this.getReferencedColumnName());
- }
-
- public Table getReferencedColumnDbTable() {
- return getOwner().getReferencedColumnDbTable();
- }
-
- public boolean isReferencedColumnResolved() {
- return getReferencedDbColumn() != null;
- }
-
- public TextRange getReferencedColumnNameTextRange() {
- if (getResourceColumn() != null) {
- TextRange textRange = getResourceColumn().getReferencedColumnNameTextRange();
- if (textRange != null) {
- return textRange;
- }
- }
- return getOwner().getValidationTextRange();
- }
-
-
- public boolean isVirtual() {
- return getOwner().isVirtual(this);
- }
-
- @Override
- protected void initialize(XmlPrimaryKeyJoinColumn resourcePkJoinColumn) {
- this.resourcePkJoinColumn = resourcePkJoinColumn;
- super.initialize(resourcePkJoinColumn);
- this.specifiedReferencedColumnName = getResourceReferencedColumnName();
- this.defaultReferencedColumnName = buildDefaultReferencedColumnName();
- }
-
- @Override
- public void update(XmlPrimaryKeyJoinColumn resourcePkJoinColumn) {
- this.resourcePkJoinColumn = resourcePkJoinColumn;
- super.update(resourcePkJoinColumn);
- this.setSpecifiedReferencedColumnName_(getResourceReferencedColumnName());
- this.setDefaultReferencedColumnName(buildDefaultReferencedColumnName());
- }
-
- protected String getResourceReferencedColumnName() {
- return this.resourcePkJoinColumn == null ? null : this.resourcePkJoinColumn.getReferencedColumnName();
- }
-
- //TODO not correct when we start supporting primaryKeyJoinColumns in 1-1 mappings
- protected String buildDefaultReferencedColumnName() {
- return buildDefaultName();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java
deleted file mode 100644
index b866bb0041..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.jpt.core.context.NamedNativeQuery;
-import org.eclipse.jpt.core.context.NamedQuery;
-import org.eclipse.jpt.core.context.Query;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmNamedNativeQuery;
-import org.eclipse.jpt.core.context.orm.OrmNamedQuery;
-import org.eclipse.jpt.core.context.orm.OrmQuery;
-import org.eclipse.jpt.core.context.orm.OrmQueryContainer;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlNamedNativeQuery;
-import org.eclipse.jpt.core.resource.orm.XmlNamedQuery;
-import org.eclipse.jpt.core.resource.orm.XmlQueryContainer;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmQueryContainer extends AbstractOrmXmlContextNode
- implements OrmQueryContainer
-{
- private final XmlQueryContainer resourceQueryContainer;
-
- protected final List<OrmNamedQuery> namedQueries;
-
- protected final List<OrmNamedNativeQuery> namedNativeQueries;
-
-
- public GenericOrmQueryContainer(XmlContextNode parent, XmlQueryContainer resourceQueryContainer) {
- super(parent);
- this.resourceQueryContainer = resourceQueryContainer;
- this.namedQueries = new ArrayList<OrmNamedQuery>();
- this.namedNativeQueries = new ArrayList<OrmNamedNativeQuery>();
- this.initializeNamedQueries();
- this.initializeNamedNativeQueries();
- }
-
- public ListIterator<OrmNamedQuery> namedQueries() {
- return new CloneListIterator<OrmNamedQuery>(this.namedQueries);
- }
-
- public int namedQueriesSize() {
- return this.namedQueries.size();
- }
-
- public OrmNamedQuery addNamedQuery(int index) {
- XmlNamedQuery resourceNamedQuery = OrmFactory.eINSTANCE.createXmlNamedQuery();
- OrmNamedQuery contextNamedQuery = buildNamedQuery(resourceNamedQuery);
- this.namedQueries.add(index, contextNamedQuery);
- this.resourceQueryContainer.getNamedQueries().add(index, resourceNamedQuery);
- this.fireItemAdded(NAMED_QUERIES_LIST, index, contextNamedQuery);
- return contextNamedQuery;
- }
-
- protected void addNamedQuery(int index, OrmNamedQuery namedQuery) {
- addItemToList(index, namedQuery, this.namedQueries, NAMED_QUERIES_LIST);
- }
-
- protected void addNamedQuery(OrmNamedQuery namedQuery) {
- this.addNamedQuery(this.namedQueries.size(), namedQuery);
- }
-
- public void removeNamedQuery(NamedQuery namedQuery) {
- removeNamedQuery(this.namedQueries.indexOf(namedQuery));
- }
-
- public void removeNamedQuery(int index) {
- OrmNamedQuery namedQuery = this.namedQueries.remove(index);
- this.resourceQueryContainer.getNamedQueries().remove(index);
- fireItemRemoved(NAMED_QUERIES_LIST, index, namedQuery);
- }
-
- protected void removeNamedQuery_(OrmNamedQuery namedQuery) {
- removeItemFromList(namedQuery, this.namedQueries, NAMED_QUERIES_LIST);
- }
-
- public void moveNamedQuery(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.namedQueries, targetIndex, sourceIndex);
- this.resourceQueryContainer.getNamedQueries().move(targetIndex, sourceIndex);
- fireItemMoved(NAMED_QUERIES_LIST, targetIndex, sourceIndex);
- }
-
- public ListIterator<OrmNamedNativeQuery> namedNativeQueries() {
- return new CloneListIterator<OrmNamedNativeQuery>(this.namedNativeQueries);
- }
-
- public int namedNativeQueriesSize() {
- return this.namedNativeQueries.size();
- }
-
- public OrmNamedNativeQuery addNamedNativeQuery(int index) {
- XmlNamedNativeQuery resourceNamedNativeQuery = OrmFactory.eINSTANCE.createXmlNamedNativeQuery();
- OrmNamedNativeQuery contextNamedNativeQuery = buildNamedNativeQuery(resourceNamedNativeQuery);
- this.namedNativeQueries.add(index, contextNamedNativeQuery);
- this.resourceQueryContainer.getNamedNativeQueries().add(index, resourceNamedNativeQuery);
- this.fireItemAdded(NAMED_NATIVE_QUERIES_LIST, index, contextNamedNativeQuery);
- return contextNamedNativeQuery;
- }
-
- protected void addNamedNativeQuery(int index, OrmNamedNativeQuery namedNativeQuery) {
- addItemToList(index, namedNativeQuery, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
- }
-
- protected void addNamedNativeQuery(OrmNamedNativeQuery namedNativeQuery) {
- this.addNamedNativeQuery(this.namedNativeQueries.size(), namedNativeQuery);
- }
-
- public void removeNamedNativeQuery(NamedNativeQuery namedNativeQuery) {
- this.removeNamedNativeQuery(this.namedNativeQueries.indexOf(namedNativeQuery));
- }
-
- public void removeNamedNativeQuery(int index) {
- OrmNamedNativeQuery namedNativeQuery = this.namedNativeQueries.remove(index);
- this.resourceQueryContainer.getNamedNativeQueries().remove(index);
- fireItemRemoved(NAMED_NATIVE_QUERIES_LIST, index, namedNativeQuery);
- }
-
- protected void removeNamedNativeQuery_(OrmNamedNativeQuery namedNativeQuery) {
- removeItemFromList(namedNativeQuery, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
- }
-
- public void moveNamedNativeQuery(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.namedNativeQueries, targetIndex, sourceIndex);
- this.resourceQueryContainer.getNamedNativeQueries().move(targetIndex, sourceIndex);
- fireItemMoved(NAMED_NATIVE_QUERIES_LIST, targetIndex, sourceIndex);
- }
-
-
- protected void initializeNamedQueries() {
- for (XmlNamedQuery namedQuery : this.resourceQueryContainer.getNamedQueries()) {
- this.namedQueries.add(buildNamedQuery(namedQuery));
- }
- }
-
- protected void initializeNamedNativeQueries() {
- for (XmlNamedNativeQuery namedNativeQuery : this.resourceQueryContainer.getNamedNativeQueries()) {
- this.namedNativeQueries.add(buildNamedNativeQuery(namedNativeQuery));
- }
- }
-
- public void update() {
- this.updateNamedQueries();
- this.updateNamedNativeQueries();
- }
-
- protected void updateNamedQueries() {
- // make a copy of the XML queries (to prevent ConcurrentModificationException)
- Iterator<XmlNamedQuery> xmlQueries = new CloneIterator<XmlNamedQuery>(this.resourceQueryContainer.getNamedQueries());
-
- for (Iterator<OrmNamedQuery> contextQueries = this.namedQueries(); contextQueries.hasNext(); ) {
- OrmNamedQuery contextQuery = contextQueries.next();
- if (xmlQueries.hasNext()) {
- contextQuery.update(xmlQueries.next());
- }
- else {
- removeNamedQuery_(contextQuery);
- }
- }
-
- while (xmlQueries.hasNext()) {
- addNamedQuery(buildNamedQuery(xmlQueries.next()));
- }
- }
-
- protected OrmNamedQuery buildNamedQuery(XmlNamedQuery resourceNamedQuery) {
- return getXmlContextNodeFactory().buildOrmNamedQuery(this, resourceNamedQuery);
- }
-
- protected void updateNamedNativeQueries() {
- // make a copy of the XML queries (to prevent ConcurrentModificationException)
- Iterator<XmlNamedNativeQuery> xmlQueries = new CloneIterator<XmlNamedNativeQuery>(this.resourceQueryContainer.getNamedNativeQueries());
-
- for (Iterator<OrmNamedNativeQuery> contextQueries = this.namedNativeQueries(); contextQueries.hasNext(); ) {
- OrmNamedNativeQuery contextQuery = contextQueries.next();
- if (xmlQueries.hasNext()) {
- contextQuery.update(xmlQueries.next());
- }
- else {
- removeNamedNativeQuery_(contextQuery);
- }
- }
-
- while (xmlQueries.hasNext()) {
- addNamedNativeQuery(buildNamedNativeQuery(xmlQueries.next()));
- }
- }
-
- protected OrmNamedNativeQuery buildNamedNativeQuery(XmlNamedNativeQuery resourceNamedNativeQuery) {
- return getXmlContextNodeFactory().buildOrmNamedNativeQuery(this, resourceNamedNativeQuery);
- }
-
-
- //************ validation ***************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.validateQueries(messages);
- }
-
- protected void validateQueries(List<IMessage> messages) {
- for (Iterator<OrmQuery> localQueries = this.queries(); localQueries.hasNext(); ) {
- OrmQuery localQuery = localQueries.next();
- for (Iterator<Query> globalQueries = this.getPersistenceUnit().queries(); globalQueries.hasNext(); ) {
- if (localQuery.duplicates(globalQueries.next())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.QUERY_DUPLICATE_NAME,
- new String[] {localQuery.getName()},
- localQuery,
- localQuery.getNameTextRange())
- );
- }
- }
- }
- }
-
- /**
- * Return all the queries, named and named native.
- */
- @SuppressWarnings("unchecked")
- protected Iterator<OrmQuery> queries() {
- return new CompositeIterator<OrmQuery>(
- namedQueries(),
- namedNativeQueries()
- );
- }
-
- public TextRange getValidationTextRange() {
- return this.resourceQueryContainer.getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmQueryHint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmQueryHint.java
deleted file mode 100644
index bd36a92e53..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmQueryHint.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.QueryHint;
-import org.eclipse.jpt.core.context.orm.OrmQuery;
-import org.eclipse.jpt.core.context.orm.OrmQueryHint;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.resource.orm.XmlQueryHint;
-import org.eclipse.jpt.core.utility.TextRange;
-
-
-public class GenericOrmQueryHint extends AbstractOrmXmlContextNode implements OrmQueryHint
-{
-
- protected String name;
-
- protected String value;
-
- protected XmlQueryHint resourceQueryHint;
-
- public GenericOrmQueryHint(OrmQuery parent, XmlQueryHint resourceQueryHint) {
- super(parent);
- this.initialize(resourceQueryHint);
- }
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String newName) {
- String oldName = this.name;
- this.name = newName;
- this.resourceQueryHint.setName(newName);
- firePropertyChanged(QueryHint.NAME_PROPERTY, oldName, newName);
- }
-
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String newValue) {
- String oldValue = this.value;
- this.value = newValue;
- this.resourceQueryHint.setValue(newValue);
- firePropertyChanged(QueryHint.VALUE_PROPERTY, oldValue, newValue);
- }
-
- protected void initialize(XmlQueryHint resourceQueryHint) {
- this.resourceQueryHint = resourceQueryHint;
- this.name = resourceQueryHint.getName();
- this.value = resourceQueryHint.getValue();
- }
-
- public void update(XmlQueryHint resourceQueryHint) {
- this.resourceQueryHint = resourceQueryHint;
- this.setName(resourceQueryHint.getName());
- this.setValue(resourceQueryHint.getValue());
- }
-
- public TextRange getValidationTextRange() {
- return this.resourceQueryHint.getValidationTextRange();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java
deleted file mode 100644
index a7ec7c06eb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java
+++ /dev/null
@@ -1,388 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jpt.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.SecondaryTable;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmBaseJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmSecondaryTable;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmTable;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlSecondaryTable;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-import org.eclipse.jpt.utility.internal.iterators.SingleElementListIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * orm.xml secondary table
- */
-public class GenericOrmSecondaryTable
- extends AbstractOrmTable
- implements OrmSecondaryTable
-{
- protected XmlSecondaryTable secondaryTable;
-
- protected final Vector<OrmPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns = new Vector<OrmPrimaryKeyJoinColumn>();
-
- protected OrmPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn;
-
- protected final OrmBaseJoinColumn.Owner joinColumnOwner;
-
-
- public GenericOrmSecondaryTable(OrmEntity parent, XmlSecondaryTable xmlSecondaryTable) {
- super(parent);
- this.joinColumnOwner = this.buildJoinColumnOwner();
- this.initialize(xmlSecondaryTable);
- }
-
- protected OrmBaseJoinColumn.Owner buildJoinColumnOwner() {
- return new PrimaryKeyJoinColumnOwner();
- }
-
- public void initializeFrom(SecondaryTable oldSecondaryTable) {
- super.initializeFrom(oldSecondaryTable);
- for (PrimaryKeyJoinColumn oldPkJoinColumn : CollectionTools.iterable(oldSecondaryTable.specifiedPrimaryKeyJoinColumns())) {
- OrmPrimaryKeyJoinColumn newPkJoinColumn = addSpecifiedPrimaryKeyJoinColumn(specifiedPrimaryKeyJoinColumnsSize());
- newPkJoinColumn.initializeFrom(oldPkJoinColumn);
- }
- }
-
- @Override
- public OrmEntity getParent() {
- return (OrmEntity) super.getParent();
- }
-
- public OrmEntity getOrmEntity() {
- return getParent();
- }
-
- public OrmPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn() {
- return this.defaultPrimaryKeyJoinColumn;
- }
-
- protected void setDefaultPrimaryKeyJoinColumn(OrmPrimaryKeyJoinColumn newPkJoinColumn) {
- OrmPrimaryKeyJoinColumn oldPkJoinColumn = this.defaultPrimaryKeyJoinColumn;
- this.defaultPrimaryKeyJoinColumn = newPkJoinColumn;
- firePropertyChanged(SecondaryTable.DEFAULT_PRIMARY_KEY_JOIN_COLUMN, oldPkJoinColumn, newPkJoinColumn);
- }
-
- public ListIterator<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
- return this.containsSpecifiedPrimaryKeyJoinColumns() ? this.specifiedPrimaryKeyJoinColumns() : this.defaultPrimaryKeyJoinColumns();
- }
-
- public int primaryKeyJoinColumnsSize() {
- return this.containsSpecifiedPrimaryKeyJoinColumns() ? this.specifiedPrimaryKeyJoinColumnsSize() : this.defaultPrimaryKeyJoinColumnsSize();
- }
-
- public ListIterator<OrmPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns() {
- return new CloneListIterator<OrmPrimaryKeyJoinColumn>(this.specifiedPrimaryKeyJoinColumns);
- }
-
- public int specifiedPrimaryKeyJoinColumnsSize() {
- return this.specifiedPrimaryKeyJoinColumns.size();
- }
-
- protected ListIterator<OrmPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns() {
- if (this.defaultPrimaryKeyJoinColumn != null) {
- return new SingleElementListIterator<OrmPrimaryKeyJoinColumn>(this.defaultPrimaryKeyJoinColumn);
- }
- return EmptyListIterator.instance();
- }
-
- protected int defaultPrimaryKeyJoinColumnsSize() {
- return (this.defaultPrimaryKeyJoinColumn == null) ? 0 : 1;
- }
-
- public boolean containsSpecifiedPrimaryKeyJoinColumns() {
- return !this.specifiedPrimaryKeyJoinColumns.isEmpty();
- }
-
- public OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
- OrmPrimaryKeyJoinColumn oldDefaultPkJoinColumn = this.getDefaultPrimaryKeyJoinColumn();
- if (oldDefaultPkJoinColumn != null) {
- //null the default join column now if one already exists.
- //if one does not exist, there is already a specified join column.
- //Remove it now so that it doesn't get removed during an update and
- //cause change notifications to be sent to the UI in the wrong order
- this.defaultPrimaryKeyJoinColumn = null;
- }
- XmlPrimaryKeyJoinColumn resourcePkJoinColumn = OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumn();
- OrmPrimaryKeyJoinColumn contextPkJoinColumn = buildPrimaryKeyJoinColumn(resourcePkJoinColumn);
- this.specifiedPrimaryKeyJoinColumns.add(index, contextPkJoinColumn);
- this.secondaryTable.getPrimaryKeyJoinColumns().add(index, resourcePkJoinColumn);
-
- this.fireItemAdded(SecondaryTable.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, contextPkJoinColumn);
- if (oldDefaultPkJoinColumn != null) {
- this.firePropertyChanged(SecondaryTable.DEFAULT_PRIMARY_KEY_JOIN_COLUMN, oldDefaultPkJoinColumn, null);
- }
- return contextPkJoinColumn;
- }
-
- protected void addSpecifiedPrimaryKeyJoinColumn(int index, OrmPrimaryKeyJoinColumn primaryKeyJoinColumn) {
- addItemToList(index, primaryKeyJoinColumn, this.specifiedPrimaryKeyJoinColumns, SecondaryTable.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- protected void addSpecifiedPrimaryKeyJoinColumn(OrmPrimaryKeyJoinColumn primaryKeyJoinColumn) {
- this.addSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.size(), primaryKeyJoinColumn);
- }
-
- public void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn pkJoinColumn) {
- this.removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.indexOf(pkJoinColumn));
- }
-
- public void removeSpecifiedPrimaryKeyJoinColumn(int index) {
- OrmPrimaryKeyJoinColumn removedPrimaryKeyJoinColumn = this.specifiedPrimaryKeyJoinColumns.remove(index);
- if (!containsSpecifiedPrimaryKeyJoinColumns()) {
- //create the defaultJoinColumn now or this will happen during project update
- //after removing the join column from the resource model. That causes problems
- //in the UI because the change notifications end up in the wrong order.
- this.defaultPrimaryKeyJoinColumn = buildPrimaryKeyJoinColumn(null);
- }
- this.secondaryTable.getPrimaryKeyJoinColumns().remove(index);
- fireItemRemoved(SecondaryTable.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, removedPrimaryKeyJoinColumn);
- if (this.defaultPrimaryKeyJoinColumn != null) {
- //fire change notification if a defaultJoinColumn was created above
- this.firePropertyChanged(Entity.DEFAULT_PRIMARY_KEY_JOIN_COLUMN, null, this.defaultPrimaryKeyJoinColumn);
- }
- }
-
- protected void removeSpecifiedPrimaryKeyJoinColumn_(OrmPrimaryKeyJoinColumn primaryKeyJoinColumn) {
- removeItemFromList(primaryKeyJoinColumn, this.specifiedPrimaryKeyJoinColumns, SecondaryTable.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.specifiedPrimaryKeyJoinColumns, targetIndex, sourceIndex);
- this.secondaryTable.getPrimaryKeyJoinColumns().move(targetIndex, sourceIndex);
- fireItemMoved(SecondaryTable.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
- }
-
-
- public boolean isVirtual() {
- return getOrmEntity().containsVirtualSecondaryTable(this);
- }
-
- @Override
- protected XmlSecondaryTable getResourceTable() {
- return this.secondaryTable;
- }
-
- @Override
- protected XmlSecondaryTable addResourceTable() {
- //secondaryTables are part of a collection, the secondary-table element will be removed/added
- //when the XmlSecondaryTable is removed/added to the XmlEntity collection
- throw new IllegalStateException("resource table is missing"); //$NON-NLS-1$
- }
-
- @Override
- protected void removeResourceTable() {
- //secondaryTables are part of a collection, the secondary-table element will be removed/added
- //when the XmlSecondaryTable is removed/added to the XmlEntity collection
- }
-
- protected void initialize(XmlSecondaryTable xst) {
- this.secondaryTable = xst;
- super.initialize(xst);
- this.initializeSpecifiedPrimaryKeyJoinColumns();
- this.initializeDefaultPrimaryKeyJoinColumn();
- }
-
- protected void initializeSpecifiedPrimaryKeyJoinColumns() {
- for (XmlPrimaryKeyJoinColumn resourcePkJoinColumn : this.secondaryTable.getPrimaryKeyJoinColumns()) {
- this.specifiedPrimaryKeyJoinColumns.add(buildPrimaryKeyJoinColumn(resourcePkJoinColumn));
- }
- }
-
- protected boolean shouldBuildDefaultPrimaryKeyJoinColumn() {
- return !containsSpecifiedPrimaryKeyJoinColumns();
- }
-
- protected void initializeDefaultPrimaryKeyJoinColumn() {
- if (!shouldBuildDefaultPrimaryKeyJoinColumn()) {
- return;
- }
- this.defaultPrimaryKeyJoinColumn = buildPrimaryKeyJoinColumn(null);
- }
-
- public void update(XmlSecondaryTable xst) {
- this.secondaryTable = xst;
- super.update(xst);
- this.updateSpecifiedPrimaryKeyJoinColumns();
- this.updateDefaultPrimaryKeyJoinColumn();
- }
-
- protected void updateSpecifiedPrimaryKeyJoinColumns() {
- // make a copy of the XML PK join columns (to prevent ConcurrentModificationException)
- Iterator<XmlPrimaryKeyJoinColumn> xmlPkJoinColumns = new CloneIterator<XmlPrimaryKeyJoinColumn>(this.secondaryTable.getPrimaryKeyJoinColumns());
-
- for (Iterator<OrmPrimaryKeyJoinColumn> contextPkJoinColumns = this.specifiedPrimaryKeyJoinColumns(); contextPkJoinColumns.hasNext(); ) {
- OrmPrimaryKeyJoinColumn contextPkJoinColumn = contextPkJoinColumns.next();
- if (xmlPkJoinColumns.hasNext()) {
- contextPkJoinColumn.update(xmlPkJoinColumns.next());
- }
- else {
- removeSpecifiedPrimaryKeyJoinColumn_(contextPkJoinColumn);
- }
- }
-
- while (xmlPkJoinColumns.hasNext()) {
- addSpecifiedPrimaryKeyJoinColumn(buildPrimaryKeyJoinColumn(xmlPkJoinColumns.next()));
- }
- }
-
- protected void updateDefaultPrimaryKeyJoinColumn() {
- if (!shouldBuildDefaultPrimaryKeyJoinColumn()) {
- setDefaultPrimaryKeyJoinColumn(null);
- return;
- }
- if (getDefaultPrimaryKeyJoinColumn() == null) {
- this.setDefaultPrimaryKeyJoinColumn(buildPrimaryKeyJoinColumn(null));
- }
- else {
- this.defaultPrimaryKeyJoinColumn.update(null);
- }
- }
-
- protected OrmPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(XmlPrimaryKeyJoinColumn resourcePkJoinColumn) {
- return getXmlContextNodeFactory().buildOrmPrimaryKeyJoinColumn(this, this.joinColumnOwner, resourcePkJoinColumn);
- }
-
- /**
- * 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 **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- if (this.connectionProfileIsActive()) {
- this.validateAgainstDatabase(messages);
- }
- for (Iterator<OrmPrimaryKeyJoinColumn> stream = this.primaryKeyJoinColumns(); stream.hasNext(); ) {
- stream.next().validate(messages, reporter);
- }
- }
-
- protected void validateAgainstDatabase(List<IMessage> messages) {
- if ( ! this.hasResolvedCatalog()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.SECONDARY_TABLE_UNRESOLVED_CATALOG,
- new String[] {this.getCatalog(), this.getName()},
- this,
- this.getCatalogTextRange()
- )
- );
- return;
- }
-
- if ( ! this.hasResolvedSchema()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.SECONDARY_TABLE_UNRESOLVED_SCHEMA,
- new String[] {this.getSchema(), this.getName()},
- this,
- this.getSchemaTextRange()
- )
- );
- return;
- }
-
- if ( ! this.isResolved()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.SECONDARY_TABLE_UNRESOLVED_NAME,
- new String[] {this.getName()},
- this,
- this.getNameTextRange()
- )
- );
- return;
- }
- }
-
-
- // ********** pk join column owner adapter **********
-
- class PrimaryKeyJoinColumnOwner
- implements OrmBaseJoinColumn.Owner
- {
- public TypeMapping getTypeMapping() {
- return GenericOrmSecondaryTable.this.getOrmEntity();
- }
-
- public Table getDbTable(String tableName) {
- return GenericOrmSecondaryTable.this.getDbTable();
- }
-
- public Table getReferencedColumnDbTable() {
- return getTypeMapping().getPrimaryDbTable();
- }
-
- public int joinColumnsSize() {
- return GenericOrmSecondaryTable.this.primaryKeyJoinColumnsSize();
- }
-
- public boolean isVirtual(BaseJoinColumn joinColumn) {
- return GenericOrmSecondaryTable.this.defaultPrimaryKeyJoinColumn == joinColumn;
- }
-
- public String getDefaultColumnName() {
- if (joinColumnsSize() != 1) {
- return null;
- }
- Entity parentEntity = getOrmEntity().getParentEntity();
- return (parentEntity == null) ? getOrmEntity().getPrimaryKeyColumnName() : parentEntity.getPrimaryKeyColumnName();
- }
-
- public TextRange getValidationTextRange() {
- return null;
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java
deleted file mode 100644
index a7805c1564..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmSequenceGenerator;
-import org.eclipse.jpt.core.resource.orm.XmlSequenceGenerator;
-
-/**
- *
- */
-public class GenericOrmSequenceGenerator
- extends AbstractOrmSequenceGenerator
-{
-
- public GenericOrmSequenceGenerator(XmlContextNode parent, XmlSequenceGenerator resourceSequenceGenerator) {
- super(parent, resourceSequenceGenerator);
- }
-
- // ********** database stuff **********
-
- /**
- * The JPA spec does not allow a sequence to have a schema.
- */
- @Override
- protected String getSchema() {
- return this.getContextDefaultSchema();
- }
-
- /**
- * The JPA spec does not allow a sequence to have a catalog.
- */
- @Override
- protected String getCatalog() {
- return this.getContextDefaultCatalog();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTable.java
deleted file mode 100644
index 63fcf35496..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTable.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmTable;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmTable;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.core.resource.orm.XmlTable;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- *
- */
-public class GenericOrmTable
- extends AbstractOrmTable
- implements OrmTable
-{
- protected XmlEntity resourceEntity;
-
- public GenericOrmTable(OrmEntity parent) {
- super(parent);
- }
-
- public OrmEntity getOrmEntity() {
- return (OrmEntity) super.getParent();
- }
-
- @Override
- protected XmlTable getResourceTable() {
- return this.resourceEntity.getTable();
- }
-
- @Override
- protected XmlTable addResourceTable() {
- XmlTable resourceTable = OrmFactory.eINSTANCE.createXmlTable();
- this.resourceEntity.setTable(resourceTable);
- return resourceTable;
- }
-
- @Override
- protected void removeResourceTable() {
- this.resourceEntity.setTable(null);
- }
-
- public void initialize(XmlEntity xmlEntity) {
- this.resourceEntity = xmlEntity;
- this.initialize(this.getResourceTable());
- }
-
- public void update(XmlEntity xmlEntity) {
- this.resourceEntity = xmlEntity;
- this.update(this.getResourceTable());
- }
-
- @Override
- protected String buildDefaultName() {
- return this.getOrmEntity().getDefaultTableName();
- }
-
- @Override
- protected String buildDefaultSchema() {
- return this.getOrmEntity().getDefaultSchema();
- }
-
- @Override
- protected String buildDefaultCatalog() {
- return this.getOrmEntity().getDefaultCatalog();
- }
-
- //*********** Validation *******************************
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- if (this.connectionProfileIsActive()) {
- this.validateAgainstDatabase(messages);
- }
- }
-
- protected void validateAgainstDatabase(List<IMessage> messages) {
- if ( ! this.hasResolvedCatalog()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.TABLE_UNRESOLVED_CATALOG,
- new String[] {this.getCatalog(), this.getName()},
- this,
- this.getCatalogTextRange()
- )
- );
- return;
- }
-
- if ( ! this.hasResolvedSchema()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.TABLE_UNRESOLVED_SCHEMA,
- new String[] {this.getSchema(), this.getName()},
- this,
- this.getSchemaTextRange()
- )
- );
- return;
- }
-
- if ( ! this.isResolved()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.TABLE_UNRESOLVED_NAME,
- new String[] {this.getName()},
- this,
- this.getNameTextRange()
- )
- );
- return;
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java
deleted file mode 100644
index a25f930bc0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java
+++ /dev/null
@@ -1,420 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.jpt.core.context.TableGenerator;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmTableGenerator;
-import org.eclipse.jpt.core.context.orm.OrmUniqueConstraint;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmGenerator;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlTableGenerator;
-import org.eclipse.jpt.core.resource.orm.XmlUniqueConstraint;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-
-/**
- *
- */
-public class GenericOrmTableGenerator
- extends AbstractOrmGenerator<XmlTableGenerator>
- implements OrmTableGenerator, UniqueConstraint.Owner
-{
- protected String specifiedTable;
- protected String defaultTable;
-
- protected String specifiedCatalog;
- protected String defaultCatalog;
-
- protected String specifiedSchema;
- protected String defaultSchema;
-
- protected String specifiedPkColumnName;
- protected String defaultPkColumnName;
-
- protected String specifiedValueColumnName;
- protected String defaultValueColumnName;
-
- protected String specifiedPkColumnValue;
- protected String defaultPkColumnValue;
-
- protected final List<OrmUniqueConstraint> uniqueConstraints;
-
-
- // ********** constructor **********
-
- public GenericOrmTableGenerator(XmlContextNode parent, XmlTableGenerator resourceTableGenerator) {
- super(parent);
- this.uniqueConstraints = new ArrayList<OrmUniqueConstraint>();
- this.initialize(resourceTableGenerator);
- }
-
- @Override
- public int getDefaultInitialValue() {
- return TableGenerator.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) {
- String old = this.specifiedTable;
- this.specifiedTable = table;
- this.getResourceGenerator().setTable(table);
- this.firePropertyChanged(SPECIFIED_TABLE_PROPERTY, old, 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);
- }
-
-
- // ********** schema **********
-
- @Override
- public String getSchema() {
- return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema;
- }
-
- public String getSpecifiedSchema() {
- return this.specifiedSchema;
- }
-
- public void setSpecifiedSchema(String schema) {
- String old = this.specifiedSchema;
- this.specifiedSchema = schema;
- this.getResourceGenerator().setSchema(schema);
- this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, 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);
- }
-
-
- // ********** catalog **********
-
- @Override
- public String getCatalog() {
- return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog;
- }
-
- public String getSpecifiedCatalog() {
- return this.specifiedCatalog;
- }
-
- public void setSpecifiedCatalog(String catalog) {
- String old = this.specifiedCatalog;
- this.specifiedCatalog = catalog;
- this.getResourceGenerator().setCatalog(catalog);
- this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, 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;
- firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog);
- }
-
-
- // ********** 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) {
- String old = this.specifiedPkColumnName;
- this.specifiedPkColumnName = name;
- this.getResourceGenerator().setPkColumnName(name);
- this.firePropertyChanged(SPECIFIED_PK_COLUMN_NAME_PROPERTY, old, 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);
- }
-
-
- // ********** 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) {
- String old = this.specifiedValueColumnName;
- this.specifiedValueColumnName = name;
- this.getResourceGenerator().setValueColumnName(name);
- this.firePropertyChanged(SPECIFIED_VALUE_COLUMN_NAME_PROPERTY, old, 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);
- }
-
-
- // ********** 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) {
- String old = this.specifiedPkColumnValue;
- this.specifiedPkColumnValue = value;
- this.getResourceGenerator().setPkColumnValue(value);
- this.firePropertyChanged(SPECIFIED_PK_COLUMN_VALUE_PROPERTY, old, 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;
- }
-
- public void setDefaultPkColumnValue(String value) {
- String old = this.defaultPkColumnValue;
- this.defaultPkColumnValue = value;
- this.firePropertyChanged(DEFAULT_PK_COLUMN_VALUE_PROPERTY, old, value);
- }
-
-
- // ********** unique constraints **********
-
- public ListIterator<OrmUniqueConstraint> uniqueConstraints() {
- return new CloneListIterator<OrmUniqueConstraint>(this.uniqueConstraints);
- }
-
- public int uniqueConstraintsSize() {
- return this.uniqueConstraints.size();
- }
-
- public OrmUniqueConstraint addUniqueConstraint(int index) {
- XmlUniqueConstraint resourceUC = OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- OrmUniqueConstraint contextUC = this.buildUniqueConstraint(resourceUC);
- this.uniqueConstraints.add(index, contextUC);
- this.getResourceGenerator().getUniqueConstraints().add(index, resourceUC);
- this.fireItemAdded(UNIQUE_CONSTRAINTS_LIST, index, contextUC);
- return contextUC;
- }
-
- protected void addUniqueConstraint(int index, OrmUniqueConstraint uniqueConstraint) {
- this.addItemToList(index, uniqueConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- }
-
- protected void addUniqueConstraint(OrmUniqueConstraint uniqueConstraint) {
- this.addUniqueConstraint(this.uniqueConstraints.size(), uniqueConstraint);
- }
-
- public void removeUniqueConstraint(UniqueConstraint uniqueConstraint) {
- this.removeUniqueConstraint(this.uniqueConstraints.indexOf(uniqueConstraint));
- }
-
- public void removeUniqueConstraint(int index) {
- OrmUniqueConstraint uniqueConstraint = this.uniqueConstraints.remove(index);
- this.getResourceGenerator().getUniqueConstraints().remove(index);
- this.fireItemRemoved(UNIQUE_CONSTRAINTS_LIST, index, uniqueConstraint);
- }
-
- protected void removeUniqueConstraint_(OrmUniqueConstraint uniqueConstraint) {
- this.removeItemFromList(uniqueConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- }
-
- public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.uniqueConstraints, targetIndex, sourceIndex);
- this.getResourceGenerator().getUniqueConstraints().move(targetIndex, sourceIndex);
- this.fireItemMoved(UNIQUE_CONSTRAINTS_LIST, targetIndex, sourceIndex);
- }
-
-
- //******************* UniqueConstraint.Owner implementation ******************
-
- public Iterator<String> candidateUniqueConstraintColumnNames() {
- org.eclipse.jpt.db.Table dbTable = this.getDbTable();
- return (dbTable != null) ? dbTable.sortedColumnIdentifiers() : EmptyIterator.<String>instance();
- }
-
-
- // ********** resource => context **********
-
- @Override
- protected void initialize(XmlTableGenerator xmlTableGenerator) {
- super.initialize(xmlTableGenerator);
- this.specifiedTable = xmlTableGenerator.getTable();
- this.defaultSchema = this.buildDefaultSchema();
- this.specifiedSchema = xmlTableGenerator.getSchema();
- this.defaultCatalog = this.buildDefaultCatalog();
- this.specifiedCatalog = xmlTableGenerator.getCatalog();
- this.specifiedPkColumnName = xmlTableGenerator.getPkColumnName();
- this.specifiedValueColumnName = xmlTableGenerator.getValueColumnName();
- this.specifiedPkColumnValue = xmlTableGenerator.getPkColumnValue();
- this.initializeUniqueContraints();
- }
-
- protected void initializeUniqueContraints() {
- if (this.resourceGenerator == null) {
- return;
- }
- for (XmlUniqueConstraint uniqueConstraint : this.resourceGenerator.getUniqueConstraints()) {
- this.uniqueConstraints.add(this.buildUniqueConstraint(uniqueConstraint));
- }
- }
-
- @Override
- public void update(XmlTableGenerator xmlTableGenerator) {
- super.update(xmlTableGenerator);
- this.setSpecifiedTable_(xmlTableGenerator.getTable());
- this.setDefaultSchema(this.buildDefaultSchema());
- this.setSpecifiedSchema_(xmlTableGenerator.getSchema());
- this.setDefaultCatalog(this.buildDefaultCatalog());
- this.setSpecifiedCatalog_(xmlTableGenerator.getCatalog());
- this.setSpecifiedPkColumnName_(xmlTableGenerator.getPkColumnName());
- this.setSpecifiedValueColumnName_(xmlTableGenerator.getValueColumnName());
- this.setSpecifiedPkColumnValue_(xmlTableGenerator.getPkColumnValue());
- // TODO defaults
- this.updateUniqueConstraints();
- }
-
- protected String buildDefaultSchema() {
- return this.getContextDefaultSchema();
- }
-
- protected String buildDefaultCatalog() {
- return this.getContextDefaultCatalog();
- }
-
- protected void updateUniqueConstraints() {
- Iterator<XmlUniqueConstraint> xmlConstraints = this.xmlUniqueConstraints();
-
- for (Iterator<OrmUniqueConstraint> contextConstraints = this.uniqueConstraints(); contextConstraints.hasNext(); ) {
- OrmUniqueConstraint contextConstraint = contextConstraints.next();
- if (xmlConstraints.hasNext()) {
- contextConstraint.update(xmlConstraints.next());
- }
- else {
- this.removeUniqueConstraint_(contextConstraint);
- }
- }
-
- while (xmlConstraints.hasNext()) {
- this.addUniqueConstraint(this.buildUniqueConstraint(xmlConstraints.next()));
- }
- }
-
- protected Iterator<XmlUniqueConstraint> xmlUniqueConstraints() {
- // make a copy of the XML constraints (to prevent ConcurrentModificationException)
- return (this.resourceGenerator == null) ? EmptyIterator.<XmlUniqueConstraint>instance()
- : new CloneIterator<XmlUniqueConstraint>(this.resourceGenerator.getUniqueConstraints());
- }
-
- protected OrmUniqueConstraint buildUniqueConstraint(XmlUniqueConstraint resourceUniqueConstraint) {
- return this.getXmlContextNodeFactory().buildOrmUniqueConstraint(this, this, resourceUniqueConstraint);
- }
-
-
- // ********** database stuff **********
-
- public Table getDbTable() {
- Schema dbSchema = this.getDbSchema();
- return (dbSchema == null) ? null : dbSchema.getTableForIdentifier(this.getTable());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java
deleted file mode 100644
index 4c42284b06..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.TemporalConverter;
-import org.eclipse.jpt.core.context.TemporalType;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmConverter;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.resource.orm.XmlConvertibleMapping;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class GenericOrmTemporalConverter extends AbstractOrmXmlContextNode
- implements TemporalConverter, OrmConverter
-{
- private TemporalType temporalType;
-
- private XmlConvertibleMapping resourceConvertibleMapping;
-
- public GenericOrmTemporalConverter(OrmAttributeMapping parent, XmlConvertibleMapping resourceConvertableMapping) {
- super(parent);
- this.initialize(resourceConvertableMapping);
- }
-
- @Override
- public OrmAttributeMapping getParent() {
- return (OrmAttributeMapping) super.getParent();
- }
-
- public String getType() {
- return Converter.TEMPORAL_CONVERTER;
- }
-
- public TemporalType getTemporalType() {
- return this.temporalType;
- }
-
- public void setTemporalType(TemporalType newTemporalType) {
- TemporalType oldTemporalType = this.temporalType;
- this.temporalType = newTemporalType;
- this.resourceConvertibleMapping.setTemporal(TemporalType.toOrmResourceModel(newTemporalType));
- firePropertyChanged(TEMPORAL_TYPE_PROPERTY, oldTemporalType, newTemporalType);
- }
-
- protected void setTemporalType_(TemporalType newTemporalType) {
- TemporalType oldTemporalType = this.temporalType;
- this.temporalType = newTemporalType;
- firePropertyChanged(TEMPORAL_TYPE_PROPERTY, oldTemporalType, newTemporalType);
- }
-
-
- protected void initialize(XmlConvertibleMapping resourceConvertibleMapping) {
- this.resourceConvertibleMapping = resourceConvertibleMapping;
- this.temporalType = this.temporalType();
- }
-
- public void update() {
- this.setTemporalType_(this.temporalType());
- }
-
- protected TemporalType temporalType() {
- return TemporalType.fromOrmResourceModel(this.resourceConvertibleMapping.getTemporal());
- }
-
-
- public TextRange getValidationTextRange() {
- return this.resourceConvertibleMapping.getTemporalTextRange();
- }
-
- public void addToResourceModel() {
- this.resourceConvertibleMapping.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.DATE);
- }
-
- public void removeFromResourceModel() {
- this.resourceConvertibleMapping.setTemporal(null);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java
deleted file mode 100644
index be02c1fa29..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0, which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTransientMapping;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAttributeMapping;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.core.resource.orm.XmlTransient;
-
-
-public class GenericOrmTransientMapping
- extends AbstractOrmAttributeMapping<XmlTransient>
- implements OrmTransientMapping
-{
-
- public GenericOrmTransientMapping(OrmPersistentAttribute parent, XmlTransient resourceMapping) {
- super(parent, resourceMapping);
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmTransientMapping(this);
- }
-
- public int getXmlSequence() {
- return 90;
- }
-
- public String getKey() {
- return MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
- }
-
- public void addToResourceModel(Attributes resourceAttributes) {
- resourceAttributes.getTransients().add(this.resourceAttributeMapping);
- }
-
- public void removeFromResourceModel(Attributes resourceAttributes) {
- resourceAttributes.getTransients().remove(this.resourceAttributeMapping);
- }
-
- // ********** metamodel **********
-
- @Override
- public MetamodelField getMetamodelField() {
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java
deleted file mode 100644
index 76f6615a58..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmUniqueConstraint;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.resource.orm.XmlUniqueConstraint;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-public class GenericOrmUniqueConstraint
- extends AbstractOrmXmlContextNode
- implements OrmUniqueConstraint
-{
-
- protected final List<String> columnNames;
-
- protected XmlUniqueConstraint resourceUniqueConstraint;
-
- protected Owner owner;
-
- public GenericOrmUniqueConstraint(XmlContextNode parent, Owner owner, XmlUniqueConstraint resourceUniqueConstraint) {
- super(parent);
- this.owner = owner;
- this.columnNames = new ArrayList<String>();
- this.initialize(resourceUniqueConstraint);
- }
-
- public ListIterator<String> columnNames() {
- return new CloneListIterator<String>(this.columnNames);
- }
-
- public int columnNamesSize() {
- return this.columnNames.size();
- }
-
- public void addColumnName(int index, String columnName) {
- this.columnNames.add(index, columnName);
- this.resourceUniqueConstraint.getColumnNames().add(index, columnName);
- fireItemAdded(COLUMN_NAMES_LIST, index, columnName);
- }
-
- protected void addColumnName_(int index, String columnName) {
- this.addItemToList(index, columnName, this.columnNames, COLUMN_NAMES_LIST);
- }
-
- protected void addColumnName_(String columnName) {
- this.addItemToList(columnName, this.columnNames, COLUMN_NAMES_LIST);
- }
-
- protected void setColumnName_(int index, String columnName) {
- this.setItemInList(index, columnName, this.columnNames, COLUMN_NAMES_LIST);
- }
-
- public void removeColumnName(String columnName) {
- this.removeColumnName(this.columnNames.indexOf(columnName));
- }
-
- public void removeColumnName(int index) {
- String removedColumnName = this.columnNames.remove(index);
- this.resourceUniqueConstraint.getColumnNames().remove(index);
- fireItemRemoved(COLUMN_NAMES_LIST, index, removedColumnName);
- }
-
- protected void removeColumnName_(int index) {
- this.removeItemFromList(index, this.columnNames, COLUMN_NAMES_LIST);
- }
-
- public void moveColumnName(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.columnNames, targetIndex, sourceIndex);
- this.resourceUniqueConstraint.getColumnNames().move(targetIndex, sourceIndex);
- fireItemMoved(COLUMN_NAMES_LIST, targetIndex, sourceIndex);
- }
-
- public TextRange getValidationTextRange() {
- return this.resourceUniqueConstraint.getValidationTextRange();
- }
-
- protected void initialize(XmlUniqueConstraint xmlUniqueConstraint) {
- this.resourceUniqueConstraint = xmlUniqueConstraint;
- this.initializeColumnNames();
- }
-
- protected void initializeColumnNames() {
- for (String annotationColumnName : this.resourceUniqueConstraint.getColumnNames()) {
- this.columnNames.add(annotationColumnName);
- }
- }
-
- public void update(XmlUniqueConstraint xmlUniqueConstraint) {
- this.resourceUniqueConstraint = xmlUniqueConstraint;
- this.updateColumnNames();
- }
-
- protected void updateColumnNames() {
- int index = 0;
- for (String xmlColumnName : this.resourceUniqueConstraint.getColumnNames()) {
- if (this.columnNames.size() > index) {
- if ( ! this.columnNames.get(index).equals(xmlColumnName)) {
- this.setColumnName_(index, xmlColumnName);
- }
- }
- else {
- this.addColumnName_(xmlColumnName);
- }
- index++;
- }
-
- while (index < this.columnNames.size()) {
- this.removeColumnName_(index);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java
deleted file mode 100644
index 0d74de740f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmVersionMapping;
-import org.eclipse.jpt.core.resource.orm.XmlVersion;
-
-
-public class GenericOrmVersionMapping extends AbstractOrmVersionMapping<XmlVersion>
-{
-
- public GenericOrmVersionMapping(OrmPersistentAttribute parent, XmlVersion resourceMapping) {
- super(parent, resourceMapping);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmXml.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmXml.java
deleted file mode 100644
index 47852a7a1e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmXml.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jpt.core.JpaResourceType;
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.MappingFileRoot;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.EntityMappings;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmXml;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmXml
- extends AbstractOrmXmlContextNode
- implements OrmXml
-{
- protected JpaXmlResource xmlResource;
-
- protected EntityMappings entityMappings;
-
- protected JpaResourceType resourceType;
-
- public GenericOrmXml(MappingFileRef parent, JpaXmlResource resource) {
- super(parent);
- if (!resource.getContentType().isKindOf(JptCorePlugin.MAPPING_FILE_CONTENT_TYPE)) {
- throw new IllegalArgumentException(resource + " does not have mapping file content type"); //$NON-NLS-1$
- }
- this.xmlResource = resource;
- XmlEntityMappings xmlEntityMappings = (XmlEntityMappings) this.xmlResource.getRootObject();
- if (xmlEntityMappings != null) {
- this.entityMappings = this.buildEntityMappings(xmlEntityMappings);
- }
- if (resource.getRootObject() != null) {
- this.entityMappings = buildEntityMappings((XmlEntityMappings) resource.getRootObject());
- this.resourceType = resource.getResourceType();
- }
- }
-
-
- // ********** overrides **********
-
- @Override
- public MappingFileRef getParent() {
- return (MappingFileRef) super.getParent();
- }
-
- @Override
- public IResource getResource() {
- return this.xmlResource.getFile();
- }
-
- @Override
- public MappingFileRoot getMappingFileRoot() {
- return getEntityMappings();
- }
-
-
- // ********** JpaStructureNode implementation **********
-
- public String getId() {
- // isn't actually displayed, so needs no details page
- return null;
- }
-
- @Override
- public JpaResourceType getResourceType() {
- return this.xmlResource.getResourceType();
- }
-
-
- // ********** MappingFile implementation **********
-
- public JpaXmlResource getXmlResource() {
- return this.xmlResource;
- }
-
- public MappingFileRoot getRoot() {
- return getEntityMappings();
- }
-
- public OrmPersistentType getPersistentType(String fullyQualifiedTypeName) {
- return (this.entityMappings == null) ? null : this.entityMappings.getPersistentType(fullyQualifiedTypeName);
- }
-
-
- // ********** PersistentTypeContainer implementation **********
-
- /**
- * All orm.xml mapping files must be able to generate a static metamodel
- * because 1.0 orm.xml files can be referenced from 2.0 persistence.xml files.
- */
- public Iterable<? extends PersistentType> getPersistentTypes() {
- return (this.entityMappings != null) ? this.entityMappings.getPersistentTypes() : EmptyIterable.<JavaPersistentType>instance();
- }
-
-
- // ********** entity mappings **********
-
- public EntityMappings getEntityMappings() {
- return this.entityMappings;
- }
-
- protected void setEntityMappings(EntityMappings entityMappings) {
- EntityMappings old = this.entityMappings;
- this.entityMappings = entityMappings;
- this.firePropertyChanged(ENTITY_MAPPINGS_PROPERTY, old, entityMappings);
- }
-
-
- // ********** updating **********
-
- public void update(JpaXmlResource resource) {
- if (!resource.getContentType().isKindOf(JptCorePlugin.MAPPING_FILE_CONTENT_TYPE)) {
- throw new IllegalArgumentException(resource + " does not have mapping file content type"); //$NON-NLS-1$
- }
- this.xmlResource = resource;
- this.update();
- }
-
- protected void update() {
- XmlEntityMappings oldXmlEntityMappings =
- (this.entityMappings == null) ? null : this.entityMappings.getXmlEntityMappings();
- XmlEntityMappings newXmlEntityMappings = (XmlEntityMappings) this.xmlResource.getRootObject();
- JpaResourceType newResourceType = xmlResource.getResourceType();
-
- // if the old and new xml entity mappings are different instances,
- // we scrap the old and rebuild. this can happen when the resource
- // model drastically changes, such as a cvs checkout or an edit reversion
- if (oldXmlEntityMappings != newXmlEntityMappings || newXmlEntityMappings == null || valuesAreDifferent(this.resourceType, newResourceType)) {
- if (this.entityMappings != null) {
- this.getJpaFile(this.xmlResource.getFile()).removeRootStructureNode(this.xmlResource);
- this.entityMappings.dispose();
- this.setEntityMappings(null);
- }
- }
-
- if (newXmlEntityMappings != null) {
- if (this.entityMappings != null) {
- this.entityMappings.update();
- } else {
- this.setEntityMappings(this.buildEntityMappings(newXmlEntityMappings));
- }
- this.getJpaFile(this.xmlResource.getFile()).addRootStructureNode(this.xmlResource, this.entityMappings);
- }
- this.resourceType = newResourceType;
- }
-
- protected EntityMappings buildEntityMappings(XmlEntityMappings xmlEntityMappings) {
- return getXmlContextNodeFactory().buildEntityMappings(this, xmlEntityMappings);
- }
-
- @Override
- public void postUpdate() {
- super.postUpdate();
- if (this.entityMappings != null) {
- this.entityMappings.postUpdate();
- }
- }
-
-
- // ********** text **********
-
- public JpaStructureNode getStructureNode(int textOffset) {
- if (this.entityMappings.containsOffset(textOffset)) {
- return this.entityMappings.getStructureNode(textOffset);
- }
- return this;
- }
-
- // never actually selected
- public TextRange getSelectionTextRange() {
- return TextRange.Empty.instance();
- }
-
- public TextRange getValidationTextRange() {
- return TextRange.Empty.instance();
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- if (this.entityMappings != null) {
- this.entityMappings.validate(messages, reporter);
- }
- }
-
-
- // ********** dispose **********
-
- public void dispose() {
- if (this.entityMappings != null) {
- this.entityMappings.dispose();
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java
deleted file mode 100644
index d6b52f3704..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.JpaResourceType;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.orm.NullOrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.context.orm.OrmXmlDefinition;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlDefinition;
-import org.eclipse.jpt.core.internal.context.orm.GenericOrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.internal.context.orm.OrmBasicMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmEmbeddableDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmEmbeddedIdMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmEmbeddedMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmEntityDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmIdMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmManyToManyMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmManyToOneMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmMappedSuperclassDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmOneToManyMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmOneToOneMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmTransientMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmVersionMappingDefinition;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-
-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 EFactory getResourceNodeFactory() {
- return OrmFactory.eINSTANCE;
- }
-
- @Override
- protected OrmXmlContextNodeFactory buildContextNodeFactory() {
- return new GenericOrmXmlContextNodeFactory();
- }
-
- public JpaResourceType getResourceType() {
- return JptCorePlugin.ORM_XML_1_0_RESOURCE_TYPE;
- }
-
-
- // ********** ORM type mappings **********
-
- @Override
- protected OrmTypeMappingDefinition[] buildOrmTypeMappingDefinitions() {
- // order should not matter here, but we'll use the same order as for java
- // (@see {@link GenericJpaPlatformProvider})
- return new OrmTypeMappingDefinition[] {
- OrmEntityDefinition.instance(),
- OrmEmbeddableDefinition.instance(),
- OrmMappedSuperclassDefinition.instance()};
- }
-
-
- // ********** ORM attribute mappings **********
-
- @Override
- protected OrmAttributeMappingDefinition[] buildOrmAttributeMappingDefinitions() {
- // order should not matter here, but we'll use the same order as for java
- // (@see {@link GenericJpaPlatformProvider})
- return new OrmAttributeMappingDefinition[] {
- OrmTransientMappingDefinition.instance(),
- OrmIdMappingDefinition.instance(),
- OrmVersionMappingDefinition.instance(),
- OrmBasicMappingDefinition.instance(),
- OrmEmbeddedMappingDefinition.instance(),
- OrmEmbeddedIdMappingDefinition.instance(),
- OrmManyToManyMappingDefinition.instance(),
- OrmManyToOneMappingDefinition.instance(),
- OrmOneToManyMappingDefinition.instance(),
- OrmOneToOneMappingDefinition.instance(),
- NullOrmAttributeMappingDefinition.instance()};
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericPersistenceUnitDefaults.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericPersistenceUnitDefaults.java
deleted file mode 100644
index 905254d008..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericPersistenceUnitDefaults.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0, which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.orm.OrmPersistenceUnitDefaults;
-import org.eclipse.jpt.core.context.orm.PersistenceUnitMetadata;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.core.resource.orm.XmlPersistenceUnitDefaults;
-import org.eclipse.jpt.core.resource.orm.XmlPersistenceUnitMetadata;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.SchemaContainer;
-
-/**
- *
- */
-public class GenericPersistenceUnitDefaults
- extends AbstractOrmXmlContextNode
- implements OrmPersistenceUnitDefaults
-{
- protected final XmlEntityMappings xmlEntityMappings;
-
- protected AccessType access;
-
- protected String specifiedCatalog;
- protected String defaultCatalog;
-
- protected String specifiedSchema;
- protected String defaultSchema;
-
- protected boolean cascadePersist;
-
-
- // ********** constructor/initialization **********
-
- public GenericPersistenceUnitDefaults(PersistenceUnitMetadata parent, XmlEntityMappings xmlEntityMappings) {
- super(parent);
- this.xmlEntityMappings = xmlEntityMappings;
- XmlPersistenceUnitDefaults resourceDefaults = this.getResourceDefaults();
- if (resourceDefaults != null) {
- this.access = AccessType.fromOrmResourceModel(resourceDefaults.getAccess());
- this.specifiedCatalog = resourceDefaults.getCatalog();
- this.specifiedSchema = resourceDefaults.getSchema();
- this.cascadePersist = resourceDefaults.isCascadePersist();
- }
- this.defaultCatalog = this.getJpaProject().getDefaultCatalog();
- this.defaultSchema = this.getJpaProject().getDefaultSchema();
- }
-
- public boolean resourceExists() {
- return getResourceDefaults() != null;
- }
-
- @Override
- public PersistenceUnitMetadata getParent() {
- return (PersistenceUnitMetadata) super.getParent();
- }
-
- protected XmlPersistenceUnitMetadata getResourcePersistenceUnitMetadata() {
- return getParent().getResourcePersistenceUnitMetadata();
- }
-
- protected XmlPersistenceUnitMetadata createResourcePersistenceUnitMetadata() {
- return getParent().createResourcePersistenceUnitMetadata();
- }
-
- // ********** access **********
-
- public AccessType getAccess() {
- return this.access;
- }
-
- public void setAccess(AccessType access) {
- AccessType old = this.access;
- this.access = access;
- if (access != old) {
- XmlPersistenceUnitDefaults resourceDefaults = this.getResourceDefaults();
- if (resourceDefaults == null) {
- resourceDefaults = this.buildResourceDefaults();
- }
- resourceDefaults.setAccess(AccessType.toOrmResourceModel(access));
- this.checkResourceDefaults(resourceDefaults);
- this.firePropertyChanged(ACCESS_PROPERTY, old, access);
- }
- }
-
- protected void setAccess_(AccessType access) {
- AccessType old = this.access;
- this.access = access;
- this.firePropertyChanged(ACCESS_PROPERTY, old, access);
- }
-
-
- // ********** 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.getDbCatalog(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) {
- String old = this.specifiedCatalog;
- this.specifiedCatalog = catalog;
- if (this.attributeValueHasChanged(old, catalog)) {
- XmlPersistenceUnitDefaults resourceDefaults = this.getResourceDefaults();
- if (resourceDefaults == null) {
- resourceDefaults = this.buildResourceDefaults();
- }
- resourceDefaults.setCatalog(catalog);
- this.checkResourceDefaults(resourceDefaults);
- this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, 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);
- }
-
- /**
- * 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.getDbCatalog(catalog);
- }
-
-
- // ********** schema **********
-
- public String getSchema() {
- return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema;
- }
-
- public String getSpecifiedSchema() {
- return this.specifiedSchema;
- }
-
- public void setSpecifiedSchema(String schema) {
- String old = this.specifiedSchema;
- this.specifiedSchema = schema;
- if (this.attributeValueHasChanged(old, schema)) {
- XmlPersistenceUnitDefaults resourceDefaults = this.getResourceDefaults();
- if (resourceDefaults == null) {
- resourceDefaults = this.buildResourceDefaults();
- }
- resourceDefaults.setSchema(schema);
- this.checkResourceDefaults(resourceDefaults);
- this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, 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);
- }
-
- public Schema getDbSchema() {
- SchemaContainer dbSchemaContainer = this.getDbSchemaContainer();
- return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema());
- }
-
-
- // ********** cascadePersist **********
-
- public boolean isCascadePersist() {
- return this.cascadePersist;
- }
-
- public void setCascadePersist(boolean cascadePersist) {
- boolean old = this.cascadePersist;
- this.cascadePersist = cascadePersist;
- if (cascadePersist != old) {
- XmlPersistenceUnitDefaults resourceDefaults = this.getResourceDefaults();
- if (resourceDefaults == null) {
- resourceDefaults = this.buildResourceDefaults();
- }
- resourceDefaults.setCascadePersist(cascadePersist);
- this.checkResourceDefaults(resourceDefaults);
- this.firePropertyChanged(CASCADE_PERSIST_PROPERTY, old, cascadePersist);
- }
- }
-
- protected void setCascadePersist_(boolean cp) {
- boolean old = this.cascadePersist;
- this.cascadePersist = cp;
- this.firePropertyChanged(CASCADE_PERSIST_PROPERTY, old, cp);
- }
-
-
- // ********** behavior **********
-
- /**
- * build the resource defaults and the resource metadata if necessary
- */
- protected XmlPersistenceUnitDefaults buildResourceDefaults() {
- XmlPersistenceUnitMetadata resourceMetadata = getResourcePersistenceUnitMetadata();
- if (resourceMetadata == null) {
- resourceMetadata = createResourcePersistenceUnitMetadata();
- this.xmlEntityMappings.setPersistenceUnitMetadata(resourceMetadata);
- }
- XmlPersistenceUnitDefaults resourceDefaults = OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults();
- resourceMetadata.setPersistenceUnitDefaults(resourceDefaults);
- return resourceDefaults;
- }
-
- /**
- * clear the resource defaults and the resource metadata if appropriate
- */
- protected void checkResourceDefaults(XmlPersistenceUnitDefaults resourceDefaults) {
- if (resourceDefaults.isUnset()) {
- XmlPersistenceUnitMetadata metadata = this.xmlEntityMappings.getPersistenceUnitMetadata();
- metadata.setPersistenceUnitDefaults(null);
- if (metadata.isUnset()) {
- this.xmlEntityMappings.setPersistenceUnitMetadata(null);
- }
- }
- }
-
- public void update() {
- XmlPersistenceUnitDefaults resourceDefaults = this.getResourceDefaults();
- if (resourceDefaults == null) {
- this.setAccess_(null);
- this.setSpecifiedCatalog_(null);
- this.setSpecifiedSchema_(null);
- this.setCascadePersist_(false);
- } else {
- this.setAccess_(AccessType.fromOrmResourceModel(resourceDefaults.getAccess()));
- this.setSpecifiedCatalog_(resourceDefaults.getCatalog());
- this.setSpecifiedSchema_(resourceDefaults.getSchema());
- this.setCascadePersist_(resourceDefaults.isCascadePersist());
- }
- this.setDefaultCatalog(this.getJpaProject().getDefaultCatalog());
- this.setDefaultSchema(this.getJpaProject().getDefaultSchema());
- }
-
- public TextRange getValidationTextRange() {
- XmlPersistenceUnitDefaults resourceDefaults = this.getResourceDefaults();
- return (resourceDefaults != null) ? resourceDefaults.getValidationTextRange() : this.xmlEntityMappings.getValidationTextRange();
- }
-
- protected XmlPersistenceUnitDefaults getResourceDefaults() {
- XmlPersistenceUnitMetadata metadata = getResourcePersistenceUnitMetadata();
- return (metadata == null) ? null : metadata.getPersistenceUnitDefaults();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericPersistenceUnitMetadata.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericPersistenceUnitMetadata.java
deleted file mode 100644
index b3f2e1bd8e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericPersistenceUnitMetadata.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0, which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.EntityMappings;
-import org.eclipse.jpt.core.context.orm.OrmPersistenceUnitDefaults;
-import org.eclipse.jpt.core.context.orm.PersistenceUnitMetadata;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.core.resource.orm.XmlPersistenceUnitMetadata;
-import org.eclipse.jpt.core.resource.xml.EmfTools;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class GenericPersistenceUnitMetadata extends AbstractOrmXmlContextNode
- implements PersistenceUnitMetadata
-{
- protected boolean xmlMappingMetadataComplete;
-
- protected final OrmPersistenceUnitDefaults persistenceUnitDefaults;
-
- protected final XmlEntityMappings xmlEntityMappings;
-
- public GenericPersistenceUnitMetadata(EntityMappings parent, XmlEntityMappings resource) {
- super(parent);
- this.xmlEntityMappings = resource;
- this.xmlMappingMetadataComplete = this.getResourceXmlMappingMetadataComplete();
- this.persistenceUnitDefaults = getXmlContextNodeFactory().buildPersistenceUnitDefaults(this, this.xmlEntityMappings);
- }
-
- public XmlPersistenceUnitMetadata createResourcePersistenceUnitMetadata() {
- return EmfTools.create(
- getResourceNodeFactory(),
- OrmPackage.eINSTANCE.getXmlPersistenceUnitMetadata(),
- XmlPersistenceUnitMetadata.class);
- }
-
- public boolean isXmlMappingMetadataComplete() {
- return this.xmlMappingMetadataComplete;
- }
-
- public void setXmlMappingMetadataComplete(boolean newXmlMappingMetadataComplete) {
- boolean oldXmlMappingMetadataComplete = this.xmlMappingMetadataComplete;
- this.xmlMappingMetadataComplete = newXmlMappingMetadataComplete;
- if (oldXmlMappingMetadataComplete != newXmlMappingMetadataComplete) {
- if (this.getResourcePersistenceUnitMetadata() != null) {
- this.getResourcePersistenceUnitMetadata().setXmlMappingMetadataComplete(newXmlMappingMetadataComplete);
- if (this.getResourcePersistenceUnitMetadata().isUnset()) {
- this.xmlEntityMappings.setPersistenceUnitMetadata(null);
- }
- }
- else if (newXmlMappingMetadataComplete) {
- this.xmlEntityMappings.setPersistenceUnitMetadata(createResourcePersistenceUnitMetadata());
- this.getResourcePersistenceUnitMetadata().setXmlMappingMetadataComplete(newXmlMappingMetadataComplete);
- }
- }
- firePropertyChanged(PersistenceUnitMetadata.XML_MAPPING_METADATA_COMPLETE_PROPERTY, oldXmlMappingMetadataComplete, newXmlMappingMetadataComplete);
- }
-
- protected void setXmlMappingMetadataComplete_(boolean newXmlMappingMetadataComplete) {
- boolean oldXmlMappingMetadataComplete = this.xmlMappingMetadataComplete;
- this.xmlMappingMetadataComplete = newXmlMappingMetadataComplete;
- firePropertyChanged(PersistenceUnitMetadata.XML_MAPPING_METADATA_COMPLETE_PROPERTY, oldXmlMappingMetadataComplete, newXmlMappingMetadataComplete);
- }
-
- public OrmPersistenceUnitDefaults getPersistenceUnitDefaults() {
- return this.persistenceUnitDefaults;
- }
-
- public void update() {
- this.setXmlMappingMetadataComplete_(this.getResourceXmlMappingMetadataComplete());
- this.persistenceUnitDefaults.update();
- }
-
-
- protected boolean getResourceXmlMappingMetadataComplete() {
- XmlPersistenceUnitMetadata resourcePersistenceUnitMetadata = getResourcePersistenceUnitMetadata();
- return resourcePersistenceUnitMetadata != null ? resourcePersistenceUnitMetadata.isXmlMappingMetadataComplete() : false;
- }
-
- public XmlPersistenceUnitMetadata getResourcePersistenceUnitMetadata() {
- return this.xmlEntityMappings.getPersistenceUnitMetadata();
- }
-
- public TextRange getValidationTextRange() {
- if (getResourcePersistenceUnitMetadata() != null) {
- return getResourcePersistenceUnitMetadata().getValidationTextRange();
- }
- return this.xmlEntityMappings.getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java
deleted file mode 100644
index cdc8829c0a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAttributeMapping;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.core.resource.orm.XmlNullAttributeMapping;
-
-/**
- * This will be used in cases where the java support attribute mapping types
- * that are not supported by the particular version of the orm.xml file. For example,
- * EclipseLink supports variable 1-1 mappings, but the generic orm.xml file does not.
- */
-public class UnsupportedOrmAttributeMapping
- extends AbstractOrmAttributeMapping<XmlNullAttributeMapping>
-{
-
- public UnsupportedOrmAttributeMapping(OrmPersistentAttribute parent, XmlNullAttributeMapping resourceMapping) {
- super(parent, resourceMapping);
- }
-
- public int getXmlSequence() {
- return -1;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmAttributeMapping(this);
- }
-
- public String getKey() {
- //this ends up returning the java attribute mapping key
- return this.resourceAttributeMapping.getMappingKey();
- }
-
- public void addToResourceModel(Attributes resourceAttributes) {
- throw new UnsupportedOperationException();
- }
-
- public void removeFromResourceModel(Attributes resourceAttributes) {
- throw new UnsupportedOperationException();
- }
-
- // ********** metamodel **********
-
- @Override
- public MetamodelField getMetamodelField() {
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericClassRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericClassRef.java
deleted file mode 100644
index c0a374c7d0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericClassRef.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.persistence;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.persistence.ClassRef;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.context.persistence.PersistenceStructureNodes;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.persistence.XmlJavaClassRef;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Context persistence.xml class reference
- */
-public class GenericClassRef
- extends AbstractPersistenceXmlContextNode
- implements ClassRef
-{
- // this is null for an "implied" class ref
- protected XmlJavaClassRef xmlJavaClassRef;
-
- protected String className;
-
- protected JavaPersistentType javaPersistentType;
-
-
- // ********** construction/initialization **********
-
- /**
- * Construct an "specified" class ref; i.e. a class ref with
- * an explicit entry in the persistence.xml.
- */
- public GenericClassRef(PersistenceUnit parent, XmlJavaClassRef classRef) {
- this(parent, classRef, classRef.getJavaClass());
- }
-
- /**
- * Construct an "implied" class ref; i.e. a class ref without
- * an explicit entry in the persistence.xml.
- */
- public GenericClassRef(PersistenceUnit parent, String className) {
- this(parent, null, className);
- }
-
- protected GenericClassRef(PersistenceUnit parent, XmlJavaClassRef classRef, String className) {
- super(parent);
- this.initialize(classRef, className);
- }
-
- protected void initialize(XmlJavaClassRef classRef, String typeName) {
- this.xmlJavaClassRef = classRef;
- this.className = typeName;
- this.javaPersistentType = this.buildJavaPersistentType();
- }
-
- @Override
- public PersistenceUnit getParent() {
- return (PersistenceUnit) super.getParent();
- }
-
-
- // ********** 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();
- }
-
-
- // ********** queries **********
-
- public boolean isFor(String typeName) {
- return (this.className != null) && this.className.equals(typeName);
- }
-
- public boolean isVirtual() {
- return this.xmlJavaClassRef == null;
- }
-
- public boolean containsOffset(int textOffset) {
- return this.isNotVirtual() && this.xmlJavaClassRef.containsOffset(textOffset);
- }
-
- protected boolean isNotVirtual() {
- return ! this.isVirtual();
- }
-
-
- // ********** class name **********
-
- public String getClassName() {
- return this.className;
- }
-
- public void setClassName(String className) {
- String old = this.className;
- this.className = className;
- this.xmlJavaClassRef.setJavaClass(className);
- this.firePropertyChanged(CLASS_NAME_PROPERTY, old, className);
- }
-
- protected void setClassName_(String newClassName) {
- String old = this.className;
- this.className = newClassName;
- this.firePropertyChanged(CLASS_NAME_PROPERTY, old, newClassName);
- }
-
-
- // ********** 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 JavaPersistentType buildJavaPersistentType() {
- JavaResourcePersistentType jrpt = this.getJavaResourcePersistentType();
- return (jrpt == null) ? null : this.buildJavaPersistentType(jrpt);
- }
-
- protected JavaPersistentType buildJavaPersistentType(JavaResourcePersistentType jrpt) {
- return this.getJpaFactory().buildJavaPersistentType(this, jrpt);
- }
-
- protected void updateJavaPersistentType() {
- JavaResourcePersistentType jrpt = this.getJavaResourcePersistentType();
- if (jrpt == null) {
- if (this.javaPersistentType != null) {
- this.javaPersistentType.dispose();
- this.setJavaPersistentType(null);
- }
- } else {
- if (this.javaPersistentType == null) {
- this.setJavaPersistentType(this.buildJavaPersistentType(jrpt));
- } else {
- this.javaPersistentType.update(jrpt);
- }
- }
- }
-
- protected JavaResourcePersistentType getJavaResourcePersistentType() {
- return (this.className == null) ? null : this.getJpaProject().getJavaResourcePersistentType(this.className.replace('$', '.'));
- }
-
-
- // ********** updating **********
-
- public void update(XmlJavaClassRef classRef) {
- this.update(classRef, classRef.getJavaClass());
- }
-
- public void update(String typeName) {
- this.update(null, typeName);
- }
-
- protected void update(XmlJavaClassRef classRef, String typeName) {
- this.xmlJavaClassRef = classRef;
- this.setClassName_(typeName);
- this.updateJavaPersistentType();
- }
-
- @Override
- public void postUpdate() {
- super.postUpdate();
- if (this.javaPersistentType != null) {
- this.javaPersistentType.postUpdate();
- }
- }
-
- // ********** XmlContextNode implementation **********
-
- public TextRange getValidationTextRange() {
- return this.isVirtual() ? null : this.xmlJavaClassRef.getValidationTextRange();
- }
-
-
- // ********** 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.className},
- this,
- this.getValidationTextRange()
- )
- );
- return;
- }
-
- // 190062 validate Java class only if this is the only reference to it
- boolean validateJavaPersistentType = true;
- for (Iterator<MappingFileRef> stream = this.getPersistenceUnit().mappingFileRefsContaining(this.className); stream.hasNext(); ) {
- validateJavaPersistentType = false;
- MappingFileRef mappingFileRef = stream.next();
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.LOW_SEVERITY,
- JpaValidationMessages.PERSISTENCE_UNIT_REDUNDANT_CLASS,
- new String[] {this.className, mappingFileRef.getFileName()},
- this,
- this.getValidationTextRange()
- )
- );
- }
-
- if (validateJavaPersistentType) {
- this.validateJavaPersistentType(messages, reporter);
- }
- }
-
- protected void validateJavaPersistentType(List<IMessage> messages, IReporter reporter) {
- try {
- this.javaPersistentType.validate(messages, reporter);
- } catch (Throwable t) {
- JptCorePlugin.log(t);
- }
- }
-
-
- // ********** misc **********
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.className);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericJarFileRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericJarFileRef.java
deleted file mode 100644
index 80b33e73c8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericJarFileRef.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.persistence;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractJarFileRef;
-import org.eclipse.jpt.core.resource.persistence.XmlJarFileRef;
-
-/**
- * Context JAR file reference (from the persistence unit)
- */
-public class GenericJarFileRef
- extends AbstractJarFileRef
-{
- public GenericJarFileRef(PersistenceUnit parent, XmlJarFileRef xmlJarFileRef) {
- super(parent, xmlJarFileRef);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericMappingFileRef.java
deleted file mode 100644
index f07ae911ce..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericMappingFileRef.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.persistence;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractMappingFileRef;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class GenericMappingFileRef
- extends AbstractMappingFileRef
-{
- protected XmlMappingFileRef xmlMappingFileRef;
-
-
- // **************** construction/initialization ****************************
-
- public GenericMappingFileRef(PersistenceUnit parent, XmlMappingFileRef xmlMappingFileRef) {
- super(parent, xmlMappingFileRef.getFileName());
- this.xmlMappingFileRef = xmlMappingFileRef;
- }
-
-
- // **************** file name **********************************************
-
- public void setFileName(String newFileName) {
- String old = this.fileName;
- this.fileName = newFileName;
- this.xmlMappingFileRef.setFileName(newFileName);
- this.firePropertyChanged(FILE_NAME_PROPERTY, old, newFileName);
- }
-
- protected void setFileName_(String newFileName) {
- String old = this.fileName;
- this.fileName = newFileName;
- this.firePropertyChanged(FILE_NAME_PROPERTY, old, newFileName);
- }
-
-
- // **************** MappingFileRef impl ************************************
-
- public void update(XmlMappingFileRef mappingFileRef) {
- this.xmlMappingFileRef = mappingFileRef;
- this.setFileName_(this.getResourceFileName());
- super.update();
- }
-
- protected String getResourceFileName() {
- return this.xmlMappingFileRef.getFileName();
- }
-
- public boolean isImplied() {
- return false;
- }
-
- public boolean containsOffset(int textOffset) {
- return this.xmlMappingFileRef.containsOffset(textOffset);
- }
-
-
- // **************** JpaStructureNode impl **********************************
-
- public TextRange getSelectionTextRange() {
- return this.xmlMappingFileRef.getSelectionTextRange();
- }
-
- public TextRange getValidationTextRange() {
- return this.xmlMappingFileRef.getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistence.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistence.java
deleted file mode 100644
index b0acb96a34..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistence.java
+++ /dev/null
@@ -1,289 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.persistence;
-
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.PersistenceStructureNodes;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.persistence.Persistence2_0;
-import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistence;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-import org.eclipse.jpt.utility.internal.iterators.SingleElementListIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericPersistence
- extends AbstractPersistenceXmlContextNode
- implements Persistence2_0
-{
- protected 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();
- }
-
- public String getId() {
- return PersistenceStructureNodes.PERSISTENCE_ID;
- }
-
- public XmlPersistence getXmlPersistence() {
- return this.xmlPersistence;
- }
-
- @Override
- public PersistenceXml getParent() {
- return (PersistenceXml) super.getParent();
- }
-
- // **************** persistence units **************************************
-
- public ListIterator<PersistenceUnit> persistenceUnits() {
- return (this.persistenceUnit == null) ? EmptyListIterator.<PersistenceUnit>instance() : this.persistenceUnits_();
- }
-
- protected ListIterator<PersistenceUnit> persistenceUnits_() {
- return new SingleElementListIterator<PersistenceUnit>(this.persistenceUnit);
- }
-
- protected Iterable<PersistenceUnit> getPersistenceUnits() {
- return (this.persistenceUnit == null) ? EmptyIterable.<PersistenceUnit>instance() : this.getPersistenceUnits_();
- }
-
- protected Iterable<PersistenceUnit> getPersistenceUnits_() {
- return new SingleElementIterable<PersistenceUnit>(this.persistenceUnit);
- }
-
- public int persistenceUnitsSize() {
- return (this.persistenceUnit == null) ? 0 : 1;
- }
-
- public PersistenceUnit addPersistenceUnit() {
- return addPersistenceUnit(persistenceUnitsSize());
- }
-
- public PersistenceUnit addPersistenceUnit(int index) {
- if (index > 0 || this.persistenceUnit != null) {
- throw new IllegalStateException("This implementation does not support multiple persistence units."); //$NON-NLS-1$
- }
- XmlPersistenceUnit xmlPersistenceUnit = PersistenceFactory.eINSTANCE.createXmlPersistenceUnit();
- this.persistenceUnit = buildPersistenceUnit(xmlPersistenceUnit);
- this.xmlPersistence.getPersistenceUnits().add(xmlPersistenceUnit);
- 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$
- }
- removePersistenceUnit(0);
- }
-
- public void removePersistenceUnit(int index) {
- if (index > 0 || this.persistenceUnit == null) {
- throw new IndexOutOfBoundsException("index: " + index); //$NON-NLS-1$
- }
- PersistenceUnit oldPersistenceUnit = this.persistenceUnit;
- this.persistenceUnit.dispose();
- this.persistenceUnit = null;
- this.xmlPersistence.getPersistenceUnits().remove(index);
- fireItemRemoved(PERSISTENCE_UNITS_LIST, index, oldPersistenceUnit);
- }
-
- protected void addPersistenceUnit_(PersistenceUnit newPersistenceUnit) {
- this.persistenceUnit = newPersistenceUnit;
- fireItemAdded(PERSISTENCE_UNITS_LIST, 0, this.persistenceUnit);
- }
-
- protected void removePersistenceUnit_(PersistenceUnit oldPersistenceUnit) {
- this.persistenceUnit.dispose();
- this.persistenceUnit = null;
- fireItemRemoved(PERSISTENCE_UNITS_LIST, 0, oldPersistenceUnit);
- }
-
-
- // **************** 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();
- }
- }
-
-
- // **************** updating ***********************************************
-
- protected void initializePersistenceUnits() {
- // only adding one here, until we support multiple persistence units
- if (this.xmlPersistence.getPersistenceUnits().size() > 0) {
- this.persistenceUnit = buildPersistenceUnit(this.xmlPersistence.getPersistenceUnits().get(0));
- }
- }
-
- public void update(XmlPersistence persistence) {
- this.xmlPersistence = persistence;
- XmlPersistenceUnit xmlPersistenceUnit = null;
- if (persistence.getPersistenceUnits().size() > 0) {
- xmlPersistenceUnit = persistence.getPersistenceUnits().get(0);
- }
-
- if (this.persistenceUnit != null) {
- if (xmlPersistenceUnit != null) {
- this.persistenceUnit.update(xmlPersistenceUnit);
- }
- else {
- removePersistenceUnit_(this.persistenceUnit);
- }
- }
- else {
- if (xmlPersistenceUnit != null) {
- addPersistenceUnit_(buildPersistenceUnit(xmlPersistenceUnit));
- }
- }
- }
-
- @Override
- public void postUpdate() {
- super.postUpdate();
- if (this.persistenceUnit != null) {
- this.persistenceUnit.postUpdate();
- }
- }
-
- protected PersistenceUnit buildPersistenceUnit(XmlPersistenceUnit xmlPersistenceUnit) {
- return this.getContextNodeFactory().buildPersistenceUnit(this, xmlPersistenceUnit);
- }
-
-
- // *************************************************************************
-
- @Override
- public PersistenceUnit getPersistenceUnit() {
- throw new UnsupportedOperationException("No PersistenceUnit in this context"); //$NON-NLS-1$
- }
-
- public JpaStructureNode getStructureNode(int textOffset) {
- for (PersistenceUnit pu : this.getPersistenceUnits()) {
- if (pu.containsOffset(textOffset)) {
- return pu.getStructureNode(textOffset);
- }
- }
- return this;
- }
-
- public boolean containsOffset(int textOffset) {
- return (this.xmlPersistence == null) ? false : this.xmlPersistence.containsOffset(textOffset);
- }
-
- public TextRange getSelectionTextRange() {
- return this.xmlPersistence.getSelectionTextRange();
- }
-
- public TextRange getValidationTextRange() {
- return this.xmlPersistence.getValidationTextRange();
- }
-
- public void dispose() {
- for (PersistenceUnit pu : this.getPersistenceUnits()) {
- pu.dispose();
- }
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- validateVersion(messages);
- this.checkForMultiplePersistenceUnits(messages);
- this.validatePersistenceUnit(messages, reporter);
- }
-
- protected void validateVersion(List<IMessage> messages) {
- if (! latestDocumentVersion().equals(this.xmlPersistence.getVersion())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.LOW_SEVERITY,
- JpaValidationMessages.XML_VERSION_NOT_LATEST,
- this,
- this.xmlPersistence.getVersionTextRange()));
- }
- }
-
- protected String latestDocumentVersion() {
- return getJpaPlatform().getMostRecentSupportedResourceType(
- JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE).getVersion();
- }
-
- /**
- * extraneous persistence units can be
- * accessed through the XmlPersistence resource object
- */
- protected void checkForMultiplePersistenceUnits(List<IMessage> messages) {
- if (this.xmlPersistence.getPersistenceUnits().size() > 1) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.NORMAL_SEVERITY,
- JpaValidationMessages.PERSISTENCE_MULTIPLE_PERSISTENCE_UNITS,
- this,
- this.getValidationTextRange()
- )
- );
- }
- }
-
- protected void validatePersistenceUnit(List<IMessage> messages, IReporter reporter) {
- if (this.persistenceUnit == null) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENCE_NO_PERSISTENCE_UNIT,
- this,
- this.getValidationTextRange()
- )
- );
- return;
- }
- this.persistenceUnit.validate(messages, reporter);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceUnit.java
deleted file mode 100644
index f64d46c892..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceUnit.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.persistence;
-
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnit;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
-
-/**
- * generic persistence-unit
- */
-public class GenericPersistenceUnit
- extends AbstractPersistenceUnit
-{
- public GenericPersistenceUnit(Persistence parent, XmlPersistenceUnit xmlPersistenceUnit) {
- super(parent, xmlPersistenceUnit);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceUnitProperty.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceUnitProperty.java
deleted file mode 100644
index b5f4aa822c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceUnitProperty.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.persistence;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
-import org.eclipse.jpt.core.resource.persistence.XmlProperty;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * 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;
- }
-
- // ********** name **********
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- String old = this.name;
- this.name = name;
- if (attributeValueHasChanged(old, name)) {
- this.xmlProperty.setName(name);
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- getParent().propertyNameChanged(old, this.name, this.value);
- }
- }
-
-
- // ********** value **********
-
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- String old = this.value;
- this.value = value;
- if (attributeValueHasChanged(old, value)) {
- this.xmlProperty.setValue(value);
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- getParent().propertyValueChanged(this.name, value);
- }
- }
-
-
- // ********** updating **********
-
- public void update() {
- this.setName(this.xmlProperty.getName());
- this.setValue(this.xmlProperty.getValue());
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- return this.xmlProperty.getValidationTextRange();
- }
-
-
- // ********** misc **********
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- sb.append(" = "); //$NON-NLS-1$
- sb.append(this.value);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceXml.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceXml.java
deleted file mode 100644
index e116d31f3e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceXml.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.persistence;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jpt.core.JpaResourceType;
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.JpaRootContextNode;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.persistence.Persistence2_0;
-import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceXml2_0;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistence;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericPersistenceXml
- extends AbstractPersistenceXmlContextNode
- implements PersistenceXml2_0
-{
- protected JpaXmlResource persistenceXmlResource;
-
- protected Persistence persistence;
-
- protected JpaResourceType resourceType;
-
- public GenericPersistenceXml(JpaRootContextNode parent, JpaXmlResource resource) {
- super(parent);
- if (! resource.getContentType().isKindOf(JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) {
- throw new IllegalArgumentException("Resource " + resource + " must have persistence xml content type"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- this.persistenceXmlResource = resource;
- if (resource.getRootObject() != null) {
- this.persistence = buildPersistence((XmlPersistence) resource.getRootObject());
- this.resourceType = resource.getResourceType();
- }
- }
-
- public JpaXmlResource getXmlResource() {
- return this.persistenceXmlResource;
- }
-
- // **************** JpaNode impl *******************************************
-
- @Override
- public IResource getResource() {
- return this.persistenceXmlResource.getFile();
- }
-
-
- // **************** JpaStructureNode impl **********************************
-
- public String getId() {
- // isn't actually displayed, so needs no details page
- return null;
- }
-
- @Override
- public JpaResourceType getResourceType() {
- return this.persistenceXmlResource.getResourceType();
- }
-
-
- // **************** persistence ********************************************
-
- public Persistence getPersistence() {
- return this.persistence;
- }
-
- protected void setPersistence(Persistence newPersistence) {
- Persistence oldPersistence = this.persistence;
- this.persistence = newPersistence;
- firePropertyChanged(PERSISTENCE_PROPERTY, oldPersistence, newPersistence);
- }
-
-
- // **************** 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();
- }
- }
-
-
- // **************** updating ***********************************************
-
- //TODO I haven't yet figured out if we do not need the resource object passed in now.
- //I don't think we will even build AbstractPersistenceXml if the resource object is null
- //I'm pretty sure this won't change now, but need to investigate - KFB
- public void update(JpaXmlResource persistenceResource) {
- XmlPersistence oldXmlPersistence =
- (this.persistence == null) ? null : this.persistence.getXmlPersistence();
- XmlPersistence newXmlPersistence = (XmlPersistence) persistenceResource.getRootObject();
- JpaResourceType newResourceType = persistenceResource.getResourceType();
-
- this.persistenceXmlResource = persistenceResource;
-
- // if the old and new xml persistences are different instances,
- // we scrap the old and rebuild. this can happen when the resource
- // model drastically changes, such as a cvs checkout or an edit reversion
- if (oldXmlPersistence != newXmlPersistence || newXmlPersistence == null || valuesAreDifferent(this.resourceType, newResourceType)) {
- if (this.persistence != null) {
- this.getJpaFile(this.persistenceXmlResource.getFile()).removeRootStructureNode(this.persistenceXmlResource);
- this.persistence.dispose();
- this.setPersistence(null);
- }
- }
-
- if (newXmlPersistence != null) {
- if (this.persistence != null) {
- this.persistence.update(newXmlPersistence);
- }
- else {
- setPersistence(buildPersistence(newXmlPersistence));
- }
- this.getJpaFile(this.persistenceXmlResource.getFile()).addRootStructureNode(this.persistenceXmlResource, this.persistence);
- }
- this.resourceType = newResourceType;
- }
-
- @Override
- public void postUpdate() {
- super.postUpdate();
- if (this.persistence != null) {
- this.persistence.postUpdate();
- }
- }
-
- protected Persistence buildPersistence(XmlPersistence xmlPersistence) {
- return getContextNodeFactory().buildPersistence(this, xmlPersistence);
- }
-
-
- // *************************************************************************
-
- @Override
- public PersistenceUnit getPersistenceUnit() {
- throw new UnsupportedOperationException("No Persistence Unit in this context"); //$NON-NLS-1$
- }
-
-
- 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 TextRange getValidationTextRange() {
- return TextRange.Empty.instance();
- }
-
-
- // **************** 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 void dispose() {
- this.persistence.dispose();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java
deleted file mode 100644
index 1a79b2c05e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.persistence;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.JpaResourceType;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.PersistenceXmlContextNodeFactory;
-import org.eclipse.jpt.core.context.persistence.PersistenceXmlDefinition;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceXmlDefinition;
-import org.eclipse.jpt.core.internal.context.persistence.GenericPersistenceXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-
-public class GenericPersistenceXmlDefinition
- extends AbstractPersistenceXmlDefinition
-{
- // singleton
- private static final PersistenceXmlDefinition INSTANCE =
- new GenericPersistenceXmlDefinition();
-
-
- /**
- * Return the singleton
- */
- public static PersistenceXmlDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private GenericPersistenceXmlDefinition() {
- super();
- }
-
-
- public EFactory getResourceNodeFactory() {
- return PersistenceFactory.eINSTANCE;
- }
-
- @Override
- protected PersistenceXmlContextNodeFactory buildContextNodeFactory() {
- return new GenericPersistenceXmlContextNodeFactory();
- }
-
- public JpaResourceType getResourceType() {
- return JptCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/ImpliedMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/ImpliedMappingFileRef.java
deleted file mode 100644
index 45612f10a6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/ImpliedMappingFileRef.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.persistence;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractMappingFileRef;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class ImpliedMappingFileRef
- extends AbstractMappingFileRef
-{
-
- // ********** construction/initialization **********
-
- public ImpliedMappingFileRef(PersistenceUnit parent, String resourceFileName) {
- super(parent, resourceFileName);
- }
-
- public boolean isImplied() {
- return true;
- }
-
- public void setFileName(String fileName) {
- throw new UnsupportedOperationException("Cannot set an implied mapping file ref's 'fileName'"); //$NON-NLS-1$
- }
-
- public TextRange getSelectionTextRange() {
- return null;
- }
-
- public TextRange getValidationTextRange() {
- return this.getPersistenceUnit().getValidationTextRange();
- }
-
- public boolean containsOffset(int textOffset) {
- return false;
- }
-
- public void update(XmlMappingFileRef mappingFileRef) {
- if (mappingFileRef != null) {
- throw new IllegalArgumentException("mappingFileRef should be null for an implied mapping file"); //$NON-NLS-1$
- }
- super.update();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java
deleted file mode 100644
index 2837174908..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-
-/**
- * javax.persistence.AssociationOverride
- */
-public final class BinaryAssociationOverride1_0Annotation
- extends BinaryAssociationOverrideAnnotation
-{
-
- public BinaryAssociationOverride1_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryAssociationOverrides1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryAssociationOverrides1_0Annotation.java
deleted file mode 100644
index 6648edb213..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryAssociationOverrides1_0Annotation.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAssociationOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAssociationOverrideAnnotation;
-
-/**
- * javax.persistence.AssociationOverrides
- */
-public final class BinaryAssociationOverrides1_0Annotation
- extends BinaryAssociationOverridesAnnotation
-{
-
- public BinaryAssociationOverrides1_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- @Override
- protected NestableAssociationOverrideAnnotation buildAssociationOverride(Object jdtAssociationOverride) {
- return new BinaryAssociationOverride1_0Annotation(this, (IAnnotation) jdtAssociationOverride);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryNamedQueries1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryNamedQueries1_0Annotation.java
deleted file mode 100644
index 5d6435121f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryNamedQueries1_0Annotation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryNamedQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
-
-/**
- * javax.persistence.NamedQueries
- */
-public final class BinaryNamedQueries1_0Annotation
- extends BinaryNamedQueriesAnnotation
-{
- public BinaryNamedQueries1_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- @Override
- protected NamedQueryAnnotation buildNamedQuery(Object jdtQuery) {
- return new BinaryNamedQuery1_0Annotation(this, (IAnnotation) jdtQuery);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java
deleted file mode 100644
index 3ddb0353c1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryNamedQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-
-/**
- * javax.persistence.NamedQuery
- */
-public final class BinaryNamedQuery1_0Annotation
- extends BinaryNamedQueryAnnotation
-{
-
- public BinaryNamedQuery1_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryOneToMany1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryOneToMany1_0Annotation.java
deleted file mode 100644
index 3ac4081a59..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryOneToMany1_0Annotation.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryOneToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-
-/**
- * BinaryOneToMany1_0Annotation
- */
-public final class BinaryOneToMany1_0Annotation
- extends BinaryOneToManyAnnotation
-{
-
- public BinaryOneToMany1_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryOneToOne1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryOneToOne1_0Annotation.java
deleted file mode 100644
index 3a4c879cbb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryOneToOne1_0Annotation.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryOneToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-
-/**
- * BinaryOneToOne1_0Annotation
- */
-public final class BinaryOneToOne1_0Annotation
- extends BinaryOneToOneAnnotation
-{
-
- public BinaryOneToOne1_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java
deleted file mode 100644
index 573dfee8ec..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinarySequenceGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-
-/**
- * javax.persistence.SequenceGenerator
- */
-public final class BinarySequenceGenerator1_0Annotation
- extends BinarySequenceGeneratorAnnotation
-{
-
- public BinarySequenceGenerator1_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java
deleted file mode 100644
index 617747551f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.resource.java.source;
-
-import org.eclipse.jpt.core.internal.resource.java.source.SourceAssociationOverrideAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberIndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.AssociationOverride
- */
-public final class SourceAssociationOverride1_0Annotation
- extends SourceAssociationOverrideAnnotation
-{
-
- // ********** construction/initialization **********
-
- public SourceAssociationOverride1_0Annotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
- }
-
- // ********** static methods **********
-
- public static SourceAssociationOverride1_0Annotation buildAssociationOverride(JavaResourceNode parent, Member member) {
- return new SourceAssociationOverride1_0Annotation(parent, member, DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER));
- }
-
- static SourceAssociationOverride1_0Annotation buildNestedAssociationOverride(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
- IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter);
- IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(member, idaa);
- return new SourceAssociationOverride1_0Annotation(parent, member, idaa, annotationAdapter);
- }
-
- protected static IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
- return new NestedIndexedDeclarationAnnotationAdapter(attributeOverridesAdapter, index, JPA.ASSOCIATION_OVERRIDE);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceAssociationOverrides1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceAssociationOverrides1_0Annotation.java
deleted file mode 100644
index 859946da3f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceAssociationOverrides1_0Annotation.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.resource.java.source;
-
-import org.eclipse.jpt.core.internal.resource.java.source.SourceAssociationOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAssociationOverrideAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.AssociationOverrides
- */
-public final class SourceAssociationOverrides1_0Annotation
- extends SourceAssociationOverridesAnnotation
-{
-
- public SourceAssociationOverrides1_0Annotation(JavaResourceNode parent, Member member) {
- super(parent, member);
- }
-
- @Override
- protected NestableAssociationOverrideAnnotation buildAssociationOverride(int index) {
- return SourceAssociationOverride1_0Annotation.buildNestedAssociationOverride(this, this.member, index, this.daa);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java
deleted file mode 100644
index 8aa0a58141..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.resource.java.source;
-
-import org.eclipse.jpt.core.internal.resource.java.source.SourceNamedQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * SourceNamedQuery1_0Annotation
- */
-public final class SourceNamedQuery1_0Annotation
- extends SourceNamedQueryAnnotation
-{
-
- // ********** constructors **********
- public SourceNamedQuery1_0Annotation(JavaResourceNode parent, Type type) {
- super(parent, type);
- }
-
- public SourceNamedQuery1_0Annotation(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, type, daa, annotationAdapter);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceOneToMany1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceOneToMany1_0Annotation.java
deleted file mode 100644
index 320a036838..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceOneToMany1_0Annotation.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.resource.java.source;
-
-import org.eclipse.jpt.core.internal.resource.java.source.SourceOneToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-
-/**
- * SourceOneToMany1_0Annotation
- */
-public final class SourceOneToMany1_0Annotation
- extends SourceOneToManyAnnotation
-{
-
- public SourceOneToMany1_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute);
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceOneToOne1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceOneToOne1_0Annotation.java
deleted file mode 100644
index 6fe653561f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceOneToOne1_0Annotation.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.resource.java.source;
-
-import org.eclipse.jpt.core.internal.resource.java.source.SourceOneToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-
-/**
- * SourceOneToOne1_0Annotation
- */
-public final class SourceOneToOne1_0Annotation
- extends SourceOneToOneAnnotation
-{
-
- public SourceOneToOne1_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java
deleted file mode 100644
index 27ac7f42a3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.resource.java.source;
-
-import org.eclipse.jpt.core.internal.resource.java.source.SourceSequenceGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.SequenceGenerator
- */
-public final class SourceSequenceGenerator1_0Annotation
- extends SourceSequenceGeneratorAnnotation
-{
-
- public SourceSequenceGenerator1_0Annotation(JavaResourceNode parent, Member member) {
- super(parent, member);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java
deleted file mode 100644
index b422f45d7e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2;
-
-import java.util.List;
-
-import org.eclipse.jpt.core.JpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.core.internal.AbstractJpaAnnotationDefintionProvider;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.Access2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.AssociationOverride2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.AssociationOverrides2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.Cacheable2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.ElementCollection2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.MapsId2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.NamedQueries2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.NamedQuery2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.OneToMany2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.OneToOne2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.OrderColumn2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.SequenceGenerator2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.AttributeOverrideAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.AttributeOverridesAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.BasicAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.ColumnAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.DiscriminatorColumnAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.DiscriminatorValueAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.EmbeddableAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.EmbeddedAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.EmbeddedIdAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.EntityAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.EnumeratedAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.GeneratedValueAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.IdAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.IdClassAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.InheritanceAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.JoinColumnAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.JoinColumnsAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.JoinTableAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.LobAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.ManyToManyAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.ManyToOneAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.MapKeyAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.MappedSuperclassAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.NamedNativeQueriesAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.NamedNativeQueryAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.OrderByAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumnAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumnsAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.SecondaryTableAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.SecondaryTablesAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.TableAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.TableGeneratorAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.TemporalAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.TransientAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.VersionAnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-
-/**
- * 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 AbstractJpaAnnotationDefintionProvider
-{
- // singleton
- private static final JpaAnnotationDefinitionProvider INSTANCE =
- new Generic2_0JpaAnnotationDefinitionProvider();
-
-
- /**
- * Return the singleton
- */
- public static JpaAnnotationDefinitionProvider instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private Generic2_0JpaAnnotationDefinitionProvider() {
- super();
- }
-
-
- @Override
- protected void addTypeAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) {
- definitions.add(Access2_0AnnotationDefinition.instance());
- definitions.add(AssociationOverride2_0AnnotationDefinition.instance());
- definitions.add(AssociationOverrides2_0AnnotationDefinition.instance());
- definitions.add(AttributeOverrideAnnotationDefinition.instance());
- definitions.add(AttributeOverridesAnnotationDefinition.instance());
- definitions.add(Cacheable2_0AnnotationDefinition.instance());
- definitions.add(DiscriminatorColumnAnnotationDefinition.instance());
- definitions.add(DiscriminatorValueAnnotationDefinition.instance());
- definitions.add(EmbeddableAnnotationDefinition.instance());
- definitions.add(EntityAnnotationDefinition.instance());
- definitions.add(IdClassAnnotationDefinition.instance());
- definitions.add(InheritanceAnnotationDefinition.instance());
- definitions.add(MappedSuperclassAnnotationDefinition.instance());
- definitions.add(NamedQuery2_0AnnotationDefinition.instance());
- definitions.add(NamedQueries2_0AnnotationDefinition.instance());
- definitions.add(NamedNativeQueryAnnotationDefinition.instance());
- definitions.add(NamedNativeQueriesAnnotationDefinition.instance());
- definitions.add(PrimaryKeyJoinColumnAnnotationDefinition.instance());
- definitions.add(PrimaryKeyJoinColumnsAnnotationDefinition.instance());
- definitions.add(SecondaryTableAnnotationDefinition.instance());
- definitions.add(SecondaryTablesAnnotationDefinition.instance());
- definitions.add(SequenceGenerator2_0AnnotationDefinition.instance());
- definitions.add(TableAnnotationDefinition.instance());
- definitions.add(TableGeneratorAnnotationDefinition.instance());
- }
-
- @Override
- protected void addTypeMappingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) {
- definitions.add(EmbeddableAnnotationDefinition.instance());
- definitions.add(EntityAnnotationDefinition.instance());
- definitions.add(MappedSuperclassAnnotationDefinition.instance());
- }
-
- @Override
- protected void addAttributeAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) {
- definitions.add(Access2_0AnnotationDefinition.instance());
- definitions.add(AssociationOverride2_0AnnotationDefinition.instance());
- definitions.add(AssociationOverrides2_0AnnotationDefinition.instance());
- definitions.add(AttributeOverrideAnnotationDefinition.instance());
- definitions.add(AttributeOverridesAnnotationDefinition.instance());
- definitions.add(BasicAnnotationDefinition.instance());
- definitions.add(ColumnAnnotationDefinition.instance());
- definitions.add(ElementCollection2_0AnnotationDefinition.instance());
- definitions.add(EmbeddedAnnotationDefinition.instance());
- definitions.add(EmbeddedIdAnnotationDefinition.instance());
- definitions.add(EnumeratedAnnotationDefinition.instance());
- definitions.add(GeneratedValueAnnotationDefinition.instance());
- definitions.add(IdAnnotationDefinition.instance());
- definitions.add(JoinColumnAnnotationDefinition.instance());
- definitions.add(JoinColumnsAnnotationDefinition.instance());
- definitions.add(JoinTableAnnotationDefinition.instance());
- definitions.add(LobAnnotationDefinition.instance());
- definitions.add(ManyToManyAnnotationDefinition.instance());
- definitions.add(ManyToOneAnnotationDefinition.instance());
- definitions.add(MapsId2_0AnnotationDefinition.instance());
- definitions.add(MapKeyAnnotationDefinition.instance());
- definitions.add(OneToMany2_0AnnotationDefinition.instance());
- definitions.add(OneToOne2_0AnnotationDefinition.instance());
- definitions.add(OrderByAnnotationDefinition.instance());
- definitions.add(OrderColumn2_0AnnotationDefinition.instance());
- definitions.add(PrimaryKeyJoinColumnAnnotationDefinition.instance());
- definitions.add(PrimaryKeyJoinColumnsAnnotationDefinition.instance());
- definitions.add(SequenceGenerator2_0AnnotationDefinition.instance());
- definitions.add(TableGeneratorAnnotationDefinition.instance());
- definitions.add(TemporalAnnotationDefinition.instance());
- definitions.add(TransientAnnotationDefinition.instance());
- definitions.add(VersionAnnotationDefinition.instance());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaPlatformFactory.java
deleted file mode 100644
index ac34884075..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaPlatformFactory.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2;
-
-import org.eclipse.jpt.core.JpaPlatform;
-import org.eclipse.jpt.core.JpaPlatformFactory;
-import org.eclipse.jpt.core.JpaPlatformVariation;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.GenericJpaAnnotationProvider;
-import org.eclipse.jpt.core.internal.GenericJpaPlatform;
-import org.eclipse.jpt.core.internal.GenericJpaPlatformFactory.SimpleVersion;
-
-/**
- * All the state in the JPA platform should be "static" (i.e. unchanging once
- * it is initialized).
- */
-public class Generic2_0JpaPlatformFactory
- implements JpaPlatformFactory
-{
- /**
- * zero-argument constructor
- */
- public Generic2_0JpaPlatformFactory() {
- super();
- }
-
-
- public JpaPlatform buildJpaPlatform(String id) {
- return new GenericJpaPlatform(
- id,
- this.buildJpaVersion(),
- new GenericJpaFactory2_0(),
- new GenericJpaAnnotationProvider(Generic2_0JpaAnnotationDefinitionProvider.instance()),
- Generic2_0JpaPlatformProvider.instance(),
- this.buildJpaPlatformVariation());
- }
-
- private JpaPlatform.Version buildJpaVersion() {
- return new SimpleVersion(JptCorePlugin.JPA_FACET_VERSION_2_0);
- }
-
- protected JpaPlatformVariation buildJpaPlatformVariation() {
- return new JpaPlatformVariation() {
- //table_per_class inheritance support is optional in the 2.0 spec
- public Supported getTablePerConcreteClassInheritanceIsSupported() {
- return Supported.MAYBE;
- }
- public boolean isJoinTableOverridable() {
- return true;
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaPlatformProvider.java
deleted file mode 100644
index 6247e02782..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaPlatformProvider.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2;
-
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.JpaPlatformProvider;
-import org.eclipse.jpt.core.JpaResourceModelProvider;
-import org.eclipse.jpt.core.JpaResourceType;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.ResourceDefinition;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.core.internal.AbstractJpaPlatformProvider;
-import org.eclipse.jpt.core.internal.JarResourceModelProvider;
-import org.eclipse.jpt.core.internal.JavaResourceModelProvider;
-import org.eclipse.jpt.core.internal.OrmResourceModelProvider;
-import org.eclipse.jpt.core.internal.PersistenceResourceModelProvider;
-import org.eclipse.jpt.core.internal.context.java.JavaBasicMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaEmbeddableDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaEmbeddedIdMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaEmbeddedMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaEntityDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaManyToManyMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaManyToOneMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaMappedSuperclassDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaOneToManyMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaOneToOneMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaTransientMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaVersionMappingDefinition;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
-import org.eclipse.jpt.core.internal.jpa1.context.persistence.GenericPersistenceXmlDefinition;
-import org.eclipse.jpt.core.internal.jpa2.context.java.JavaElementCollectionMappingDefinition2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.JavaIdMappingDefinition2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.orm.GenericOrmXml2_0Definition;
-import org.eclipse.jpt.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
-{
- public static final String ID = "generic2_0"; //$NON-NLS-1$
-
-
- // 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 JpaResourceType getMostRecentSupportedResourceType(IContentType contentType) {
- if (contentType.equals(JptCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
- return JptCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptCorePlugin.JAR_CONTENT_TYPE)) {
- return JptCorePlugin.JAR_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) {
- return JptCorePlugin.PERSISTENCE_XML_2_0_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptCorePlugin.ORM_XML_CONTENT_TYPE)) {
- return JptCorePlugin.ORM_XML_2_0_RESOURCE_TYPE;
- }
- else {
- throw new IllegalArgumentException(contentType.toString());
- }
- }
-
- @Override
- protected JpaResourceModelProvider[] buildResourceModelProviders() {
- // order should not be important here
- return new JpaResourceModelProvider[] {
- JavaResourceModelProvider.instance(),
- JarResourceModelProvider.instance(),
- PersistenceResourceModelProvider.instance(),
- OrmResourceModelProvider.instance()};
- }
-
-
- // ********** Java type mappings **********
-
- @Override
- protected JavaTypeMappingDefinition[] buildNonNullJavaTypeMappingDefinitions() {
- // order determined by analyzing order that reference implementation (eclipselink) uses
- return new JavaTypeMappingDefinition[] {
- JavaEntityDefinition.instance(),
- JavaEmbeddableDefinition.instance(),
- JavaMappedSuperclassDefinition.instance()};
- }
-
-
- // ********** Java attribute mappings **********
-
- @Override
- protected JavaAttributeMappingDefinition[] buildNonNullDefaultJavaAttributeMappingDefinitions() {
- // order determined by analyzing order that reference implementation (eclipselink) uses
- return new JavaAttributeMappingDefinition[] {
- JavaEmbeddedMappingDefinition.instance(),
- JavaBasicMappingDefinition.instance()};
- }
-
- @Override
- protected JavaAttributeMappingDefinition[] buildNonNullSpecifiedJavaAttributeMappingDefinitions() {
- // order determined by analyzing order that reference implementation (eclipselink) uses
- return new JavaAttributeMappingDefinition[] {
- JavaTransientMappingDefinition.instance(),
- JavaElementCollectionMappingDefinition2_0.instance(),
- JavaIdMappingDefinition2_0.instance(),
- JavaVersionMappingDefinition.instance(),
- JavaBasicMappingDefinition.instance(),
- JavaEmbeddedMappingDefinition.instance(),
- JavaEmbeddedIdMappingDefinition.instance(),
- JavaManyToManyMappingDefinition.instance(),
- JavaManyToOneMappingDefinition.instance(),
- JavaOneToManyMappingDefinition.instance(),
- JavaOneToOneMappingDefinition.instance()};
- }
-
-
- // ********** Mapping Files **********
-
- @Override
- protected ResourceDefinition[] buildResourceDefinitions() {
- return new ResourceDefinition[] {
- GenericPersistenceXmlDefinition.instance(),
- Generic2_0PersistenceXmlDefinition.instance(),
- GenericOrmXmlDefinition.instance(),
- GenericOrmXml2_0Definition.instance()};
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericJpaFactory2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericJpaFactory2_0.java
deleted file mode 100644
index 9b3012a494..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericJpaFactory2_0.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2;
-
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JpaProject.Config;
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.AssociationOverrideContainer.Owner;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverrideRelationshipReference;
-import org.eclipse.jpt.core.context.java.JavaEmbeddable;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaNamedQuery;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaSequenceGenerator;
-import org.eclipse.jpt.core.internal.AbstractJpaFactory;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaAssociationOverrideRelationshipReference2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaCacheable2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaDerivedId2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaElementCollectionMapping2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaEmbeddable2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaMapsId2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaNamedQuery2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaOrphanRemoval2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaPersistentAttribute2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaPersistentType2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaSequenceGenerator2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.VirtualAssociationOverride2_0Annotation;
-import org.eclipse.jpt.core.jpa2.JpaProject2_0;
-import org.eclipse.jpt.core.jpa2.context.PersistentType2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCacheable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCacheableHolder2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaDerivedId2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaElementCollectionMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaEmbeddedMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaMapsId2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-
-
-/**
- * Central class that allows extenders to easily replace implementations of
- * various Dali interfaces.
- */
-public class GenericJpaFactory2_0
- extends AbstractJpaFactory
-{
-
- 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);
- }
-
- @Override
- public PersistentType2_0.MetamodelSynchronizer buildPersistentTypeMetamodelSynchronizer(PersistentType2_0 persistentType) {
- return new GenericPersistentTypeMetamodelSynchronizer(persistentType);
- }
-
-
- // ********** Java Context Model **********
-
- @Override
- public JavaPersistentType buildJavaPersistentType(PersistentType.Owner owner, JavaResourcePersistentType jrpt) {
- return new GenericJavaPersistentType2_0(owner, jrpt);
- }
-
- @Override
- public JavaPersistentAttribute buildJavaPersistentAttribute(PersistentType parent, JavaResourcePersistentAttribute jrpa) {
- return new GenericJavaPersistentAttribute2_0(parent, jrpa);
- }
-
- @Override
- public JavaEmbeddable buildJavaEmbeddable(JavaPersistentType parent) {
- return new GenericJavaEmbeddable2_0(parent);
- }
-
- @Override
- public JavaSequenceGenerator buildJavaSequenceGenerator(JavaJpaContextNode parent) {
- return new GenericJavaSequenceGenerator2_0(parent);
- }
-
- //The 2.0 JPA spec supports association overrides on an embedded mapping while the 1.0 spec did not
- @Override
- public JavaAssociationOverrideContainer buildJavaAssociationOverrideContainer(JavaEmbeddedMapping2_0 parent, Owner owner) {
- return new GenericJavaAssociationOverrideContainer(parent, owner);
- }
-
- @Override
- public JavaAssociationOverrideRelationshipReference buildJavaAssociationOverrideRelationshipReference(JavaAssociationOverride parent) {
- return new GenericJavaAssociationOverrideRelationshipReference2_0(parent);
- }
-
- @Override
- public AssociationOverrideAnnotation buildJavaVirtualAssociationOverrideAnnotation(JavaResourcePersistentMember jrpm, String name, JoiningStrategy joiningStrategy) {
- return new VirtualAssociationOverride2_0Annotation(jrpm, name, joiningStrategy);
- }
-
- @Override
- public JavaDerivedId2_0 buildJavaDerivedId(JavaSingleRelationshipMapping2_0 parent) {
- return new GenericJavaDerivedId2_0(parent);
- }
-
- @Override
- public JavaElementCollectionMapping2_0 buildJavaElementCollectionMapping2_0(JavaPersistentAttribute parent) {
- return new GenericJavaElementCollectionMapping2_0(parent);
- }
-
- @Override
- public JavaMapsId2_0 buildJavaMapsId(JavaSingleRelationshipMapping2_0 parent) {
- return new GenericJavaMapsId2_0(parent);
- }
-
- @Override
- public JavaCacheable2_0 buildJavaCacheable(JavaCacheableHolder2_0 parent) {
- return new GenericJavaCacheable2_0(parent);
- }
-
- @Override
- public JavaOrphanRemovable2_0 buildJavaOrphanRemoval(JavaOrphanRemovalHolder2_0 parent) {
- return new GenericJavaOrphanRemoval2_0(parent);
- }
-
- @Override
- public JavaNamedQuery buildJavaNamedQuery(JavaJpaContextNode parent) {
- return new GenericJavaNamedQuery2_0(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericPersistentTypeMetamodelSynchronizer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericPersistentTypeMetamodelSynchronizer.java
deleted file mode 100644
index 1002ef5192..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericPersistentTypeMetamodelSynchronizer.java
+++ /dev/null
@@ -1,604 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2;
-
-import java.io.PrintWriter;
-import java.io.Serializable;
-import java.io.StringWriter;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.TreeSet;
-import java.util.Map.Entry;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.jpa2.JpaProject2_0;
-import org.eclipse.jpt.core.jpa2.context.AttributeMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.jpa2.context.PersistentType2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.JavaResourcePersistentType2_0;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.ClassTools;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.IndentingPrintWriter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.Transformer;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-
-import com.ibm.icu.text.Collator;
-import com.ibm.icu.text.DateFormat;
-import com.ibm.icu.text.SimpleDateFormat;
-
-/**
- * For now, the "synchronization" is simple brute-force: we generate the source
- * code and then compare it with what is already present in the file.
- * If the new source is different, we replace the file contents; otherwise, we
- * leave the file unchanged.
- */
-@SuppressWarnings("nls")
-public class GenericPersistentTypeMetamodelSynchronizer
- implements PersistentType2_0.MetamodelSynchronizer
-{
- protected final PersistentType2_0 persistentType;
-
-
- public GenericPersistentTypeMetamodelSynchronizer(PersistentType2_0 persistentType) {
- super();
- this.persistentType = persistentType;
- }
-
- public IFile getFile() {
- return (IFile) this.getPackageFragment().getCompilationUnit(this.getFileName()).getResource();
- }
-
-
- // ********** synchronize **********
-
- public void synchronize() {
- try {
- this.synchronize_();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- }
- }
-
- protected void synchronize_() 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);
- if (newSource != null) {
- pkg.createCompilationUnit(fileName, newSource, true, null); // true=force
- }
- } else {
- // write a new file, creating the package folders if necessary
- if ( ! pkg.exists()) {
- this.getSourceFolder().createPackageFragment(pkg.getElementName(), true, null); // true=force
- }
- pkg.createCompilationUnit(fileName, this.buildSource(), false, null); // false=no force
- }
- }
-
- /**
- * pre-condition: the compilation unit exists
- *
- * return null if the old source is not to be replaced
- */
- protected String buildSource(ICompilationUnit compilationUnit) throws JavaModelException {
- IFile file = (IFile) compilationUnit.getResource();
- JavaResourcePersistentType2_0 genType = this.getJpaProject().getGeneratedMetamodelType(file);
- if (genType == null) {
- return null; // the file exists, but its source is not a generated metamodel class
- }
-
- String oldSource = compilationUnit.getSource();
- int oldLength = oldSource.length();
-
- String newSource = this.buildSource();
- int newLength = newSource.length();
- if (newLength != oldLength) {
- return newSource;
- }
-
- String date = genType.getGeneratedAnnotation().getDate(); // if we get here, this will be non-empty
- int dateBegin = oldSource.indexOf(date);
- if (dateBegin == -1) {
- return null; // hmmm...
- }
- int dateEnd = dateBegin + date.length();
- if (dateEnd > oldLength) {
- return null; // hmmm...
- }
-
- if (newSource.regionMatches(0, oldSource, 0, dateBegin) &&
- newSource.regionMatches(dateEnd, oldSource, dateEnd, oldLength - dateEnd)) {
- return null;
- }
- return newSource;
- }
-
-
- // ********** package/file **********
-
- protected IPackageFragment getPackageFragment() {
- return this.getSourceFolder().getPackageFragment(this.getPackageName());
- }
-
- protected IPackageFragmentRoot getSourceFolder() {
- return this.getJpaProject().getMetamodelPackageFragmentRoot();
- }
-
- protected JpaProject2_0 getJpaProject() {
- return (JpaProject2_0) this.persistentType.getJpaProject();
- }
-
- // TODO
- protected String getPackageName() {
- // the default is to store the metamodel in the same package as the model
- return ClassTools.packageNameForClassNamed(this.getMetamodelClassName());
- }
-
- protected String getFileName() {
- return ClassTools.shortNameForClassNamed(this.getMetamodelClassName()) + ".java";
- }
-
- protected String getMetamodelClassName() {
- return this.buildMetamodelClassName(this.persistentType.getName());
- }
-
- // TODO
- protected String buildMetamodelClassName(String className) {
- // the default is to simply append an underscore to the model class name
- return className + '_';
- }
-
-
- // ********** source code **********
-
- /**
- * build the "body" source first; then build the "package" and "imports" source
- * and concatenate the "body" source to it
- */
- protected String buildSource() {
- // build the body source first so we can gather up the import statements
- BodySourceWriter bodySourceWriter = this.buildBodySourceWriter();
-
- 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() {
- BodySourceWriter pw = new BodySourceWriter(this.getPackageName(), this.getMetamodelClassName());
- this.printBodySourceOn(pw);
- return pw;
- }
-
- protected void printBodySourceOn(BodySourceWriter pw) {
- this.printClassDeclarationOn(pw);
- pw.print(" {");
- pw.println();
-
- pw.indent();
- this.printAttributesOn(pw);
- pw.undent();
-
- pw.print('}');
- pw.println(); // EOF
- }
-
-
- // ********** class declaration **********
-
- protected void printClassDeclarationOn(BodySourceWriter pw) {
- this.printGeneratedAnnotationOn(pw);
- this.printStaticMetamodelAnnotationOn(pw);
-
- pw.print("public class ");
- pw.printTypeDeclaration(this.getMetamodelClassName());
- PersistentType superPersistentType = this.persistentType.getSuperPersistentType();
- if (superPersistentType != null) {
- pw.print(" extends ");
- pw.printTypeDeclaration(this.buildMetamodelClassName(superPersistentType.getName()));
- }
- }
-
- protected void printStaticMetamodelAnnotationOn(BodySourceWriter pw) {
- pw.printAnnotation(JPA2_0.STATIC_METAMODEL);
- pw.print('(');
- pw.printTypeDeclaration(this.persistentType.getName());
- pw.print(".class");
- pw.print(')');
- pw.println();
- }
-
- protected void printGeneratedAnnotationOn(BodySourceWriter pw) {
- pw.printAnnotation("javax.annotation.Generated");
- pw.print('(');
- pw.print("value=");
- pw.printStringLiteral(JavaResourcePersistentType2_0.METAMODEL_GENERATED_ANNOTATION_VALUE);
- pw.print(", ");
- pw.print("date=");
- pw.printStringLiteral(format(new Date()));
- pw.print(')');
- pw.println();
- }
-
- /**
- * {@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 **********
-
- protected void printAttributesOn(BodySourceWriter pw) {
- for (Iterator<PersistentAttribute> stream = this.persistentType.attributes(); stream.hasNext(); ) {
- this.printAttributeOn(stream.next(), pw);
- }
- }
-
- protected void printAttributeOn(PersistentAttribute persistentAttribute, BodySourceWriter pw) {
- AttributeMapping attributeMapping = persistentAttribute.getMapping();
- if (attributeMapping != null) { // probably shouldn't be null?
- this.printAttributeMappingOn(attributeMapping, pw);
- }
- }
-
- protected void printAttributeMappingOn(AttributeMapping attributeMapping, BodySourceWriter pw) {
- MetamodelField field = ((AttributeMapping2_0) attributeMapping).getMetamodelField();
- if (field != null) {
- this.printFieldOn(field, pw);
- }
- }
-
- protected void printFieldOn(MetamodelField field, BodySourceWriter pw) {
- for (String modifier : field.getModifiers()) {
- pw.print(modifier);
- pw.print(' ');
- }
- pw.printTypeDeclaration(field.getTypeName());
- pw.print('<');
- for (Iterator<String> stream = field.getTypeArgumentNames().iterator(); stream.hasNext(); ) {
- pw.printTypeDeclaration(stream.next());
- if (stream.hasNext()) {
- pw.print(", ");
- }
- }
- pw.print('>');
- pw.print(' ');
- pw.print(field.getName());
- pw.print(';');
- pw.println();
- }
-
-
- // ********** 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();
- }
-
-
- // ********** source writer **********
-
- /**
- * Extend IndentingPrintWriter with some methods that facilitate building
- * class source code.
- */
- protected static class BodySourceWriter
- extends IndentingPrintWriter
- {
- protected final String packageName;
- protected final String className;
- // key = short class name; value = import package
- protected final HashMap<String, ImportPackage> imports = new HashMap<String, ImportPackage>();
-
- protected BodySourceWriter(String packageName, String className) {
- super(new StringWriter(2000));
- this.packageName = packageName;
- this.className = className;
- }
-
- protected String getSource() {
- return this.out.toString();
- }
-
- protected int getLength() {
- return ((StringWriter) this.out).getBuffer().length();
- }
-
- protected void printVisibility(String visibilityModifier) {
- if (visibilityModifier.length() != 0) {
- this.print(visibilityModifier);
- this.print(' ');
- }
- }
-
- protected void printAnnotation(String annotationName) {
- this.print('@');
- this.printTypeDeclaration(annotationName);
- }
-
- protected void printTypeDeclaration(String typeDeclaration) {
- this.print(this.buildImportedTypeDeclaration(typeDeclaration));
- }
-
- protected void printField(String fieldName, String typeDeclaration, String visibility) {
- this.printVisibility(visibility);
- this.printTypeDeclaration(typeDeclaration);
- this.print(' ');
- this.print(fieldName);
- this.print(';');
- this.println();
- this.println();
- }
-
- protected void printParameterizedField(String fieldName, String typeDeclaration, String parameterTypeDeclaration, String visibility) {
- this.printVisibility(visibility);
- this.printTypeDeclaration(typeDeclaration);
- this.print('<');
- this.printTypeDeclaration(parameterTypeDeclaration);
- this.print('>');
- this.print(' ');
- this.print(fieldName);
- this.print(';');
- this.println();
- this.println();
- }
-
- /**
- * Convert the specified string to a String Literal and print it,
- * adding the surrounding double-quotes and escaping characters
- * as necessary.
- */
- void printStringLiteral(String string) {
- StringTools.convertToJavaStringLiteralOn(string, this);
- }
-
-
- // ********** imports **********
-
- // ***** writing
- /**
- * Return the specified class's "imported" name.
- * The class declaration must be of the form:
- * "int"
- * "int[]" (not "[I")
- * "java.lang.Object"
- * "java.lang.Object[]" (not "[Ljava.lang.Object;")
- * "java.util.Map.Entry" (not "java.util.Map$Entry")
- * "java.util.Map.Entry[][]" (not "[[Ljava.util.Map$Entry;")
- *
- * To really do this right, we would need to gather all the types from
- * the "unamed" (default) package that were referenced in the
- * compilation unit beforehand. *Any* collisions with one of these
- * types would have to be fully qualified (whether it was from
- * 'java.lang' or the same package as the current compilation unit).
- * In other words, if we have any types from the "unnamed" package,
- * results are unpredictable....
- */
- protected String buildImportedTypeDeclaration(String typeDeclaration) {
- if (this.typeDeclarationIsMemberClass(typeDeclaration)) {
- // no need for an import, just return the partially-qualified name
- return this.buildMemberClassTypeDeclaration(typeDeclaration);
- }
- int last = typeDeclaration.lastIndexOf('.');
- String currentPackageName = (last == -1) ? "" : typeDeclaration.substring(0, last);
- String shortTypeDeclaration = typeDeclaration.substring(last + 1);
- String shortElementTypeName = shortTypeDeclaration;
- while (shortElementTypeName.endsWith("[]")) {
- shortElementTypeName = shortElementTypeName.substring(0, shortElementTypeName.length() - 2);
- }
- ImportPackage prev = this.imports.get(shortElementTypeName);
- if (prev == null) {
- // this is the first class with this short element type name
- this.imports.put(shortElementTypeName, new ImportPackage(currentPackageName));
- return shortTypeDeclaration;
- }
- if (prev.packageName.equals(currentPackageName)) {
- // this element type has already been imported
- return shortTypeDeclaration;
- }
- if (currentPackageName.equals(this.packageName) &&
- prev.packageName.equals("java.lang")) {
- // we force the 'java.lang' class to be explicitly imported
- prev.collision = true;
- }
- // another class with the same short element type name has been
- // previously imported, so this one must be used fully-qualified
- return typeDeclaration;
- }
-
- /**
- * e.g. "foo.bar.Employee.PK" will return true
- */
- protected boolean typeDeclarationIsMemberClass(String typeDeclaration) {
- return (typeDeclaration.length() > this.className.length())
- && typeDeclaration.startsWith(this.className)
- && (typeDeclaration.charAt(this.className.length()) == '.');
- }
-
- /**
- * e.g. "foo.bar.Employee.PK" will return "Employee.PK"
- * this prevents collisions with other imported classes (e.g. "joo.jar.PK")
- */
- protected String buildMemberClassTypeDeclaration(String typeDeclaration) {
- int index = this.packageName.length();
- if (index != 0) {
- index++; // bump past the '.'
- }
- return typeDeclaration.substring(index);
- }
-
- // ***** reading
- protected Iterable<String> getImports() {
- return this.getSortedRequiredImports();
- }
-
- /**
- * transform our map entries to class names
- */
- protected Iterable<String> getSortedRequiredImports() {
- return new TransformationIterable<Map.Entry<String, ImportPackage>, String>(this.getSortedRequiredImportEntries(), this.buildImportEntriesTransformer());
- }
-
- protected Transformer<Map.Entry<String, ImportPackage>, String> buildImportEntriesTransformer() {
- return IMPORT_ENTRIES_TRANSFORMER;
- }
-
- protected static final Transformer<Map.Entry<String, ImportPackage>, String> IMPORT_ENTRIES_TRANSFORMER = new ImportEntriesTransformer();
-
- protected static class ImportEntriesTransformer
- implements Transformer<Map.Entry<String, ImportPackage>, String>
- {
- public String transform(Entry<String, ImportPackage> importEntry) {
- String pkg = importEntry.getValue().packageName;
- String type = importEntry.getKey();
- StringBuilder sb = new StringBuilder(pkg.length() + 1 + type.length());
- sb.append(pkg);
- sb.append('.');
- sb.append(type);
- return sb.toString();
- }
- }
-
- /**
- * sort by package first, then class (*not* by fully-qualified class name)
- */
- protected Iterable<Map.Entry<String, ImportPackage>> getSortedRequiredImportEntries() {
- TreeSet<Map.Entry<String, ImportPackage>> sortedEntries = new TreeSet<Map.Entry<String, ImportPackage>>(this.buildImportEntriesComparator());
- CollectionTools.addAll(sortedEntries, this.getRequiredImportEntries());
- return sortedEntries;
- }
-
- protected Comparator<Map.Entry<String, ImportPackage>> buildImportEntriesComparator() {
- return IMPORT_ENTRIES_COMPARATOR;
- }
-
- protected static final Comparator<Map.Entry<String, ImportPackage>> IMPORT_ENTRIES_COMPARATOR = new ImportEntriesComparator();
-
- protected static class ImportEntriesComparator
- implements Comparator<Map.Entry<String, ImportPackage>>, Serializable
- {
- public int compare(Map.Entry<String, ImportPackage> e1, Map.Entry<String, ImportPackage> e2) {
- Collator collator = Collator.getInstance();
- int pkg = collator.compare(e1.getValue().packageName, e2.getValue().packageName);
- return (pkg == 0) ? collator.compare(e1.getKey(), e2.getKey()) : pkg;
- }
- }
-
- /**
- * strip off any non-required imports (e.g. "java.lang.Object')
- */
- protected Iterable<Map.Entry<String, ImportPackage>> getRequiredImportEntries() {
- return new FilteringIterable<Map.Entry<String, ImportPackage>, Map.Entry<String, ImportPackage>>(this.imports.entrySet(), this.buildRequiredImportEntriesFilter());
- }
-
- protected Filter<Map.Entry<String, ImportPackage>> buildRequiredImportEntriesFilter() {
- return new RequiredImportEntriesFilter();
- }
-
- protected class RequiredImportEntriesFilter
- implements Filter<Map.Entry<String, ImportPackage>>
- {
- public boolean accept(Map.Entry<String, ImportPackage> importEntry) {
- return this.packageMustBeImported(importEntry.getValue());
- }
-
- protected boolean packageMustBeImported(ImportPackage importPackage) {
- String pkg = importPackage.packageName;
- if (pkg.equals("")) {
- // cannot import a type from the "unnamed" package
- return false;
- }
- if (pkg.equals("java.lang")) {
- // we must import from 'java.lang' if we also have a class in the same package
- return importPackage.collision;
- }
- if (pkg.equals(BodySourceWriter.this.packageName)) {
- // we never need to import a class from the same package
- return false;
- }
- return true;
- }
- }
-
- /**
- * We need a 'collision' flag for when we encounter a class from
- * 'java.lang' followed by a class from the current compilation unit's
- * package. We will need to include the explicit import of the
- * 'java.lang' class and all the references to the other class will
- * have to be fully-qualified.
- *
- * If the classes are encountered in the opposite order (i.e. the class
- * from the current compilation unit's package followed by the class
- * from 'java.lang'), we do *not* need to import the first class while
- * all the references to the 'java.lang' class will be fully-qualified.
- *
- * Unfortunately, we still have a problem: if we reference a class from
- * 'java.lang' and there is a conflicting class from the current
- * compilation unit's package (but that class is *not* revealed to us
- * here), the simple name will be resolved to the non-'java.lang' class.
- * Unless we simply force an import of *all* 'java.lang' classes.... :-(
- *
- * This shouldn't happen very often. :-)
- */
- protected static class ImportPackage {
- protected final String packageName;
- protected boolean collision = false;
-
- protected ImportPackage(String packageName) {
- super();
- this.packageName = packageName;
- }
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/SimpleMetamodelField.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/SimpleMetamodelField.java
deleted file mode 100644
index 4615c38895..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/SimpleMetamodelField.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context;
-
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-/**
- * Straightforward implementation.
- */
-public class SimpleMetamodelField
- implements MetamodelField
-{
- protected final Iterable<String> modifiers;
- protected final String typeName;
- protected final Iterable<String> typeArgumentNames;
- protected final String name;
-
- public SimpleMetamodelField(
- Iterable<String> modifiers,
- String typeName,
- Iterable<String> typeArgumentNames,
- String name
- ) {
- super();
- if (modifiers == null) {
- throw new NullPointerException();
- }
- if (typeName == null) {
- throw new NullPointerException();
- }
- if (typeArgumentNames == null) {
- throw new NullPointerException();
- }
- if (name == null) {
- throw new NullPointerException();
- }
- this.modifiers = modifiers;
- this.typeName = typeName;
- this.typeArgumentNames = typeArgumentNames;
- this.name = name;
- }
-
- public Iterable<String> getModifiers() {
- return this.modifiers;
- }
-
- public String getTypeName() {
- return this.typeName;
- }
-
- public Iterable<String> getTypeArgumentNames() {
- return this.typeArgumentNames;
- }
-
- public String getName() {
- return this.name;
- }
-
- @Override
- public int hashCode() {
- return CollectionTools.hashCode(this.modifiers) ^
- this.typeName.hashCode() ^
- CollectionTools.hashCode(this.typeArgumentNames) ^
- this.name.hashCode();
- }
-
- @Override
- public boolean equals(Object o) {
- if ( ! (o instanceof MetamodelField)) {
- return false;
- }
- MetamodelField other = (MetamodelField) o;
- return CollectionTools.elementsAreEqual(this.getModifiers(), other.getModifiers()) &&
- this.getTypeName().equals(other.getTypeName()) &&
- CollectionTools.elementsAreEqual(this.getTypeArgumentNames(), other.getTypeArgumentNames()) &&
- this.getName().equals(other.getName());
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- for (String modifier : this.modifiers) {
- sb.append(modifier);
- sb.append(' ');
- }
- sb.append(this.typeName);
- sb.append('<');
- for (String typeArgumentName : this.typeArgumentNames) {
- sb.append(typeArgumentName);
- sb.append(", "); //$NON-NLS-1$
- }
- sb.setLength(sb.length() - 2);
- sb.append('>');
- sb.append(' ');
- sb.append(this.name);
- return sb.toString();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaAssociationOverrideRelationshipReference2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaAssociationOverrideRelationshipReference2_0.java
deleted file mode 100644
index 367280e54e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaAssociationOverrideRelationshipReference2_0.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.AssociationOverrideRelationshipReference;
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaAssociationOverrideRelationshipReference;
-import org.eclipse.jpt.core.jpa2.context.AssociationOverrideRelationshipReference2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaAssociationOverrideRelationshipReference2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaJoinTableInAssociationOverrideJoiningStrategy2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.AssociationOverride2_0Annotation;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaAssociationOverrideRelationshipReference2_0 extends AbstractJavaAssociationOverrideRelationshipReference
- implements JavaAssociationOverrideRelationshipReference2_0
-{
-
- protected final JavaJoinTableInAssociationOverrideJoiningStrategy2_0 joinTableJoiningStrategy;
-
- public GenericJavaAssociationOverrideRelationshipReference2_0(JavaAssociationOverride parent) {
- super(parent);
- this.joinTableJoiningStrategy = buildJoinTableJoiningStrategy();
- }
-
- public void initializeFrom(AssociationOverrideRelationshipReference oldAssociationOverride) {
- if (oldAssociationOverride.getJoinColumnJoiningStrategy().hasSpecifiedJoinColumns()) {
- getJoinColumnJoiningStrategy().initializeFrom(oldAssociationOverride.getJoinColumnJoiningStrategy());
- }
- else {
- getJoinTableJoiningStrategy().initializeFrom(((AssociationOverrideRelationshipReference2_0) oldAssociationOverride).getJoinTableJoiningStrategy());
- }
- }
-
- protected JavaJoinTableInAssociationOverrideJoiningStrategy2_0 buildJoinTableJoiningStrategy() {
- return new GenericJavaJoinTableInAssociationOverrideJoiningStrategy2_0(this);
- }
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.joinTableJoiningStrategy.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return null;
- }
-
- @Override
- protected void initializeJoiningStrategies(AssociationOverrideAnnotation associationOverride) {
- super.initializeJoiningStrategies(associationOverride);
- this.joinTableJoiningStrategy.initialize((AssociationOverride2_0Annotation) associationOverride);
- }
-
- @Override
- protected void updateJoiningStrategies(AssociationOverrideAnnotation associationOverride) {
- super.updateJoiningStrategies(associationOverride);
- this.joinTableJoiningStrategy.update((AssociationOverride2_0Annotation) associationOverride);
- }
-
- @Override
- protected JoiningStrategy calculatePredominantJoiningStrategy() {
- if (this.joinColumnJoiningStrategy.hasSpecifiedJoinColumns()) {
- return this.joinColumnJoiningStrategy;
- }
- return this.joinTableJoiningStrategy;
- }
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
-// if (this.connectionProfileIsActive()) {
-// this.validateJoinTable(messages, astRoot);
-// }
- }
-
-
-
- // **************** join columns *******************************************
-
-
- public JavaJoinTableInAssociationOverrideJoiningStrategy2_0 getJoinTableJoiningStrategy() {
- return this.joinTableJoiningStrategy;
- }
-
- public boolean usesJoinTableJoiningStrategy() {
- return getPredominantJoiningStrategy() == this.joinTableJoiningStrategy;
- }
-
- public void setJoinTableJoiningStrategy() {
- this.joinTableJoiningStrategy.addStrategy();
- this.joinColumnJoiningStrategy.removeStrategy();
- }
-
- public void unsetJoinTableJoiningStrategy() {
- this.joinTableJoiningStrategy.removeStrategy();
- }
-
- public boolean mayHaveDefaultJoinTable() {
- return getAssociationOverride().isVirtual();
- }
-
- @Override
- public void setJoinColumnJoiningStrategy() {
- super.setJoinColumnJoiningStrategy();
- this.joinTableJoiningStrategy.removeStrategy();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java
deleted file mode 100644
index e21fb8be65..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCacheable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCacheableHolder2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.Cacheable2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class GenericJavaCacheable2_0
- extends AbstractJavaJpaContextNode
- implements JavaCacheable2_0
-{
- protected boolean defaultCacheable;
- protected Boolean specifiedCacheable;
-
- protected JavaResourcePersistentType resourcePersistentType;
-
- public GenericJavaCacheable2_0(JavaCacheableHolder2_0 parent) {
- super(parent);
- }
-
- @Override
- public JavaCacheableHolder2_0 getParent() {
- return (JavaCacheableHolder2_0) super.getParent();
- }
-
- protected String getCacheableAnnotationName() {
- return Cacheable2_0Annotation.ANNOTATION_NAME;
- }
-
- protected Cacheable2_0Annotation getResourceCacheable() {
- return (Cacheable2_0Annotation) this.resourcePersistentType.getAnnotation(getCacheableAnnotationName());
- }
-
- protected void addResourceCacheable() {
- this.resourcePersistentType.addAnnotation(getCacheableAnnotationName());
- }
-
- protected void removeResourceCacheable() {
- this.resourcePersistentType.removeAnnotation(getCacheableAnnotationName());
- }
-
- protected boolean calculateDefaultCacheable() {
- return getParent().calculateDefaultCacheable();
- }
-
- public boolean isCacheable() {
- return this.specifiedCacheable != null ? this.specifiedCacheable.booleanValue() : this.defaultCacheable;
- }
-
- public boolean isDefaultCacheable() {
- return this.defaultCacheable;
- }
-
- protected void setDefaultCacheable(boolean newDefaultCacheable) {
- boolean oldDefaultCacheable = this.defaultCacheable;
- this.defaultCacheable = newDefaultCacheable;
- firePropertyChanged(DEFAULT_CACHEABLE_PROPERTY, oldDefaultCacheable, newDefaultCacheable);
- }
-
- public Boolean getSpecifiedCacheable() {
- return this.specifiedCacheable;
- }
-
- public void setSpecifiedCacheable(Boolean newSpecifiedCacheable) {
- if (this.specifiedCacheable == newSpecifiedCacheable) {
- return;
- }
- Boolean oldSpecifiedCacheable = this.specifiedCacheable;
- this.specifiedCacheable = newSpecifiedCacheable;
-
- if (newSpecifiedCacheable != null) {
- if (getResourceCacheable() == null) {
- addResourceCacheable();
- }
- if (newSpecifiedCacheable.booleanValue()) {
- if (getResourceCacheable().getValue() == Boolean.FALSE) {
- getResourceCacheable().setValue(null);
- }
- }
- else {
- getResourceCacheable().setValue(Boolean.FALSE);
- }
- }
- else {
- removeResourceCacheable();
- }
- firePropertyChanged(SPECIFIED_CACHEABLE_PROPERTY, oldSpecifiedCacheable, newSpecifiedCacheable);
- }
-
- protected void setSpecifiedCacheable_(Boolean newSpecifiedCacheable) {
- Boolean oldSpecifiedCacheable = this.specifiedCacheable;
- this.specifiedCacheable = newSpecifiedCacheable;
- firePropertyChanged(SPECIFIED_CACHEABLE_PROPERTY, oldSpecifiedCacheable, newSpecifiedCacheable);
- }
-
- public void initialize(JavaResourcePersistentType jrpt) {
- this.resourcePersistentType = jrpt;
- Cacheable2_0Annotation resourceCacheable = this.getResourceCacheable();
- this.specifiedCacheable = this.specifiedCacheable(resourceCacheable);
- }
-
- public void update(JavaResourcePersistentType jrpt) {
- this.resourcePersistentType = jrpt;
- Cacheable2_0Annotation resourceCacheable = this.getResourceCacheable();
- this.setSpecifiedCacheable_(this.specifiedCacheable(resourceCacheable));
- this.setDefaultCacheable(this.calculateDefaultCacheable());
- }
-
- private Boolean specifiedCacheable(Cacheable2_0Annotation resourceCacheable) {
- if (resourceCacheable == null) {
- return null;
- }
- if (resourceCacheable.getValue() == null) { //@Cacheable is equivalent to @Cacheable(true)
- return Boolean.TRUE;
- }
- return resourceCacheable.getValue();
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- Cacheable2_0Annotation resourceCacheable = this.getResourceCacheable();
- return resourceCacheable == null ? null : resourceCacheable.getTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaDerivedId2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaDerivedId2_0.java
deleted file mode 100644
index b3d24271d4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaDerivedId2_0.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.jpa2.context.java.JavaDerivedId2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaDerivedId2_0
- extends AbstractJavaJpaContextNode
- implements JavaDerivedId2_0
-{
- protected boolean value;
-
-
- public GenericJavaDerivedId2_0(JavaSingleRelationshipMapping2_0 parent) {
- super(parent);
- }
-
-
- @Override
- public JavaSingleRelationshipMapping2_0 getParent() {
- return (JavaSingleRelationshipMapping2_0) super.getParent();
- }
-
- protected JavaResourcePersistentAttribute getResourceAttribute() {
- return getParent().getPersistentAttribute().getResourcePersistentAttribute();
- }
-
- public boolean getValue() {
- return this.value;
- }
-
- public void setValue(boolean newValue) {
- if (this.value == newValue) {
- return;
- }
- boolean oldValue = this.value;
- this.value = newValue;
-
- if (newValue) {
- addIdAnnotation();
- }
- else {
- removeIdAnnotation();
- }
- firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
- }
-
- protected void setValue_(boolean newValue) {
- boolean oldValue = this.value;
- this.value = newValue;
- firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
- }
-
- protected boolean getResourceDerivedId() {
- return getIdAnnotation() != null;
- }
-
- protected IdAnnotation getIdAnnotation() {
- return (IdAnnotation) getResourceAttribute().getAnnotation(JPA.ID);
- }
-
- protected void addIdAnnotation() {
- getResourceAttribute().addAnnotation(JPA.ID);
- }
-
- protected void removeIdAnnotation() {
- getResourceAttribute().removeAnnotation(JPA.ID);
- }
-
- public void initialize() {
- this.value = getResourceDerivedId();
- }
-
- public void update() {
- this.setValue_(getResourceDerivedId());
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- IdAnnotation annotation = this.getIdAnnotation();
- return annotation == null ? null : annotation.getTextRange(astRoot);
- }
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- // no validation rules
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java
deleted file mode 100644
index a7af52ccb4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import java.util.Vector;
-
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.Fetchable;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMapping;
-import org.eclipse.jpt.core.jpa2.MappingKeys2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaElementCollectionMapping2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.ElementCollection2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-
-
-public class GenericJavaElementCollectionMapping2_0
- extends AbstractJavaAttributeMapping<ElementCollection2_0Annotation>
- implements JavaElementCollectionMapping2_0
-{
- protected FetchType specifiedFetch;
-
- public GenericJavaElementCollectionMapping2_0(JavaPersistentAttribute parent) {
- super(parent);
- }
-
- @Override
- protected void initialize() {
- super.initialize();
- this.specifiedFetch = this.getResourceFetch();
- }
-
- @Override
- protected void update() {
- super.update();
- this.setSpecifiedFetch_(this.getResourceFetch());
- }
-
- //************** JavaAttributeMapping implementation ***************
-
- public String getKey() {
- return MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String getAnnotationName() {
- return ElementCollection2_0Annotation.ANNOTATION_NAME;
- }
-
- @Override
- protected void addSupportingAnnotationNamesTo(Vector<String> names) {
- super.addSupportingAnnotationNamesTo(names);
- names.add(JPA.ASSOCIATION_OVERRIDE);
- names.add(JPA.ASSOCIATION_OVERRIDES);
- names.add(JPA.ATTRIBUTE_OVERRIDE);
- names.add(JPA.ATTRIBUTE_OVERRIDES);
-// names.add(JPA2_0.COLLECTION_TABLE);
- names.add(JPA.COLUMN);
- names.add(JPA.ENUMERATED);
- names.add(JPA.LOB);
- names.add(JPA.MAP_KEY);
-// names.add(JPA2_0.MAP_KEY_CLASS);
-// names.add(JPA2_0.MAP_KEY_COLUMN);
-// names.add(JPA2_0.MAP_KEY_ENUMERATED);
-// names.add(JPA2_0.MAP_KEY_JOIN_COLUMN);
-// names.add(JPA2_0.MAP_KEY_JOIN_COLUMNS);
-// names.add(JPA2_0.MAP_KEY_TEMPORAL);
- names.add(JPA.ORDER_BY);
-// names.add(JPA2_0.ORDER_COLUMN);
- names.add(JPA.TEMPORAL);
- }
-
-
- // *************** Fetch ***************
-
- public FetchType getFetch() {
- return (this.getSpecifiedFetch() == null) ? this.getDefaultFetch() : this.getSpecifiedFetch();
- }
-
- public FetchType getDefaultFetch() {
- return DEFAULT_FETCH_TYPE;
- }
-
- public FetchType getSpecifiedFetch() {
- return this.specifiedFetch;
- }
-
- public void setSpecifiedFetch(FetchType newSpecifiedFetch) {
- FetchType oldFetch = this.specifiedFetch;
- this.specifiedFetch = newSpecifiedFetch;
- this.mappingAnnotation.setFetch(FetchType.toJavaResourceModel(newSpecifiedFetch));
- firePropertyChanged(Fetchable.SPECIFIED_FETCH_PROPERTY, oldFetch, newSpecifiedFetch);
- }
-
- /**
- * internal setter used only for updating from the resource model.
- * There were problems with InvalidThreadAccess exceptions in the UI
- * when you set a value from the UI and the annotation doesn't exist yet.
- * Adding the annotation causes an update to occur and then the exception.
- */
- protected void setSpecifiedFetch_(FetchType newSpecifiedFetch) {
- FetchType oldFetch = this.specifiedFetch;
- this.specifiedFetch = newSpecifiedFetch;
- firePropertyChanged(Fetchable.SPECIFIED_FETCH_PROPERTY, oldFetch, newSpecifiedFetch);
- }
-
- protected FetchType getResourceFetch() {
- return FetchType.fromJavaResourceModel(this.mappingAnnotation.getFetch());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaEmbeddable2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaEmbeddable2_0.java
deleted file mode 100644
index 4e9bd8353c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaEmbeddable2_0.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaEmbeddable;
-import org.eclipse.jpt.core.jpa2.MappingKeys2_0;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-
-
-public class GenericJavaEmbeddable2_0
- extends AbstractJavaEmbeddable
-{
- public GenericJavaEmbeddable2_0(JavaPersistentType parent) {
- super(parent);
- }
-
- @Override
- public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
- return ArrayTools.contains(ALLOWED_ATTRIBUTE_MAPPING_KEYS, attributeMappingKey);
- }
-
- public static final String[] ALLOWED_ATTRIBUTE_MAPPING_KEYS =
- new String[] {
- MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY,
- MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY,
- MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY,
- MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY,
- MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY,
- MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY,
- MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY,
- MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY
- };
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaJoinTableInAssociationOverrideJoiningStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaJoinTableInAssociationOverrideJoiningStrategy2_0.java
deleted file mode 100644
index c909eff6af..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaJoinTableInAssociationOverrideJoiningStrategy2_0.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJoinTableJoiningStrategy;
-import org.eclipse.jpt.core.jpa2.context.java.JavaAssociationOverrideRelationshipReference2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaJoinTableInAssociationOverrideJoiningStrategy2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.AssociationOverride2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class GenericJavaJoinTableInAssociationOverrideJoiningStrategy2_0
- extends AbstractJavaJoinTableJoiningStrategy
- implements JavaJoinTableInAssociationOverrideJoiningStrategy2_0
-{
- protected transient AssociationOverride2_0Annotation associationOverrideAnnotation;
-
- public GenericJavaJoinTableInAssociationOverrideJoiningStrategy2_0(JavaAssociationOverrideRelationshipReference2_0 parent) {
- super(parent);
- }
-
- public boolean isOverridableAssociation() {
- return false;
- }
-
- @Override
- public JavaAssociationOverrideRelationshipReference2_0 getRelationshipReference() {
- return (JavaAssociationOverrideRelationshipReference2_0) super.getRelationshipReference();
- }
-
- // **************** join table *********************************************
-
- public JoinTableAnnotation getAnnotation() {
- return this.associationOverrideAnnotation.getNonNullJoinTable();
- }
- @Override
- protected JoinTableAnnotation addAnnotation() {
- return this.associationOverrideAnnotation.addJoinTable();
- }
-
- @Override
- protected void removeAnnotation() {
- this.associationOverrideAnnotation.removeJoinTable();
- }
-
-
- public void initialize(AssociationOverride2_0Annotation associationOverride) {
- this.associationOverrideAnnotation = associationOverride;
- super.initialize();
- }
-
- public void update(AssociationOverride2_0Annotation associationOverride) {
- this.associationOverrideAnnotation = associationOverride;
- super.update();
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getRelationshipReference().getValidationTextRange(astRoot);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaMapsId2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaMapsId2_0.java
deleted file mode 100644
index cccd2ca020..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaMapsId2_0.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.jpa2.context.java.JavaMapsId2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.MapsId2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaMapsId2_0
- extends AbstractJavaJpaContextNode
- implements JavaMapsId2_0
-{
- protected String value;
-
-
- public GenericJavaMapsId2_0(JavaSingleRelationshipMapping2_0 parent) {
- super(parent);
- }
-
-
- @Override
- public JavaSingleRelationshipMapping2_0 getParent() {
- return (JavaSingleRelationshipMapping2_0) super.getParent();
- }
-
- protected JavaResourcePersistentAttribute getResourceAttribute() {
- return getParent().getPersistentAttribute().getResourcePersistentAttribute();
- }
-
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String newValue) {
- if (StringTools.stringsAreEqual(this.value, newValue)) {
- return;
- }
- String oldValue = this.value;
- this.value = newValue;
-
- if (newValue != null) {
- getMapsIdAnnotation().setValue(newValue);
- }
- else {
- removeMapsIdAnnotation();
- }
- firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
- }
-
- protected void setValue_(String newValue) {
- String oldValue = this.value;
- this.value = newValue;
- firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
- }
-
- protected String getResourceMapsId() {
- return getMapsIdAnnotation().getValue();
- }
-
- protected MapsId2_0Annotation getMapsIdAnnotation() {
- return (MapsId2_0Annotation) getResourceAttribute().getNonNullAnnotation(JPA2_0.MAPS_ID);
- }
-
- protected void removeMapsIdAnnotation() {
- getResourceAttribute().removeAnnotation(JPA2_0.MAPS_ID);
- }
-
- public void initialize() {
- this.value = getResourceMapsId();
- }
-
- public void update() {
- this.setValue_(getResourceMapsId());
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getMapsIdAnnotation().getTextRange(astRoot);
- }
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- // no validation rules
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java
deleted file mode 100644
index 73178a2130..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaQuery;
-import org.eclipse.jpt.core.jpa2.context.LockModeType_2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaNamedQuery2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.NamedQuery2_0Annotation;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
-
-/**
- * GenericJavaNamedQuery2_0
- */
-public class GenericJavaNamedQuery2_0 extends AbstractJavaQuery
- implements JavaNamedQuery2_0
-{
- private LockModeType_2_0 specifiedLockMode;
- private LockModeType_2_0 defaultLockMode;
-
- public GenericJavaNamedQuery2_0(JavaJpaContextNode parent) {
- super(parent);
- }
-
- // ********** NamedQuery2_0 implementation **********
-
- public LockModeType_2_0 getLockMode() {
- return (this.specifiedLockMode != null) ? this.specifiedLockMode : this.defaultLockMode;
- }
-
- public LockModeType_2_0 getSpecifiedLockMode() {
- return this.specifiedLockMode;
- }
-
- public void setSpecifiedLockMode(LockModeType_2_0 lockMode) {
- LockModeType_2_0 old = this.specifiedLockMode;
- this.specifiedLockMode = lockMode;
- this.getResourceQuery().setLockMode(LockModeType_2_0.toJavaResourceModel(lockMode));
- this.firePropertyChanged(SPECIFIED_LOCK_MODE_PROPERTY, old, lockMode);
- }
-
- protected void setSpecifiedLockMode_(LockModeType_2_0 lockMode) {
- LockModeType_2_0 old = this.specifiedLockMode;
- this.specifiedLockMode = lockMode;
- this.firePropertyChanged(SPECIFIED_LOCK_MODE_PROPERTY, old, lockMode);
- }
-
- public LockModeType_2_0 getDefaultLockMode() {
- return this.defaultLockMode;
- }
-
- protected void setDefaultLockMode(LockModeType_2_0 lockMode) {
- LockModeType_2_0 old = this.defaultLockMode;
- this.defaultLockMode = lockMode;
- firePropertyChanged(DEFAULT_LOCK_MODE_PROPERTY, old, lockMode);
- }
-
- // ********** resource => context **********
-
- public void initialize(NamedQueryAnnotation resourceQuery) {
- super.initialize(resourceQuery);
- this.specifiedLockMode = this.getResourceQueryLockMode(resourceQuery);
- }
-
- public void update(NamedQueryAnnotation resourceQuery) {
- super.update(resourceQuery);
- this.setSpecifiedLockMode_(this.getResourceQueryLockMode(resourceQuery));
- }
-
- @Override
- protected NamedQuery2_0Annotation getResourceQuery() {
- return (NamedQuery2_0Annotation) super.getResourceQuery();
- }
-
- protected LockModeType_2_0 getResourceQueryLockMode(NamedQueryAnnotation resourceQuery) {
- return LockModeType_2_0.fromJavaResourceModel(
- ((NamedQuery2_0Annotation)resourceQuery).getLockMode());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java
deleted file mode 100644
index 0f8a5e5e34..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaNamedColumn;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaNamedColumn;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrderColumn2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.TextRange;
-
-
-public class GenericJavaOrderColumn2_0
- extends AbstractJavaNamedColumn<OrderColumn2_0Annotation>
- implements JavaOrderColumn2_0
-{
- protected Boolean specifiedNullable;
-
- protected Boolean specifiedInsertable;
-
- protected Boolean specifiedUpdatable;
-
- protected JavaResourcePersistentMember persistenceResource;
-
-
- public GenericJavaOrderColumn2_0(JavaJpaContextNode parent, JavaNamedColumn.Owner owner) {
- super(parent, owner);
- }
-
- @Override
- public void initialize(OrderColumn2_0Annotation column) {
- super.initialize(column);
- this.specifiedNullable = this.getResourceNullable(column);
- this.specifiedInsertable = this.getResourceInsertable(column);
- this.specifiedUpdatable = this.getResourceUpdatable(column);
- }
-
- public boolean isNullable() {
- return (this.getSpecifiedNullable() == null) ? this.isDefaultNullable() : this.getSpecifiedNullable().booleanValue();
- }
-
- public boolean isDefaultNullable() {
- return BaseColumn.DEFAULT_NULLABLE;
- }
-
- public Boolean getSpecifiedNullable() {
- return this.specifiedNullable;
- }
-
- public void setSpecifiedNullable(Boolean newSpecifiedNullable) {
- Boolean oldSpecifiedNullable = this.specifiedNullable;
- this.specifiedNullable = newSpecifiedNullable;
- this.getResourceColumn().setNullable(newSpecifiedNullable);
- firePropertyChanged(BaseColumn.SPECIFIED_NULLABLE_PROPERTY, oldSpecifiedNullable, newSpecifiedNullable);
- }
-
- /**
- * internal setter used only for updating from the resource model.
- * There were problems with InvalidThreadAccess exceptions in the UI
- * when you set a value from the UI and the annotation doesn't exist yet.
- * Adding the annotation causes an update to occur and then the exception.
- */
- protected void setSpecifiedNullable_(Boolean newSpecifiedNullable) {
- Boolean oldSpecifiedNullable = this.specifiedNullable;
- this.specifiedNullable = newSpecifiedNullable;
- firePropertyChanged(BaseColumn.SPECIFIED_NULLABLE_PROPERTY, oldSpecifiedNullable, newSpecifiedNullable);
- }
-
- public boolean isInsertable() {
- return (this.getSpecifiedInsertable() == null) ? this.isDefaultInsertable() : this.getSpecifiedInsertable().booleanValue();
- }
-
- public boolean isDefaultInsertable() {
- return BaseColumn.DEFAULT_INSERTABLE;
- }
-
- public Boolean getSpecifiedInsertable() {
- return this.specifiedInsertable;
- }
-
- public void setSpecifiedInsertable(Boolean newSpecifiedInsertable) {
- Boolean oldSpecifiedInsertable = this.specifiedInsertable;
- this.specifiedInsertable = newSpecifiedInsertable;
- this.getResourceColumn().setInsertable(newSpecifiedInsertable);
- firePropertyChanged(BaseColumn.SPECIFIED_INSERTABLE_PROPERTY, oldSpecifiedInsertable, newSpecifiedInsertable);
- }
-
- /**
- * internal setter used only for updating from the resource model.
- * There were problems with InvalidThreadAccess exceptions in the UI
- * when you set a value from the UI and the annotation doesn't exist yet.
- * Adding the annotation causes an update to occur and then the exception.
- */
- protected void setSpecifiedInsertable_(Boolean newSpecifiedInsertable) {
- Boolean oldSpecifiedInsertable = this.specifiedInsertable;
- this.specifiedInsertable = newSpecifiedInsertable;
- firePropertyChanged(BaseColumn.SPECIFIED_INSERTABLE_PROPERTY, oldSpecifiedInsertable, newSpecifiedInsertable);
- }
-
- public boolean isUpdatable() {
- return (this.getSpecifiedUpdatable() == null) ? this.isDefaultUpdatable() : this.getSpecifiedUpdatable().booleanValue();
- }
-
- public boolean isDefaultUpdatable() {
- return BaseColumn.DEFAULT_UPDATABLE;
- }
-
- public Boolean getSpecifiedUpdatable() {
- return this.specifiedUpdatable;
- }
-
- public void setSpecifiedUpdatable(Boolean newSpecifiedUpdatable) {
- Boolean oldSpecifiedUpdatable = this.specifiedUpdatable;
- this.specifiedUpdatable = newSpecifiedUpdatable;
- this.getResourceColumn().setUpdatable(newSpecifiedUpdatable);
- firePropertyChanged(BaseColumn.SPECIFIED_UPDATABLE_PROPERTY, oldSpecifiedUpdatable, newSpecifiedUpdatable);
- }
-
- /**
- * internal setter used only for updating from the resource model.
- * There were problems with InvalidThreadAccess exceptions in the UI
- * when you set a value from the UI and the annotation doesn't exist yet.
- * Adding the annotation causes an update to occur and then the exception.
- */
- protected void setSpecifiedUpdatable_(Boolean newSpecifiedUpdatable) {
- Boolean oldSpecifiedUpdatable = this.specifiedUpdatable;
- this.specifiedUpdatable = newSpecifiedUpdatable;
- firePropertyChanged(BaseColumn.SPECIFIED_UPDATABLE_PROPERTY, oldSpecifiedUpdatable, newSpecifiedUpdatable);
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = getResourceColumn().getTextRange(astRoot);
- return (textRange != null) ? textRange : this.getOwner().getValidationTextRange(astRoot);
- }
-
- @Override
- public void update(OrderColumn2_0Annotation column) {
- super.update(column);
- this.setSpecifiedNullable_(this.getResourceNullable(column));
- this.setSpecifiedInsertable_(this.getResourceInsertable(column));
- this.setSpecifiedUpdatable_(this.getResourceUpdatable(column));
- }
-
- protected Boolean getResourceNullable(OrderColumn2_0Annotation column) {
- return column.getNullable();
- }
-
- protected Boolean getResourceInsertable(OrderColumn2_0Annotation column) {
- return column.getInsertable();
- }
-
- protected Boolean getResourceUpdatable(OrderColumn2_0Annotation column) {
- return column.getUpdatable();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOrphanRemoval2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOrphanRemoval2_0.java
deleted file mode 100644
index 8587f04505..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOrphanRemoval2_0.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.OrphanRemovable2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * GenericJavaOrphanRemoval2_0
- */
-public class GenericJavaOrphanRemoval2_0
- extends AbstractJavaJpaContextNode
- implements JavaOrphanRemovable2_0
-{
- protected boolean defaultOrphanRemoval;
- protected Boolean specifiedOrphanRemoval;
-
- protected JavaResourcePersistentAttribute resourcePersistentAttribute;
-
- public GenericJavaOrphanRemoval2_0(JavaOrphanRemovalHolder2_0 parent) {
- super(parent);
- }
-
- @Override
- public JavaOrphanRemovalHolder2_0 getParent() {
- return (JavaOrphanRemovalHolder2_0) super.getParent();
- }
-
- protected String getAnnotationName() {
- return ((JavaAttributeMapping)getParent()).getAnnotationName();
- }
-
- protected OrphanRemovable2_0Annotation getResourceOrphanRemovable() {
- return (OrphanRemovable2_0Annotation) this.resourcePersistentAttribute.getAnnotation(this.getAnnotationName());
- }
-
- // ********** OrphanRemovable2_0 implementation **********
-
- public boolean isOrphanRemoval() {
- return this.specifiedOrphanRemoval != null ? this.specifiedOrphanRemoval.booleanValue() : this.defaultOrphanRemoval;
- }
-
- public Boolean getSpecifiedOrphanRemoval() {
- return this.specifiedOrphanRemoval;
- }
-
- public boolean isDefaultOrphanRemoval() {
- return this.defaultOrphanRemoval;
- }
-
- protected void setDefaultOrphanRemoval(boolean newDefaultOrphanRemoval) {
- boolean old = this.defaultOrphanRemoval;
- this.defaultOrphanRemoval = newDefaultOrphanRemoval;
- this.firePropertyChanged(DEFAULT_ORPHAN_REMOVAL_PROPERTY, old, newDefaultOrphanRemoval);
- }
-
- public void setSpecifiedOrphanRemoval(Boolean newOrphanRemoval) {
- Boolean old = this.specifiedOrphanRemoval;
- this.specifiedOrphanRemoval = newOrphanRemoval;
- this.getResourceOrphanRemovable().setOrphanRemoval(newOrphanRemoval);
- this.firePropertyChanged(SPECIFIED_ORPHAN_REMOVAL_PROPERTY, old, newOrphanRemoval);
- }
-
- protected void setSpecifiedOrphanRemoval_(Boolean newSpecifiedOrphanRemoval) {
- Boolean old = this.specifiedOrphanRemoval;
- this.specifiedOrphanRemoval = newSpecifiedOrphanRemoval;
- this.firePropertyChanged(SPECIFIED_ORPHAN_REMOVAL_PROPERTY, old, newSpecifiedOrphanRemoval);
- }
-
- // ********** initialize/update **********
-
- public void initialize(JavaResourcePersistentAttribute jrpa) {
- this.resourcePersistentAttribute = jrpa;
- OrphanRemovable2_0Annotation resource = this.getResourceOrphanRemovable();
- this.specifiedOrphanRemoval = this.getSpecifiedOrphanRemovalFrom(resource);
- }
-
- public void update(JavaResourcePersistentAttribute jrpa) {
- this.resourcePersistentAttribute = jrpa;
- OrphanRemovable2_0Annotation resource = this.getResourceOrphanRemovable();
- this.setSpecifiedOrphanRemoval_(this.getSpecifiedOrphanRemovalFrom(resource));
- }
-
- private Boolean getSpecifiedOrphanRemovalFrom(OrphanRemovable2_0Annotation resource) {
- return (resource == null) ? null : resource.getOrphanRemoval();
- }
-
- // ********** validation **********
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- // TODO
- return null;
- }
-
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java
deleted file mode 100644
index b390a08fbc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.MultiRelationshipMapping;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaPersistentAttribute;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.jpa2.context.java.JavaPersistentAttribute2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.utility.internal.ClassTools;
-
-/**
- * JPA 2.0 Java persistent attribute
- */
-public class GenericJavaPersistentAttribute2_0
- extends AbstractJavaPersistentAttribute
- implements JavaPersistentAttribute2_0
-{
- protected AccessType specifiedAccess;
-
-
- public GenericJavaPersistentAttribute2_0(PersistentType parent, JavaResourcePersistentAttribute resourcePersistentAttribute) {
- super(parent, resourcePersistentAttribute);
- this.specifiedAccess = this.buildSpecifiedAccess();
- }
-
-
- // ********** AccessHolder implementation **********
-
- 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 specifiedAccess) {
- AccessType old = this.specifiedAccess;
- this.specifiedAccess = specifiedAccess;
- this.firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, old, specifiedAccess);
- }
-
- protected AccessType buildSpecifiedAccess() {
- Access2_0Annotation accessAnnotation =
- (Access2_0Annotation) this.resourcePersistentAttribute.
- getAnnotation(Access2_0Annotation.ANNOTATION_NAME);
- return accessAnnotation == null ? null : AccessType.fromJavaResourceModel(accessAnnotation.getValue());
- }
-
- @Override
- public void update() {
- super.update();
- this.setSpecifiedAccess_(this.buildSpecifiedAccess());
- }
-
-
- // ********** metamodel **********
-
- public String getMetamodelContainerFieldTypeName() {
- return this.getJpaContainer(this.resourcePersistentAttribute.getTypeName()).getMetamodelContainerFieldTypeName();
- }
-
- public String getMetamodelContainerFieldMapKeyTypeName() {
- return this.getJpaContainer(this.resourcePersistentAttribute.getTypeName()).getMetamodelContainerFieldMapKeyTypeName((MultiRelationshipMapping) this.getMapping());
- }
-
- public String getMetamodelTypeName() {
- String typeName = this.resourcePersistentAttribute.getTypeName();
- if (typeName == null) {
- return MetamodelField.DEFAULT_TYPE_NAME;
- }
- if (ClassTools.classNamedIsPrimitive(typeName)) {
- return ClassTools.wrapperClassName(typeName); // ???
- }
- return typeName;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java
deleted file mode 100644
index 62848905c9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaPersistentType;
-import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
-import org.eclipse.jpt.core.jpa2.context.PersistentType2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaPersistentType2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-
-/**
- * JPA 2.0 Java persistent type.
- * Support for specified access and metamodel generation.
- */
-public class GenericJavaPersistentType2_0
- extends AbstractJavaPersistentType
- implements JavaPersistentType2_0
-{
- protected final PersistentType2_0.MetamodelSynchronizer metamodelSynchronizer;
-
- public GenericJavaPersistentType2_0(PersistentType.Owner parent, JavaResourcePersistentType jrpt) {
- super(parent, jrpt);
- this.metamodelSynchronizer = this.buildMetamodelSynchronizer();
- }
-
- protected PersistentType2_0.MetamodelSynchronizer buildMetamodelSynchronizer() {
- return ((JpaFactory2_0) this.getJpaFactory()).buildPersistentTypeMetamodelSynchronizer(this);
- }
-
-
- // ********** access **********
-
- protected Access2_0Annotation getAccessAnnotation() {
- return (Access2_0Annotation) this.resourcePersistentType.getNonNullAnnotation(this.getAccessAnnotationName());
- }
-
- protected String getAccessAnnotationName() {
- return Access2_0Annotation.ANNOTATION_NAME;
- }
-
- @Override
- protected AccessType buildSpecifiedAccess() {
- return AccessType.fromJavaResourceModel(this.getAccessAnnotation().getValue());
- }
-
- public void setSpecifiedAccess(AccessType specifiedAccess) {
- AccessType old = this.specifiedAccess;
- this.specifiedAccess = specifiedAccess;
- this.getAccessAnnotation().setValue(AccessType.toJavaResourceModel(specifiedAccess));
- this.firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, old, specifiedAccess);
- }
-
- protected void setSpecifiedAccess_(AccessType specifiedAccess) {
- AccessType old = this.specifiedAccess;
- this.specifiedAccess = specifiedAccess;
- this.firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, old, specifiedAccess);
- }
-
- @Override
- protected Iterator<JavaResourcePersistentAttribute> resourceAttributes() {
- return (this.specifiedAccess == null) ?
- super.resourceAttributes() :
- this.resourcePersistentType.persistableAttributes(AccessType.toJavaResourceModel(this.specifiedAccess));
- }
-
- @Override
- public void updateAccess() {
- super.updateAccess();
- this.setSpecifiedAccess_(this.buildSpecifiedAccess());
- }
-
-
- // ********** metamodel **********
-
- public IFile getMetamodelFile() {
- return this.metamodelSynchronizer.getFile();
- }
-
- public void initializeMetamodel() {
- // do nothing - probably shouldn't be called...
- }
-
- public void synchronizeMetamodel() {
- this.metamodelSynchronizer.synchronize();
- }
-
- public void disposeMetamodel() {
- // do nothing - probably shouldn't be called...
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0.java
deleted file mode 100644
index 242ab12a17..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaSequenceGenerator;
-import org.eclipse.jpt.core.jpa2.context.SequenceGenerator2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.SequenceGenerator2_0Annotation;
-import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation;
-
-/**
- * Generic2_0JavaSequenceGenerator
- */
-public class GenericJavaSequenceGenerator2_0 extends AbstractJavaSequenceGenerator
- implements SequenceGenerator2_0
-{
- protected String specifiedCatalog;
- protected String defaultCatalog;
-
- protected String specifiedSchema;
- protected String defaultSchema;
-
- public GenericJavaSequenceGenerator2_0(JavaJpaContextNode parent) {
- super(parent);
- }
-
- // ********** catalog **********
-
- @Override
- public String getCatalog() {
- return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog;
- }
-
- public String getSpecifiedCatalog() {
- return this.specifiedCatalog;
- }
-
- public void setSpecifiedCatalog(String catalog) {
- String old = this.specifiedCatalog;
- this.specifiedCatalog = catalog;
- this.getResourceGenerator().setCatalog(catalog);
- this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, 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;
- 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) {
- String old = this.specifiedSchema;
- this.specifiedSchema = schema;
- this.getResourceGenerator().setSchema(schema);
- this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, 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();
- }
-
- // ********** resource => context **********
-
- @Override
- public void initialize(SequenceGeneratorAnnotation resourceSequenceGenerator) {
- super.initialize(resourceSequenceGenerator);
- SequenceGenerator2_0Annotation resource = (SequenceGenerator2_0Annotation) resourceSequenceGenerator;
-
- this.defaultCatalog = this.buildDefaultCatalog();
- this.specifiedCatalog = resource.getCatalog();
- this.defaultSchema = this.buildDefaultSchema();
- this.specifiedSchema = resource.getSchema();
- }
-
- @Override
- public void update(SequenceGeneratorAnnotation resourceSequenceGenerator) {
- super.update(resourceSequenceGenerator);
- SequenceGenerator2_0Annotation resource = (SequenceGenerator2_0Annotation) resourceSequenceGenerator;
-
- this.setDefaultCatalog(this.buildDefaultCatalog());
- this.setSpecifiedCatalog_(resource.getCatalog());
- this.setDefaultSchema(this.buildDefaultSchema());
- this.setSpecifiedSchema_(resource.getSchema());
- }
-
- @Override
- protected SequenceGenerator2_0Annotation getResourceGenerator() {
- return (SequenceGenerator2_0Annotation) super.getResourceGenerator();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java
deleted file mode 100644
index 3a276373a1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
-import org.eclipse.jpt.core.jpa2.MappingKeys2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.ElementCollection2_0Annotation;
-
-public class JavaElementCollectionMappingDefinition2_0
- extends AbstractJavaAttributeMappingDefinition
-{
- // singleton
- private static final JavaElementCollectionMappingDefinition2_0 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 JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) {
- return ((JpaFactory2_0) factory).buildJavaElementCollectionMapping2_0(parent);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaIdMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaIdMappingDefinition2_0.java
deleted file mode 100644
index 29aa664540..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaIdMappingDefinition2_0.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaIdMappingDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.ManyToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
-
-public class JavaIdMappingDefinition2_0
- extends AbstractJavaIdMappingDefinition
-{
- // singleton
- private static final JavaIdMappingDefinition2_0 INSTANCE =
- new JavaIdMappingDefinition2_0();
-
-
- /**
- * Return the singleton.
- */
- public static JavaAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private JavaIdMappingDefinition2_0() {
- super();
- }
-
-
- @Override
- public boolean testSpecified(JavaPersistentAttribute persistentAttribute) {
- return super.testSpecified(persistentAttribute) && ! testDerivedId(persistentAttribute);
- }
-
- /**
- * Return whether the Id annotation, if present, is used as a supporting annotation for
- * 1-1 or M-1 mapping, rather than as a primary mapping annotation
- */
- protected boolean testDerivedId(JavaPersistentAttribute persistentAttribute) {
- JavaResourcePersistentAttribute resourceAttribute =
- persistentAttribute.getResourcePersistentAttribute();
- return resourceAttribute.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME) != null
- || resourceAttribute.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME) != null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaCacheable2_0.java
deleted file mode 100644
index 7110530551..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaCacheable2_0.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCacheable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCacheableHolder2_0;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class NullJavaCacheable2_0
- extends AbstractJavaJpaContextNode
- implements JavaCacheable2_0
-{
- public NullJavaCacheable2_0(JavaCacheableHolder2_0 parent) {
- super(parent);
- }
-
- public Boolean getSpecifiedCacheable() {
- return null;
- }
-
- public void setSpecifiedCacheable(Boolean newSpecifiedCacheable) {
- throw new UnsupportedOperationException();
- }
-
- public boolean isCacheable() {
- return false;
- }
-
- public boolean isDefaultCacheable() {
- return false;
- }
-
- public void initialize(JavaResourcePersistentType jrpt) {
- //no-op
- }
-
- public void update(JavaResourcePersistentType jrpt) {
- //no-op
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaDerivedId2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaDerivedId2_0.java
deleted file mode 100644
index 56ae0466d5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaDerivedId2_0.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.jpa2.context.java.JavaDerivedId2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class NullJavaDerivedId2_0
- extends AbstractJavaJpaContextNode
- implements JavaDerivedId2_0
-{
-
- public NullJavaDerivedId2_0(JavaSingleRelationshipMapping2_0 parent) {
- super(parent);
- }
-
- public boolean getValue() {
- return false;
- }
-
- public void setValue(boolean newValue) {
- throw new UnsupportedOperationException();
- }
-
-
- public void initialize() {
- //no-op
- }
-
- public void update() {
- //no-op
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaMapsId2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaMapsId2_0.java
deleted file mode 100644
index eb46ee87cb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaMapsId2_0.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.jpa2.context.java.JavaMapsId2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class NullJavaMapsId2_0
- extends AbstractJavaJpaContextNode
- implements JavaMapsId2_0
-{
- public NullJavaMapsId2_0(JavaSingleRelationshipMapping2_0 parent) {
- super(parent);
- }
-
-
- public String getValue() {
- return null;
- }
-
- public void setValue(String newValue) {
- throw new UnsupportedOperationException();
- }
-
- public void initialize() {
- //no-op
- }
-
- public void update() {
- //no-op
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaOrphanRemoval2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaOrphanRemoval2_0.java
deleted file mode 100644
index 03633a8565..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaOrphanRemoval2_0.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * NullJavaOrphanRemoval2_0
- */
-public class NullJavaOrphanRemoval2_0
- extends AbstractJavaJpaContextNode
- implements JavaOrphanRemovable2_0
-{
- // ********** constructor **********
- public NullJavaOrphanRemoval2_0(JavaOrphanRemovalHolder2_0 parent) {
- super(parent);
- }
-
- // ********** OrphanRemovable2_0 implementation **********
-
- public boolean isOrphanRemoval() {
- return false;
- }
-
- public Boolean getSpecifiedOrphanRemoval() {
- return null;
- }
-
- public boolean isDefaultOrphanRemoval() {
- return false;
- }
-
- public void setSpecifiedOrphanRemoval(Boolean newSpecifiedOrphanRemoval) {
- throw new UnsupportedOperationException();
- }
-
- // ********** JavaOrphanRemovable2_0 implementation **********
-
- public void initialize(JavaResourcePersistentAttribute jrpa) {
- // do nothing
- }
-
- public void update(JavaResourcePersistentAttribute jrpa) {
- // do nothing
- }
-
- // ********** validation **********
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/VirtualAssociationOverride2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/VirtualAssociationOverride2_0Annotation.java
deleted file mode 100644
index 8ef6bcc0f8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/VirtualAssociationOverride2_0Annotation.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.core.context.JoinTableJoiningStrategy;
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.internal.context.java.VirtualAssociationOverrideAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.NullJoinTableAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.AssociationOverride2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember.AnnotationInitializer;
-
-/**
- * javax.persistence.AssociationOverride
- */
-public final class VirtualAssociationOverride2_0Annotation
- extends VirtualAssociationOverrideAnnotation
- implements AssociationOverride2_0Annotation
-{
-
- private final JoinTableAnnotation joinTable;
-
- public VirtualAssociationOverride2_0Annotation(JavaResourcePersistentMember parent, String name, JoiningStrategy joiningStrategy) {
- super(parent, name, joiningStrategy);
- this.joinTable = this.buildJoinTable();
- }
-
- protected JoinTableAnnotation buildJoinTable() {
- if (this.joiningStrategy instanceof JoinTableJoiningStrategy) {
- return new VirtualAssociationOverrideJoinTableAnnotation(this, ((JoinTableJoiningStrategy)this.joiningStrategy).getJoinTable());
- }
- return new NullJoinTableAnnotation(this);
- }
-
- // ***** join table
-
- public JoinTableAnnotation getJoinTable() {
- return this.joinTable;
- }
-
- public JoinTableAnnotation getNonNullJoinTable() {
- return this.joinTable;
- }
-
- public JoinTableAnnotation addJoinTable() {
- throw new UnsupportedOperationException();
- }
-
- public void removeJoinTable() {
- throw new UnsupportedOperationException();
- }
-
- public JoinColumnAnnotation addJoinTable(AnnotationInitializer initializer) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/VirtualAssociationOverrideJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/VirtualAssociationOverrideJoinTableAnnotation.java
deleted file mode 100644
index 62b0475fd2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/VirtualAssociationOverrideJoinTableAnnotation.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.internal.context.java.VirtualAssociationOverrideJoinColumnAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.NullJoinTableAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.AssociationOverride2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-public final class VirtualAssociationOverrideJoinTableAnnotation extends NullJoinTableAnnotation
- implements JoinTableAnnotation
-{
- private JoinTable joinTable; //TODO uniqueConstraints
-
- private final Vector<JoinColumnAnnotation> joinColumns;
-
- private final Vector<JoinColumnAnnotation> inverseJoinColumns;
-
- public VirtualAssociationOverrideJoinTableAnnotation(AssociationOverride2_0Annotation parent, JoinTable joinTable) {
- super(parent);
- this.joinTable = joinTable;
- this.joinColumns = this.buildJoinColumns();
- this.inverseJoinColumns = this.buildInverseJoinColumns();
- }
-
- @Override
- protected JoinTableAnnotation addAnnotation() {
- throw new UnsupportedOperationException();
- }
-
- private Vector<JoinColumnAnnotation> buildJoinColumns() {
- Vector<JoinColumnAnnotation> result = new Vector<JoinColumnAnnotation>(this.joinTable.joinColumnsSize());
- for (JoinColumn joinColumn : CollectionTools.iterable(this.joinTable.joinColumns())) {
- result.add(new VirtualAssociationOverrideJoinColumnAnnotation(this, joinColumn));
- }
- return result;
- }
-
- private Vector<JoinColumnAnnotation> buildInverseJoinColumns() {
- Vector<JoinColumnAnnotation> result = new Vector<JoinColumnAnnotation>(this.joinTable.inverseJoinColumnsSize());
- for (JoinColumn joinColumn : CollectionTools.iterable(this.joinTable.inverseJoinColumns())) {
- result.add(new VirtualAssociationOverrideJoinColumnAnnotation(this, joinColumn));
- }
- return result;
- }
-
- @Override
- public String getName() {
- return this.joinTable.getSpecifiedName();
- }
-
- @Override
- public void setName(String name) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getCatalog() {
- return this.joinTable.getCatalog();
- }
-
- @Override
- public void setCatalog(String catalog) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getSchema() {
- return this.joinTable.getSchema();
- }
-
- @Override
- public void setSchema(String schema) {
- throw new UnsupportedOperationException();
- }
-
- // ***** join columns
- @Override
- public ListIterator<JoinColumnAnnotation> joinColumns() {
- return this.joinColumns.listIterator();
- }
-
- @Override
- public JoinColumnAnnotation joinColumnAt(int index) {
- return this.joinColumns.elementAt(index);
- }
-
- @Override
- public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
- return this.joinColumns.indexOf(joinColumn);
- }
-
- @Override
- public int joinColumnsSize() {
- return this.joinColumns.size();
- }
-
- // ***** inverse join columns
- @Override
- public ListIterator<JoinColumnAnnotation> inverseJoinColumns() {
- return this.inverseJoinColumns.listIterator();
- }
-
- @Override
- public JoinColumnAnnotation inverseJoinColumnAt(int index) {
- return this.inverseJoinColumns.elementAt(index);
- }
-
- @Override
- public int indexOfInverseJoinColumn(JoinColumnAnnotation joinColumn) {
- return this.inverseJoinColumns.indexOf(joinColumn);
- }
-
- @Override
- public int inverseJoinColumnsSize() {
- return this.inverseJoinColumns.size();
- }
-
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmAssociationOverrideRelationshipReference2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmAssociationOverrideRelationshipReference2_0.java
deleted file mode 100644
index a24cd1bb13..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmAssociationOverrideRelationshipReference2_0.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.AssociationOverrideRelationshipReference;
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAssociationOverrideRelationshipReference;
-import org.eclipse.jpt.core.jpa2.context.AssociationOverrideRelationshipReference2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmAssociationOverrideRelationshipReference2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmJoinTableInAssociationOverrideJoiningStrategy2_0;
-import org.eclipse.jpt.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmAssociationOverrideRelationshipReference2_0 extends AbstractOrmAssociationOverrideRelationshipReference
- implements OrmAssociationOverrideRelationshipReference2_0
-{
-
- protected OrmJoinTableInAssociationOverrideJoiningStrategy2_0 joinTableJoiningStrategy;
-
- // cache the strategy for property change notification
- protected JoiningStrategy cachedPredominantJoiningStrategy;
-
- public GenericOrmAssociationOverrideRelationshipReference2_0(OrmAssociationOverride parent, XmlAssociationOverride xao) {
- super(parent, xao);
- }
-
- protected OrmJoinTableInAssociationOverrideJoiningStrategy2_0 buildJoinTableJoiningStrategy(XmlAssociationOverride xao) {
- return new GenericOrmJoinTableInAssociationOverrideJoiningStrategy2_0(this, xao);
- }
-
- @Override
- public void initializeFrom(AssociationOverrideRelationshipReference oldAssociationOverride) {
- if (oldAssociationOverride.getJoinColumnJoiningStrategy().hasSpecifiedJoinColumns()) {
- getJoinColumnJoiningStrategy().initializeFrom(oldAssociationOverride.getJoinColumnJoiningStrategy());
- }
- else {
- getJoinTableJoiningStrategy().initializeFrom(((AssociationOverrideRelationshipReference2_0) oldAssociationOverride).getJoinTableJoiningStrategy());
- }
- }
-
- @Override
- protected void initializeJoiningStrategies(org.eclipse.jpt.core.resource.orm.XmlAssociationOverride xao) {
- super.initializeJoiningStrategies(xao);
- this.joinTableJoiningStrategy = buildJoinTableJoiningStrategy((XmlAssociationOverride) xao);
- }
-
- @Override
- protected void updateJoiningStrategies(org.eclipse.jpt.core.resource.orm.XmlAssociationOverride xao) {
- super.updateJoiningStrategies(xao);
- this.joinTableJoiningStrategy.update((XmlAssociationOverride) xao);
- }
-
- @Override
- protected JoiningStrategy calculatePredominantJoiningStrategy() {
- if (this.joinColumnJoiningStrategy.hasSpecifiedJoinColumns()) {
- return this.joinColumnJoiningStrategy;
- }
- return this.joinTableJoiningStrategy;
- }
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
-// if (this.connectionProfileIsActive()) {
-// this.validateJoinTable(messages, astRoot);
-// }
- }
-
-
-
- // **************** join table *******************************************
-
-
- public OrmJoinTableInAssociationOverrideJoiningStrategy2_0 getJoinTableJoiningStrategy() {
- return this.joinTableJoiningStrategy;
- }
-
- public boolean usesJoinTableJoiningStrategy() {
- return getPredominantJoiningStrategy() == this.joinTableJoiningStrategy;
- }
-
- public void setJoinTableJoiningStrategy() {
- this.joinTableJoiningStrategy.addStrategy();
- this.joinColumnJoiningStrategy.removeStrategy();
- }
-
- public void unsetJoinTableJoiningStrategy() {
- this.joinTableJoiningStrategy.removeStrategy();
- }
-
- public boolean mayHaveDefaultJoinTable() {
- return getAssociationOverride().isVirtual();
- }
-
- @Override
- public void setJoinColumnJoiningStrategy() {
- super.setJoinColumnJoiningStrategy();
- this.joinTableJoiningStrategy.removeStrategy();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmCacheable2_0.java
deleted file mode 100644
index da3d2fcb2a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmCacheable2_0.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c)2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheableHolder2_0;
-import org.eclipse.jpt.core.resource.orm.v2_0.XmlCacheable_2_0;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class GenericOrmCacheable2_0 extends AbstractOrmXmlContextNode
- implements OrmCacheable2_0
-{
- protected final XmlCacheable_2_0 resource;
-
- protected boolean defaultCacheable;
-
- protected Boolean specifiedCacheable;
-
-
- public GenericOrmCacheable2_0(OrmCacheableHolder2_0 parent, XmlCacheable_2_0 resource) {
- super(parent);
- this.resource = resource;
- this.specifiedCacheable = this.getResourceCacheable();
- }
-
- @Override
- public OrmCacheableHolder2_0 getParent() {
- return (OrmCacheableHolder2_0) super.getParent();
- }
-
- public boolean isCacheable() {
- return (this.specifiedCacheable != null) ? this.specifiedCacheable.booleanValue() : this.defaultCacheable;
- }
-
- public boolean isDefaultCacheable() {
- return this.defaultCacheable;
- }
-
- protected void setDefaultCacheable(boolean newDefaultCacheable) {
- boolean oldDefaultCacheable = this.defaultCacheable;
- this.defaultCacheable = newDefaultCacheable;
- firePropertyChanged(DEFAULT_CACHEABLE_PROPERTY, oldDefaultCacheable, newDefaultCacheable);
- }
-
- public Boolean getSpecifiedCacheable() {
- return this.specifiedCacheable;
- }
-
- public void setSpecifiedCacheable(Boolean newSpecifiedCacheable) {
- Boolean oldSpecifiedCacheable = this.specifiedCacheable;
- this.specifiedCacheable = newSpecifiedCacheable;
- this.resource.setCacheable(newSpecifiedCacheable);
- firePropertyChanged(SPECIFIED_CACHEABLE_PROPERTY, oldSpecifiedCacheable, newSpecifiedCacheable);
- }
-
- protected void setSpecifiedCacheable_(Boolean newSpecifiedCacheable) {
- Boolean oldSpecifiedCacheable = this.specifiedCacheable;
- this.specifiedCacheable = newSpecifiedCacheable;
- firePropertyChanged(SPECIFIED_CACHEABLE_PROPERTY, oldSpecifiedCacheable, newSpecifiedCacheable);
- }
-
-
- // **************** initialize/update **************************************
-
- public void update() {
- setSpecifiedCacheable_(this.getResourceCacheable());
- setDefaultCacheable(this.calculateDefaultCacheable());
- }
-
- protected Boolean getResourceCacheable() {
- return this.resource.getCacheable();
- }
-
- protected boolean calculateDefaultCacheable() {
- return getParent().calculateDefaultCacheable();
- }
-
-
- // **************** validation **************************************
-
- public TextRange getValidationTextRange() {
- return this.resource.getCacheableTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmDerivedId2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmDerivedId2_0.java
deleted file mode 100644
index 316f1f83f6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmDerivedId2_0.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmDerivedId2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.resource.orm.v2_0.XmlDerivedId_2_0;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmDerivedId2_0
- extends AbstractOrmXmlContextNode
- implements OrmDerivedId2_0
-{
- protected XmlDerivedId_2_0 resource;
-
- protected boolean value;
-
-
- public GenericOrmDerivedId2_0(OrmSingleRelationshipMapping2_0 parent, XmlDerivedId_2_0 resource) {
- super(parent);
- this.resource = resource;
- this.value = getResourceToContextValue();
- }
-
-
- @Override
- public OrmSingleRelationshipMapping2_0 getParent() {
- return (OrmSingleRelationshipMapping2_0) super.getParent();
- }
-
- public boolean getValue() {
- return this.value;
- }
-
- public void setValue(boolean newValue) {
- boolean oldValue = this.value;
- this.value = newValue;
- this.resource.setId(getContextToResourceValue());
- firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
- }
-
- protected void setValue_(boolean newValue) {
- boolean oldValue = this.value;
- this.value = newValue;
- firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
- }
-
- public void update() {
- setValue_(getResourceToContextValue());
- }
-
- protected boolean getResourceToContextValue() {
- return (resource.getId() == null) ? false : resource.getId().booleanValue();
- }
-
- protected Boolean getContextToResourceValue() {
- return (this.value) ? Boolean.TRUE : null;
- }
-
- public TextRange getValidationTextRange() {
- return this.resource.getDerivedIdTextRange();
- }
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- // no validation rules
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java
deleted file mode 100644
index 3bbc026761..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0, which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.Fetchable;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAttributeMapping;
-import org.eclipse.jpt.core.jpa2.MappingKeys2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmElementCollectionMapping2_0;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.core.resource.orm.XmlElementCollection;
-
-
-public class GenericOrmElementCollectionMapping2_0
- extends AbstractOrmAttributeMapping<XmlElementCollection>
- implements OrmElementCollectionMapping2_0
-{
-
- protected FetchType specifiedFetch;
-
- public GenericOrmElementCollectionMapping2_0(OrmPersistentAttribute parent, XmlElementCollection resourceMapping) {
- super(parent, resourceMapping);
- this.specifiedFetch = this.getResourceFetch();
- }
-
- @Override
- public void update() {
- super.update();
- this.setSpecifiedFetch_(this.getResourceFetch());
- }
-
- //************* AttributeMapping implementation ***************
-
- public String getKey() {
- return MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY;
- }
-
- //************* OrmAttributeMapping implementation ***************
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmAttributeMapping(this);
- }
-
- public int getXmlSequence() {
- return 75;
- }
-
- public void addToResourceModel(Attributes resourceAttributes) {
- resourceAttributes.getElementCollections().add(this.resourceAttributeMapping);
- }
-
- public void removeFromResourceModel(Attributes resourceAttributes) {
- resourceAttributes.getElementCollections().remove(this.resourceAttributeMapping);
- }
-
-
- //************* Fetchable *************
-
- public FetchType getFetch() {
- return (this.getSpecifiedFetch() == null) ? this.getDefaultFetch() : this.getSpecifiedFetch();
- }
-
- public FetchType getDefaultFetch() {
- return DEFAULT_FETCH_TYPE;
- }
-
- public FetchType getSpecifiedFetch() {
- return this.specifiedFetch;
- }
-
- public void setSpecifiedFetch(FetchType newSpecifiedFetch) {
- FetchType oldFetch = this.specifiedFetch;
- this.specifiedFetch = newSpecifiedFetch;
- this.resourceAttributeMapping.setFetch(FetchType.toOrmResourceModel(newSpecifiedFetch));
- firePropertyChanged(Fetchable.SPECIFIED_FETCH_PROPERTY, oldFetch, newSpecifiedFetch);
- }
-
- protected void setSpecifiedFetch_(FetchType newSpecifiedFetch) {
- FetchType oldFetch = this.specifiedFetch;
- this.specifiedFetch = newSpecifiedFetch;
- firePropertyChanged(Fetchable.SPECIFIED_FETCH_PROPERTY, oldFetch, newSpecifiedFetch);
- }
-
- protected FetchType getResourceFetch() {
- return FetchType.fromOrmResourceModel(this.resourceAttributeMapping.getFetch());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmEmbeddable2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmEmbeddable2_0.java
deleted file mode 100644
index 0c73b1073a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmEmbeddable2_0.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmEmbeddable;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaEmbeddable2_0;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddable;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-
-
-public class GenericOrmEmbeddable2_0
- extends AbstractOrmEmbeddable
-{
- public GenericOrmEmbeddable2_0(OrmPersistentType parent, XmlEmbeddable resourceMapping) {
- super(parent, resourceMapping);
- }
-
- @Override
- public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
- return ArrayTools.contains(GenericJavaEmbeddable2_0.ALLOWED_ATTRIBUTE_MAPPING_KEYS, attributeMappingKey);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmJoinTableInAssociationOverrideJoiningStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmJoinTableInAssociationOverrideJoiningStrategy2_0.java
deleted file mode 100644
index 138a4921b1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmJoinTableInAssociationOverrideJoiningStrategy2_0.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmJoinTableJoiningStrategy;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmAssociationOverrideRelationshipReference2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmJoinTableInAssociationOverrideJoiningStrategy2_0;
-import org.eclipse.jpt.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class GenericOrmJoinTableInAssociationOverrideJoiningStrategy2_0
- extends AbstractOrmJoinTableJoiningStrategy
- implements OrmJoinTableInAssociationOverrideJoiningStrategy2_0
-{
- protected transient XmlAssociationOverride resourceAssociationOverride;
-
- public GenericOrmJoinTableInAssociationOverrideJoiningStrategy2_0(OrmAssociationOverrideRelationshipReference2_0 parent, XmlAssociationOverride xao) {
- super(parent);
- this.resourceAssociationOverride = xao;
- this.initialize();
- }
-
- public boolean isOverridableAssociation() {
- return false;
- }
-
- @Override
- public OrmAssociationOverrideRelationshipReference2_0 getRelationshipReference() {
- return (OrmAssociationOverrideRelationshipReference2_0) super.getRelationshipReference();
- }
-
- // **************** join table *********************************************
-
- @Override
- protected void setResourceJoinTable(XmlJoinTable resourceJoinTable) {
- this.resourceAssociationOverride.setJoinTable(resourceJoinTable);
- }
-
- public XmlJoinTable getResourceJoinTable() {
- return this.resourceAssociationOverride.getJoinTable();
- }
-
- public void removeResourceJoinTable() {
- this.resourceAssociationOverride.setJoinTable(null);
- }
-
- public void update(XmlAssociationOverride resourceAssociationOverride) {
- this.resourceAssociationOverride = resourceAssociationOverride;
- super.update();
- }
-
- public TextRange getValidationTextRange() {
- return this.resourceAssociationOverride.getValidationTextRange();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmMapsId2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmMapsId2_0.java
deleted file mode 100644
index ec6497ec20..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmMapsId2_0.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmMapsId2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.resource.orm.v2_0.XmlMapsId_2_0;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmMapsId2_0
- extends AbstractOrmXmlContextNode
- implements OrmMapsId2_0
-{
- protected XmlMapsId_2_0 resource;
-
- protected String value;
-
-
- public GenericOrmMapsId2_0(OrmSingleRelationshipMapping2_0 parent, XmlMapsId_2_0 resource) {
- super(parent);
- this.resource = resource;
- this.value = this.resource.getMapsId();
- }
-
-
- @Override
- public OrmSingleRelationshipMapping2_0 getParent() {
- return (OrmSingleRelationshipMapping2_0) super.getParent();
- }
-
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String newValue) {
- String oldValue = this.value;
- this.value = newValue;
- this.resource.setMapsId(this.value);
- firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
- }
-
- protected void setValue_(String newValue) {
- String oldValue = this.value;
- this.value = newValue;
- firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
- }
-
- public void update() {
- setValue_(this.resource.getMapsId());
- }
-
- public TextRange getValidationTextRange() {
- return this.resource.getMapsIdTextRange();
- }
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- // no validation rules
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java
deleted file mode 100644
index 922adcbe75..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmQuery;
-import org.eclipse.jpt.core.jpa2.context.LockModeType_2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmNamedQuery2_0;
-import org.eclipse.jpt.core.resource.orm.XmlNamedQuery;
-
-/**
- * GenericOrmNamedQuery2_0
- */
-public class GenericOrmNamedQuery2_0 extends AbstractOrmQuery<XmlNamedQuery>
- implements OrmNamedQuery2_0
-{
- private LockModeType_2_0 specifiedLockMode;
- private LockModeType_2_0 defaultLockMode;
-
- // ********** constructor **********
- public GenericOrmNamedQuery2_0(XmlContextNode parent, XmlNamedQuery resourceNamedQuery) {
- super(parent, resourceNamedQuery);
- }
-
- // ********** NamedQuery2_0 implementation **********
-
- public LockModeType_2_0 getLockMode() {
- return (this.specifiedLockMode != null) ? this.specifiedLockMode : this.defaultLockMode;
- }
-
- public LockModeType_2_0 getSpecifiedLockMode() {
- return this.specifiedLockMode;
- }
-
- public void setSpecifiedLockMode(LockModeType_2_0 lockMode) {
- LockModeType_2_0 old = this.specifiedLockMode;
- this.specifiedLockMode = lockMode;
- this.getResourceQuery().setLockMode(LockModeType_2_0.toOrmResourceModel(lockMode));
- this.firePropertyChanged(SPECIFIED_LOCK_MODE_PROPERTY, old, lockMode);
- }
-
- public void setSpecifiedLockMode_(LockModeType_2_0 lockMode) {
- LockModeType_2_0 old = this.specifiedLockMode;
- this.specifiedLockMode = lockMode;
- this.firePropertyChanged(SPECIFIED_LOCK_MODE_PROPERTY, old, lockMode);
- }
-
- public LockModeType_2_0 getDefaultLockMode() {
- return this.defaultLockMode;
- }
-
- protected void setDefaultLockMode(LockModeType_2_0 lockMode) {
- LockModeType_2_0 old = this.defaultLockMode;
- this.defaultLockMode = lockMode;
- this.firePropertyChanged(DEFAULT_LOCK_MODE_PROPERTY, old, lockMode);
- }
-
- // ********** resource => context **********
-
- @Override
- protected void initialize(XmlNamedQuery xmlQuery) {
- super.initialize(xmlQuery);
-
- this.specifiedLockMode = this.getResourceLockModeOf(xmlQuery);
- }
-
- @Override
- public void update(XmlNamedQuery xmlQuery) {
- super.update(xmlQuery);
-
- this.setSpecifiedLockMode_(this.getResourceLockModeOf(xmlQuery));
- }
-
- private LockModeType_2_0 getResourceLockModeOf(XmlNamedQuery xmlQuery) {
- return LockModeType_2_0.fromOrmResourceModel(xmlQuery.getLockMode());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java
deleted file mode 100644
index 864252f7ea..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.orm.OrmNamedColumn;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmNamedColumn;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrderColumn2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrderable2_0;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlOrderColumn;
-import org.eclipse.jpt.core.resource.orm.v2_0.XmlOrderable_2_0;
-import org.eclipse.jpt.core.utility.TextRange;
-
-
-public class GenericOrmOrderColumn2_0
- extends AbstractOrmNamedColumn<XmlOrderColumn>
- implements OrmOrderColumn2_0
-{
- protected Boolean specifiedNullable;
-
- protected Boolean specifiedInsertable;
-
- protected Boolean specifiedUpdatable;
-
- protected XmlOrderable_2_0 xmlOrderable;
-
- public GenericOrmOrderColumn2_0(OrmOrderable2_0 parent, OrmNamedColumn.Owner owner) {
- super(parent, owner);
- }
-
- @Override
- public XmlOrderColumn getResourceColumn() {
- return this.xmlOrderable.getOrderColumn();
- }
-
- @Override
- protected void addResourceColumn() {
- this.xmlOrderable.setOrderColumn(OrmFactory.eINSTANCE.createXmlOrderColumn());
- }
-
- @Override
- protected void removeResourceColumn() {
- this.xmlOrderable.setOrderColumn(null);
- }
-
- public boolean isResourceSpecified() {
- return getResourceColumn() != null;
- }
-
- @Override
- protected void removeResourceColumnIfFeaturesUnset() {
- //override to do nothing
- //don't want to remove the order-column element if it's features are all set to null
- }
-
- public boolean isNullable() {
- return (this.getSpecifiedNullable() == null) ? this.isDefaultNullable() : this.getSpecifiedNullable().booleanValue();
- }
-
- public boolean isDefaultNullable() {
- return BaseColumn.DEFAULT_NULLABLE;
- }
-
- public Boolean getSpecifiedNullable() {
- return this.specifiedNullable;
- }
-
- public void setSpecifiedNullable(Boolean newSpecifiedNullable) {
- Boolean oldSpecifiedNullable = this.specifiedNullable;
- this.specifiedNullable = newSpecifiedNullable;
- if (this.valuesAreDifferent(oldSpecifiedNullable, newSpecifiedNullable)) {
- if (this.getResourceColumn() != null) {
- this.getResourceColumn().setNullable(newSpecifiedNullable);
- this.removeResourceColumnIfFeaturesUnset();
- }
- else if (newSpecifiedNullable != null) {
- addResourceColumn();
- getResourceColumn().setNullable(newSpecifiedNullable);
- }
- }
- firePropertyChanged(BaseColumn.SPECIFIED_NULLABLE_PROPERTY, oldSpecifiedNullable, newSpecifiedNullable);
- }
-
- protected void setSpecifiedNullable_(Boolean newSpecifiedNullable) {
- Boolean oldSpecifiedNullable = this.specifiedNullable;
- this.specifiedNullable = newSpecifiedNullable;
- firePropertyChanged(BaseColumn.SPECIFIED_NULLABLE_PROPERTY, oldSpecifiedNullable, newSpecifiedNullable);
- }
-
- public boolean isInsertable() {
- return (this.getSpecifiedInsertable() == null) ? this.isDefaultInsertable() : this.getSpecifiedInsertable().booleanValue();
- }
-
- public boolean isDefaultInsertable() {
- return BaseColumn.DEFAULT_INSERTABLE;
- }
-
- public Boolean getSpecifiedInsertable() {
- return this.specifiedInsertable;
- }
-
- public void setSpecifiedInsertable(Boolean newSpecifiedInsertable) {
- Boolean oldSpecifiedInsertable = this.specifiedInsertable;
- this.specifiedInsertable = newSpecifiedInsertable;
- if (this.valuesAreDifferent(oldSpecifiedInsertable, newSpecifiedInsertable)) {
- if (this.getResourceColumn() != null) {
- this.getResourceColumn().setInsertable(newSpecifiedInsertable);
- this.removeResourceColumnIfFeaturesUnset();
- }
- else if (newSpecifiedInsertable != null) {
- addResourceColumn();
- getResourceColumn().setInsertable(newSpecifiedInsertable);
- }
- }
- firePropertyChanged(BaseColumn.SPECIFIED_INSERTABLE_PROPERTY, oldSpecifiedInsertable, newSpecifiedInsertable);
- }
-
- protected void setSpecifiedInsertable_(Boolean newSpecifiedInsertable) {
- Boolean oldSpecifiedInsertable = this.specifiedInsertable;
- this.specifiedInsertable = newSpecifiedInsertable;
- firePropertyChanged(BaseColumn.SPECIFIED_INSERTABLE_PROPERTY, oldSpecifiedInsertable, newSpecifiedInsertable);
- }
-
- public boolean isUpdatable() {
- return (this.getSpecifiedUpdatable() == null) ? this.isDefaultUpdatable() : this.getSpecifiedUpdatable().booleanValue();
- }
-
- public boolean isDefaultUpdatable() {
- return BaseColumn.DEFAULT_UPDATABLE;
- }
-
- public Boolean getSpecifiedUpdatable() {
- return this.specifiedUpdatable;
- }
-
- public void setSpecifiedUpdatable(Boolean newSpecifiedUpdatable) {
- Boolean oldSpecifiedUpdatable = this.specifiedUpdatable;
- this.specifiedUpdatable = newSpecifiedUpdatable;
- if (this.valuesAreDifferent(oldSpecifiedUpdatable, newSpecifiedUpdatable)) {
- if (this.getResourceColumn() != null) {
- this.getResourceColumn().setUpdatable(newSpecifiedUpdatable);
- this.removeResourceColumnIfFeaturesUnset();
- }
- else if (newSpecifiedUpdatable != null) {
- addResourceColumn();
- getResourceColumn().setUpdatable(newSpecifiedUpdatable);
- }
- }
- firePropertyChanged(BaseColumn.SPECIFIED_UPDATABLE_PROPERTY, oldSpecifiedUpdatable, newSpecifiedUpdatable);
- }
-
- protected void setSpecifiedUpdatable_(Boolean newSpecifiedUpdatable) {
- Boolean oldSpecifiedUpdatable = this.specifiedUpdatable;
- this.specifiedUpdatable = newSpecifiedUpdatable;
- firePropertyChanged(BaseColumn.SPECIFIED_UPDATABLE_PROPERTY, oldSpecifiedUpdatable, newSpecifiedUpdatable);
- }
-
- public void initialize(XmlOrderable_2_0 xmlOrderable) {
- this.xmlOrderable = xmlOrderable;
- this.initialize(this.getResourceColumn());
- }
-
- public void update(XmlOrderable_2_0 xmlOrderable) {
- this.xmlOrderable = xmlOrderable;
- this.update(this.getResourceColumn());
- }
-
- @Override
- protected void initialize(XmlOrderColumn column) {
- super.initialize(column);
- this.specifiedNullable = this.getResourceNullable(column);
- this.specifiedUpdatable = this.getResourceUpdatable(column);
- this.specifiedInsertable = this.getResourceInsertable(column);
- }
-
- @Override
- protected void update(XmlOrderColumn column) {
- super.update(column);
- setSpecifiedNullable_(this.getResourceNullable(column));
- setSpecifiedUpdatable_(this.getResourceUpdatable(column));
- setSpecifiedInsertable_(this.getResourceInsertable(column));
- }
-
- protected Boolean getResourceNullable(XmlOrderColumn column) {
- return column == null ? null : column.getNullable();
- }
-
- protected Boolean getResourceUpdatable(XmlOrderColumn column) {
- return column == null ? null : column.getUpdatable();
- }
-
-
- protected Boolean getResourceInsertable(XmlOrderColumn column) {
- return column == null ? null : column.getInsertable();
- }
-
- @Override
- public TextRange getValidationTextRange() {
- TextRange textRange = getResourceColumn().getValidationTextRange();
- return (textRange != null) ? textRange : this.getOwner().getValidationTextRange();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOrphanRemoval2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOrphanRemoval2_0.java
deleted file mode 100644
index 2402b9381a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOrphanRemoval2_0.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.resource.orm.v2_0.XmlOrphanRemovable_2_0;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * GenericOrmOrphanRemoval2_0
- */
-public class GenericOrmOrphanRemoval2_0 extends AbstractOrmXmlContextNode
- implements OrmOrphanRemovable2_0
-{
- protected final XmlOrphanRemovable_2_0 resource;
- protected boolean defaultOrphanRemoval;
- protected Boolean specifiedOrphanRemoval;
-
- // ********** constructor **********
- public GenericOrmOrphanRemoval2_0(OrmOrphanRemovalHolder2_0 parent, XmlOrphanRemovable_2_0 resource) {
- super(parent);
- this.resource = resource;
- this.specifiedOrphanRemoval = this.getResourceOrphanRemoval();
- }
-
- @Override
- public OrmOrphanRemovalHolder2_0 getParent() {
- return (OrmOrphanRemovalHolder2_0) super.getParent();
- }
-
- // ********** OrphanRemovable2_0 implementation **********
-
- public boolean isOrphanRemoval() {
- return (this.specifiedOrphanRemoval != null) ? this.specifiedOrphanRemoval.booleanValue() : this.defaultOrphanRemoval;
- }
-
- public Boolean getSpecifiedOrphanRemoval() {
- return this.specifiedOrphanRemoval;
- }
-
- public boolean isDefaultOrphanRemoval() {
- return this.defaultOrphanRemoval;
- }
-
- public void setSpecifiedOrphanRemoval(Boolean newSpecifiedOrphanRemoval) {
- Boolean old = this.specifiedOrphanRemoval;
- this.specifiedOrphanRemoval = newSpecifiedOrphanRemoval;
- this.resource.setOrphanRemoval(newSpecifiedOrphanRemoval);
- this.firePropertyChanged(SPECIFIED_ORPHAN_REMOVAL_PROPERTY, old, newSpecifiedOrphanRemoval);
- }
-
- protected void setSpecifiedOrphanRemoval_(Boolean newSpecifiedOrphanRemoval) {
- Boolean old = this.specifiedOrphanRemoval;
- this.specifiedOrphanRemoval = newSpecifiedOrphanRemoval;
- this.firePropertyChanged(SPECIFIED_ORPHAN_REMOVAL_PROPERTY, old, newSpecifiedOrphanRemoval);
- }
-
- // ********** initialize/update **********
- public void update() {
- this.setSpecifiedOrphanRemoval_(this.getResourceOrphanRemoval());
- }
-
- // ********** validation **********
- public TextRange getValidationTextRange() {
- // TODO
- return null;
- }
-
- protected Boolean getResourceOrphanRemoval() {
- return this.resource.getOrphanRemoval();
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmPersistentAttribute2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmPersistentAttribute2_0.java
deleted file mode 100644
index c4bfc6940a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmPersistentAttribute2_0.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmPersistentAttribute;
-import org.eclipse.jpt.core.resource.orm.XmlAccessHolder;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-
-
-public class GenericOrmPersistentAttribute2_0
- extends AbstractOrmPersistentAttribute
-{
-
- protected AccessType specifiedAccess;
-
- public GenericOrmPersistentAttribute2_0(OrmPersistentType parent, Owner owner, XmlAttributeMapping resourceMapping) {
- super(parent, owner, resourceMapping);
- this.specifiedAccess = getResourceAccess();
- }
-
- public AccessType getSpecifiedAccess() {
- return this.specifiedAccess;
- }
-
- public void setSpecifiedAccess(AccessType newSpecifiedAccess) {
- AccessType oldAccess = this.specifiedAccess;
- this.specifiedAccess = newSpecifiedAccess;
- ((XmlAccessHolder) this.getResourceAttributeMapping()).setAccess(AccessType.toOrmResourceModel(newSpecifiedAccess));
- firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, oldAccess, newSpecifiedAccess);
- }
-
- protected void setSpecifiedAccess_(AccessType newSpecifiedAccess) {
- AccessType oldAccess = this.specifiedAccess;
- this.specifiedAccess = newSpecifiedAccess;
- firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, oldAccess, newSpecifiedAccess);
- }
-
- @Override
- public void update() {
- super.update();
- setSpecifiedAccess_(getResourceAccess());
- }
-
- protected AccessType getResourceAccess() {
- return AccessType.fromOrmResourceModel(((XmlAccessHolder) getResourceAttributeMapping()).getAccess());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmSequenceGenerator2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmSequenceGenerator2_0.java
deleted file mode 100644
index 25a055bc9a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmSequenceGenerator2_0.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmSequenceGenerator;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmSequenceGenerator2_0;
-import org.eclipse.jpt.core.resource.orm.XmlSequenceGenerator;
-
-/**
- * Generic2_0OrmSequenceGenerator
- */
-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 resourceSequenceGenerator) {
- super(parent, resourceSequenceGenerator);
- }
-
- // ********** catalog **********
-
- @Override
- public String getCatalog() {
- return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog;
- }
-
- public String getSpecifiedCatalog() {
- return this.specifiedCatalog;
- }
-
- public void setSpecifiedCatalog(String catalog) {
- String old = this.specifiedCatalog;
- this.specifiedCatalog = catalog;
- this.getResourceGenerator().setCatalog(catalog);
- this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, 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;
- 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) {
- String old = this.specifiedSchema;
- this.specifiedSchema = schema;
- this.getResourceGenerator().setSchema(schema);
- this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, 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();
- }
-
- // ********** resource => context **********
-
- @Override
- protected void initialize(org.eclipse.jpt.core.resource.orm.XmlSequenceGenerator xmlResource) {
- super.initialize(xmlResource);
- XmlSequenceGenerator xmlResource2_0 = (XmlSequenceGenerator) xmlResource;
-
- this.defaultCatalog = this.buildDefaultCatalog();
- this.specifiedCatalog = xmlResource2_0.getCatalog();
- this.defaultSchema = this.buildDefaultSchema();
- this.specifiedSchema = xmlResource2_0.getSchema();
- }
-
- @Override
- public void update(org.eclipse.jpt.core.resource.orm.XmlSequenceGenerator xmlResource) {
- super.update(xmlResource);
- XmlSequenceGenerator xmlResource2_0 = (XmlSequenceGenerator) xmlResource;
-
- this.setDefaultCatalog(this.buildDefaultCatalog());
- this.setSpecifiedCatalog_(xmlResource2_0.getCatalog());
- this.setDefaultSchema(this.buildDefaultSchema());
- this.setSpecifiedSchema_(xmlResource2_0.getSchema());
- }
-
- @Override
- protected XmlSequenceGenerator getResourceGenerator() {
- return (XmlSequenceGenerator) super.getResourceGenerator();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmXml2_0ContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmXml2_0ContextNodeFactory.java
deleted file mode 100644
index fc9b028744..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmXml2_0ContextNodeFactory.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaBasicMapping;
-import org.eclipse.jpt.core.context.java.JavaEmbeddedIdMapping;
-import org.eclipse.jpt.core.context.java.JavaEmbeddedMapping;
-import org.eclipse.jpt.core.context.java.JavaIdMapping;
-import org.eclipse.jpt.core.context.java.JavaManyToManyMapping;
-import org.eclipse.jpt.core.context.java.JavaManyToOneMapping;
-import org.eclipse.jpt.core.context.java.JavaOneToManyMapping;
-import org.eclipse.jpt.core.context.java.JavaOneToOneMapping;
-import org.eclipse.jpt.core.context.java.JavaTransientMapping;
-import org.eclipse.jpt.core.context.java.JavaVersionMapping;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideRelationshipReference;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddable;
-import org.eclipse.jpt.core.context.orm.OrmNamedQuery;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmSequenceGenerator;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer.Owner;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmAssociationOverrideContainer;
-import org.eclipse.jpt.core.jpa2.context.java.JavaElementCollectionMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaManyToOneMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOneToManyMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOneToOneMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheableHolder2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmDerivedId2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmElementCollectionMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmEmbeddedMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmMapsId2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.jpt.core.resource.orm.XmlAssociationOverrideContainer;
-import org.eclipse.jpt.core.resource.orm.XmlBasic;
-import org.eclipse.jpt.core.resource.orm.XmlElementCollection;
-import org.eclipse.jpt.core.resource.orm.XmlEmbedded;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddedId;
-import org.eclipse.jpt.core.resource.orm.XmlId;
-import org.eclipse.jpt.core.resource.orm.XmlManyToMany;
-import org.eclipse.jpt.core.resource.orm.XmlManyToOne;
-import org.eclipse.jpt.core.resource.orm.XmlNamedQuery;
-import org.eclipse.jpt.core.resource.orm.XmlNullAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlOneToMany;
-import org.eclipse.jpt.core.resource.orm.XmlOneToOne;
-import org.eclipse.jpt.core.resource.orm.XmlTransient;
-import org.eclipse.jpt.core.resource.orm.XmlVersion;
-import org.eclipse.jpt.core.resource.orm.v2_0.XmlCacheable_2_0;
-import org.eclipse.jpt.core.resource.orm.v2_0.XmlDerivedId_2_0;
-import org.eclipse.jpt.core.resource.orm.v2_0.XmlMapsId_2_0;
-import org.eclipse.jpt.core.resource.orm.v2_0.XmlOrphanRemovable_2_0;
-
-public class GenericOrmXml2_0ContextNodeFactory extends AbstractOrmXmlContextNodeFactory
-{
-
- @Override
- public OrmEmbeddable buildOrmEmbeddable(OrmPersistentType parent, org.eclipse.jpt.core.resource.orm.XmlEmbeddable resourceMapping) {
- return new GenericOrmEmbeddable2_0(parent, resourceMapping);
- }
-
- @Override
- public OrmPersistentAttribute buildOrmPersistentAttribute(OrmPersistentType parent, OrmPersistentAttribute.Owner owner, org.eclipse.jpt.core.resource.orm.XmlAttributeMapping resourceMapping) {
- return new GenericOrmPersistentAttribute2_0(parent, owner, resourceMapping);
- }
-
- @Override
- public OrmAssociationOverrideRelationshipReference buildOrmAssociationOverrideRelationshipReference(OrmAssociationOverride parent, org.eclipse.jpt.core.resource.orm.XmlAssociationOverride associationOverride) {
- return new GenericOrmAssociationOverrideRelationshipReference2_0(parent, associationOverride);
- }
-
- @Override
- public OrmSequenceGenerator buildOrmSequenceGenerator(XmlContextNode parent, org.eclipse.jpt.core.resource.orm.XmlSequenceGenerator resourceSequenceGenerator) {
- return new GenericOrmSequenceGenerator2_0(parent, resourceSequenceGenerator);
- }
-
- @Override
- public OrmAssociationOverrideContainer buildOrmAssociationOverrideContainer(
- OrmEmbeddedMapping2_0 parent,
- Owner owner,
- XmlAssociationOverrideContainer resourceAssociationOverrideContainer) {
-
- return new GenericOrmAssociationOverrideContainer(parent, owner, resourceAssociationOverrideContainer);
- }
-
- @Override
- public OrmDerivedId2_0 buildOrmDerivedId(
- OrmSingleRelationshipMapping2_0 parent, XmlDerivedId_2_0 resource) {
-
- return new GenericOrmDerivedId2_0(parent, resource);
- }
-
- @Override
- public OrmElementCollectionMapping2_0 buildOrmElementCollectionMapping2_0(
- OrmPersistentAttribute parent, XmlElementCollection resourceMapping) {
-
- return new GenericOrmElementCollectionMapping2_0(parent, resourceMapping);
- }
-
- @Override
- public OrmMapsId2_0 buildOrmMapsId(
- OrmSingleRelationshipMapping2_0 parent, XmlMapsId_2_0 resource) {
-
- return new GenericOrmMapsId2_0(parent, resource);
- }
-
- @Override
- public OrmCacheable2_0 buildOrmCacheable(OrmCacheableHolder2_0 parent, XmlCacheable_2_0 resource) {
- return new GenericOrmCacheable2_0(parent, resource);
- }
-
- @Override
- public OrmOrphanRemovable2_0 buildOrmOrphanRemoval(OrmOrphanRemovalHolder2_0 parent, XmlOrphanRemovable_2_0 resource) {
- return new GenericOrmOrphanRemoval2_0(parent, resource);
- }
-
- @Override
- public OrmNamedQuery buildOrmNamedQuery(XmlContextNode parent, XmlNamedQuery resourceNamedQuery) {
- return new GenericOrmNamedQuery2_0(parent, resourceNamedQuery);
- }
-
-
- // ********** ORM Virtual Resource Model **********
-
- @Override
- public XmlAssociationOverride buildVirtualXmlAssociationOverride(String name, OrmTypeMapping parent, JoiningStrategy joiningStrategy) {
- return new VirtualXmlAssociationOverride2_0(name, parent, joiningStrategy);
- }
-
- @Override
- public XmlBasic buildVirtualXmlBasic(OrmTypeMapping ormTypeMapping, JavaBasicMapping javaBasicMapping) {
- return new VirtualXmlBasic2_0(ormTypeMapping, javaBasicMapping);
- }
-
- @Override
- public XmlId buildVirtualXmlId(OrmTypeMapping ormTypeMapping, JavaIdMapping javaIdMapping) {
- return new VirtualXmlId2_0(ormTypeMapping, javaIdMapping);
- }
-
- @Override
- public XmlEmbeddedId buildVirtualXmlEmbeddedId(OrmTypeMapping ormTypeMapping, JavaEmbeddedIdMapping javaEmbeddedIdMapping) {
- return new VirtualXmlEmbeddedId2_0(ormTypeMapping, javaEmbeddedIdMapping);
- }
-
- @Override
- public XmlEmbedded buildVirtualXmlEmbedded(OrmTypeMapping ormTypeMapping, JavaEmbeddedMapping javaEmbeddedMapping) {
- return new VirtualXmlEmbedded2_0(ormTypeMapping, javaEmbeddedMapping);
- }
-
- @Override
- public XmlManyToMany buildVirtualXmlManyToMany(OrmTypeMapping ormTypeMapping, JavaManyToManyMapping javaManyToManyMapping) {
- return new VirtualXmlManyToMany2_0(ormTypeMapping, javaManyToManyMapping);
- }
-
- @Override
- public XmlManyToOne buildVirtualXmlManyToOne(OrmTypeMapping ormTypeMapping, JavaManyToOneMapping javaManyToOneMapping) {
- return new VirtualXmlManyToOne2_0(ormTypeMapping, (JavaManyToOneMapping2_0) javaManyToOneMapping);
- }
-
- @Override
- public XmlOneToMany buildVirtualXmlOneToMany(OrmTypeMapping ormTypeMapping, JavaOneToManyMapping javaOneToManyMapping) {
- return new VirtualXmlOneToMany2_0(ormTypeMapping, (JavaOneToManyMapping2_0) javaOneToManyMapping);
- }
-
- @Override
- public XmlOneToOne buildVirtualXmlOneToOne(OrmTypeMapping ormTypeMapping, JavaOneToOneMapping javaOneToOneMapping) {
- return new VirtualXmlOneToOne2_0(ormTypeMapping, (JavaOneToOneMapping2_0) javaOneToOneMapping);
- }
-
- @Override
- public XmlTransient buildVirtualXmlTransient(OrmTypeMapping ormTypeMapping, JavaTransientMapping javaTransientMapping) {
- return new VirtualXmlTransient2_0(ormTypeMapping, javaTransientMapping);
- }
-
- @Override
- public XmlVersion buildVirtualXmlVersion(OrmTypeMapping ormTypeMapping, JavaVersionMapping javaVersionMapping) {
- return new VirtualXmlVersion2_0(ormTypeMapping, javaVersionMapping);
- }
-
- @Override
- public XmlNullAttributeMapping buildVirtualXmlNullAttributeMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping) {
- return new VirtualXmlNullAttributeMapping2_0(ormTypeMapping, javaAttributeMapping);
- }
-
- @Override
- public XmlElementCollection buildVirtualXmlElementCollection2_0(OrmTypeMapping ormTypeMapping, JavaElementCollectionMapping2_0 javaMapping) {
- return new VirtualXmlElementCollection2_0(ormTypeMapping, javaMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java
deleted file mode 100644
index 181bfa4df9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.JpaResourceType;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.orm.NullOrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.context.orm.OrmXmlDefinition;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmBasicMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmEmbeddableDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmEmbeddedIdMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmEmbeddedMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmEntityDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmIdMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmManyToManyMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmManyToOneMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmMappedSuperclassDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmOneToManyMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmOneToOneMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmTransientMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmVersionMappingDefinition;
-import org.eclipse.jpt.core.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 EFactory getResourceNodeFactory() {
- return OrmFactory.eINSTANCE;
- }
-
- @Override
- protected OrmXmlContextNodeFactory buildContextNodeFactory() {
- return new GenericOrmXml2_0ContextNodeFactory();
- }
-
- public JpaResourceType getResourceType() {
- return JptCorePlugin.ORM_XML_2_0_RESOURCE_TYPE;
- }
-
-
- // ********** ORM type mappings **********
-
- @Override
- protected OrmTypeMappingDefinition[] buildOrmTypeMappingDefinitions() {
- // order should not matter here, but we'll use the same order as for java
- // (@see {@link Generic2_0JpaPlatformProvider})
- return new OrmTypeMappingDefinition[] {
- OrmEntityDefinition.instance(),
- OrmEmbeddableDefinition.instance(),
- OrmMappedSuperclassDefinition.instance()};
- }
-
-
- // ********** ORM attribute mappings **********
-
- @Override
- protected OrmAttributeMappingDefinition[] buildOrmAttributeMappingDefinitions() {
- // order should not matter here, but we'll use the same order as for java
- // (@see {@link Generic2_0JpaPlatformProvider})
- return new OrmAttributeMappingDefinition[] {
- OrmTransientMappingDefinition.instance(),
- OrmElementCollectionMapping2_0Definition.instance(),
- OrmIdMappingDefinition.instance(),
- OrmVersionMappingDefinition.instance(),
- OrmBasicMappingDefinition.instance(),
- OrmEmbeddedMappingDefinition.instance(),
- OrmEmbeddedIdMappingDefinition.instance(),
- OrmManyToManyMappingDefinition.instance(),
- OrmManyToOneMappingDefinition.instance(),
- OrmOneToManyMappingDefinition.instance(),
- OrmOneToOneMappingDefinition.instance(),
- NullOrmAttributeMappingDefinition.instance()};
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullMapsId2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullMapsId2_0.java
deleted file mode 100644
index 0d99ecd9a9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullMapsId2_0.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmMapsId2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class NullMapsId2_0
- extends AbstractOrmXmlContextNode
- implements OrmMapsId2_0
-{
- public NullMapsId2_0(OrmSingleRelationshipMapping2_0 parent) {
- super(parent);
- }
-
-
- public String getValue() {
- return null;
- }
-
- public void setValue(String newValue) {
- //no-op - setValue is called when morphing a mapping, we can't throw an UnsupportedOperationException
- }
-
- public void update() {
- //no-op
- }
-
- public TextRange getValidationTextRange() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmCacheable2_0.java
deleted file mode 100644
index 9bcf898ae8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmCacheable2_0.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheableHolder2_0;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class NullOrmCacheable2_0
- extends AbstractOrmXmlContextNode
- implements OrmCacheable2_0
-{
- public NullOrmCacheable2_0(OrmCacheableHolder2_0 parent) {
- super(parent);
- }
-
- public boolean isCacheable() {
- return false;
- }
-
- public boolean isDefaultCacheable() {
- return false;
- }
-
- public Boolean getSpecifiedCacheable() {
- return null;
- }
-
- public void setSpecifiedCacheable(Boolean newSpecifiedCacheable) {
- throw new UnsupportedOperationException();
- }
-
- public void update() {
- //no-op
- }
-
- public TextRange getValidationTextRange() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmDerivedId2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmDerivedId2_0.java
deleted file mode 100644
index e8e05bee85..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmDerivedId2_0.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmDerivedId2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class NullOrmDerivedId2_0
- extends AbstractOrmXmlContextNode
- implements OrmDerivedId2_0
-{
-
- public NullOrmDerivedId2_0(OrmSingleRelationshipMapping2_0 parent) {
- super(parent);
- }
-
- public boolean getValue() {
- return false;
- }
-
- public void setValue(boolean newValue) {
- //no-op - setValue is called when morphing a mapping, we can't throw an UnsupportedOperationException
- }
-
- public void update() {
- //no-op
- }
-
- public TextRange getValidationTextRange() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmMapsId2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmMapsId2_0.java
deleted file mode 100644
index af6cd1bfe7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmMapsId2_0.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmMapsId2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class NullOrmMapsId2_0
- extends AbstractOrmXmlContextNode
- implements OrmMapsId2_0
-{
- public NullOrmMapsId2_0(OrmSingleRelationshipMapping2_0 parent) {
- super(parent);
- }
-
-
- public String getValue() {
- return null;
- }
-
- public void setValue(String newValue) {
- //no-op - setValue is called when morphing a mapping, we can't throw an UnsupportedOperationException
- }
-
- public void update() {
- //no-op
- }
-
- public TextRange getValidationTextRange() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmOrphanRemoval2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmOrphanRemoval2_0.java
deleted file mode 100644
index 9c90fa5da1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmOrphanRemoval2_0.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * NullOrmOrphanRemovable2_0
- */
-public class NullOrmOrphanRemoval2_0
- extends AbstractOrmXmlContextNode
- implements OrmOrphanRemovable2_0
-{
- public NullOrmOrphanRemoval2_0(OrmOrphanRemovalHolder2_0 parent) {
- super(parent);
- }
-
- public boolean isDefaultOrphanRemoval() {
- return false;
- }
-
- public boolean isOrphanRemoval() {
- return false;
- }
-
- public Boolean getSpecifiedOrphanRemoval() {
- return null;
- }
-
- public void setSpecifiedOrphanRemoval(Boolean newSpecifiedOrphanRemoval) {
- throw new UnsupportedOperationException();
- }
-
- public void update() {
- // do nothing
- }
-
- public TextRange getValidationTextRange() {
- return null;
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/OrmElementCollectionMapping2_0Definition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/OrmElementCollectionMapping2_0Definition.java
deleted file mode 100644
index 66c9a0556e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/OrmElementCollectionMapping2_0Definition.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.jpa2.MappingKeys2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaElementCollectionMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlElementCollection;
-import org.eclipse.jpt.core.resource.xml.EmfTools;
-
-public class OrmElementCollectionMapping2_0Definition
- implements OrmAttributeMappingDefinition
-{
- // singleton
- private static final OrmAttributeMappingDefinition INSTANCE =
- new OrmElementCollectionMapping2_0Definition();
-
-
- /**
- * Return the singleton
- */
- public static OrmAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmElementCollectionMapping2_0Definition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY;
- }
-
- public XmlAttributeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlElementCollection(),
- XmlElementCollection.class);
- }
-
- public OrmAttributeMapping buildContextMapping(
- OrmPersistentAttribute parent,
- XmlAttributeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return ((OrmXml2_0ContextNodeFactory) factory).buildOrmElementCollectionMapping2_0(parent, (XmlElementCollection) resourceMapping);
- }
-
- public XmlAttributeMapping buildVirtualResourceMapping(
- OrmTypeMapping ormTypeMapping,
- JavaAttributeMapping javaAttributeMapping,
- OrmXmlContextNodeFactory factory) {
- return ((OrmXml2_0ContextNodeFactory) factory).buildVirtualXmlElementCollection2_0(ormTypeMapping, (JavaElementCollectionMapping2_0) javaAttributeMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlAssociationOverride2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlAssociationOverride2_0.java
deleted file mode 100644
index a4e66fee61..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlAssociationOverride2_0.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c)2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.JoinTableJoiningStrategy;
-import org.eclipse.jpt.core.context.JoiningStrategy;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.context.orm.VirtualXmlAssociationOverride;
-import org.eclipse.jpt.core.internal.context.orm.VirtualXmlJoinTable;
-import org.eclipse.jpt.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
-
-public class VirtualXmlAssociationOverride2_0 extends XmlAssociationOverride
-{
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JoiningStrategy joiningStrategy;
-
- protected final VirtualXmlAssociationOverride virtualXmlAssociationOverride;
-
- public VirtualXmlAssociationOverride2_0(String name, OrmTypeMapping ormTypeMapping, JoiningStrategy joiningStrategy) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.joiningStrategy = joiningStrategy;
- this.virtualXmlAssociationOverride = new VirtualXmlAssociationOverride(name, ormTypeMapping, joiningStrategy);
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlAssociationOverride.getName();
- }
-
- @Override
- public void setName(String value) {
- this.virtualXmlAssociationOverride.setName(value);
- }
-
- @Override
- public EList<XmlJoinColumn> getJoinColumns() {
- return this.virtualXmlAssociationOverride.getJoinColumns();
- }
-
- @Override
- public XmlJoinTable getJoinTable() {
- if (this.joiningStrategy instanceof JoinTableJoiningStrategy) {
- JoinTable joinTable = ((JoinTableJoiningStrategy) this.joiningStrategy).getJoinTable();
- if (joinTable != null) {
- return new VirtualXmlJoinTable(
- this.ormTypeMapping,
- joinTable);
- }
- }
- return null;
- }
-
- @Override
- public void setJoinTable(XmlJoinTable newJoinTable) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlBasic2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlBasic2_0.java
deleted file mode 100644
index ed7ac05655..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlBasic2_0.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.context.java.JavaBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.context.orm.VirtualXmlBasic;
-import org.eclipse.jpt.core.resource.orm.AccessType;
-import org.eclipse.jpt.core.resource.orm.EnumType;
-import org.eclipse.jpt.core.resource.orm.FetchType;
-import org.eclipse.jpt.core.resource.orm.TemporalType;
-import org.eclipse.jpt.core.resource.orm.XmlBasic;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.core.utility.TextRange;
-/**
- * VirtualBasic is an implementation of Basic used when there is
- * no tag in the orm.xml and an underlying javaBasicMapping exists.
- */
-public class VirtualXmlBasic2_0 extends XmlBasic
-{
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaBasicMapping javaAttributeMapping;
-
- protected final VirtualXmlBasic virtualXmlBasic;
-
- public VirtualXmlBasic2_0(OrmTypeMapping ormTypeMapping, JavaBasicMapping javaBasicMapping) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaBasicMapping;
- this.virtualXmlBasic = new VirtualXmlBasic(ormTypeMapping, javaBasicMapping);
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public String getMappingKey() {
- return this.virtualXmlBasic.getMappingKey();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlBasic.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlBasic.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlBasic.getNameTextRange();
- }
-
- @Override
- public XmlColumn getColumn() {
- return this.virtualXmlBasic.getColumn();
- }
-
- @Override
- public void setColumn(XmlColumn value) {
- this.virtualXmlBasic.setColumn(value);
- }
-
- @Override
- public FetchType getFetch() {
- return this.virtualXmlBasic.getFetch();
- }
-
- @Override
- public void setFetch(FetchType newFetch) {
- this.virtualXmlBasic.setFetch(newFetch);
- }
-
- @Override
- public Boolean getOptional() {
- return this.virtualXmlBasic.getOptional();
- }
-
- @Override
- public void setOptional(Boolean newOptional) {
- this.virtualXmlBasic.setOptional(newOptional);
- }
-
- @Override
- public boolean isLob() {
- return this.virtualXmlBasic.isLob();
- }
-
- @Override
- public void setLob(boolean newLob) {
- this.virtualXmlBasic.setLob(newLob);
- }
-
- @Override
- public TextRange getLobTextRange() {
- return this.virtualXmlBasic.getLobTextRange();
- }
-
- @Override
- public TemporalType getTemporal() {
- return this.virtualXmlBasic.getTemporal();
- }
-
- @Override
- public void setTemporal(TemporalType setTemporal){
- this.virtualXmlBasic.setTemporal(setTemporal);
- }
-
- @Override
- public TextRange getTemporalTextRange() {
- return this.virtualXmlBasic.getTemporalTextRange();
- }
-
- @Override
- public EnumType getEnumerated() {
- return this.virtualXmlBasic.getEnumerated();
- }
-
- @Override
- public void setEnumerated(EnumType setEnumerated) {
- this.virtualXmlBasic.setEnumerated(setEnumerated);
- }
-
- @Override
- public TextRange getEnumeratedTextRange() {
- return null;
- }
-
- @Override
- public AccessType getAccess() {
- return org.eclipse.jpt.core.context.AccessType.toOrmResourceModel(this.javaAttributeMapping.getPersistentAttribute().getAccess());
- }
-
- @Override
- public void setAccess(AccessType value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlElementCollection2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlElementCollection2_0.java
deleted file mode 100644
index 8f95d3800e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlElementCollection2_0.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.context.orm.VirtualXmlAttributeMapping;
-import org.eclipse.jpt.core.jpa2.context.java.JavaElementCollectionMapping2_0;
-import org.eclipse.jpt.core.resource.orm.AccessType;
-import org.eclipse.jpt.core.resource.orm.FetchType;
-import org.eclipse.jpt.core.resource.orm.XmlElementCollection;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * VirtualOneToOne is an implementation of OneToOne used when there is
- * no tag in the orm.xml and an underlying javaOneToOneMapping exists.
- */
-public class VirtualXmlElementCollection2_0 extends XmlElementCollection
-{
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaElementCollectionMapping2_0 javaAttributeMapping;
-
- protected final VirtualXmlAttributeMapping virtualXmlAttributeMapping;
-
-
- public VirtualXmlElementCollection2_0(
- OrmTypeMapping ormTypeMapping, JavaElementCollectionMapping2_0 javaMapping) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaMapping;
- this.virtualXmlAttributeMapping = new VirtualXmlAttributeMapping(ormTypeMapping, javaMapping);
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public String getMappingKey() {
- return this.virtualXmlAttributeMapping.getMappingKey();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlAttributeMapping.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlAttributeMapping.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlAttributeMapping.getNameTextRange();
- }
-
- @Override
- public FetchType getFetch() {
- if (this.isOrmMetadataComplete()) {
- return org.eclipse.jpt.core.context.FetchType.toOrmResourceModel(this.javaAttributeMapping.getDefaultFetch());
- }
- return org.eclipse.jpt.core.context.FetchType.toOrmResourceModel(this.javaAttributeMapping.getFetch());
- }
-
- @Override
- public void setFetch(FetchType newFetch) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
-
- @Override
- public AccessType getAccess() {
- return org.eclipse.jpt.core.context.AccessType.toOrmResourceModel(this.javaAttributeMapping.getPersistentAttribute().getAccess());
- }
-
- @Override
- public void setAccess(AccessType value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
-//
-// @Override
-// public String getTargetClass() {
-// if (this.isOrmMetadataComplete()) {
-// return this.javaAttributeMapping.getDefaultTargetClass();
-// }
-// return this.javaAttributeMapping.getTargetClass();
-// }
-//
-// @Override
-// public void setTargetClass(String value) {
-// throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
-// }
-
- @Override
- public TextRange getTargetClassTextRange() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlEmbedded2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlEmbedded2_0.java
deleted file mode 100644
index 75ea340475..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlEmbedded2_0.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.core.context.java.JavaEmbeddedMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.context.orm.VirtualXmlEmbedded;
-import org.eclipse.jpt.core.resource.orm.AccessType;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.jpt.core.resource.orm.XmlEmbedded;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * VirtualBasic is an implementation of Basic used when there is
- * no tag in the orm.xml and an underlying javaBasicMapping exists.
- */
-public class VirtualXmlEmbedded2_0 extends XmlEmbedded
-{
-
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaEmbeddedMapping javaAttributeMapping;
-
- protected final VirtualXmlEmbedded virtualXmlEmbedded;
-
- public VirtualXmlEmbedded2_0(OrmTypeMapping ormTypeMapping, JavaEmbeddedMapping javaEmbeddedMapping) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaEmbeddedMapping;
- this.virtualXmlEmbedded = new VirtualXmlEmbedded(ormTypeMapping, javaEmbeddedMapping);
- }
-
- @Override
- public String getMappingKey() {
- return this.virtualXmlEmbedded.getMappingKey();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlEmbedded.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlEmbedded.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlEmbedded.getNameTextRange();
- }
-
- @Override
- public EList<XmlAttributeOverride> getAttributeOverrides() {
- return this.virtualXmlEmbedded.getAttributeOverrides();
- }
-
- @Override
- public AccessType getAccess() {
- return org.eclipse.jpt.core.context.AccessType.toOrmResourceModel(this.javaAttributeMapping.getPersistentAttribute().getAccess());
- }
-
- @Override
- public void setAccess(AccessType value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlEmbeddedId2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlEmbeddedId2_0.java
deleted file mode 100644
index 4fed9661b6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlEmbeddedId2_0.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.core.context.java.JavaEmbeddedIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.context.orm.VirtualXmlEmbeddedId;
-import org.eclipse.jpt.core.resource.orm.AccessType;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddedId;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * VirtualBasic is an implementation of Basic used when there is
- * no tag in the orm.xml and an underlying javaBasicMapping exists.
- */
-public class VirtualXmlEmbeddedId2_0 extends XmlEmbeddedId
-{
-
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaEmbeddedIdMapping javaAttributeMapping;
-
- protected final VirtualXmlEmbeddedId virtualXmlEmbeddedId;
-
- public VirtualXmlEmbeddedId2_0(OrmTypeMapping ormTypeMapping, JavaEmbeddedIdMapping javaEmbeddedIdMapping) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaEmbeddedIdMapping;
- this.virtualXmlEmbeddedId = new VirtualXmlEmbeddedId(ormTypeMapping, javaEmbeddedIdMapping);
- }
-
- @Override
- public String getMappingKey() {
- return this.virtualXmlEmbeddedId.getMappingKey();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlEmbeddedId.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlEmbeddedId.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlEmbeddedId.getNameTextRange();
- }
-
- @Override
- public EList<XmlAttributeOverride> getAttributeOverrides() {
- return this.virtualXmlEmbeddedId.getAttributeOverrides();
- }
-
- @Override
- public AccessType getAccess() {
- return org.eclipse.jpt.core.context.AccessType.toOrmResourceModel(this.javaAttributeMapping.getPersistentAttribute().getAccess());
- }
-
- @Override
- public void setAccess(AccessType value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlId2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlId2_0.java
deleted file mode 100644
index 710664c2b6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlId2_0.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.context.java.JavaIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.context.orm.VirtualXmlId;
-import org.eclipse.jpt.core.resource.orm.AccessType;
-import org.eclipse.jpt.core.resource.orm.EnumType;
-import org.eclipse.jpt.core.resource.orm.TemporalType;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.core.resource.orm.XmlGeneratedValue;
-import org.eclipse.jpt.core.resource.orm.XmlId;
-import org.eclipse.jpt.core.resource.orm.XmlSequenceGenerator;
-import org.eclipse.jpt.core.resource.orm.XmlTableGenerator;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * VirtualBasic is an implementation of Basic used when there is
- * no tag in the orm.xml and an underlying javaBasicMapping exists.
- */
-public class VirtualXmlId2_0 extends XmlId
-{
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaIdMapping javaAttributeMapping;
-
- protected final VirtualXmlId virtualXmlId;
-
- protected final VirtualXmlSequenceGenerator2_0 virtualSequenceGenerator;
-
- public VirtualXmlId2_0(OrmTypeMapping ormTypeMapping, JavaIdMapping javaIdMapping) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaIdMapping;
- this.virtualXmlId = new VirtualXmlId(ormTypeMapping, javaIdMapping);
- this.virtualSequenceGenerator = new VirtualXmlSequenceGenerator2_0(javaIdMapping.getGeneratorContainer(), this.isOrmMetadataComplete());
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public String getMappingKey() {
- return this.virtualXmlId.getMappingKey();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlId.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlId.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlId.getNameTextRange();
- }
-
- @Override
- public XmlColumn getColumn() {
- return this.virtualXmlId.getColumn();
- }
-
- @Override
- public void setColumn(XmlColumn value) {
- this.virtualXmlId.setColumn(value);
- }
-
- @Override
- public TemporalType getTemporal() {
- return this.virtualXmlId.getTemporal();
- }
-
- @Override
- public void setTemporal(TemporalType newTemporal){
- this.virtualXmlId.setTemporal(newTemporal);
- }
-
- @Override
- public TextRange getTemporalTextRange() {
- return this.virtualXmlId.getTemporalTextRange();
- }
-
- @Override
- public XmlGeneratedValue getGeneratedValue() {
- return this.virtualXmlId.getGeneratedValue();
- }
-
- @Override
- public void setGeneratedValue(XmlGeneratedValue value) {
- this.virtualXmlId.setGeneratedValue(value);
- }
-
- @Override
- public XmlSequenceGenerator getSequenceGenerator() {
- if (this.isOrmMetadataComplete()) {
- return null;
- }
- if (this.javaAttributeMapping.getGeneratorContainer().getSequenceGenerator() != null) {
- return this.virtualSequenceGenerator;
- }
- return null;
- }
-
- @Override
- public void setSequenceGenerator(XmlSequenceGenerator value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public XmlTableGenerator getTableGenerator() {
- return this.virtualXmlId.getTableGenerator();
- }
-
- @Override
- public void setTableGenerator(XmlTableGenerator value) {
- this.virtualXmlId.setTableGenerator(value);
- }
-
- @Override
- public EnumType getEnumerated() {
- return this.virtualXmlId.getEnumerated();
- }
-
- @Override
- public void setEnumerated(EnumType value) {
- this.virtualXmlId.setEnumerated(value);
- }
-
- @Override
- public TextRange getEnumeratedTextRange() {
- return this.virtualXmlId.getEnumeratedTextRange();
- }
-
- @Override
- public boolean isLob() {
- return this.virtualXmlId.isLob();
- }
-
- @Override
- public void setLob(boolean value) {
- this.virtualXmlId.setLob(value);
- }
-
- @Override
- public TextRange getLobTextRange() {
- return this.virtualXmlId.getLobTextRange();
- }
-
- @Override
- public AccessType getAccess() {
- return org.eclipse.jpt.core.context.AccessType.toOrmResourceModel(this.javaAttributeMapping.getPersistentAttribute().getAccess());
- }
-
- @Override
- public void setAccess(AccessType value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlManyToMany2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlManyToMany2_0.java
deleted file mode 100644
index 8a7fcac676..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlManyToMany2_0.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.core.context.java.JavaManyToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.context.orm.VirtualXmlManyToMany;
-import org.eclipse.jpt.core.resource.orm.AccessType;
-import org.eclipse.jpt.core.resource.orm.CascadeType;
-import org.eclipse.jpt.core.resource.orm.FetchType;
-import org.eclipse.jpt.core.resource.orm.MapKey;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
-import org.eclipse.jpt.core.resource.orm.XmlManyToMany;
-import org.eclipse.jpt.core.resource.orm.XmlOrderColumn;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * VirtualBasic is an implementation of Basic used when there is
- * no tag in the orm.xml and an underlying javaBasicMapping exists.
- */
-public class VirtualXmlManyToMany2_0 extends XmlManyToMany
-{
-
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaManyToManyMapping javaAttributeMapping;
-
- protected final VirtualXmlManyToMany virtualXmlManyToMany;
-
- public VirtualXmlManyToMany2_0(OrmTypeMapping ormTypeMapping, JavaManyToManyMapping javaManyToManyMapping) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaManyToManyMapping;
- this.virtualXmlManyToMany = new VirtualXmlManyToMany(ormTypeMapping, javaManyToManyMapping);
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public String getMappingKey() {
- return this.virtualXmlManyToMany.getMappingKey();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlManyToMany.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlManyToMany.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlManyToMany.getNameTextRange();
- }
-
- @Override
- public FetchType getFetch() {
- return this.virtualXmlManyToMany.getFetch();
- }
-
- @Override
- public void setFetch(FetchType newFetch) {
- this.virtualXmlManyToMany.setFetch(newFetch);
- }
-
- public EList<XmlJoinColumn> getJoinColumns() {
- return this.virtualXmlManyToMany.getJoinColumns();
- }
-
- @Override
- public CascadeType getCascade() {
- return this.virtualXmlManyToMany.getCascade();
- }
-
- @Override
- public void setCascade(CascadeType value) {
- this.virtualXmlManyToMany.setCascade(value);
- }
-
- @Override
- public XmlJoinTable getJoinTable() {
- return this.virtualXmlManyToMany.getJoinTable();
- }
-
- @Override
- public void setJoinTable(XmlJoinTable value) {
- this.virtualXmlManyToMany.setJoinTable(value);
- }
-
- @Override
- public String getTargetEntity() {
- return this.virtualXmlManyToMany.getTargetEntity();
- }
-
- @Override
- public void setTargetEntity(String value) {
- this.virtualXmlManyToMany.setTargetEntity(value);
- }
-
- @Override
- public String getMappedBy() {
- return this.virtualXmlManyToMany.getMappedBy();
- }
-
- @Override
- public void setMappedBy(String value) {
- this.virtualXmlManyToMany.setMappedBy(value);
- }
-
-
- @Override
- public MapKey getMapKey() {
- return this.virtualXmlManyToMany.getMapKey();
- }
-
- @Override
- public void setMapKey(MapKey value) {
- this.virtualXmlManyToMany.setMapKey(value);
- }
-
- @Override
- public String getOrderBy() {
- return this.virtualXmlManyToMany.getOrderBy();
- }
-
- @Override
- public void setOrderBy(String value) {
- this.virtualXmlManyToMany.setOrderBy(value);
- }
-
- @Override
- public XmlOrderColumn getOrderColumn() {
- return this.virtualXmlManyToMany.getOrderColumn();
- }
-
- @Override
- public TextRange getMappedByTextRange() {
- return this.virtualXmlManyToMany.getMappedByTextRange();
- }
-
- @Override
- public TextRange getTargetEntityTextRange() {
- return this.virtualXmlManyToMany.getTargetEntityTextRange();
- }
-
- @Override
- public AccessType getAccess() {
- return org.eclipse.jpt.core.context.AccessType.toOrmResourceModel(this.javaAttributeMapping.getPersistentAttribute().getAccess());
- }
-
- @Override
- public void setAccess(AccessType value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlManyToOne2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlManyToOne2_0.java
deleted file mode 100644
index 685d8b971a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlManyToOne2_0.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.context.orm.VirtualXmlManyToOne;
-import org.eclipse.jpt.core.jpa2.context.java.JavaManyToOneMapping2_0;
-import org.eclipse.jpt.core.resource.orm.AccessType;
-import org.eclipse.jpt.core.resource.orm.CascadeType;
-import org.eclipse.jpt.core.resource.orm.FetchType;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
-import org.eclipse.jpt.core.resource.orm.XmlManyToOne;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class VirtualXmlManyToOne2_0 extends XmlManyToOne
-{
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaManyToOneMapping2_0 javaAttributeMapping;
-
- protected final VirtualXmlManyToOne virtualXmlManyToOne;
-
-
- public VirtualXmlManyToOne2_0(
- OrmTypeMapping ormTypeMapping,
- JavaManyToOneMapping2_0 javaManyToOneMapping) {
-
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaManyToOneMapping;
- this.virtualXmlManyToOne = new VirtualXmlManyToOne(ormTypeMapping, javaManyToOneMapping);
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public String getMappingKey() {
- return this.virtualXmlManyToOne.getMappingKey();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlManyToOne.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlManyToOne.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlManyToOne.getNameTextRange();
- }
-
- @Override
- public FetchType getFetch() {
- return this.virtualXmlManyToOne.getFetch();
- }
-
- @Override
- public void setFetch(FetchType newFetch) {
- this.virtualXmlManyToOne.setFetch(newFetch);
- }
-
- @Override
- public Boolean getOptional() {
- return this.virtualXmlManyToOne.getOptional();
- }
-
- @Override
- public void setOptional(Boolean newOptional) {
- this.virtualXmlManyToOne.setOptional(newOptional);
- }
-
- @Override
- public EList<XmlJoinColumn> getJoinColumns() {
- return this.virtualXmlManyToOne.getJoinColumns();
- }
-
- @Override
- public CascadeType getCascade() {
- return this.virtualXmlManyToOne.getCascade();
- }
-
- @Override
- public void setCascade(CascadeType value) {
- this.virtualXmlManyToOne.setCascade(value);
- }
-
- @Override
- public XmlJoinTable getJoinTable() {
- return this.virtualXmlManyToOne.getJoinTable();
- }
-
- @Override
- public void setJoinTable(XmlJoinTable value) {
- this.virtualXmlManyToOne.setJoinTable(value);
- }
-
- @Override
- public String getTargetEntity() {
- return this.virtualXmlManyToOne.getTargetEntity();
- }
-
- @Override
- public void setTargetEntity(String value) {
- this.virtualXmlManyToOne.setTargetEntity(value);
- }
-
- @Override
- public TextRange getTargetEntityTextRange() {
- return this.virtualXmlManyToOne.getTargetEntityTextRange();
- }
-
- @Override
- public AccessType getAccess() {
- return org.eclipse.jpt.core.context.AccessType.toOrmResourceModel(this.javaAttributeMapping.getPersistentAttribute().getAccess());
- }
-
- @Override
- public void setAccess(AccessType value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Boolean getId() {
- if (isOrmMetadataComplete()) {
- return null;
- }
- boolean javaIdValue = this.javaAttributeMapping.getDerivedId().getValue();
- return (javaIdValue) ? Boolean.TRUE : null;
- }
-
- @Override
- public void setId(Boolean newId) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlNullAttributeMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlNullAttributeMapping2_0.java
deleted file mode 100644
index c95d82fae1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlNullAttributeMapping2_0.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.context.orm.VirtualXmlNullAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.AccessType;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlNullAttributeMapping;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * VirtualVersion is an implementation of Version used when there is
- * no tag in the orm.xml and an underlying javaVersionMapping exists.
- */
-public class VirtualXmlNullAttributeMapping2_0 extends XmlNullAttributeMapping implements XmlAttributeMapping
-{
-
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaAttributeMapping javaAttributeMapping;
-
- protected final VirtualXmlNullAttributeMapping virtualXmlNullAttributeMapping;
-
- public VirtualXmlNullAttributeMapping2_0(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaAttributeMapping;
- this.virtualXmlNullAttributeMapping = new VirtualXmlNullAttributeMapping(ormTypeMapping, javaAttributeMapping);
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- public String getMappingKey() {
- return this.virtualXmlNullAttributeMapping.getMappingKey();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlNullAttributeMapping.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlNullAttributeMapping.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlNullAttributeMapping.getNameTextRange();
- }
-
- public AccessType getAccess() {
- return org.eclipse.jpt.core.context.AccessType.toOrmResourceModel(this.javaAttributeMapping.getPersistentAttribute().getAccess());
- }
-
- public void setAccess(AccessType value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlOneToMany2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlOneToMany2_0.java
deleted file mode 100644
index cce837f50d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlOneToMany2_0.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.context.orm.VirtualXmlOneToMany;
-import org.eclipse.jpt.core.jpa2.context.OneToManyMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOneToManyMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.resource.orm.AccessType;
-import org.eclipse.jpt.core.resource.orm.CascadeType;
-import org.eclipse.jpt.core.resource.orm.FetchType;
-import org.eclipse.jpt.core.resource.orm.MapKey;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
-import org.eclipse.jpt.core.resource.orm.XmlOneToMany;
-import org.eclipse.jpt.core.resource.orm.XmlOrderColumn;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * VirtualBasic is an implementation of Basic used when there is
- * no tag in the orm.xml and an underlying javaBasicMapping exists.
- */
-public class VirtualXmlOneToMany2_0 extends XmlOneToMany
-{
-
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaOneToManyMapping2_0 javaAttributeMapping;
-
- protected final VirtualXmlOneToMany virtualXmlOneToMany;
-
- public VirtualXmlOneToMany2_0(
- OrmTypeMapping ormTypeMapping, JavaOneToManyMapping2_0 javaOneToManyMapping) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaOneToManyMapping;
- this.virtualXmlOneToMany = new VirtualXmlOneToMany(ormTypeMapping, javaOneToManyMapping);
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public String getMappingKey() {
- return this.virtualXmlOneToMany.getMappingKey();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlOneToMany.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlOneToMany.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlOneToMany.getNameTextRange();
- }
-
- @Override
- public FetchType getFetch() {
- return this.virtualXmlOneToMany.getFetch();
- }
-
- @Override
- public void setFetch(FetchType newFetch) {
- this.virtualXmlOneToMany.setFetch(newFetch);
- }
-
- @Override
- public CascadeType getCascade() {
- return this.virtualXmlOneToMany.getCascade();
- }
-
- @Override
- public void setCascade(CascadeType value) {
- this.virtualXmlOneToMany.setCascade(value);
- }
-
- private JavaOrphanRemovable2_0 getOrphanRemovalOf(OneToManyMapping2_0 oneToManyMapping) {
- return ((JavaOrphanRemovalHolder2_0) oneToManyMapping).getOrphanRemoval();
- }
-
- @Override
- public Boolean getOrphanRemoval() {
- JavaOrphanRemovable2_0 mappingsOrphanRemoval = this.getOrphanRemovalOf(this.javaAttributeMapping);
- if (this.isOrmMetadataComplete()) {
- return mappingsOrphanRemoval.isDefaultOrphanRemoval();
- }
- return mappingsOrphanRemoval.isOrphanRemoval();
- }
-
- @Override
- public void setOrphanRemoval(Boolean newOrphanRemoval) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public XmlJoinTable getJoinTable() {
- return this.virtualXmlOneToMany.getJoinTable();
- }
-
- @Override
- public void setJoinTable(XmlJoinTable value) {
- this.virtualXmlOneToMany.setJoinTable(value);
- }
-
- @Override
- public String getTargetEntity() {
- return this.virtualXmlOneToMany.getTargetEntity();
- }
-
- @Override
- public void setTargetEntity(String value) {
- this.virtualXmlOneToMany.setTargetEntity(value);
- }
-
- @Override
- public String getMappedBy() {
- return this.virtualXmlOneToMany.getMappedBy();
- }
-
- @Override
- public void setMappedBy(String value) {
- this.virtualXmlOneToMany.setMappedBy(value);
- }
-
-
- @Override
- public MapKey getMapKey() {
- return this.virtualXmlOneToMany.getMapKey();
- }
-
- @Override
- public void setMapKey(MapKey value) {
- this.virtualXmlOneToMany.setMapKey(value);
- }
-
- @Override
- public String getOrderBy() {
- return this.virtualXmlOneToMany.getOrderBy();
- }
-
- @Override
- public void setOrderBy(String value) {
- this.virtualXmlOneToMany.setOrderBy(value);
- }
-
- @Override
- public XmlOrderColumn getOrderColumn() {
- return this.virtualXmlOneToMany.getOrderColumn();
- }
-
- @Override
- public TextRange getMappedByTextRange() {
- return this.virtualXmlOneToMany.getMappedByTextRange();
- }
-
- @Override
- public TextRange getTargetEntityTextRange() {
- return this.virtualXmlOneToMany.getTargetEntityTextRange();
- }
-
- @Override
- public EList<XmlJoinColumn> getJoinColumns() {
- return this.virtualXmlOneToMany.getJoinColumns();
- }
-
- @Override
- public AccessType getAccess() {
- return org.eclipse.jpt.core.context.AccessType.toOrmResourceModel(this.javaAttributeMapping.getPersistentAttribute().getAccess());
- }
-
- @Override
- public void setAccess(AccessType value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlOneToOne2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlOneToOne2_0.java
deleted file mode 100644
index 5c5d7c24ec..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlOneToOne2_0.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.context.orm.VirtualXmlOneToOne;
-import org.eclipse.jpt.core.jpa2.context.OneToOneMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOneToOneMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.resource.orm.AccessType;
-import org.eclipse.jpt.core.resource.orm.CascadeType;
-import org.eclipse.jpt.core.resource.orm.FetchType;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
-import org.eclipse.jpt.core.resource.orm.XmlOneToOne;
-import org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class VirtualXmlOneToOne2_0 extends XmlOneToOne
-{
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaOneToOneMapping2_0 javaAttributeMapping;
-
- protected final VirtualXmlOneToOne virtualXmlOneToOne;
-
-
- public VirtualXmlOneToOne2_0(
- OrmTypeMapping ormTypeMapping,
- JavaOneToOneMapping2_0 javaOneToOneMapping) {
-
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaOneToOneMapping;
- this.virtualXmlOneToOne = new VirtualXmlOneToOne(ormTypeMapping, javaOneToOneMapping);
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public String getMappingKey() {
- return this.virtualXmlOneToOne.getMappingKey();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlOneToOne.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlOneToOne.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlOneToOne.getNameTextRange();
- }
-
- @Override
- public FetchType getFetch() {
- return this.virtualXmlOneToOne.getFetch();
- }
-
- @Override
- public void setFetch(FetchType newFetch) {
- this.virtualXmlOneToOne.setFetch(newFetch);
- }
-
- @Override
- public Boolean getOptional() {
- return this.virtualXmlOneToOne.getOptional();
- }
-
- @Override
- public void setOptional(Boolean newOptional) {
- this.virtualXmlOneToOne.setOptional(newOptional);
- }
-
- @Override
- public EList<XmlJoinColumn> getJoinColumns() {
- return this.virtualXmlOneToOne.getJoinColumns();
- }
-
- @Override
- public CascadeType getCascade() {
- return this.virtualXmlOneToOne.getCascade();
- }
-
- @Override
- public void setCascade(CascadeType value) {
- this.virtualXmlOneToOne.setCascade(value);
- }
-
- private JavaOrphanRemovable2_0 getOrphanRemovalOf(OneToOneMapping2_0 oneToOneMapping) {
- return ((JavaOrphanRemovalHolder2_0) oneToOneMapping).getOrphanRemoval();
- }
-
- @Override
- public Boolean getOrphanRemoval() {
- JavaOrphanRemovable2_0 mappingsOrphanRemoval = this.getOrphanRemovalOf(this.javaAttributeMapping);
- if (this.isOrmMetadataComplete()) {
- return mappingsOrphanRemoval.isDefaultOrphanRemoval();
- }
- return mappingsOrphanRemoval.isOrphanRemoval();
- }
-
- @Override
- public void setOrphanRemoval(Boolean newOrphanRemoval) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public XmlJoinTable getJoinTable() {
- return this.virtualXmlOneToOne.getJoinTable();
- }
-
- @Override
- public void setJoinTable(XmlJoinTable value) {
- this.virtualXmlOneToOne.setJoinTable(value);
- }
-
- @Override
- public String getTargetEntity() {
- return this.virtualXmlOneToOne.getTargetEntity();
- }
-
- @Override
- public void setTargetEntity(String value) {
- this.virtualXmlOneToOne.setTargetEntity(value);
- }
-
- @Override
- public String getMappedBy() {
- return this.virtualXmlOneToOne.getMappedBy();
- }
-
- @Override
- public void setMappedBy(String value) {
- this.virtualXmlOneToOne.setMappedBy(value);
- }
-
- @Override
- public EList<XmlPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
- return this.virtualXmlOneToOne.getPrimaryKeyJoinColumns();
- }
-
- @Override
- public TextRange getMappedByTextRange() {
- return this.virtualXmlOneToOne.getMappedByTextRange();
- }
-
- @Override
- public TextRange getTargetEntityTextRange() {
- return this.virtualXmlOneToOne.getTargetEntityTextRange();
- }
-
- @Override
- public AccessType getAccess() {
- return org.eclipse.jpt.core.context.AccessType.toOrmResourceModel(this.javaAttributeMapping.getPersistentAttribute().getAccess());
- }
-
- @Override
- public void setAccess(AccessType value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Boolean getId() {
- if (isOrmMetadataComplete()) {
- return null;
- }
- boolean javaIdValue = this.javaAttributeMapping.getDerivedId().getValue();
- return (javaIdValue) ? Boolean.TRUE : null;
- }
-
- @Override
- public void setId(Boolean newId) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlSequenceGenerator2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlSequenceGenerator2_0.java
deleted file mode 100644
index 24ff515718..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlSequenceGenerator2_0.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.context.java.JavaGeneratorContainer;
-import org.eclipse.jpt.core.context.java.JavaSequenceGenerator;
-import org.eclipse.jpt.core.internal.context.orm.VirtualXmlSequenceGenerator;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaSequenceGenerator2_0;
-import org.eclipse.jpt.core.resource.orm.XmlSequenceGenerator;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * Generic2_0VirtualXmlSequenceGenerator
- */
-public class VirtualXmlSequenceGenerator2_0 extends XmlSequenceGenerator
-{
- protected final JavaGeneratorContainer javaGeneratorHolder;
-
- protected final boolean metadataComplete;
-
- protected final VirtualXmlSequenceGenerator virtualXmlSequenceGenerator;
-
- public VirtualXmlSequenceGenerator2_0(JavaGeneratorContainer javaGeneratorHolder, boolean metadataComplete) {
- super();
- this.javaGeneratorHolder = javaGeneratorHolder;
- this.metadataComplete = metadataComplete;
- this.virtualXmlSequenceGenerator = new VirtualXmlSequenceGenerator(javaGeneratorHolder, metadataComplete);
- }
-
- protected JavaSequenceGenerator getJavaSequenceGenerator() {
- return this.javaGeneratorHolder.getSequenceGenerator();
- }
-
- @Override
- public String getCatalog() {
- return ((GenericJavaSequenceGenerator2_0)this.getJavaSequenceGenerator()).getCatalog();
- }
-
- @Override
- public void setCatalog(String newCatalog) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public String getSchema() {
- return ((GenericJavaSequenceGenerator2_0)this.getJavaSequenceGenerator()).getSchema();
- }
-
- @Override
- public void setSchema(String newSchema) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public Integer getAllocationSize() {
- return this.virtualXmlSequenceGenerator.getAllocationSize();
- }
-
- @Override
- public void setAllocationSize(Integer newAllocationSize) {
- this.virtualXmlSequenceGenerator.setAllocationSize(newAllocationSize);
- }
-
- @Override
- public Integer getInitialValue() {
- return this.virtualXmlSequenceGenerator.getInitialValue();
- }
-
- @Override
- public void setInitialValue(Integer newInitialValue) {
- this.virtualXmlSequenceGenerator.setInitialValue(newInitialValue);
- }
-
- @Override
- public String getName() {
- return this.virtualXmlSequenceGenerator.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlSequenceGenerator.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlSequenceGenerator.getNameTextRange();
- }
-
- @Override
- public String getSequenceName() {
- return this.virtualXmlSequenceGenerator.getSequenceName();
- }
-
- @Override
- public void setSequenceName(String newSequenceName) {
- this.virtualXmlSequenceGenerator.setSequenceName(newSequenceName);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlTransient2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlTransient2_0.java
deleted file mode 100644
index ade064eea6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlTransient2_0.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.context.java.JavaTransientMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.context.orm.VirtualXmlTransient;
-import org.eclipse.jpt.core.resource.orm.AccessType;
-import org.eclipse.jpt.core.resource.orm.XmlTransient;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * VirtualBasic is an implementation of Basic used when there is
- * no tag in the orm.xml and an underlying javaBasicMapping exists.
- */
-public class VirtualXmlTransient2_0 extends XmlTransient
-{
-
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaTransientMapping javaAttributeMapping;
-
- protected final VirtualXmlTransient virtualXmlTransient;
-
- public VirtualXmlTransient2_0(OrmTypeMapping ormTypeMapping, JavaTransientMapping javaTransientMapping) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaTransientMapping;
- this.virtualXmlTransient = new VirtualXmlTransient(ormTypeMapping, javaTransientMapping);
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public String getMappingKey() {
- return this.virtualXmlTransient.getMappingKey();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlTransient.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlTransient.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlTransient.getNameTextRange();
- }
-
- @Override
- public AccessType getAccess() {
- return org.eclipse.jpt.core.context.AccessType.toOrmResourceModel(this.javaAttributeMapping.getPersistentAttribute().getAccess());
- }
-
- @Override
- public void setAccess(AccessType value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlVersion2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlVersion2_0.java
deleted file mode 100644
index 3cc3534bc2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/VirtualXmlVersion2_0.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.context.java.JavaVersionMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.context.orm.VirtualXmlVersion;
-import org.eclipse.jpt.core.resource.orm.AccessType;
-import org.eclipse.jpt.core.resource.orm.EnumType;
-import org.eclipse.jpt.core.resource.orm.TemporalType;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.core.resource.orm.XmlVersion;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * VirtualBasic is an implementation of Basic used when there is
- * no tag in the orm.xml and an underlying javaBasicMapping exists.
- */
-public class VirtualXmlVersion2_0 extends XmlVersion
-{
-
- protected OrmTypeMapping ormTypeMapping;
-
- protected final JavaVersionMapping javaAttributeMapping;
-
- protected final VirtualXmlVersion virtualXmlVersion;
-
- public VirtualXmlVersion2_0(OrmTypeMapping ormTypeMapping, JavaVersionMapping javaVersionMapping) {
- super();
- this.ormTypeMapping = ormTypeMapping;
- this.javaAttributeMapping = javaVersionMapping;
- this.virtualXmlVersion = new VirtualXmlVersion(ormTypeMapping, javaVersionMapping);
- }
-
- protected boolean isOrmMetadataComplete() {
- return this.ormTypeMapping.isMetadataComplete();
- }
-
- @Override
- public String getMappingKey() {
- return this.virtualXmlVersion.getMappingKey();
- }
-
- @Override
- public String getName() {
- return this.virtualXmlVersion.getName();
- }
-
- @Override
- public void setName(String newName) {
- this.virtualXmlVersion.setName(newName);
- }
-
- @Override
- public TextRange getNameTextRange() {
- return this.virtualXmlVersion.getNameTextRange();
- }
-
- @Override
- public XmlColumn getColumn() {
- return this.virtualXmlVersion.getColumn();
- }
-
- @Override
- public void setColumn(XmlColumn value) {
- this.virtualXmlVersion.setColumn(value);
- }
-
- @Override
- public TemporalType getTemporal() {
- return this.virtualXmlVersion.getTemporal();
- }
-
- @Override
- public void setTemporal(TemporalType newTemporal){
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public EnumType getEnumerated() {
- return this.virtualXmlVersion.getEnumerated();
- }
-
- @Override
- public void setEnumerated(EnumType value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public boolean isLob() {
- return this.virtualXmlVersion.isLob();
- }
-
- @Override
- public void setLob(boolean value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-
- @Override
- public TextRange getEnumeratedTextRange() {
- return this.virtualXmlVersion.getEnumeratedTextRange();
- }
-
- @Override
- public TextRange getLobTextRange() {
- return this.virtualXmlVersion.getLobTextRange();
- }
-
- @Override
- public TextRange getTemporalTextRange() {
- return this.virtualXmlVersion.getTemporalTextRange();
- }
-
- @Override
- public AccessType getAccess() {
- return org.eclipse.jpt.core.context.AccessType.toOrmResourceModel(this.javaAttributeMapping.getPersistentAttribute().getAccess());
- }
-
- @Override
- public void setAccess(AccessType value) {
- throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java
deleted file mode 100644
index e810ba8343..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.persistence;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceXmlContextNodeFactory;
-import org.eclipse.jpt.core.internal.jpa2.context.persistence.connection.GenericConnection2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.persistence.options.GenericOptions2_0;
-import org.eclipse.jpt.core.jpa2.context.persistence.connection.JpaConnection2_0;
-import org.eclipse.jpt.core.jpa2.context.persistence.options.JpaOptions2_0;
-
-
-public class Generic2_0PersistenceXmlContextNodeFactory extends AbstractPersistenceXmlContextNodeFactory
-{
-
- public JpaConnection2_0 buildConnection(PersistenceUnit parent) {
- return new GenericConnection2_0(parent);
- }
-
- public JpaOptions2_0 buildOptions(PersistenceUnit parent) {
- return new GenericOptions2_0(parent);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java
deleted file mode 100644
index 00658ee3ed..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.persistence;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.JpaResourceType;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.PersistenceXmlContextNodeFactory;
-import org.eclipse.jpt.core.context.persistence.PersistenceXmlDefinition;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceXmlDefinition;
-import org.eclipse.jpt.core.resource.persistence.v2_0.PersistenceV2_0Factory;
-
-public class Generic2_0PersistenceXmlDefinition
- extends AbstractPersistenceXmlDefinition
-{
- // singleton
- private static final PersistenceXmlDefinition INSTANCE =
- new Generic2_0PersistenceXmlDefinition();
-
-
- /**
- * Return the singleton
- */
- public static PersistenceXmlDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private Generic2_0PersistenceXmlDefinition() {
- super();
- }
-
-
- public EFactory getResourceNodeFactory() {
- return PersistenceV2_0Factory.eINSTANCE;
- }
-
- @Override
- protected PersistenceXmlContextNodeFactory buildContextNodeFactory() {
- return new Generic2_0PersistenceXmlContextNodeFactory();
- }
-
- public JpaResourceType getResourceType() {
- return JptCorePlugin.PERSISTENCE_XML_2_0_RESOURCE_TYPE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/GenericConnection2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/GenericConnection2_0.java
deleted file mode 100644
index 48f975c8b0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/GenericConnection2_0.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.persistence.connection;
-
-import java.util.Map;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnitProperties;
-import org.eclipse.jpt.core.jpa2.context.persistence.connection.JpaConnection2_0;
-
-/**
- * GenericConnection2_0
- */
-public class GenericConnection2_0 extends AbstractPersistenceUnitProperties
- implements JpaConnection2_0
-{
- // ********** GenericConnection properties **********
- private String driver;
- private String url;
- private String user;
- private String password;
-
-
- // ********** constructors **********
- public GenericConnection2_0(PersistenceUnit parent) {
- super(parent);
- }
-
- // ********** initialization **********
- /**
- * Initializes properties with values from the persistence unit.
- */
- @Override
- protected void initializeProperties() {
- this.driver =
- this.getStringValue(PERSISTENCE_JDBC_DRIVER);
- this.url =
- this.getStringValue(PERSISTENCE_JDBC_URL);
- this.user =
- this.getStringValue(PERSISTENCE_JDBC_USER);
- this.password =
- this.getStringValue(PERSISTENCE_JDBC_PASSWORD);
- }
-
- // ********** behavior **********
-
- public void propertyValueChanged(String propertyName, String newValue) {
- if (propertyName.equals(PERSISTENCE_JDBC_DRIVER)) {
- this.driverChanged(newValue);
- }
- else if (propertyName.equals(PERSISTENCE_JDBC_URL)) {
- this.urlChanged(newValue);
- }
- else if (propertyName.equals(PERSISTENCE_JDBC_USER)) {
- this.userChanged(newValue);
- }
- else if (propertyName.equals(PERSISTENCE_JDBC_PASSWORD)) {
- this.passwordChanged(newValue);
- }
- }
-
- public void propertyRemoved(String propertyName) {
- if (propertyName.equals(PERSISTENCE_JDBC_DRIVER)) {
- this.driverChanged(null);
- }
- else if (propertyName.equals(PERSISTENCE_JDBC_URL)) {
- this.urlChanged(null);
- }
- else if (propertyName.equals(PERSISTENCE_JDBC_USER)) {
- this.userChanged(null);
- }
- else if (propertyName.equals(PERSISTENCE_JDBC_PASSWORD)) {
- this.passwordChanged(null);
- }
- }
-
- /**
- * Adds property names key/value pairs, where:
- * key = PU property key
- * value = property id
- */
- @Override
- protected void addPropertyNames(Map<String, String> propertyNames) {
- propertyNames.put(
- PERSISTENCE_JDBC_DRIVER,
- DRIVER_PROPERTY);
- propertyNames.put(
- PERSISTENCE_JDBC_URL,
- URL_PROPERTY);
- propertyNames.put(
- PERSISTENCE_JDBC_USER,
- USER_PROPERTY);
- propertyNames.put(
- PERSISTENCE_JDBC_PASSWORD,
- PASSWORD_PROPERTY);
- }
-
- // ********** Driver **********
- public String getDriver() {
- return this.driver;
- }
-
- public void setDriver(String newDriver) {
- String old = this.driver;
- this.driver = newDriver;
- this.putProperty(DRIVER_PROPERTY, newDriver);
- this.firePropertyChanged(DRIVER_PROPERTY, old, newDriver);
- }
-
- private void driverChanged(String newValue) {
- String old = this.driver;
- this.driver = newValue;
- this.firePropertyChanged(DRIVER_PROPERTY, old, newValue);
- }
-
- public String getDefaultDriver() {
- return DEFAULT_JDBC_DRIVER;
- }
-
- // ********** URL **********
- public String getUrl() {
- return this.url;
- }
-
- public void setUrl(String newUrl) {
- String old = this.url;
- this.url = newUrl;
- this.putProperty(URL_PROPERTY, newUrl);
- this.firePropertyChanged(URL_PROPERTY, old, newUrl);
- }
-
- private void urlChanged(String newValue) {
- String old = this.url;
- this.url = newValue;
- this.firePropertyChanged(URL_PROPERTY, old, newValue);
- }
-
- public String getDefaultUrl() {
- return DEFAULT_JDBC_URL;
- }
-
- // ********** User **********
- public String getUser() {
- return this.user;
- }
-
- public void setUser(String newUser) {
- String old = this.user;
- this.user = newUser;
- this.putProperty(USER_PROPERTY, newUser);
- this.firePropertyChanged(USER_PROPERTY, old, newUser);
- }
-
- private void userChanged(String newValue) {
- String old = this.user;
- this.user = newValue;
- this.firePropertyChanged(USER_PROPERTY, old, newValue);
- }
-
- public String getDefaultUser() {
- return DEFAULT_JDBC_USER;
- }
-
- // ********** Password **********
- public String getPassword() {
- return this.password;
- }
-
- public void setPassword(String newPassword) {
- String old = this.password;
- this.password = newPassword;
- this.putProperty(PASSWORD_PROPERTY, newPassword);
- this.firePropertyChanged(PASSWORD_PROPERTY, old, newPassword);
- }
-
- private void passwordChanged(String newValue) {
- String old = this.password;
- this.password = newValue;
- this.firePropertyChanged(PASSWORD_PROPERTY, old, newValue);
- }
-
- public String getDefaultPassword() {
- return DEFAULT_JDBC_PASSWORD;
- }
-
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java
deleted file mode 100644
index 2e7130f1d7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.persistence.connection;
-
-import java.util.Map;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnitProperties;
-import org.eclipse.jpt.core.jpa2.context.persistence.connection.JpaConnection2_0;
-
-/**
- * GenericConnection2_0
- */
-public class NullConnection2_0 extends AbstractPersistenceUnitProperties
- implements JpaConnection2_0
-{
-
-
- // ********** constructors **********
- public NullConnection2_0(PersistenceUnit parent) {
- super(parent);
- }
-
- // ********** initialization **********
- /**
- * Initializes properties with values from the persistence unit.
- */
- @Override
- protected void initializeProperties() {
- //do nothing
- }
-
- // ********** behavior **********
-
- public void propertyValueChanged(String propertyName, String newValue) {
- //do nothing
- }
-
- public void propertyRemoved(String propertyName) {
- //do nothing
- }
-
- /**
- * Adds property names key/value pairs, where:
- * key = PU property key
- * value = property id
- */
- @Override
- protected void addPropertyNames(Map<String, String> propertyNames) {
- //do nothing
- }
-
- // ********** Driver **********
- public String getDriver() {
- return null;
- }
-
- public void setDriver(String newDriver) {
- throw new UnsupportedOperationException();
- }
-
- public String getDefaultDriver() {
- return DEFAULT_JDBC_DRIVER;
- }
-
- // ********** URL **********
- public String getUrl() {
- return null;
- }
-
- public void setUrl(String newUrl) {
- throw new UnsupportedOperationException();
- }
-
- public String getDefaultUrl() {
- return DEFAULT_JDBC_URL;
- }
-
- // ********** User **********
- public String getUser() {
- return null;
- }
-
- public void setUser(String newUser) {
- throw new UnsupportedOperationException();
- }
-
- public String getDefaultUser() {
- return DEFAULT_JDBC_USER;
- }
-
- // ********** Password **********
- public String getPassword() {
- return null;
- }
-
- public void setPassword(String newPassword) {
- throw new UnsupportedOperationException();
- }
-
- public String getDefaultPassword() {
- return DEFAULT_JDBC_PASSWORD;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java
deleted file mode 100644
index d9f70492b3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.persistence.options;
-
-import java.util.Map;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnitProperties;
-import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0;
-import org.eclipse.jpt.core.jpa2.context.persistence.options.JpaOptions2_0;
-
-/**
- * JPA 2.0 options
- */
-public class GenericOptions2_0 extends AbstractPersistenceUnitProperties
- implements JpaOptions2_0
-{
- // ********** GenericConnection properties **********
- private Integer lockTimeout;
- private Integer queryTimeout;
- private String validationGroupPrePersist;
- private String validationGroupPreUpdate;
- private String validationGroupPreRemove;
-
-
- // ********** 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.validationGroupPrePersist =
- this.getStringValue(PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST);
- this.validationGroupPreUpdate =
- this.getStringValue(PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE);
- this.validationGroupPreRemove =
- this.getStringValue(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.validationGroupPrePersistChanged(newValue);
- }
- else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE)) {
- this.validationGroupPreUpdateChanged(newValue);
- }
- else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE)) {
- this.validationGroupPreRemoveChanged(newValue);
- }
- }
-
- 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.validationGroupPrePersistChanged(null);
- }
- else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE)) {
- this.validationGroupPreUpdateChanged(null);
- }
- else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE)) {
- this.validationGroupPreRemoveChanged(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_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;
- }
-
-
- // ********** ValidationGroupPrePersist **********
- public String getValidationGroupPrePersist() {
- return this.validationGroupPrePersist;
- }
-
- public void setValidationGroupPrePersist(String newValidationGroupPrePersist) {
- String old = this.validationGroupPrePersist;
- this.validationGroupPrePersist = newValidationGroupPrePersist;
- this.putProperty(VALIDATION_GROUP_PRE_PERSIST_PROPERTY, newValidationGroupPrePersist);
- this.firePropertyChanged(VALIDATION_GROUP_PRE_PERSIST_PROPERTY, old, newValidationGroupPrePersist);
- }
-
- private void validationGroupPrePersistChanged(String newValue) {
- String old = this.validationGroupPrePersist;
- this.validationGroupPrePersist = newValue;
- this.firePropertyChanged(VALIDATION_GROUP_PRE_PERSIST_PROPERTY, old, newValue);
- }
-
- public String getDefaultValidationGroupPrePersist() {
- return DEFAULT_VALIDATION_GROUP_PRE_PERSIST;
- }
-
- // ********** ValidationGroupPreUpdate **********
- public String getValidationGroupPreUpdate() {
- return this.validationGroupPreUpdate;
- }
-
- public void setValidationGroupPreUpdate(String newValidationGroupPreUpdate) {
- String old = this.validationGroupPreUpdate;
- this.validationGroupPreUpdate = newValidationGroupPreUpdate;
- this.putProperty(VALIDATION_GROUP_PRE_UPDATE_PROPERTY, newValidationGroupPreUpdate);
- this.firePropertyChanged(VALIDATION_GROUP_PRE_UPDATE_PROPERTY, old, newValidationGroupPreUpdate);
- }
-
- private void validationGroupPreUpdateChanged(String newValue) {
- String old = this.validationGroupPreUpdate;
- this.validationGroupPreUpdate = newValue;
- this.firePropertyChanged(VALIDATION_GROUP_PRE_UPDATE_PROPERTY, old, newValue);
- }
-
- public String getDefaultValidationGroupPreUpdate() {
- return DEFAULT_VALIDATION_GROUP_PRE_UPDATE;
- }
-
- // ********** ValidationGroupPreRemove **********
- public String getValidationGroupPreRemove() {
- return this.validationGroupPreRemove;
- }
-
- public void setValidationGroupPreRemove(String newValidationGroupPreRemove) {
- String old = this.validationGroupPreRemove;
- this.validationGroupPreRemove = newValidationGroupPreRemove;
- this.putProperty(VALIDATION_GROUP_PRE_REMOVE_PROPERTY, newValidationGroupPreRemove);
- this.firePropertyChanged(VALIDATION_GROUP_PRE_REMOVE_PROPERTY, old, newValidationGroupPreRemove);
- }
-
- private void validationGroupPreRemoveChanged(String newValue) {
- String old = this.validationGroupPreRemove;
- this.validationGroupPreRemove = newValue;
- this.firePropertyChanged(VALIDATION_GROUP_PRE_REMOVE_PROPERTY, old, newValue);
- }
-
- public String getDefaultValidationGroupPreRemove() {
- return DEFAULT_VALIDATION_GROUP_PRE_REMOVE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/NullOptions2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/NullOptions2_0.java
deleted file mode 100644
index a09768382a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/NullOptions2_0.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.persistence.options;
-
-import java.util.Map;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnitProperties;
-import org.eclipse.jpt.core.jpa2.context.persistence.options.JpaOptions2_0;
-
-/**
- * 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;
- }
-
-
- // ********** ValidationGroupPrePersist **********
- public String getValidationGroupPrePersist() {
- return null;
- }
-
- public void setValidationGroupPrePersist(String newValidationGroupPrePersist) {
- throw new UnsupportedOperationException();
- }
-
- public String getDefaultValidationGroupPrePersist() {
- return DEFAULT_VALIDATION_GROUP_PRE_PERSIST;
- }
-
- // ********** ValidationGroupPreUpdate **********
- public String getValidationGroupPreUpdate() {
- return null;
- }
-
- public void setValidationGroupPreUpdate(String newValidationGroupPreUpdate) {
- throw new UnsupportedOperationException();
- }
-
- public String getDefaultValidationGroupPreUpdate() {
- return DEFAULT_VALIDATION_GROUP_PRE_UPDATE;
- }
-
- // ********** ValidationGroupPreRemove **********
- public String getValidationGroupPreRemove() {
- return null;
- }
-
- public void setValidationGroupPreRemove(String newValidationGroupPreRemove) {
- throw new UnsupportedOperationException();
- }
-
- public String getDefaultValidationGroupPreRemove() {
- return DEFAULT_VALIDATION_GROUP_PRE_REMOVE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java
deleted file mode 100644
index ec2cd71009..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryAccess2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceAccess2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceAccess2_0Annotation(parent, member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- return new NullAccess2_0Annotation(parent);
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember 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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java
deleted file mode 100644
index d885db7ebf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryAssociationOverride2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceAssociationOverride2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.AssociationOverride
- */
-public final class AssociationOverride2_0AnnotationDefinition
- implements AnnotationDefinition
-{
- // singleton
- private static final AnnotationDefinition INSTANCE = new AssociationOverride2_0AnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static AnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private AssociationOverride2_0AnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return SourceAssociationOverride2_0Annotation.buildAssociationOverride(parent, member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryAssociationOverride2_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return AssociationOverrideAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java
deleted file mode 100644
index 3d9b6239d1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryAssociationOverrides2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceAssociationOverrides2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.AssociationOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.AssociationOverrides
- */
-public final class AssociationOverrides2_0AnnotationDefinition
- implements AnnotationDefinition
-{
- // singleton
- private static final AnnotationDefinition INSTANCE = new AssociationOverrides2_0AnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static AnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private AssociationOverrides2_0AnnotationDefinition() {
- super();
- }
-
- public AssociationOverridesAnnotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new SourceAssociationOverrides2_0Annotation(parent, member);
- }
-
- public AssociationOverridesAnnotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryAssociationOverrides2_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return AssociationOverridesAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java
deleted file mode 100644
index e5911e193b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryCacheable2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceCacheable2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.Cacheable2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * javax.persistence.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(JavaResourcePersistentMember parent, Member member) {
- return new SourceCacheable2_0Annotation((JavaResourcePersistentType) parent, (Type) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryCacheable2_0Annotation((JavaResourcePersistentType) parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return Cacheable2_0Annotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java
deleted file mode 100644
index 867ffbf4bb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryElementCollection2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceElementCollection2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.ElementCollection2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceElementCollection2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryElementCollection2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ElementCollection2_0Annotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java
deleted file mode 100644
index 42a60a11a5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryGeneratedAnnotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceGeneratedAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.GeneratedAnnotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * javax.annotation.Generated
- * <p>
- * This annotation definition is not really required; it's just here for a bit
- * of consistency....
- */
-public final class GeneratedAnnotationDefinition
- implements AnnotationDefinition
-{
- // singleton
- private static final GeneratedAnnotationDefinition INSTANCE = new GeneratedAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static GeneratedAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private GeneratedAnnotationDefinition() {
- super();
- }
-
- public GeneratedAnnotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new SourceGeneratedAnnotation((JavaResourcePersistentType) parent, (Type) member);
- }
-
- public GeneratedAnnotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- return null;
- }
-
- public GeneratedAnnotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryGeneratedAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return GeneratedAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java
deleted file mode 100644
index 6c1f5bb613..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryMapsId2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceMapsId2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapsId2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceMapsId2_0Annotation(parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- return new NullMapsId2_0Annotation(parent);
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember 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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java
deleted file mode 100644
index 2c17accad0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryNamedQueries2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceNamedQueries2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.NamedQueriesAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * javax.persistence.NamedQueries
- */
-public class NamedQueries2_0AnnotationDefinition
- implements AnnotationDefinition
-{
- // singleton
- private static final AnnotationDefinition INSTANCE = new NamedQueries2_0AnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static AnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private NamedQueries2_0AnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new SourceNamedQueries2_0Annotation(parent, (Type) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryNamedQueries2_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return NamedQueriesAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java
deleted file mode 100644
index 5c09d18be5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryNamedQuery2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceNamedQuery2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * javax.persistence.NamedQuery
- */
-public class NamedQuery2_0AnnotationDefinition
- implements AnnotationDefinition
-{
- // singleton
- private static final AnnotationDefinition INSTANCE = new NamedQuery2_0AnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static AnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private NamedQuery2_0AnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new SourceNamedQuery2_0Annotation(parent, (Type) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryNamedQuery2_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return NamedQueryAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java
deleted file mode 100644
index d3990a5aaf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.NullAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.core.resource.java.AccessType;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.Access
- */
-public class NullAccess2_0Annotation
- extends NullAnnotation
- implements Access2_0Annotation
-{
-
- protected NullAccess2_0Annotation(JavaResourcePersistentMember parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- protected Access2_0Annotation addAnnotation() {
- return (Access2_0Annotation) super.addAnnotation();
- }
-
- // ***** value
- public AccessType getValue() {
- return null;
- }
-
- public void setValue(AccessType value) {
- if (value != null) {
- this.addAnnotation().setValue(value);
- }
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullAssociationOverrideJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullAssociationOverrideJoinTableAnnotation.java
deleted file mode 100644
index ef40c1d9f8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullAssociationOverrideJoinTableAnnotation.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jpt.core.internal.resource.java.NullJoinTableAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.AssociationOverride2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember.AnnotationInitializer;
-
-/**
- * javax.persistence.JoinTable found in a javax.persistence.AssociationOverride annotation
- */
-public 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();
- }
-
- @Override
- protected JoinColumnAnnotation addAnnotation(AnnotationInitializer initializer) {
- return this.getAssociationOverride2_0Annotation().addJoinTable(initializer);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java
deleted file mode 100644
index a7e55dc6dc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.NullAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapsId2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.MapsId
- */
-public class NullMapsId2_0Annotation
- extends NullAnnotation
- implements MapsId2_0Annotation
-{
- protected NullMapsId2_0Annotation(JavaResourcePersistentMember parent) {
- super(parent);
- }
-
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- protected MapsId2_0Annotation addAnnotation() {
- return (MapsId2_0Annotation) super.addAnnotation();
- }
-
- public String getValue() {
- return null;
- }
-
- public void setValue(String newValue) {
- if (newValue != null) {
- this.addAnnotation().setValue(newValue);
- }
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullOneToMany2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullOneToMany2_0Annotation.java
deleted file mode 100644
index e1f7c07248..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullOneToMany2_0Annotation.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.NullOneToManyAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.OneToMany2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * NullOneToMany2_0Annotation
- */
-public final class NullOneToMany2_0Annotation
- extends NullOneToManyAnnotation
- implements OneToMany2_0Annotation
-{
- public NullOneToMany2_0Annotation(JavaResourcePersistentAttribute parent) {
- super(parent);
- }
-
- // ********** JPA 2.0 - OrphanRemovable2_0 implementation **********
- public Boolean getOrphanRemoval() {
- return null;
- }
-
- public void setOrphanRemoval(Boolean orphanRemoval) {
- if (orphanRemoval != null) {
- this.addAnnotation().setOrphanRemoval(orphanRemoval);
- }
- }
-
- public TextRange getOrphanRemovalTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- @Override
- protected OneToMany2_0Annotation addAnnotation() {
- return (OneToMany2_0Annotation) super.addAnnotation();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullOneToOne2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullOneToOne2_0Annotation.java
deleted file mode 100644
index 686116f6f7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullOneToOne2_0Annotation.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.NullOneToOneAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.OneToOne2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * NullOneToOne2_0Annotation
- */
-public final class NullOneToOne2_0Annotation
- extends NullOneToOneAnnotation
- implements OneToOne2_0Annotation
-{
- public NullOneToOne2_0Annotation(JavaResourcePersistentAttribute parent) {
- super(parent);
- }
-
- // ********** JPA 2.0 - OrphanRemovable2_0 implementation **********
- public Boolean getOrphanRemoval() {
- return null;
- }
-
- public void setOrphanRemoval(Boolean orphanRemoval) {
- if (orphanRemoval != null) {
- this.addAnnotation().setOrphanRemoval(orphanRemoval);
- }
- }
-
- public TextRange getOrphanRemovalTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- @Override
- protected OneToOne2_0Annotation addAnnotation() {
- return (OneToOne2_0Annotation) super.addAnnotation();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/OneToMany2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/OneToMany2_0AnnotationDefinition.java
deleted file mode 100644
index 10d1450d2a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/OneToMany2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryOneToMany2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceOneToMany2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.OneToMany
- */
-public final class OneToMany2_0AnnotationDefinition
- implements AnnotationDefinition
-{
- // singleton
- private static final AnnotationDefinition INSTANCE = new OneToMany2_0AnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static AnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private OneToMany2_0AnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new SourceOneToMany2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- return new NullOneToMany2_0Annotation((JavaResourcePersistentAttribute) parent);
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryOneToMany2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return OneToManyAnnotation.ANNOTATION_NAME;
- }
-
-}
-
-
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/OneToOne2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/OneToOne2_0AnnotationDefinition.java
deleted file mode 100644
index f0c926047d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/OneToOne2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryOneToOne2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceOneToOne2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.OneToOne
- */
-public class OneToOne2_0AnnotationDefinition
- implements AnnotationDefinition
-{
- // singleton
- private static final AnnotationDefinition INSTANCE = new OneToOne2_0AnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static AnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private OneToOne2_0AnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new SourceOneToOne2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- return new NullOneToOne2_0Annotation((JavaResourcePersistentAttribute) parent);
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryOneToOne2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return OneToOneAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java
deleted file mode 100644
index 0b1f977a11..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryOrderColumn2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceOrderColumn2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceOrderColumn2_0Annotation(parent, member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- return null;// new NullOrderColumn2_0Annotation(parent);
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember 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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java
deleted file mode 100644
index f3d9aed822..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinarySequenceGenerator2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceSequenceGenerator2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceSequenceGenerator2_0Annotation(parent, member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinarySequenceGenerator2_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return SequenceGeneratorAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java
deleted file mode 100644
index 76686e5815..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryStaticMetamodelAnnotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceStaticMetamodelAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.StaticMetamodelAnnotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * javax.persistence.metamodel.StaticMetamodel
- * <p>
- * This annotation definition is not really required; it's just here for a bit
- * of consistency....
- */
-public final class StaticMetamodelAnnotationDefinition
- implements AnnotationDefinition
-{
- // singleton
- private static final StaticMetamodelAnnotationDefinition INSTANCE = new StaticMetamodelAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static StaticMetamodelAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private StaticMetamodelAnnotationDefinition() {
- super();
- }
-
- public StaticMetamodelAnnotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new SourceStaticMetamodelAnnotation((JavaResourcePersistentType) parent, (Type) member);
- }
-
- public StaticMetamodelAnnotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- return null;
- }
-
- public StaticMetamodelAnnotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryStaticMetamodelAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return StaticMetamodelAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java
deleted file mode 100644
index c4fc19b2bd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.AccessType;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.Access
- */
-public final class BinaryAccess2_0Annotation
- extends BinaryAnnotation
- implements Access2_0Annotation
-{
- private AccessType value;
-
-
- public BinaryAccess2_0Annotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.value = this.buildValue();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setValue_(this.buildValue());
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.value);
- }
-
-
- // ********** AccessAnnotation implementation **********
-
- // ***** value
- public AccessType getValue() {
- return this.value;
- }
-
- public void setValue(AccessType value) {
- throw new UnsupportedOperationException();
- }
-
- private void setValue_(AccessType value) {
- AccessType old = this.value;
- this.value = value;
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private AccessType buildValue() {
- return AccessType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA2_0.ACCESS));
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java
deleted file mode 100644
index 27e2fcb276..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.NullJoinTableAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAssociationOverrideAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryJoinTableAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.AssociationOverride2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember.AnnotationInitializer;
-
-/**
- * BinarySequenceGenerator2_0Annotation
- */
-public final class BinaryAssociationOverride2_0Annotation
- extends BinaryAssociationOverrideAnnotation
- implements AssociationOverride2_0Annotation
-{
- private JoinTableAnnotation joinTable;
-
- public BinaryAssociationOverride2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.joinTable = this.buildJoinTable();
- }
-
- @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 : new NullJoinTableAnnotation(this);
- }
-
- public JoinTableAnnotation addJoinTable() {
- throw new UnsupportedOperationException();
- }
-
- public JoinColumnAnnotation addJoinTable(AnnotationInitializer initializer) {
- 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 buildJoinTable(IAnnotation jdtJoinTable) {
- return new BinaryJoinTableAnnotation(this, jdtJoinTable);
- }
-
- private IAnnotation getJdtJoinTable() {
- return (IAnnotation) this.getJdtMemberValue(JPA2_0.ASSOCIATION_OVERRIDE__JOIN_TABLE);
- }
-
- private void setJoinTable(JoinTableAnnotation column) {
- JoinTableAnnotation old = this.joinTable;
- this.joinTable = column;
- this.firePropertyChanged(JOIN_TABLE_PROPERTY, old, column);
- }
-
- // TODO
- private void updateJoinTable() {
- throw new UnsupportedOperationException();
-// IAnnotation jdtJoinTable = this.getJdtJoinTable();
-// if (jdtJoinTable == null) {
-// this.setJoinTable(null);
-// } else {
-// if (this.column == null) {
-// this.setJoinTable(this.buildJoinTable(jdtJoinTable));
-// } else {
-// this.column.update(jdtJoinTable);
-// }
-// }
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java
deleted file mode 100644
index d47f13bc82..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAssociationOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAssociationOverrideAnnotation;
-
-/**
- * javax.persistence.AssociationOverrides
- */
-public class BinaryAssociationOverrides2_0Annotation
- extends BinaryAssociationOverridesAnnotation
-{
-
- public BinaryAssociationOverrides2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- @Override
- protected NestableAssociationOverrideAnnotation buildAssociationOverride(Object jdtAssociationOverride) {
- return new BinaryAssociationOverride2_0Annotation(this, (IAnnotation) jdtAssociationOverride);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java
deleted file mode 100644
index 1a737311cc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.Cacheable2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.Cacheable
- */
-public final class BinaryCacheable2_0Annotation
- extends BinaryAnnotation
- implements Cacheable2_0Annotation
-{
- private Boolean value;
-
-
- public BinaryCacheable2_0Annotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.value = this.buildValue();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setValue_(this.buildValue());
- }
-
-
- // ********** Cacheable2_0Annotation implementation **********
-
- // ***** value
- public Boolean getValue() {
- return this.value;
- }
-
- public void setValue(Boolean value) {
- throw new UnsupportedOperationException();
- }
-
- private void setValue_(Boolean value) {
- Boolean old = this.value;
- this.value = value;
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private Boolean buildValue() {
- return (Boolean) this.getJdtMemberValue(JPA2_0.CACHEABLE__VALUE);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java
deleted file mode 100644
index 12d2654def..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.ElementCollection2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * org.eclipse.persistence.annotations.Transformation
- */
-public class BinaryElementCollection2_0Annotation
- extends BinaryAnnotation
- implements ElementCollection2_0Annotation
-{
- private String targetClass;
- private FetchType fetch;
-
-
- public BinaryElementCollection2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.targetClass = this.buildTargetClass();
- this.fetch = this.buildFetch();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setTargetClass_(this.buildTargetClass());
- this.setFetch_(this.buildFetch());
- }
-
-
- // ********** ElementCollection2_0Annotation implementation **********
-
- // ***** target entity
- public String getTargetClass() {
- return this.targetClass;
- }
-
- public void setTargetClass(String targetClass) {
- throw new UnsupportedOperationException();
- }
-
- private void setTargetClass_(String targetClass) {
- String old = this.targetClass;
- this.targetClass = targetClass;
- this.firePropertyChanged(TARGET_CLASS_PROPERTY, old, targetClass);
- this.firePropertyChanged(FULLY_QUALIFIED_TARGET_CLASS_NAME_PROPERTY, old, targetClass);
- }
-
- private String buildTargetClass() {
- return (String) this.getJdtMemberValue(JPA2_0.ELEMENT_COLLECTION__TARGET_CLASS);
- }
-
- public TextRange getTargetClassTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** fully-qualified target entity class name
- public String getFullyQualifiedTargetClassName() {
- return this.targetClass;
- }
-
- // ***** fetch
- public FetchType getFetch() {
- return this.fetch;
- }
-
- public void setFetch(FetchType fetch) {
- throw new UnsupportedOperationException();
- }
-
- private void setFetch_(FetchType fetch) {
- FetchType old = this.fetch;
- this.fetch = fetch;
- this.firePropertyChanged(FETCH_PROPERTY, old, fetch);
- }
-
- private FetchType buildFetch() {
- return FetchType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA2_0.ELEMENT_COLLECTION__FETCH));
- }
-
- public TextRange getFetchTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java
deleted file mode 100644
index e9f51b48b7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.GeneratedAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.annotation.Generated
- */
-public final class BinaryGeneratedAnnotation
- extends BinaryAnnotation
- implements GeneratedAnnotation
-{
- private final Vector<String> values;
- private String date;
- private String comments;
-
-
- public BinaryGeneratedAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.values = this.buildValues();
- this.date = this.buildDate();
- this.comments = this.buildComments();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.updateValues();
- this.setDate_(this.buildDate());
- this.setComments_(this.buildComments());
- }
-
- // TODO
- private void updateValues() {
- throw new UnsupportedOperationException();
- }
-
-
- // ********** GeneratedAnnotation implementation **********
-
- // ***** values
- public ListIterator<String> values() {
- return new CloneListIterator<String>(this.values);
- }
-
- public int valuesSize() {
- return this.values.size();
- }
-
- public String getValue(int index) {
- return this.values.get(index);
- }
-
- private Vector<String> buildValues() {
- Object[] jdtValues = this.getJdtMemberValues(VALUE_ELEMENT_NAME);
- Vector<String> result = new Vector<String>(jdtValues.length);
- for (Object value : jdtValues) {
- result.add((String) value);
- }
- return result;
- }
-
- public void addValue(String value) {
- throw new UnsupportedOperationException();
- }
-
- public void addValue(int index, String value) {
- throw new UnsupportedOperationException();
- }
-
- public void moveValue(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void removeValue(String value) {
- throw new UnsupportedOperationException();
- }
-
- public void removeValue(int index) {
- throw new UnsupportedOperationException();
- }
-
- // ***** date
- public String getDate() {
- return this.date;
- }
-
- public void setDate(String date) {
- throw new UnsupportedOperationException();
- }
-
- private void setDate_(String date) {
- String old = this.date;
- this.date = date;
- this.firePropertyChanged(DATE_PROPERTY, old, date);
- }
-
- private String buildDate() {
- return (String) this.getJdtMemberValue(DATE_ELEMENT_NAME);
- }
-
- // ***** comments
- public String getComments() {
- return this.comments;
- }
-
- public void setComments(String comments) {
- throw new UnsupportedOperationException();
- }
-
- private void setComments_(String comments) {
- String old = this.comments;
- this.comments = comments;
- this.firePropertyChanged(COMMENTS_PROPERTY, old, comments);
- }
-
- private String buildComments() {
- return (String) this.getJdtMemberValue(COMMENTS_ELEMENT_NAME);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java
deleted file mode 100644
index 6ca7591d74..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.MapsId2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.MapsId
- */
-public class BinaryMapsId2_0Annotation
- extends BinaryAnnotation
- implements MapsId2_0Annotation
-{
- private String value;
-
-
- public BinaryMapsId2_0Annotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.value = this.buildValue();
- }
-
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setValue_(this.buildValue());
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.value);
- }
-
-
- // ********** 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();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java
deleted file mode 100644
index 23c5499dff..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryNamedQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
-
-/**
- * javax.persistence.NamedQueries
- */
-public final class BinaryNamedQueries2_0Annotation
- extends BinaryNamedQueriesAnnotation
-{
- public BinaryNamedQueries2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- @Override
- protected NamedQueryAnnotation buildNamedQuery(Object jdtQuery) {
- return new BinaryNamedQuery2_0Annotation(this, (IAnnotation) jdtQuery);
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java
deleted file mode 100644
index c42b1289dd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryNamedQueryAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.LockModeType_2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.NamedQuery2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * BinaryNamedQuery2_0Annotation
- */
-public final class BinaryNamedQuery2_0Annotation
- extends BinaryNamedQueryAnnotation
- implements NamedQuery2_0Annotation
-{
- private LockModeType_2_0 lockMode;
-
- public BinaryNamedQuery2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.lockMode = this.buildLockMode();
- }
-
- @Override
- public void update() {
- super.update();
- this.setLockMode_(this.buildLockMode());
- }
-
- // ********** NamedQuery2_0Annotation implementation **********
-
- public LockModeType_2_0 getLockMode() {
- return this.lockMode;
- }
-
- public void setLockMode(LockModeType_2_0 lockMode) {
- throw new UnsupportedOperationException();
- }
-
- private void setLockMode_(LockModeType_2_0 lockMode) {
- LockModeType_2_0 old = this.lockMode;
- this.lockMode = lockMode;
- this.firePropertyChanged(LOCK_MODE_PROPERTY, old, lockMode);
- }
-
- public TextRange getLockModeTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean lockModeTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- private LockModeType_2_0 buildLockMode() {
- return LockModeType_2_0.fromJavaAnnotationValue(this.getJdtMemberValue(JPA2_0.NAMED_QUERY__LOCK_MODE));
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryOneToMany2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryOneToMany2_0Annotation.java
deleted file mode 100644
index 7760598650..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryOneToMany2_0Annotation.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryOneToManyAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.OneToMany2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * BinaryOneToMany2_0Annotation
- */
-public final class BinaryOneToMany2_0Annotation
- extends BinaryOneToManyAnnotation
- implements OneToMany2_0Annotation
-{
- private Boolean orphanRemoval;
-
- // ********** constructor **********
- public BinaryOneToMany2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.orphanRemoval = this.buildOrphanRemoval();
- }
-
- @Override
- public void update() {
- super.update();
- this.setOrphanRemoval_(this.buildOrphanRemoval());
- }
-
- // ********** 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);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryOneToOne2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryOneToOne2_0Annotation.java
deleted file mode 100644
index 47150a3570..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryOneToOne2_0Annotation.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryOneToOneAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.OneToOne2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * BinaryOneToOne2_0Annotation
- */
-public final class BinaryOneToOne2_0Annotation
- extends BinaryOneToOneAnnotation
- implements OneToOne2_0Annotation
-{
- private Boolean orphanRemoval;
-
- // ********** constructor **********
- public BinaryOneToOne2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.orphanRemoval = this.buildOrphanRemoval();
- }
-
- @Override
- public void update() {
- super.update();
- this.setOrphanRemoval_(this.buildOrphanRemoval());
- }
-
- // ********** 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);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java
deleted file mode 100644
index e83939294f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryNamedColumnAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.OrderColumn
- */
-public class BinaryOrderColumn2_0Annotation
- extends BinaryNamedColumnAnnotation
- implements OrderColumn2_0Annotation
-{
- private Boolean nullable;
- private Boolean insertable;
- private Boolean updatable;
-
-
- public BinaryOrderColumn2_0Annotation(JavaResourceNode 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;
- }
-
- @Override
- protected String getColumnDefinitionElementName() {
- return JPA.COLUMN__COLUMN_DEFINITION;
- }
-
- @Override
- protected String getNameElementName() {
- return JPA.COLUMN__NAME;
- }
-
- //************* OrderColumn2_0Annotation implementation *************
-
- // ***** nullable
- public Boolean getNullable() {
- return this.nullable;
- }
-
- public void setNullable(Boolean nullable) {
- throw new UnsupportedOperationException();
- }
-
- private void setNullable_(Boolean nullable) {
- Boolean old = this.nullable;
- this.nullable = nullable;
- this.firePropertyChanged(NULLABLE_PROPERTY, old, nullable);
- }
-
- private Boolean buildNullable() {
- return (Boolean) this.getJdtMemberValue(getNullableElementName());
- }
-
- String getNullableElementName() {
- return JPA.COLUMN__NULLABLE;
- }
-
- public TextRange getNullableTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** insertable
- public Boolean getInsertable() {
- return this.insertable;
- }
-
- public void setInsertable(Boolean insertable) {
- throw new UnsupportedOperationException();
- }
-
- private void setInsertable_(Boolean insertable) {
- Boolean old = this.insertable;
- this.insertable = insertable;
- this.firePropertyChanged(INSERTABLE_PROPERTY, old, insertable);
- }
-
- private Boolean buildInsertable() {
- return (Boolean) this.getJdtMemberValue(this.getInsertableElementName());
- }
-
- String getInsertableElementName() {
- return JPA.COLUMN__INSERTABLE;
- }
-
- public TextRange getInsertableTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** updatable
- public Boolean getUpdatable() {
- return this.updatable;
- }
-
- public void setUpdatable(Boolean updatable) {
- throw new UnsupportedOperationException();
- }
-
- private void setUpdatable_(Boolean updatable) {
- Boolean old = this.updatable;
- this.updatable = updatable;
- this.firePropertyChanged(UPDATABLE_PROPERTY, old, updatable);
- }
-
- private Boolean buildUpdatable() {
- return (Boolean) this.getJdtMemberValue(this.getUpdatableElementName());
- }
-
- String getUpdatableElementName() {
- return JPA.COLUMN__UPDATABLE;
- }
-
- public TextRange getUpdatableTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java
deleted file mode 100644
index 6919129230..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinarySequenceGeneratorAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.SequenceGenerator2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * BinarySequenceGenerator2_0Annotation
- */
-public final class BinarySequenceGenerator2_0Annotation
- extends BinarySequenceGeneratorAnnotation
- implements SequenceGenerator2_0Annotation
-{
- private String catalog;
- private String schema;
-
-
- public BinarySequenceGenerator2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.catalog = this.buildCatalog();
- this.schema = this.buildSchema();
- }
-
- @Override
- public void update() {
- super.update();
- this.setCatalog_(this.buildCatalog());
- this.setSchema_(this.buildSchema());
- }
-
- // ********** SequenceGenerator2_0Annotation implementation **********
-
- // ********** catalog **********
-
- public String getCatalog() {
- return this.catalog;
- }
-
- public void setCatalog(String catalog) {
- throw new UnsupportedOperationException();
- }
-
- private void setCatalog_(String catalog) {
- String old = this.catalog;
- this.catalog = catalog;
- this.firePropertyChanged(CATALOG_PROPERTY, old, catalog);
- }
-
- private String buildCatalog() {
- return (String) this.getJdtMemberValue(JPA2_0.SEQUENCE_GENERATOR__CATALOG);
- }
-
- public TextRange getCatalogTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean catalogTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ********** schema **********
-
- public String getSchema() {
- return this.schema;
- }
-
- public void setSchema(String schema) {
- throw new UnsupportedOperationException();
- }
-
- private void setSchema_(String schema) {
- String old = this.schema;
- this.schema = schema;
- this.firePropertyChanged(SCHEMA_PROPERTY, old, schema);
- }
-
- private String buildSchema() {
- return (String) this.getJdtMemberValue(JPA2_0.SEQUENCE_GENERATOR__SCHEMA);
- }
-
- public TextRange getSchemaTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean schemaTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java
deleted file mode 100644
index caa427c79b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.StaticMetamodelAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-
-/**
- * javax.persistence.metamodel.StaticMetamodel
- */
-public final class BinaryStaticMetamodelAnnotation
- extends BinaryAnnotation
- implements StaticMetamodelAnnotation
-{
- private String value;
-
-
- public BinaryStaticMetamodelAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.value = this.buildValue();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setValue_(this.buildValue());
- }
-
-
- // ********** StaticMetamodelAnnotation implementation **********
-
- // ***** value
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- throw new UnsupportedOperationException();
- }
-
- private void setValue_(String value) {
- String old = this.value;
- this.value = value;
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- this.firePropertyChanged(FULLY_QUALIFIED_CLASS_NAME_PROPERTY, old, value);
- }
-
- private String buildValue() {
- return (String) this.getJdtMemberValue(JPA2_0.STATIC_METAMODEL__VALUE);
- }
-
- // ***** fully-qualified class name
- /**
- * binary is already fully-qualified
- */
- public String getFullyQualifiedClassName() {
- return this.value;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java
deleted file mode 100644
index 318d880818..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.AccessType;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.Access
- */
-public final class SourceAccess2_0Annotation
- extends SourceAnnotation<Member>
- implements Access2_0Annotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter();
- private final AnnotationElementAdapter<String> valueAdapter;
- private AccessType value;
-
-
- public SourceAccess2_0Annotation(JavaResourcePersistentMember parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(member, VALUE_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.buildValue(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setValue(this.buildValue(astRoot));
- }
-
- @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.attributeValueHasNotChanged(this.value, value)) {
- return;
- }
- AccessType old = this.value;
- this.value = value;
- this.valueAdapter.setValue(AccessType.toJavaAnnotationValue(value));
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private AccessType buildValue(CompilationUnit astRoot) {
- return AccessType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot));
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(VALUE_ADAPTER, astRoot);
- }
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.ACCESS__VALUE);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java
deleted file mode 100644
index 02cf8620ad..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.NullAssociationOverrideJoinTableAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceAssociationOverrideAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceJoinTableAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberIndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NestedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.jpa2.resource.java.AssociationOverride2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableJoinTableAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember.AnnotationInitializer;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * SourceSequenceGenerator2_0Annotation
- */
-public final class SourceAssociationOverride2_0Annotation
- extends SourceAssociationOverrideAnnotation
- implements AssociationOverride2_0Annotation
-{
- private final MemberAnnotationAdapter joinTableAdapter;
- private NestableJoinTableAnnotation joinTable;
-
-
- // ********** constructor **********
- public SourceAssociationOverride2_0Annotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
- this.joinTableAdapter = new MemberAnnotationAdapter(this.member, buildJoinTableAnnotationAdapter(this.daa));
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- if (this.joinTableAdapter.getAnnotation(astRoot) != null) {
- this.joinTable = buildJoinTableAnnotation(this, this.member, this.daa);
- this.joinTable.initialize(astRoot);
- }
- }
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
- this.updateJoinTable(astRoot);
- }
-
- //************ AssociationOverride2_0Annotation implementation ****************
-
- // ***** joinTable
- public JoinTableAnnotation getJoinTable() {
- return this.joinTable;
- }
-
- public NestableJoinTableAnnotation addJoinTable() {
- NestableJoinTableAnnotation table = buildJoinTableAnnotation(this, this.member, this.daa);
- table.newAnnotation();
- this.setJoinTable(table);
- return table;
- }
-
- public JoinColumnAnnotation addJoinTable(AnnotationInitializer initializer) {
- NestableJoinTableAnnotation table = buildJoinTableAnnotation(this, this.member, this.daa);
- JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) initializer.initializeAnnotation(table);
- table.newAnnotation();
- this.setJoinTable(table);
- return joinColumn;
- }
-
- public void removeJoinTable() {
- this.joinTable.removeAnnotation();
- setJoinTable(null);
- }
-
- private void setJoinTable(NestableJoinTableAnnotation joinTable) {
- JoinTableAnnotation old = this.joinTable;
- this.joinTable = joinTable;
- this.firePropertyChanged(JOIN_TABLE_PROPERTY, old, joinTable);
- }
-
- public JoinTableAnnotation getNonNullJoinTable() {
- return (this.joinTable != null) ? this.joinTable : new NullAssociationOverrideJoinTableAnnotation(this);
- }
-
- private void updateJoinTable(CompilationUnit astRoot) {
- if (this.joinTableAdapter.getAnnotation(astRoot) == null) {
- this.setJoinTable(null);
- } else {
- if (this.joinTable == null) {
- NestableJoinTableAnnotation table = buildJoinTableAnnotation(this, this.member, this.daa);
- table.initialize(astRoot);
- this.setJoinTable(table);
- } else {
- this.joinTable.update(astRoot);
- }
- }
- }
-
-
- // ********** static methods **********
-
- public static SourceAssociationOverride2_0Annotation buildAssociationOverride(JavaResourceNode parent, Member member) {
- return new SourceAssociationOverride2_0Annotation(parent, member, DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER));
- }
-
- static NestableJoinTableAnnotation buildJoinTableAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter associationOverrideAnnotationAdapter) {
- return new SourceJoinTableAnnotation(parent, member, buildJoinTableAnnotationAdapter(associationOverrideAnnotationAdapter));
- }
-
- static DeclarationAnnotationAdapter buildJoinTableAnnotationAdapter(DeclarationAnnotationAdapter associationOverrideAnnotationAdapter) {
- return new NestedDeclarationAnnotationAdapter(associationOverrideAnnotationAdapter, JPA2_0.ASSOCIATION_OVERRIDE__JOIN_TABLE, org.eclipse.jpt.core.resource.java.JPA.JOIN_TABLE);
- }
-
-
- static SourceAssociationOverrideAnnotation buildNestedAssociationOverride(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
- IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter);
- IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(member, idaa);
- return new SourceAssociationOverride2_0Annotation(parent, member, idaa, annotationAdapter);
- }
-
- protected static IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
- return new NestedIndexedDeclarationAnnotationAdapter(attributeOverridesAdapter, index, org.eclipse.jpt.core.resource.java.JPA.ASSOCIATION_OVERRIDE);
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java
deleted file mode 100644
index 62dead13dc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jpt.core.internal.resource.java.source.SourceAssociationOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAssociationOverrideAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.AssociationOverrides
- */
-public final class SourceAssociationOverrides2_0Annotation
- extends SourceAssociationOverridesAnnotation
-{
-
- public SourceAssociationOverrides2_0Annotation(JavaResourceNode parent, Member member) {
- super(parent, member);
- }
-
- @Override
- protected NestableAssociationOverrideAnnotation buildAssociationOverride(int index) {
- return SourceAssociationOverride2_0Annotation.buildNestedAssociationOverride(this, this.member, index, this.daa);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java
deleted file mode 100644
index 812163a0c4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.BooleanExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.jpa2.resource.java.Cacheable2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * javax.persistence.Cacheable
- */
-public final class SourceCacheable2_0Annotation
- extends SourceAnnotation<Member>
- implements Cacheable2_0Annotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<Boolean> VALUE_ADAPTER = buildValueAdapter();
- private final AnnotationElementAdapter<Boolean> valueAdapter;
- private Boolean value;
-
-
- public SourceCacheable2_0Annotation(JavaResourcePersistentType parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new ShortCircuitAnnotationElementAdapter<Boolean>(type, VALUE_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.buildValue(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setValue(this.buildValue(astRoot));
- }
-
- @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.attributeValueHasNotChanged(this.value, value)) {
- return;
- }
- Boolean old = this.value;
- this.value = value;
- this.valueAdapter.setValue(value);
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- 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, false, BooleanExpressionConverter.instance());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java
deleted file mode 100644
index 444ee39f06..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.JDTTools;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
-import org.eclipse.jpt.core.jpa2.resource.java.ElementCollection2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
-
-/**
- * org.eclipse.persistence.annotations.Transformation
- */
-public final class SourceElementCollection2_0Annotation
- extends SourceAnnotation<Attribute>
- implements ElementCollection2_0Annotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> TARGET_CLASS_ADAPTER = buildTargetClassAdapter();
- private final AnnotationElementAdapter<String> targetClassAdapter;
- private String targetClass;
-
- String fullyQualifiedTargetClassName;
-
- private static final DeclarationAnnotationElementAdapter<String> FETCH_ADAPTER = buildFetchAdapter();
- private final AnnotationElementAdapter<String> fetchAdapter;
- private FetchType fetch;
-
-
- public SourceElementCollection2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.targetClassAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, TARGET_CLASS_ADAPTER);
- this.fetchAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, FETCH_ADAPTER);
- }
-
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.targetClass = this.buildTargetClass(astRoot);
- this.fullyQualifiedTargetClassName = this.buildFullyQualifiedTargetClassName(astRoot);
- this.fetch = this.buildFetch(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setTargetClass(this.buildTargetClass(astRoot));
- this.setFullyQualifiedTargetClassName(this.buildFullyQualifiedTargetClassName(astRoot));
- this.setFetch(this.buildFetch(astRoot));
- }
-
- @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.attributeValueHasNotChanged(this.targetClass, targetClass)) {
- return;
- }
- String old = this.targetClass;
- this.targetClass = targetClass;
- this.targetClassAdapter.setValue(targetClass);
- this.firePropertyChanged(TARGET_CLASS_PROPERTY, old, targetClass);
- }
-
- 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() {
- return this.fullyQualifiedTargetClassName;
- }
-
- private void setFullyQualifiedTargetClassName(String name) {
- String old = this.fullyQualifiedTargetClassName;
- this.fullyQualifiedTargetClassName = name;
- this.firePropertyChanged(FULLY_QUALIFIED_TARGET_CLASS_NAME_PROPERTY, old, name);
- }
-
- private String buildFullyQualifiedTargetClassName(CompilationUnit astRoot) {
- return (this.targetClass == null) ? null : JDTTools.resolveFullyQualifiedName(this.targetClassAdapter.getExpression(astRoot));
- }
-
- // ***** fetch
- public FetchType getFetch() {
- return this.fetch;
- }
-
- public void setFetch(FetchType fetch) {
- if (this.attributeValueHasNotChanged(this.fetch, fetch)) {
- return;
- }
- FetchType old = this.fetch;
- this.fetch = fetch;
- this.fetchAdapter.setValue(FetchType.toJavaAnnotationValue(fetch));
- this.firePropertyChanged(FETCH_PROPERTY, old, fetch);
- }
-
- 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, false);
- }
-
- 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, false, converter);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java
deleted file mode 100644
index 9de575883c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import java.util.Arrays;
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.AnnotationStringArrayExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitArrayAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.jpa2.resource.java.GeneratedAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
-import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Type;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.annotation.Generated
- */
-public final class SourceGeneratedAnnotation
- extends SourceAnnotation<Type>
- implements GeneratedAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String[]> VALUE_ADAPTER = buildValueAdapter();
- private final AnnotationElementAdapter<String[]> valueAdapter;
- private final Vector<String> values = new Vector<String>();
-
- private static final DeclarationAnnotationElementAdapter<String> DATE_ADAPTER = buildAdapter(DATE_ELEMENT_NAME);
- private final AnnotationElementAdapter<String> dateAdapter;
- private String date;
-
- private static final DeclarationAnnotationElementAdapter<String> COMMENTS_ADAPTER = buildAdapter(COMMENTS_ELEMENT_NAME);
- private final AnnotationElementAdapter<String> commentsAdapter;
- private String comments;
-
-
- public SourceGeneratedAnnotation(JavaResourcePersistentType parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = this.buildAnnotationElementAdapter(VALUE_ADAPTER);
- this.dateAdapter = this.buildAdapter(DATE_ADAPTER);
- this.commentsAdapter = this.buildAdapter(COMMENTS_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- private AnnotationElementAdapter<String[]> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String[]> daea) {
- return new ShortCircuitArrayAnnotationElementAdapter<String>(this.member, daea);
- }
-
- private AnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationElementAdapter<String> daea) {
- return new ShortCircuitAnnotationElementAdapter<String>(this.member, daea);
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.initializeValues(astRoot);
- this.date = this.buildDate(astRoot);
- this.comments = this.buildComments(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.updateValues(astRoot);
- }
-
- public IndexedAnnotationAdapter getIndexedAnnotationAdapter() {
- return (IndexedAnnotationAdapter) this.annotationAdapter;
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.values);
- }
-
-
- // ********** GeneratedAnnotation implementation **********
-
- // ***** values
- public ListIterator<String> values() {
- return new CloneListIterator<String>(this.values);
- }
-
- public int valuesSize() {
- return this.values.size();
- }
-
- public 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.addValue_(index, value);
- this.valueAdapter.setValue(this.values.toArray(new String[this.values.size()]));
- }
-
- private void addValue_(int index, String value) {
- this.addItemToList(index, value, this.values, VALUES_LIST);
- }
-
- public void moveValue(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.values, VALUES_LIST);
- this.valueAdapter.setValue(this.values.toArray(new String[this.values.size()]));
- }
-
- public void removeValue(String value) {
- this.removeItemFromList(value, this.values, VALUES_LIST);
- this.valueAdapter.setValue(this.values.toArray(new String[this.values.size()]));
- }
-
- public void removeValue(int index) {
- this.removeItemFromList(index, this.values, VALUES_LIST);
- this.valueAdapter.setValue(this.values.toArray(new String[this.values.size()]));
- }
-
- private void initializeValues(CompilationUnit astRoot) {
- String[] javaValues = this.valueAdapter.getValue(astRoot);
- for (int i = 0; i < javaValues.length; i++) {
- this.values.add(javaValues[i]);
- }
- }
-
- private void updateValues(CompilationUnit astRoot) {
- String[] javaValues = this.valueAdapter.getValue(astRoot);
- this.synchronizeList(Arrays.asList(javaValues), this.values, VALUES_LIST);
- }
-
- // ***** date
- public String getDate() {
- return this.date;
- }
-
- public void setDate(String date) {
- if (this.attributeValueHasNotChanged(this.date, date)) {
- return;
- }
- String old = this.date;
- this.date = date;
- this.dateAdapter.setValue(date);
- this.firePropertyChanged(DATE_PROPERTY, old, date);
- }
-
- private String buildDate(CompilationUnit astRoot) {
- return this.dateAdapter.getValue(astRoot);
- }
-
- // ***** comments
- public String getComments() {
- return this.comments;
- }
-
- public void setComments(String comments) {
- if (this.attributeValueHasNotChanged(this.comments, comments)) {
- return;
- }
- String old = this.date;
- this.comments = comments;
- this.commentsAdapter.setValue(comments);
- this.firePropertyChanged(COMMENTS_PROPERTY, old, comments);
- }
-
- private String buildComments(CompilationUnit astRoot) {
- return this.commentsAdapter.getValue(astRoot);
- }
-
-
- // ********** static methods **********
-
- protected static DeclarationAnnotationElementAdapter<String[]> buildValueAdapter() {
- return buildArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, VALUE_ELEMENT_NAME);
- }
-
- private static DeclarationAnnotationElementAdapter<String[]> buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return buildArrayAnnotationElementAdapter(annotationAdapter, elementName, AnnotationStringArrayExpressionConverter.forStrings());
- }
-
- private static DeclarationAnnotationElementAdapter<String[]> buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String[]> converter) {
- return new ConversionDeclarationAnnotationElementAdapter<String[]>(annotationAdapter, elementName, false, converter);
- }
-
- protected static DeclarationAnnotationElementAdapter<String> buildAdapter(String elementName) {
- return buildAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
- }
-
- static DeclarationAnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(annotationAdapter, elementName);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java
deleted file mode 100644
index d73ceb8cc3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.MapsId2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-
-/**
- * javax.persistence.MapsId
- */
-public class SourceMapsId2_0Annotation
- extends SourceAnnotation<Attribute>
- implements MapsId2_0Annotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER
- = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER
- = buildValueAdapter();
-
-
- private final AnnotationElementAdapter<String> valueAdapter;
-
- private String value;
-
-
- public SourceMapsId2_0Annotation(JavaResourcePersistentMember parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, VALUE_ADAPTER);
- }
-
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.buildValue(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setValue(this.buildValue(astRoot));
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.value);
- }
-
-
- // ********** MapsId2_0Annotation implementation **********
-
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String newValue) {
- if (this.attributeValueHasNotChanged(this.value, newValue)) {
- return;
- }
- String oldValue = this.value;
- this.value = newValue;
- this.valueAdapter.setValue(newValue);
- this.firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
- }
-
- 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, JPA2_0.MAPS_ID__VALUE, false);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java
deleted file mode 100644
index 82f15d31a9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jpt.core.internal.resource.java.source.SourceNamedQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableNamedQueryAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * SourceNamedQueries2_0Annotation
- */
-public class SourceNamedQueries2_0Annotation extends SourceNamedQueriesAnnotation
-{
- public SourceNamedQueries2_0Annotation(JavaResourceNode parent, Type type) {
- super(parent, type);
- }
-
- protected NestableNamedQueryAnnotation buildNamedQuery(int index) {
- return SourceNamedQuery2_0Annotation.createNestedNamedQuery(this, member, index, this.daa);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java
deleted file mode 100644
index e554df0082..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceNamedQueryAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberIndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.LockModeType_2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.NamedQuery2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * SourceNamedQuery2_0Annotation
- */
-public final class SourceNamedQuery2_0Annotation
- extends SourceNamedQueryAnnotation
- implements NamedQuery2_0Annotation
-{
- private final DeclarationAnnotationElementAdapter<String> lockModeDeclarationAdapter;
- private final AnnotationElementAdapter<String> lockModeAdapter;
- private LockModeType_2_0 lockMode;
-
- // ********** constructors **********
- public SourceNamedQuery2_0Annotation(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, type, daa, annotationAdapter);
- this.lockModeDeclarationAdapter = this.buildLockModeTypeAdapter(daa);
- this.lockModeAdapter = new ShortCircuitAnnotationElementAdapter<String>(type, this.lockModeDeclarationAdapter);
- }
-
- public SourceNamedQuery2_0Annotation(JavaResourceNode parent, Type type) {
- this(parent, type, DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(type, DECLARATION_ANNOTATION_ADAPTER));
- }
-
- private DeclarationAnnotationElementAdapter<String> buildLockModeTypeAdapter(DeclarationAnnotationAdapter daa) {
- return new EnumDeclarationAnnotationElementAdapter(daa, this.getLockModeElementName());
- }
-
- private String getLockModeElementName() {
- return JPA2_0.NAMED_QUERY__LOCK_MODE;
- }
-
- // ********** initialize/update **********
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.lockMode = this.buildLockMode(astRoot);
- }
-
- @Override
- public void initializeFrom(NestableAnnotation oldAnnotation) {
- super.initializeFrom(oldAnnotation);
-
- NamedQuery2_0Annotation old = (NamedQuery2_0Annotation) oldAnnotation;
- this.setLockMode(old.getLockMode());
- }
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
- this.setLockMode(this.buildLockMode(astRoot));
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.lockMode);
- }
-
- // ********** NamedQuery2_0Annotation implementation **********
-
- public LockModeType_2_0 getLockMode() {
- return this.lockMode;
- }
-
- public void setLockMode(LockModeType_2_0 lockMode) {
- if (this.attributeValueHasNotChanged(this.lockMode, lockMode)) {
- return;
- }
- LockModeType_2_0 old = this.lockMode;
- this.lockMode = lockMode;
- this.lockModeAdapter.setValue(LockModeType_2_0.toJavaAnnotationValue(lockMode));
- this.firePropertyChanged(LOCK_MODE_PROPERTY, old, lockMode);
- }
-
- 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);
- }
-
-
- // ********** static methods **********
-
- static SourceNamedQuery2_0Annotation createNestedNamedQuery(JavaResourceNode parent, Type type, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
- IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter);
- IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(type, idaa);
-
- return new SourceNamedQuery2_0Annotation(parent, type, idaa, annotationAdapter);
- }
-
- private static IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter namedQueriesAdapter) {
- return new NestedIndexedDeclarationAnnotationAdapter(namedQueriesAdapter, index, JPA.NAMED_QUERY);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOneToMany2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOneToMany2_0Annotation.java
deleted file mode 100644
index 57c49026ab..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOneToMany2_0Annotation.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceOneToManyAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.BooleanExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.OneToMany2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-
-/**
- * SourceOneToMany2_0Annotation
- */
-public final class SourceOneToMany2_0Annotation
- extends SourceOneToManyAnnotation
- implements OneToMany2_0Annotation
-{
- private static final DeclarationAnnotationElementAdapter<Boolean> ORPHAN_REMOVAL_ADAPTER = buildOrphanRemovalAdapter();
- private final AnnotationElementAdapter<Boolean> orphanRemovalAdapter;
- private Boolean orphanRemoval;
-
- // ********** constructor **********
- public SourceOneToMany2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute);
- this.orphanRemovalAdapter = this.buildBooleanAnnotationElementAdapter(ORPHAN_REMOVAL_ADAPTER);
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.orphanRemoval = this.buildOrphanRemoval(astRoot);
- }
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
- this.setOrphanRemoval(this.buildOrphanRemoval(astRoot));
- }
-
- // ********** OneToMany2_0Annotation implementation **********
-
- public Boolean getOrphanRemoval() {
- return this.orphanRemoval;
- }
-
- public void setOrphanRemoval(Boolean orphanRemoval) {
- if (this.attributeValueHasNotChanged(this.orphanRemoval, orphanRemoval)) {
- return;
- }
- Boolean old = this.orphanRemoval;
- this.orphanRemoval = orphanRemoval;
- this.orphanRemovalAdapter.setValue(orphanRemoval);
- this.firePropertyChanged(ORPHAN_REMOVAL_PROPERTY, old, orphanRemoval);
- }
-
- 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<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, false, BooleanExpressionConverter.instance());
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOneToOne2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOneToOne2_0Annotation.java
deleted file mode 100644
index 11ce5d7fe1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOneToOne2_0Annotation.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceOneToOneAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.BooleanExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.OneToOne2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-
-/**
- * SourceOneToOne2_0Annotation
- */
-public final class SourceOneToOne2_0Annotation
- extends SourceOneToOneAnnotation
- implements OneToOne2_0Annotation
-{
- private static final DeclarationAnnotationElementAdapter<Boolean> ORPHAN_REMOVAL_ADAPTER = buildOrphanRemovalAdapter();
- private final AnnotationElementAdapter<Boolean> orphanRemovalAdapter;
- private Boolean orphanRemoval;
-
- // ********** constructor **********
- public SourceOneToOne2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute);
- this.orphanRemovalAdapter = this.buildBooleanAnnotationElementAdapter(ORPHAN_REMOVAL_ADAPTER);
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.orphanRemoval = this.buildOrphanRemoval(astRoot);
- }
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
- this.setOrphanRemoval(this.buildOrphanRemoval(astRoot));
- }
-
- // ********** OneToOne2_0Annotation implementation **********
-
- public Boolean getOrphanRemoval() {
- return this.orphanRemoval;
- }
-
- public void setOrphanRemoval(Boolean orphanRemoval) {
- if (this.attributeValueHasNotChanged(this.orphanRemoval, orphanRemoval)) {
- return;
- }
- Boolean old = this.orphanRemoval;
- this.orphanRemoval = orphanRemoval;
- this.orphanRemovalAdapter.setValue(orphanRemoval);
- this.firePropertyChanged(ORPHAN_REMOVAL_PROPERTY, old, orphanRemoval);
- }
-
- 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<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, false, BooleanExpressionConverter.instance());
- }
-
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java
deleted file mode 100644
index 86cb77d662..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceNamedColumnAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.BooleanExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.core.resource.java.BaseColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.OrderColumn
- */
-public class SourceOrderColumn2_0Annotation
- extends SourceNamedColumnAnnotation
- implements OrderColumn2_0Annotation
-{
-
- final DeclarationAnnotationElementAdapter<Boolean> nullableDeclarationAdapter;
- final AnnotationElementAdapter<Boolean> nullableAdapter;
- Boolean nullable;
-
- final DeclarationAnnotationElementAdapter<Boolean> insertableDeclarationAdapter;
- final AnnotationElementAdapter<Boolean> insertableAdapter;
- Boolean insertable;
-
- final DeclarationAnnotationElementAdapter<Boolean> updatableDeclarationAdapter;
- final AnnotationElementAdapter<Boolean> updatableAdapter;
- Boolean updatable;
-
- public SourceOrderColumn2_0Annotation(JavaResourceNode parent, Member member) {
- this(parent, member, new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME));
- }
-
- SourceOrderColumn2_0Annotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
- this(parent, member, daa, new MemberAnnotationAdapter(member, daa));
- }
-
- SourceOrderColumn2_0Annotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
- this.nullableDeclarationAdapter = this.buildBooleanElementAdapter(this.getNullableElementName());
- this.nullableAdapter = this.buildShortCircuitBooleanElementAdapter(this.nullableDeclarationAdapter);
- this.insertableDeclarationAdapter = this.buildBooleanElementAdapter(this.getInsertableElementName());
- this.insertableAdapter = this.buildShortCircuitBooleanElementAdapter(this.insertableDeclarationAdapter);
- this.updatableDeclarationAdapter = this.buildBooleanElementAdapter(this.getUpdatableElementName());
- this.updatableAdapter = this.buildShortCircuitBooleanElementAdapter(this.updatableDeclarationAdapter);
- }
-
- @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 update(CompilationUnit astRoot) {
- super.update(astRoot);
- this.setNullable(this.buildNullable(astRoot));
- this.setInsertable(this.buildInsertable(astRoot));
- this.setUpdatable(this.buildUpdatable(astRoot));
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> buildStringElementAdapter(String elementName) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(this.daa, elementName, false);
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<Boolean> buildBooleanElementAdapter(String elementName) {
- return new ConversionDeclarationAnnotationElementAdapter<Boolean>(this.daa, elementName, false, BooleanExpressionConverter.instance());
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- protected String getNameElementName() {
- return JPA.COLUMN__NAME;
- }
-
- @Override
- protected String getColumnDefinitionElementName() {
- return JPA.COLUMN__COLUMN_DEFINITION;
- }
- //************* OrderColumn2_0Annotation implementation *************
-
- // ***** nullable
- public Boolean getNullable() {
- return this.nullable;
- }
-
- public void setNullable(Boolean nullable) {
- if (this.attributeValueHasNotChanged(this.nullable, nullable)) {
- return;
- }
- Boolean old = this.nullable;
- this.nullable = nullable;
- this.nullableAdapter.setValue(nullable);
- this.firePropertyChanged(NULLABLE_PROPERTY, old, nullable);
- }
-
- private Boolean buildNullable(CompilationUnit astRoot) {
- return this.nullableAdapter.getValue(astRoot);
- }
-
- public TextRange getNullableTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.nullableDeclarationAdapter, astRoot);
- }
-
- String getNullableElementName() {
- return JPA.COLUMN__NULLABLE;
- }
-
- // ***** insertable
- public Boolean getInsertable() {
- return this.insertable;
- }
-
- public void setInsertable(Boolean insertable) {
- if (this.attributeValueHasNotChanged(this.insertable, insertable)) {
- return;
- }
- Boolean old = this.insertable;
- this.insertable = insertable;
- this.insertableAdapter.setValue(insertable);
- this.firePropertyChanged(INSERTABLE_PROPERTY, old, insertable);
- }
-
- private Boolean buildInsertable(CompilationUnit astRoot) {
- return this.insertableAdapter.getValue(astRoot);
- }
-
- public TextRange getInsertableTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.insertableDeclarationAdapter, astRoot);
- }
-
- String getInsertableElementName() {
- return JPA.COLUMN__INSERTABLE;
- }
-
- // ***** updatable
- public Boolean getUpdatable() {
- return this.updatable;
- }
-
- public void setUpdatable(Boolean updatable) {
- if (this.attributeValueHasNotChanged(this.updatable, updatable)) {
- return;
- }
- Boolean old = this.updatable;
- this.updatable = updatable;
- this.updatableAdapter.setValue(updatable);
- this.firePropertyChanged(UPDATABLE_PROPERTY, old, updatable);
- }
-
- private Boolean buildUpdatable(CompilationUnit astRoot) {
- return this.updatableAdapter.getValue(astRoot);
- }
-
- public TextRange getUpdatableTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.updatableDeclarationAdapter, astRoot);
- }
-
- String getUpdatableElementName() {
- return JPA.COLUMN__UPDATABLE;
- }
-
-
- //************* NestableAnnotation implementation *************
-
- @Override
- public void initializeFrom(NestableAnnotation oldAnnotation) {
- super.initializeFrom(oldAnnotation);
- BaseColumnAnnotation oldColumn = (BaseColumnAnnotation) oldAnnotation;
- this.setNullable(oldColumn.getNullable());
- this.setInsertable(oldColumn.getInsertable());
- this.setUpdatable(oldColumn.getUpdatable());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java
deleted file mode 100644
index f1c09d3aa0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceSequenceGeneratorAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.SequenceGenerator2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * SourceSequenceGenerator2_0Annotation
- */
-public final class SourceSequenceGenerator2_0Annotation
- extends SourceSequenceGeneratorAnnotation
- implements SequenceGenerator2_0Annotation
-{
- private static final DeclarationAnnotationElementAdapter<String> CATALOG_ADAPTER = buildAdapter(JPA2_0.SEQUENCE_GENERATOR__CATALOG);
- private final AnnotationElementAdapter<String> catalogAdapter;
- private String catalog;
-
- private static final DeclarationAnnotationElementAdapter<String> SCHEMA_ADAPTER = buildAdapter(JPA2_0.SEQUENCE_GENERATOR__SCHEMA);
- private final AnnotationElementAdapter<String> schemaAdapter;
- private String schema;
-
-
- // ********** constructor **********
- public SourceSequenceGenerator2_0Annotation(JavaResourceNode parent, Member member) {
- super(parent, member);
-
- this.catalogAdapter = this.buildAdapter(CATALOG_ADAPTER);
- this.schemaAdapter = this.buildAdapter(SCHEMA_ADAPTER);
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
-
- this.catalog = this.buildCatalog(astRoot);
- this.schema = this.buildSchema(astRoot);
-
- }
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
-
- this.setCatalog(this.buildCatalog(astRoot));
- this.setSchema(this.buildSchema(astRoot));
- }
-
- // ********** catalog **********
- public String getCatalog() {
- return this.catalog;
- }
-
- public void setCatalog(String catalog) {
- if (this.attributeValueHasNotChanged(this.catalog, catalog)) {
- return;
- }
- String old = this.catalog;
- this.catalog = catalog;
- this.catalogAdapter.setValue(catalog);
- this.firePropertyChanged(CATALOG_PROPERTY, old, catalog);
- }
-
- 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.attributeValueHasNotChanged(this.schema, schema)) {
- return;
- }
- String old = this.schema;
- this.schema = schema;
- this.schemaAdapter.setValue(schema);
- this.firePropertyChanged(SCHEMA_PROPERTY, old, schema);
- }
-
- private String buildSchema(CompilationUnit astRoot) {
- return this.schemaAdapter.getValue(astRoot);
- }
-
- public TextRange getSchemaTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(SCHEMA_ADAPTER, astRoot);
- }
-
- public boolean schemaTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(SCHEMA_ADAPTER, pos, astRoot);
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java
deleted file mode 100644
index bab8473fef..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.JDTTools;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.StaticMetamodelAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * javax.persistence.metamodel.StaticMetamodel
- */
-public final class SourceStaticMetamodelAnnotation
- extends SourceAnnotation<Type>
- implements StaticMetamodelAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter();
- private final AnnotationElementAdapter<String> valueAdapter;
- private String value;
-
- private String fullyQualifiedClassName;
-
-
- public SourceStaticMetamodelAnnotation(JavaResourcePersistentType parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(type, VALUE_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.buildValue(astRoot);
- this.fullyQualifiedClassName = this.buildFullyQualifiedClassName(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setValue(this.buildValue(astRoot));
- this.setFullyQualifiedClassName(this.buildFullyQualifiedClassName(astRoot));
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.value);
- }
-
-
- // ********** StaticMetamodelAnnotation implementation **********
-
- // ***** value
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- if (this.attributeValueHasNotChanged(this.value, value)) {
- return;
- }
- String old = this.value;
- this.value = value;
- this.valueAdapter.setValue(value);
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private String buildValue(CompilationUnit astRoot) {
- return this.valueAdapter.getValue(astRoot);
- }
-
- // ***** fully-qualified class name
- public String getFullyQualifiedClassName() {
- return this.fullyQualifiedClassName;
- }
-
- private void setFullyQualifiedClassName(String fullyQualifiedClassName) {
- String old = this.fullyQualifiedClassName;
- this.fullyQualifiedClassName = fullyQualifiedClassName;
- this.firePropertyChanged(FULLY_QUALIFIED_CLASS_NAME_PROPERTY, old, fullyQualifiedClassName);
- }
-
- private String buildFullyQualifiedClassName(CompilationUnit astRoot) {
- return (this.value == null) ? null : JDTTools.resolveFullyQualifiedName(this.valueAdapter.getExpression(astRoot));
- }
-
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.STATIC_METAMODEL__VALUE, SimpleTypeStringExpressionConverter.instance());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java
deleted file mode 100644
index db52d48cf4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java
+++ /dev/null
@@ -1,393 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.operations;
-
-import java.util.Iterator;
-import java.util.Set;
-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.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.JptCoreMessages;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-public abstract class AbstractJpaFileCreationDataModelProvider
- extends AbstractDataModelProvider
- implements JpaFileCreationDataModelProperties
-{
- protected AbstractJpaFileCreationDataModelProvider() {
- super();
- }
-
-
- @Override
- public Set<String> getPropertyNames() {
- @SuppressWarnings("unchecked")
- Set<String> propertyNames = super.getPropertyNames();
- propertyNames.add(PROJECT_NAME);
- propertyNames.add(SOURCE_FOLDER);
- propertyNames.add(FILE_PATH);
- propertyNames.add(VERSION);
- return propertyNames;
- }
-
- @Override
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(SOURCE_FOLDER)) {
- IFolder sourceFolder = getDefaultSourceFolder();
- if (sourceFolder != null && sourceFolder.exists()) {
- return sourceFolder.getFullPath().toPortableString();
- }
- }
- else if (propertyName.equals(FILE_PATH)) {
- return getDefaultFilePath();
- }
- else if (propertyName.equals(VERSION)) {
- return getDefaultVersion();
- }
- return super.getDefaultProperty(propertyName);
- }
-
- protected abstract String getDefaultFilePath();
-
- protected abstract String getDefaultVersion();
-
- @Override
- public boolean propertySet(String propertyName, Object propertyValue) {
- boolean ok = super.propertySet(propertyName, propertyValue);
- if (propertyName.equals(PROJECT_NAME)) {
- this.model.notifyPropertyChange(SOURCE_FOLDER, IDataModel.DEFAULT_CHG);
- }
- return ok;
- }
-
- @Override
- public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
- if (propertyName.equals(PROJECT_NAME)) {
- return ArrayTools.array(
- new TransformationIterator<IProject, DataModelPropertyDescriptor>(jpaIProjects()) {
- @Override
- protected DataModelPropertyDescriptor transform(IProject next) {
- return new DataModelPropertyDescriptor(next.getName());
- }
- },
- new DataModelPropertyDescriptor[0]);
- }
- return super.getValidPropertyDescriptors(propertyName);
- }
-
- @Override
- public DataModelPropertyDescriptor getPropertyDescriptor(String propertyName) {
- if (propertyName.equals(PROJECT_NAME)) {
- return new DataModelPropertyDescriptor(getStringProperty(PROJECT_NAME));
- }
- return super.getPropertyDescriptor(propertyName);
- }
-
-
- // **************** validation *********************************************
-
- @Override
- public IStatus validate(String propertyName) {
- IStatus status = Status.OK_STATUS;
- if (propertyName.equals(PROJECT_NAME)
- || propertyName.equals(SOURCE_FOLDER)
- || propertyName.equals(FILE_PATH)) {
- status = validateProjectSourceFolderAndFilePath();
- }
- if (! status.isOK()) {
- return status;
- }
-
- if (propertyName.equals(PROJECT_NAME)
- || propertyName.equals(VERSION)) {
- status = validateVersion();
- }
- if (! status.isOK()) {
- return status;
- }
-
- return status;
- }
-
- protected IStatus validateProjectSourceFolderAndFilePath() {
- String projectName = (String) getProperty(PROJECT_NAME);
- if (StringTools.stringIsEmpty(projectName)) {
- return new Status(
- IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_PROJECT_NOT_SPECIFIED);
- }
- String sourceFolderPath = getStringProperty(SOURCE_FOLDER);
- if (StringTools.stringIsEmpty(sourceFolderPath)) {
- return new Status(
- IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_SOURCE_FOLDER_NOT_SPECIFIED);
- }
- if (sourceFolderIsIllegal(sourceFolderPath)) {
- return new Status(
- IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_SOURCE_FOLDER_ILLEGAL);
- }
- if (sourceFolderNotInProject(sourceFolderPath)) {
- return new Status(
- IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
- NLS.bind(
- JptCoreMessages.VALIDATE_SOURCE_FOLDER_NOT_IN_PROJECT,
- sourceFolderPath, projectName));
- }
- if (getVerifiedSourceFolder() == null) {
- return new Status(
- IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
- NLS.bind(JptCoreMessages.VALIDATE_SOURCE_FOLDER_DOES_NOT_EXIST, sourceFolderPath));
- }
- if (getVerifiedJavaSourceFolder() == null) {
- return new Status(
- IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
- NLS.bind(JptCoreMessages.VALIDATE_SOURCE_FOLDER_NOT_SOURCE_FOLDER, sourceFolderPath));
- }
- String filePath = getStringProperty(FILE_PATH);
- if (StringTools.stringIsEmpty(filePath)) {
- return new Status(
- IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_FILE_PATH_NOT_SPECIFIED);
- }
- if (getExistingFile() != null) {
- return new Status(
- IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_FILE_ALREADY_EXISTS);
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus validateVersion() {
- if (getProject() == null) {
- return Status.OK_STATUS;
- }
- String fileVersion = getStringProperty(VERSION);
- if (! fileVersionSupported(fileVersion)) {
- return new Status(
- IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_FILE_VERSION_NOT_SUPPORTED);
- }
- try {
- String jpaFacetVersion = getJpaFacetVersion(getProject());
- if (! fileVersionSupportedForFacetVersion(fileVersion, jpaFacetVersion)) {
- return new Status(
- IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_FILE_VERSION_NOT_SUPPORTED_FOR_FACET_VERSION);
- }
- }
- catch (CoreException ce) {
- // project should have been validated already, so assume that this will never get hit
- // fall through to final return
- }
- return Status.OK_STATUS;
- }
-
- protected abstract boolean fileVersionSupported(String fileVersion);
-
- protected abstract boolean fileVersionSupportedForFacetVersion(String fileVersion, String jpaFacetVersion);
-
-
- // **************** helper methods *****************************************
-
- // Copied from ArtifactEditOperationDataModelProvider
- protected IProject getProject() {
- String projectName = (String) model.getProperty(PROJECT_NAME);
- if (StringTools.stringIsEmpty(projectName)) {
- return null;
- }
- return ProjectUtilities.getProject(projectName);
- }
-
- protected JpaProject getJpaProject() {
- IProject project = getProject();
- return (project == null) ? null : JptCorePlugin.getJpaProject(project);
- }
-
- /**
- * Return a best guess java source folder for the specified project
- */
- // Copied from NewJavaClassDataModelProvider
- protected IFolder getDefaultSourceFolder() {
- IProject project = getProject();
- if (project == null) {
- return null;
- }
- IPackageFragmentRoot[] sources = J2EEProjectUtilities.getSourceContainers(project);
- // Try and return the first source folder
- if (sources.length > 0) {
- try {
- return (IFolder) sources[0].getCorrespondingResource();
- } catch (Exception e) {
- return null;
- }
- }
- return null;
- }
-
- /**
- * Return whether the path provided can not be a valid IFolder path
- */
- protected boolean sourceFolderIsIllegal(String folderPath) {
- IProject project = getProject();
- if (project == null) {
- return false;
- }
- try {
- project.getWorkspace().getRoot().getFolder(new Path(folderPath));
- }
- catch (IllegalArgumentException e) {
- return true;
- }
- return false;
- }
-
- /**
- * Return whether the path provided is in the current project
- */
- protected boolean sourceFolderNotInProject(String folderPath) {
- IProject project = getProject();
- if (project == null) {
- return false;
- }
- IFolder folder;
- try {
- folder = project.getWorkspace().getRoot().getFolder(new Path(folderPath));
- }
- catch (IllegalArgumentException e) {
- return false;
- }
- return ! project.equals(folder.getProject());
- }
-
- /**
- * Return an IFolder represented by the SOURCE_FOLDER property, verified
- * to exist
- */
- protected IFolder getVerifiedSourceFolder() {
- String folderPath = getStringProperty(SOURCE_FOLDER);
- IProject project = getProject();
- if (project == null) {
- return null;
- }
- IFolder folder;
- try {
- folder = project.getWorkspace().getRoot().getFolder(new Path(folderPath));
- }
- catch (IllegalArgumentException e) {
- return null;
- }
- if (folder == null || ! folder.exists()) {
- return null;
- }
- return folder;
- }
-
- /**
- * Return the source folder, provided it is verified to be an actual java
- * source folder
- */
- protected IFolder getVerifiedJavaSourceFolder() {
- IFolder folder = getVerifiedSourceFolder();
- if (folder == null) {
- return null;
- }
- IJavaProject jProject = JavaCore.create(getProject());
- if (jProject == null) {
- return null;
- }
- IPackageFragmentRoot packageFragmentRoot = jProject.getPackageFragmentRoot(folder);
- if (packageFragmentRoot == null || ! packageFragmentRoot.exists()) {
- return null;
- }
- return folder;
- }
-
- protected IFile getExistingFile() {
- IFolder folder = getVerifiedSourceFolder();
- if (folder == null) {
- return null;
- }
- String filePath = getStringProperty(FILE_PATH);
- IFile existingFile = folder.getFile(new Path(filePath));
- if (! existingFile.exists()) {
- return null;
- }
- return existingFile;
- }
-
- protected Iterator<IProject> jpaIProjects() {
- return new FilteringIterator<IProject, IProject>(this.allIProjects(), this.buildJpaIProjectsFilter());
- }
-
- protected Iterator<IProject> allIProjects() {
- return CollectionTools.iterator(ProjectUtilities.getAllProjects());
- }
-
- protected Filter<IProject> buildJpaIProjectsFilter() {
- return new JpaIProjectsFilter();
- }
-
- protected class JpaIProjectsFilter implements Filter<IProject> {
- public boolean accept(IProject project) {
- try {
- return this.accept_(project);
- } catch (CoreException ex) {
- return false;
- }
- }
- protected boolean accept_(IProject project) throws CoreException {
- return hasJpaFacet(project) && hasSupportedPlatformId(project);
- }
- }
-
- protected boolean hasJpaFacet(IProject project) throws CoreException {
- return FacetedProjectFramework.hasProjectFacet(project, JptCorePlugin.FACET_ID);
- }
-
- protected String getJpaFacetVersion(IProject project) throws CoreException {
- IFacetedProject fproj = ProjectFacetsManager.create(project);
- return fproj.getProjectFacetVersion(
- ProjectFacetsManager.getProjectFacet(JptCorePlugin.FACET_ID)).getVersionString();
- }
-
- protected boolean hasSupportedPlatformId(IProject project) {
- JpaProject jpaProject = JptCorePlugin.getJpaProject(project);
- return (jpaProject != null) && isSupportedPlatformId(jpaProject.getJpaPlatform().getId());
- }
-
- protected boolean isSupportedPlatformId(String id) {
- return true;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationOperation.java
deleted file mode 100644
index 806bc48a52..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationOperation.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.operations;
-
-import org.eclipse.core.commands.ExecutionException;
-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.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.resource.AbstractXmlResourceProvider;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public abstract class AbstractJpaFileCreationOperation
- extends AbstractDataModelOperation
- implements JpaFileCreationDataModelProperties
-{
- /**
- * Will be null until folder is created
- */
- protected IFolder createdSourceFolder;
-
- /**
- * Will be null until file is created
- */
- protected IFile createdFile;
-
-
- protected AbstractJpaFileCreationOperation(IDataModel dataModel) {
- super(dataModel);
- }
-
-
- @Override
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- // Create source folder if it does not exist
- createSourceFolder();
- // Create file
- createFile();
- return OK_STATUS;
- }
-
- protected IProject getProject() throws ExecutionException {
- String projectName = (String) getDataModel().getProperty(PROJECT_NAME);
- IProject project = ProjectUtilities.getProject(projectName);
- if (project == null) {
- throw new ExecutionException("No project name specified"); //$NON-NLS-1$
- }
- return project;
- }
-
- protected JpaProject getJpaProject() throws ExecutionException {
- IProject project = getProject();
- JpaProject jpaProject = JptCorePlugin.getJpaProject(project);
- if (jpaProject == null) {
- throw new ExecutionException("Project does not have JPA content"); //$NON-NLS-1$
- }
- return jpaProject;
- }
-
- /**
- * This method will return the source folder as specified in the data model.
- * It will create the source folder if it does not exist. It will not add
- * it as a source folder to the project build path if it is not already.
- * This method may return null.
- */
- // copied from NewJavaClassOperation
- protected void createSourceFolder() throws ExecutionException {
- // Get the source folder name from the data model
- String folderPath = model.getStringProperty(SOURCE_FOLDER);
- IProject project = getProject();
- IFolder folder = project.getWorkspace().getRoot().getFolder(new Path(folderPath));
- // If folder does not exist, create the folder with the specified path
- if (! folder.exists()) {
- try {
- folder.create(true, true, null);
- } catch (CoreException e) {
- throw new ExecutionException("Could not create folder", e); //$NON-NLS-1$
- }
- }
- // Return the source folder
- this.createdSourceFolder = folder;
- }
-
- protected void createFile() {
- String filePath = getDataModel().getStringProperty(FILE_PATH);
- IFile newFile = this.createdSourceFolder.getFile(new Path(filePath));
- AbstractXmlResourceProvider resourceProvider = getXmlResourceProvider(newFile);
- try {
- resourceProvider.createFileAndResource(getDataModel());
- }
- catch (CoreException e) {
- JptCorePlugin.log(e);
- newFile = null;
- }
- this.createdFile = newFile;
- }
-
- @Override
- public ISchedulingRule getSchedulingRule() {
- try {
- return this.getProject();
- } catch (ExecutionException ex) {
- throw new RuntimeException(ex);
- }
- }
-
- protected abstract AbstractXmlResourceProvider getXmlResourceProvider(IFile file);
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/JpaFileCreationDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/JpaFileCreationDataModelProperties.java
deleted file mode 100644
index 62b1e36c80..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/JpaFileCreationDataModelProperties.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.operations;
-
-public interface JpaFileCreationDataModelProperties
-{
- /**
- * Required, type String, identifies the name of the project in which to create the file
- */
- public static final String PROJECT_NAME = "JpaFileCreationDataModelProperties.PROJECT_NAME";
-
- /**
- * Required, type String, identifies the fully pathed source folder in which to create the file
- */
- public static final String SOURCE_FOLDER = "JpaFileCreationDataModelProperties.SOURCE_FOLDER";
-
- /**
- * Required, type String, identifies the file path relative to the source folder
- */
- public static final String FILE_PATH = "JpaFileCreationDataModelProperties.FILE_PATH";
-
- /**
- * Required, type String, identifies the version of the file to create
- */
- public static final String VERSION = "JpaFileCreationDataModelProperties.VERSION";
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationDataModelProperties.java
deleted file mode 100644
index f8e9ab8f5c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationDataModelProperties.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.operations;
-
-public interface OrmFileCreationDataModelProperties
- extends JpaFileCreationDataModelProperties
-{
- /**
- * Optional, type AccessType, specifies the default access type (or null)
- */
- public static final String DEFAULT_ACCESS = "OrmFileCreationDataModelProperties.DEFAULT_ACCESS";
-
- /**
- * Required, type Boolean, specifies whether to add a reference to the file
- * in the persistence unit
- */
- public static final String ADD_TO_PERSISTENCE_UNIT = "OrmFileCreationDataModelProperties.ADD_TO_PERSISTENCE_UNIT";
-
- /**
- * Optional (unless ADD_TO_PERSISTENCE_UNIT property is true), type String,
- * identifies the persistence unit to which to add a reference to the file
- */
- public static final String PERSISTENCE_UNIT = "OrmFileCreationDataModelProperties.PERSISTENCE_UNIT";
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationDataModelProvider.java
deleted file mode 100644
index a8322a227c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationDataModelProvider.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.operations;
-
-import java.util.Iterator;
-import java.util.Set;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.core.internal.JptCoreMessages;
-import org.eclipse.jpt.core.resource.orm.AccessType;
-import org.eclipse.jpt.core.resource.orm.JPA;
-import org.eclipse.jpt.core.resource.orm.v2_0.JPA2_0;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-public class OrmFileCreationDataModelProvider
- extends AbstractJpaFileCreationDataModelProvider
- implements OrmFileCreationDataModelProperties
-{
- /**
- * required default constructor
- */
- public OrmFileCreationDataModelProvider() {
- super();
- }
-
-
- @Override
- public IDataModelOperation getDefaultOperation() {
- return new OrmFileCreationOperation(getDataModel());
- }
-
- @Override
- public Set<String> getPropertyNames() {
- @SuppressWarnings("unchecked")
- 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 getDefaultFilePath() {
- return new Path(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH).toPortableString();
- }
-
- @Override
- protected String getDefaultVersion() {
- if (getProject() == null) {
- return null;
- }
- return getJpaProject().getJpaPlatform().getMostRecentSupportedResourceType(
- JptCorePlugin.ORM_XML_CONTENT_TYPE).getVersion();
- }
-
- protected PersistenceUnit getDefaultPersistenceUnit() {
- JpaProject jpaProject = getJpaProject();
- if (jpaProject == null) {
- return null;
- }
- PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
- if (persistenceXml == null) {
- return null;
- }
- Persistence persistence = persistenceXml.getPersistence();
- if (persistence == null) {
- return null;
- }
- if (persistence.persistenceUnitsSize() == 0) {
- return null;
- }
- return persistence.persistenceUnits().next();
- }
-
- @Override
- public boolean propertySet(String propertyName, Object propertyValue) {
- boolean ok = super.propertySet(propertyName, propertyValue);
- if (propertyName.equals(PROJECT_NAME)) {
- this.model.notifyPropertyChange(PERSISTENCE_UNIT, IDataModel.DEFAULT_CHG);
- this.model.notifyPropertyChange(PERSISTENCE_UNIT, IDataModel.VALID_VALUES_CHG);
- }
- else if (propertyName.equals(ADD_TO_PERSISTENCE_UNIT)) {
- this.model.notifyPropertyChange(PERSISTENCE_UNIT, IDataModel.ENABLE_CHG);
- }
- return ok;
- }
-
- @Override
- public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
- if (propertyName.equals(DEFAULT_ACCESS)) {
- DataModelPropertyDescriptor[] accessTypes = new DataModelPropertyDescriptor[3];
- accessTypes[0] = accessPropertyDescriptor(null);
- accessTypes[1] = accessPropertyDescriptor(AccessType.FIELD);
- accessTypes[2] = accessPropertyDescriptor(AccessType.PROPERTY);
- return accessTypes;
- }
- else if (propertyName.equals(PERSISTENCE_UNIT)) {
- return ArrayTools.array(
- new TransformationIterator<String, DataModelPropertyDescriptor>(new CompositeIterator<String>(null, persistenceUnitNames())) {
- @Override
- protected DataModelPropertyDescriptor transform(String next) {
- return persistenceUnitPropertyDescriptor(next);
- }
- },
- new DataModelPropertyDescriptor[0]);
- }
- return super.getValidPropertyDescriptors(propertyName);
- }
-
- @Override
- public DataModelPropertyDescriptor getPropertyDescriptor(String propertyName) {
- if (propertyName.equals(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(JptCorePlugin.JPA_FACET_VERSION_1_0)
- && fileVersion.equals(JPA2_0.SCHEMA_VERSION)) {
- return false;
- }
- return true;
- }
-
- protected IStatus validatePersistenceUnit() {
- boolean addToPUnit = getBooleanProperty(ADD_TO_PERSISTENCE_UNIT);
- String projectName = getStringProperty(PROJECT_NAME);
- String pUnitName = getStringProperty(PERSISTENCE_UNIT);
- if (addToPUnit) {
- if (StringTools.stringIsEmpty(pUnitName)) {
- return new Status(
- IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
- NLS.bind(JptCoreMessages.VALIDATE_PERSISTENCE_UNIT_DOES_NOT_SPECIFIED, pUnitName));
- }
- if (getPersistenceUnit() == null) {
- return new Status(
- IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
- NLS.bind(JptCoreMessages.VALIDATE_PERSISTENCE_UNIT_NOT_IN_PROJECT, pUnitName, projectName));
- }
- }
- return Status.OK_STATUS;
- }
-
-
- // **************** helper methods *****************************************
-
- protected PersistenceUnit getPersistenceUnit() {
- String pUnitName = getStringProperty(PERSISTENCE_UNIT);
- JpaProject jpaProject =
- (StringTools.stringIsEmpty(pUnitName)) ? null : getJpaProject();
- PersistenceXml persistenceXml =
- (jpaProject == null) ? null : jpaProject.getRootContextNode().getPersistenceXml();
- Persistence persistence =
- (persistenceXml == null) ? null : persistenceXml.getPersistence();
- if (persistence != null) {
- for (Iterator<PersistenceUnit> stream = persistence.persistenceUnits(); stream.hasNext(); ) {
- PersistenceUnit next = stream.next();
- if (pUnitName.equals(next.getName())) {
- return next;
- }
- }
- }
- return null;
- }
-
- protected Iterator<PersistenceUnit> persistenceUnits() {
- //only get the persistence units for the selected JpaProject,
- //if no jpa project is selected, then no persistence units will be listed in the combo
- JpaProject jpaProject = getJpaProject();
- PersistenceXml persistenceXml = (jpaProject == null) ? null : jpaProject.getRootContextNode().getPersistenceXml();
- Persistence persistence = (persistenceXml == null) ? null : persistenceXml.getPersistence();
- return (persistence == null) ? EmptyIterator.<PersistenceUnit>instance() : persistence.persistenceUnits();
- }
-
- protected Iterator<String> persistenceUnitNames() {
- return new TransformationIterator<PersistenceUnit, String>(persistenceUnits()) {
- @Override
- protected String transform(PersistenceUnit next) {
- return next.getName();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationOperation.java
deleted file mode 100644
index 17a63ec16c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationOperation.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.operations;
-
-import java.util.Iterator;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.core.internal.resource.orm.OrmXmlResourceProvider;
-import org.eclipse.jpt.core.resource.AbstractXmlResourceProvider;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class OrmFileCreationOperation
- extends AbstractJpaFileCreationOperation
- implements OrmFileCreationDataModelProperties
-{
- public OrmFileCreationOperation(IDataModel dataModel) {
- super(dataModel);
- }
-
-
- @Override
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IStatus status = super.execute(monitor, info);
-
- if (status.isOK()) {
- addMappingFileToPersistenceXml();
- }
-
- return OK_STATUS;
- }
-
- protected PersistenceUnit getPersistenceUnit() throws ExecutionException {
- String pUnitName = getDataModel().getStringProperty(PERSISTENCE_UNIT);
- JpaProject jpaProject = getJpaProject();
- PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
- if (persistenceXml == null) {
- throw new ExecutionException("Project does not have a persistence.xml file"); //$NON-NLS-1$
- }
- Persistence persistence = persistenceXml.getPersistence();
- if (persistence == null) {
- throw new ExecutionException("persistence.xml does not have a persistence node."); //$NON-NLS-1$
- }
- for (Iterator<PersistenceUnit> stream = persistence.persistenceUnits(); stream.hasNext(); ) {
- PersistenceUnit pUnit = stream.next();
- if (pUnitName.equals(pUnit.getName())) {
- return pUnit;
- }
- }
- throw new ExecutionException("persistence.xml does not have persistence unit named \'" + pUnitName + "\'"); //$NON-NLS-1$
- }
-
- protected void addMappingFileToPersistenceXml() throws ExecutionException {
- if (! getDataModel().getBooleanProperty(ADD_TO_PERSISTENCE_UNIT)) {
- return;
- }
- JpaProject jpaProject = JptCorePlugin.getJpaProject(this.createdFile.getProject());
- JpaXmlResource resource = jpaProject.getPersistenceXmlResource();
-
- final PersistenceUnit pUnit = getPersistenceUnit();
-
- resource.modify(new Runnable() {
- public void run() {
- String filePath = getDataModel().getStringProperty(FILE_PATH);
- for (Iterator<MappingFileRef> stream = pUnit.specifiedMappingFileRefs(); stream.hasNext(); ) {
- if (filePath.equals(stream.next().getFileName())) {
- return;
- }
- }
- MappingFileRef mfRef = pUnit.addSpecifiedMappingFileRef();
- mfRef.setFileName(new Path(filePath).toPortableString());
- }
- });
- }
-
- @Override
- protected AbstractXmlResourceProvider getXmlResourceProvider(IFile file) {
- return OrmXmlResourceProvider.getXmlResourceProvider(file);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationDataModelProperties.java
deleted file mode 100644
index 6d9c2578f2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationDataModelProperties.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.operations;
-
-public interface PersistenceFileCreationDataModelProperties
- extends JpaFileCreationDataModelProperties
-{
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationDataModelProvider.java
deleted file mode 100644
index e8d744dc1f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationDataModelProvider.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.operations;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.resource.persistence.JPA;
-import org.eclipse.jpt.core.resource.persistence.v2_0.JPA2_0;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-public class PersistenceFileCreationDataModelProvider
- extends AbstractJpaFileCreationDataModelProvider
- implements PersistenceFileCreationDataModelProperties
-{
- /**
- * required default constructor
- */
- public PersistenceFileCreationDataModelProvider() {
- super();
- }
-
-
- @Override
- public IDataModelOperation getDefaultOperation() {
- return new PersistenceFileCreationOperation(getDataModel());
- }
-
- @Override
- protected String getDefaultFilePath() {
- return new Path(JptCorePlugin.DEFAULT_PERSISTENCE_XML_FILE_PATH).toPortableString();
- }
-
- @Override
- protected String getDefaultVersion() {
- if (getProject() == null) {
- return null;
- }
- return getJpaProject().getJpaPlatform().getMostRecentSupportedResourceType(
- JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE).getVersion();
- }
-
-
- // **************** validation *********************************************
-
- @Override
- protected boolean fileVersionSupported(String fileVersion) {
- return (fileVersion.equals(JPA.SCHEMA_VERSION)
- || fileVersion.equals(JPA2_0.SCHEMA_VERSION));
- }
-
- @Override
- protected boolean fileVersionSupportedForFacetVersion(String fileVersion, String jpaFacetVersion) {
- if (jpaFacetVersion.equals(JptCorePlugin.JPA_FACET_VERSION_1_0)
- && fileVersion.equals(JPA2_0.SCHEMA_VERSION)) {
- return false;
- }
- return true;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationOperation.java
deleted file mode 100644
index e98e3316bd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationOperation.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.operations;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jpt.core.internal.resource.persistence.PersistenceXmlResourceProvider;
-import org.eclipse.jpt.core.resource.AbstractXmlResourceProvider;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class PersistenceFileCreationOperation
- extends AbstractJpaFileCreationOperation
- implements PersistenceFileCreationDataModelProperties
-{
- public PersistenceFileCreationOperation(IDataModel dataModel) {
- super(dataModel);
- }
-
-
- @Override
- protected AbstractXmlResourceProvider getXmlResourceProvider(IFile file) {
- return PersistenceXmlResourceProvider.getXmlResourceProvider(file);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/prefs/JpaPreferenceInitializer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/prefs/JpaPreferenceInitializer.java
deleted file mode 100644
index fda01b3469..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/prefs/JpaPreferenceInitializer.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.prefs;
-
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.jpt.core.JptCorePlugin;
-
-/**
- * Class used to initialize default preference values.
- * See <code>org.eclipse.core.runtime.preferences</code> extension point.
- */
-public class JpaPreferenceInitializer
- extends AbstractPreferenceInitializer
-{
- @Override
- public void initializeDefaultPreferences() {
- JptCorePlugin.initializeDefaultPreferences();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/IndeterminateContentDescriber.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/IndeterminateContentDescriber.java
deleted file mode 100644
index 6184852469..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/IndeterminateContentDescriber.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.resource;
-
-import java.io.InputStream;
-import java.io.Reader;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.content.IContentDescription;
-import org.eclipse.core.runtime.content.ITextContentDescriber;
-
-/**
- * This class simply returns INDETERMINATE for any contents it receives.
- *
- * It is used currently for org.eclipse.jpt.core.content.baseJpaContent in order
- * to make that content type act as an "abstract" content type.
- */
-public class IndeterminateContentDescriber implements ITextContentDescriber
-{
- public int describe(InputStream contents, IContentDescription description) {
- return INDETERMINATE;
- }
-
- public int describe(Reader contents, IContentDescription description) {
- return INDETERMINATE;
- }
-
- public QualifiedName[] getSupportedOptions() {
- return new QualifiedName[0];
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractJavaResourceNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractJavaResourceNode.java
deleted file mode 100644
index f047f4d8ef..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractJavaResourceNode.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jpt.core.JpaAnnotationProvider;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.CallbackChangeSupport;
-import org.eclipse.jpt.utility.internal.model.ChangeSupport;
-
-/**
- * Java resource containment hierarchy
- */
-public abstract class AbstractJavaResourceNode
- extends AbstractModel
- implements JavaResourceNode
-{
- protected final JavaResourceNode parent;
-
-
- // ********** constructor **********
-
- protected AbstractJavaResourceNode(JavaResourceNode parent) {
- super();
- this.checkParent(parent);
- this.parent = parent;
- }
-
-
- // ********** parent **********
-
- protected void checkParent(JavaResourceNode p) {
- if (p == null) {
- if (this.requiresParent()) {
- throw new IllegalArgumentException("'parent' cannot be null"); //$NON-NLS-1$
- }
- } else {
- if (this.forbidsParent()) {
- throw new IllegalArgumentException("'parent' must be null"); //$NON-NLS-1$
- }
- }
- }
-
- protected boolean requiresParent() {
- return true;
- }
-
- protected boolean forbidsParent() {
- return ! this.requiresParent(); // assume 'parent' is not optional
- }
-
-
- // ********** change support callback hook **********
-
- @Override
- protected final ChangeSupport buildChangeSupport() {
- return new CallbackChangeSupport(this, this.buildChangeSupportListener());
- }
-
- private CallbackChangeSupport.Listener buildChangeSupportListener() {
- return new CallbackChangeSupport.Listener() {
- public void aspectChanged(String aspectName) {
- AbstractJavaResourceNode.this.aspectChanged(aspectName);
- }
- };
- }
-
- /**
- * ignore the aspect name, we notify listeners of *every* change
- */
- protected void aspectChanged(@SuppressWarnings("unused") String aspectName) {
- this.getRoot().resourceModelChanged();
- }
-
-
- // ********** JavaResourceNode implementation **********
-
- /**
- * @see org.eclipse.jpt.core.internal.resource.java.source.SourceCompilationUnit#getRoot()
- * @see org.eclipse.jpt.core.internal.resource.java.binary.BinaryPackageFragmentRoot#getRoot()
- * @see org.eclipse.jpt.core.internal.resource.java.binary.BinaryPersistentTypeCache#getRoot()
- */
- public Root getRoot() {
- return this.parent.getRoot();
- }
-
- public IFile getFile() {
- return this.getRoot().getFile();
- }
-
-
- // ********** convenience methods **********
-
- protected JpaAnnotationProvider getAnnotationProvider() {
- return this.getRoot().getAnnotationProvider();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java
deleted file mode 100644
index 9fc26e3348..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.jpa1.resource.java.binary.BinaryAssociationOverride1_0Annotation;
-import org.eclipse.jpt.core.internal.jpa1.resource.java.source.SourceAssociationOverride1_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.AssociationOverride
- */
-public final class AssociationOverrideAnnotationDefinition
- implements AnnotationDefinition
-{
- // singleton
- private static final AnnotationDefinition INSTANCE = new AssociationOverrideAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static AnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private AssociationOverrideAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return SourceAssociationOverride1_0Annotation.buildAssociationOverride(parent, member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryAssociationOverride1_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return AssociationOverrideAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java
deleted file mode 100644
index 2fd18af99f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.jpa1.resource.java.binary.BinaryAssociationOverrides1_0Annotation;
-import org.eclipse.jpt.core.internal.jpa1.resource.java.source.SourceAssociationOverrides1_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.AssociationOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.AssociationOverrides
- */
-public final class AssociationOverridesAnnotationDefinition
- implements AnnotationDefinition
-{
- // singleton
- private static final AnnotationDefinition INSTANCE = new AssociationOverridesAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static AnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private AssociationOverridesAnnotationDefinition() {
- super();
- }
-
- public AssociationOverridesAnnotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new SourceAssociationOverrides1_0Annotation(parent, member);
- }
-
- public AssociationOverridesAnnotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryAssociationOverrides1_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return AssociationOverridesAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java
deleted file mode 100644
index 03b83f682e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAttributeOverrideAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceAttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.AttributeOverride
- */
-public final class AttributeOverrideAnnotationDefinition
- implements AnnotationDefinition
-{
- // singleton
- private static final AnnotationDefinition INSTANCE = new AttributeOverrideAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static AnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private AttributeOverrideAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return SourceAttributeOverrideAnnotation.buildAttributeOverride(parent, member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryAttributeOverrideAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return AttributeOverrideAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java
deleted file mode 100644
index 27c8986fcb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAttributeOverridesAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceAttributeOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.AttributeOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.AttributeOverrides
- */
-public final class AttributeOverridesAnnotationDefinition
- implements AnnotationDefinition
-{
- // singleton
- private static final AnnotationDefinition INSTANCE = new AttributeOverridesAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static AnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private AttributeOverridesAnnotationDefinition() {
- super();
- }
-
- public AttributeOverridesAnnotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new SourceAttributeOverridesAnnotation(parent, member);
- }
-
- public AttributeOverridesAnnotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryAttributeOverridesAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return AttributeOverridesAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/BasicAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/BasicAnnotationDefinition.java
deleted file mode 100644
index 989aa71ed0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/BasicAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryBasicAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceBasicAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceBasicAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- return new NullBasicAnnotation((JavaResourcePersistentAttribute) parent);
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryBasicAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return BasicAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ColumnAnnotationDefinition.java
deleted file mode 100644
index 219c98745c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ColumnAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryColumnAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceColumnAnnotation(parent, member, SourceColumnAnnotation.MAPPING_DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- return new NullColumnAnnotation(parent);
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryColumnAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ColumnAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java
deleted file mode 100644
index ff4ec04c77..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryDiscriminatorColumnAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceDiscriminatorColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.DiscriminatorColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceDiscriminatorColumnAnnotation((JavaResourcePersistentType) parent, member, SourceDiscriminatorColumnAnnotation.DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- return new NullDiscriminatorColumnAnnotation((JavaResourcePersistentType) parent);
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryDiscriminatorColumnAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return DiscriminatorColumnAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java
deleted file mode 100644
index ea12342ee1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryDiscriminatorValueAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceDiscriminatorValueAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.DiscriminatorValueAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * javax.persistence.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(JavaResourcePersistentMember parent, Member member) {
- return new SourceDiscriminatorValueAnnotation(parent, (Type) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- return new NullDiscriminatorValueAnnotation((JavaResourcePersistentType) parent);
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryDiscriminatorValueAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return DiscriminatorValueAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddableAnnotationDefinition.java
deleted file mode 100644
index fd7dbfa3c7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddableAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryEmbeddableAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceEmbeddableAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * javax.persistence.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(JavaResourcePersistentMember parent, Member member) {
- return new SourceEmbeddableAnnotation((JavaResourcePersistentType) parent, (Type) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryEmbeddableAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return EmbeddableAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedAnnotationDefinition.java
deleted file mode 100644
index 1a3889fe3c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryEmbeddedAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceEmbeddedAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceEmbeddedAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- return new NullEmbeddedAnnotation((JavaResourcePersistentAttribute) parent);
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryEmbeddedAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return EmbeddedAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java
deleted file mode 100644
index 741375240d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryEmbeddedIdAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceEmbeddedIdAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceEmbeddedIdAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryEmbeddedIdAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return EmbeddedIdAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EntityAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EntityAnnotationDefinition.java
deleted file mode 100644
index 7c4f432ffe..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EntityAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryEntityAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceEntityAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * javax.persistence.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(JavaResourcePersistentMember parent, Member member) {
- return new SourceEntityAnnotation((JavaResourcePersistentType) parent, (Type) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryEntityAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return EntityAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumeratedAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumeratedAnnotationDefinition.java
deleted file mode 100644
index 5146a6d178..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumeratedAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryEnumeratedAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceEnumeratedAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceEnumeratedAnnotation(parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- return new NullEnumeratedAnnotation((JavaResourcePersistentAttribute) parent);
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryEnumeratedAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return EnumeratedAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValueAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValueAnnotationDefinition.java
deleted file mode 100644
index 7026476532..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValueAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryGeneratedValueAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceGeneratedValueAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceGeneratedValueAnnotation(parent, member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryGeneratedValueAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return GeneratedValueAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdAnnotationDefinition.java
deleted file mode 100644
index 12ebf03b98..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryIdAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceIdAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceIdAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryIdAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return IdAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdClassAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdClassAnnotationDefinition.java
deleted file mode 100644
index 5e99e4c3e0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdClassAnnotationDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryIdClassAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceIdClassAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.IdClassAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceIdClassAnnotation(parent, (Type) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryIdClassAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return IdClassAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceAnnotationDefinition.java
deleted file mode 100644
index 297ae12fa7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryInheritanceAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceInheritanceAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.InheritanceAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * javax.persistence.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(JavaResourcePersistentMember parent, Member member) {
- return new SourceInheritanceAnnotation((JavaResourcePersistentType) parent, (Type) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- return new NullInheritanceAnnotation((JavaResourcePersistentType) parent);
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryInheritanceAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return InheritanceAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnAnnotationDefinition.java
deleted file mode 100644
index c2c248a86c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryJoinColumnAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.JoinColumn
- */
-public final class JoinColumnAnnotationDefinition
- implements AnnotationDefinition
-{
- // singleton
- private static final AnnotationDefinition INSTANCE = new JoinColumnAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static AnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private JoinColumnAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return SourceJoinColumnAnnotation.createJoinColumn(parent, member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryJoinColumnAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return JoinColumnAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnsAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnsAnnotationDefinition.java
deleted file mode 100644
index 1c00f40fde..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnsAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryJoinColumnsAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceJoinColumnsAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JoinColumnsAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.JoinColumns
- */
-public final class JoinColumnsAnnotationDefinition
- implements AnnotationDefinition
-{
- // singleton
- private static final AnnotationDefinition INSTANCE = new JoinColumnsAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static AnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private JoinColumnsAnnotationDefinition() {
- super();
- }
-
- public JoinColumnsAnnotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new SourceJoinColumnsAnnotation(parent, member);
- }
-
- public JoinColumnsAnnotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryJoinColumnsAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return JoinColumnsAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTableAnnotationDefinition.java
deleted file mode 100644
index a58445ec6a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTableAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryJoinTableAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceJoinTableAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceJoinTableAnnotation(parent, member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- return new NullJoinTableAnnotation(parent);
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryJoinTableAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return JoinTableAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/LobAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/LobAnnotationDefinition.java
deleted file mode 100644
index 29022f2c7a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/LobAnnotationDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryLobAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceLobAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.LobAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceLobAnnotation(parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryLobAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return LobAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToManyAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToManyAnnotationDefinition.java
deleted file mode 100644
index a10d93fec5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToManyAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryManyToManyAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceManyToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.ManyToManyAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceManyToManyAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryManyToManyAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ManyToManyAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOneAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOneAnnotationDefinition.java
deleted file mode 100644
index 140d7977b8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOneAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryManyToOneAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceManyToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.ManyToOneAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceManyToOneAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryManyToOneAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ManyToOneAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MapKeyAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MapKeyAnnotationDefinition.java
deleted file mode 100644
index 03c6ff8b36..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MapKeyAnnotationDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryMapKeyAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceMapKeyAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.MapKeyAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceMapKeyAnnotation(parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryMapKeyAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return MapKeyAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java
deleted file mode 100644
index c6452c9e68..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryMappedSuperclassAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceMappedSuperclassAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.MappedSuperclassAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceMappedSuperclassAnnotation((JavaResourcePersistentType) parent, (Type) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryMappedSuperclassAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return MappedSuperclassAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java
deleted file mode 100644
index 21d55cb918..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryNamedNativeQueriesAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceNamedNativeQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueriesAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceNamedNativeQueriesAnnotation(parent, (Type) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryNamedNativeQueriesAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return NamedNativeQueriesAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java
deleted file mode 100644
index db6d640c07..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryNamedNativeQueryAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceNamedNativeQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueryAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * javax.persistence.NamedNativeQuery
- */
-public final class NamedNativeQueryAnnotationDefinition
- implements AnnotationDefinition
-{
- // singleton
- private static final AnnotationDefinition INSTANCE = new NamedNativeQueryAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static AnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private NamedNativeQueryAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return SourceNamedNativeQueryAnnotation.createNamedNativeQuery(parent, (Type) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryNamedNativeQueryAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return NamedNativeQueryAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueriesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueriesAnnotationDefinition.java
deleted file mode 100644
index e560b3e62d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueriesAnnotationDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.jpa1.resource.java.binary.BinaryNamedQueries1_0Annotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceNamedQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.NamedQueriesAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceNamedQueriesAnnotation(parent, (Type) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryNamedQueries1_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return NamedQueriesAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueryAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueryAnnotationDefinition.java
deleted file mode 100644
index 9685560628..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueryAnnotationDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.jpa1.resource.java.binary.BinaryNamedQuery1_0Annotation;
-import org.eclipse.jpt.core.internal.jpa1.resource.java.source.SourceNamedQuery1_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * javax.persistence.NamedQuery
- */
-public final class NamedQueryAnnotationDefinition
- implements AnnotationDefinition
-{
- // singleton
- private static final AnnotationDefinition INSTANCE = new NamedQueryAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static AnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private NamedQueryAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new SourceNamedQuery1_0Annotation(parent, (Type) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryNamedQuery1_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return NamedQueryAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAnnotation.java
deleted file mode 100644
index 3fc989ff90..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAnnotation.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * Simplify null annotation classes
- */
-public abstract class NullAnnotation
- extends AbstractJavaResourceNode
- implements Annotation
-{
-
- protected NullAnnotation(JavaResourceNode parent) {
- super(parent);
- }
-
- public void initialize(CompilationUnit astRoot) {
- // do nothing
- }
-
- public org.eclipse.jdt.core.dom.Annotation getJdtAnnotation(CompilationUnit astRoot) {
- return null;
- }
-
- public JavaResourceCompilationUnit getJavaResourceCompilationUnit() {
- throw new UnsupportedOperationException();
- }
-
- public void newAnnotation() {
- throw new UnsupportedOperationException();
- }
-
- public void removeAnnotation() {
- throw new UnsupportedOperationException();
- }
-
- public TextRange getTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public void update(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Convenience method: Cast the annotation's parent to a
- * persistent member.
- */
- protected JavaResourcePersistentMember getMember() {
- return (JavaResourcePersistentMember) this.parent;
- }
-
- /**
- * Convenience method: Add the type or attribute's annotation
- * and return it.
- * Pre-condition: The annotation's parent must be a persistent member
- * (type or attribute).
- */
- protected Annotation addAnnotation() {
- return this.getMember().addAnnotation(this.getAnnotationName());
- }
-
- /**
- * Convenience method: Add the type or attribute's annotation
- * and return it.
- * Pre-condition: The annotation's parent must be a persistent member
- * (type or attribute).
- */
- protected Annotation addAnnotation(
- JavaResourcePersistentMember.AnnotationInitializer initializer) {
- return this.getMember().addAnnotation(this.getAnnotationName(), initializer);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java
deleted file mode 100644
index 85f0c6fe08..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-
-/**
- * javax.persistence.Column
- */
-public class NullAttributeOverrideColumnAnnotation
- extends NullColumnAnnotation
-{
- public NullAttributeOverrideColumnAnnotation(AttributeOverrideAnnotation parent) {
- super(parent);
- }
-
- private AttributeOverrideAnnotation getAttributeOverrideAnnotation() {
- return (AttributeOverrideAnnotation) this.parent;
- }
-
- @Override
- protected ColumnAnnotation addAnnotation() {
- return this.getAttributeOverrideAnnotation().addColumn();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseColumnAnnotation.java
deleted file mode 100644
index 477b7f8da0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseColumnAnnotation.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.BaseColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.Column
- * javax.persistence.JoinColumn
- */
-public abstract class NullBaseColumnAnnotation
- extends NullNamedColumnAnnotation
- implements BaseColumnAnnotation
-{
- protected NullBaseColumnAnnotation(JavaResourceNode parent) {
- super(parent);
- }
-
- @Override
- protected BaseColumnAnnotation addAnnotation() {
- return (BaseColumnAnnotation) super.addAnnotation();
- }
-
- // ***** table
- public String getTable() {
- return null;
- }
-
- public void setTable(String table) {
- if (table != null) {
- this.addAnnotation().setTable(table);
- }
- }
-
- public TextRange getTableTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public boolean tableTouches(int pos, CompilationUnit astRoot) {
- return false;
- }
-
- // ***** unique
- public Boolean getUnique() {
- return null;
- }
-
- public void setUnique(Boolean unique) {
- if (unique != null) {
- this.addAnnotation().setUnique(unique);
- }
- }
-
- public TextRange getUniqueTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- // ***** updatable
- public Boolean getUpdatable() {
- return null;
- }
-
- public void setUpdatable(Boolean updatable) {
- if (updatable != null) {
- this.addAnnotation().setUpdatable(updatable);
- }
- }
-
- public TextRange getUpdatableTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- // ***** insertable
- public Boolean getInsertable() {
- return null;
- }
-
- public void setInsertable(Boolean insertable) {
- if (insertable != null) {
- this.addAnnotation().setInsertable(insertable);
- }
- }
-
- public TextRange getInsertableTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- // ***** nullable
- public Boolean getNullable() {
- return null;
- }
-
- public void setNullable(Boolean nullable) {
- if (nullable != null) {
- this.addAnnotation().setNullable(nullable);
- }
- }
-
- public TextRange getNullableTextRange(CompilationUnit astRoot) {
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseTableAnnotation.java
deleted file mode 100644
index 93160b0452..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseTableAnnotation.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import java.util.ListIterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.BaseTableAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-
-/**
- * javax.persistence.Table
- * javax.persistence.JoinTable
- */
-public abstract class NullBaseTableAnnotation
- extends NullAnnotation
- implements BaseTableAnnotation
-{
- protected NullBaseTableAnnotation(JavaResourceNode parent) {
- super(parent);
- }
-
- @Override
- protected BaseTableAnnotation addAnnotation() {
- return (BaseTableAnnotation) super.addAnnotation();
- }
-
- public boolean isSpecified() {
- return false;
- }
-
- // ***** name
- public String getName() {
- return null;
- }
-
- public void setName(String name) {
- if (name != null) {
- this.addAnnotation().setName(name);
- }
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public boolean nameTouches(int pos, CompilationUnit astRoot) {
- return false;
- }
-
- // ***** schema
- public String getSchema() {
- return null;
- }
-
- public void setSchema(String schema) {
- if (schema != null) {
- this.addAnnotation().setSchema(schema);
- }
- }
-
- public TextRange getSchemaTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public boolean schemaTouches(int pos, CompilationUnit astRoot) {
- return false;
- }
-
- // ***** catalog
- public String getCatalog() {
- return null;
- }
-
- public void setCatalog(String catalog) {
- if (catalog != null) {
- this.addAnnotation().setCatalog(catalog);
- }
- }
-
- public TextRange getCatalogTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public boolean catalogTouches(int pos, CompilationUnit astRoot) {
- return false;
- }
-
- // ***** unique constraints
- public ListIterator<UniqueConstraintAnnotation> uniqueConstraints() {
- return EmptyListIterator.instance();
- }
-
- public int uniqueConstraintsSize() {
- return 0;
- }
-
- public UniqueConstraintAnnotation uniqueConstraintAt(int index) {
- throw new UnsupportedOperationException();
- }
-
- public int indexOfUniqueConstraint(UniqueConstraintAnnotation uniqueConstraint) {
- throw new UnsupportedOperationException();
- }
-
- public UniqueConstraintAnnotation addUniqueConstraint(int index) {
- return this.addAnnotation().addUniqueConstraint(index);
- }
-
- public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void removeUniqueConstraint(int index) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBasicAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBasicAnnotation.java
deleted file mode 100644
index 0e16de1e07..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBasicAnnotation.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * null javax.persistence.Basic
- */
-public final class NullBasicAnnotation
- extends NullAnnotation
- implements BasicAnnotation
-{
- protected NullBasicAnnotation(JavaResourcePersistentAttribute parent) {
- super(parent);
- }
-
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- protected BasicAnnotation addAnnotation() {
- return (BasicAnnotation) super.addAnnotation();
- }
-
-
- // ***** fetch
-
- public FetchType getFetch() {
- return null;
- }
-
- public void setFetch(FetchType fetch) {
- if (fetch != null) {
- this.addAnnotation().setFetch(fetch);
- }
- }
-
- public TextRange getFetchTextRange(CompilationUnit astRoot) {
- return null;
- }
-
-
- // ***** optional
-
- public Boolean getOptional() {
- return null;
- }
-
- public void setOptional(Boolean optional) {
- if (optional != null) {
- this.addAnnotation().setOptional(optional);
- }
- }
-
- public TextRange getOptionalTextRange(CompilationUnit astRoot) {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullColumnAnnotation.java
deleted file mode 100644
index 3bf5452a0b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullColumnAnnotation.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.Column
- */
-public class NullColumnAnnotation
- extends NullBaseColumnAnnotation
- implements ColumnAnnotation
-{
- public NullColumnAnnotation(JavaResourceNode parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- protected ColumnAnnotation addAnnotation() {
- return (ColumnAnnotation) super.addAnnotation();
- }
-
- // ***** length
- public Integer getLength() {
- return null;
- }
-
- public void setLength(Integer length) {
- if (length != null) {
- this.addAnnotation().setLength(length);
- }
- }
-
- public TextRange getLengthTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- // ***** scale
- public Integer getScale() {
- return null;
- }
-
- public void setScale(Integer scale) {
- if (scale != null) {
- this.addAnnotation().setScale(scale);
- }
- }
-
- public TextRange getScaleTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- // ***** precision
- public Integer getPrecision() {
- return null;
- }
-
- public void setPrecision(Integer precision) {
- if (precision != null) {
- this.addAnnotation().setPrecision(precision);
- }
- }
-
- public TextRange getPrecisionTextRange(CompilationUnit astRoot) {
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java
deleted file mode 100644
index 126ad60814..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jpt.core.resource.java.DiscriminatorColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.DiscriminatorType;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-
-/**
- * javax.persistence.DiscriminatorColumn
- */
-public final class NullDiscriminatorColumnAnnotation
- extends NullNamedColumnAnnotation
- implements DiscriminatorColumnAnnotation
-{
- public NullDiscriminatorColumnAnnotation(JavaResourcePersistentType parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- protected DiscriminatorColumnAnnotation addAnnotation() {
- return (DiscriminatorColumnAnnotation) super.addAnnotation();
- }
-
- // ***** discriminator type
- public DiscriminatorType getDiscriminatorType() {
- return null;
- }
-
- public void setDiscriminatorType(DiscriminatorType discriminatorType) {
- if (discriminatorType != null) {
- this.addAnnotation().setDiscriminatorType(discriminatorType);
- }
- }
-
- // ***** length
- public Integer getLength() {
- return null;
- }
-
- public void setLength(Integer length) {
- if (length != null) {
- this.addAnnotation().setLength(length);
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorValueAnnotation.java
deleted file mode 100644
index 7a68d3d2dc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorValueAnnotation.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.DiscriminatorValueAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.DiscriminatorValue
- */
-public final class NullDiscriminatorValueAnnotation
- extends NullAnnotation
- implements DiscriminatorValueAnnotation
-{
-
- protected NullDiscriminatorValueAnnotation(JavaResourcePersistentType parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- protected DiscriminatorValueAnnotation addAnnotation() {
- return (DiscriminatorValueAnnotation) super.addAnnotation();
- }
-
- // ***** value
- public String getValue() {
- return null;
- }
-
- public void setValue(String value) {
- if (value != null) {
- this.addAnnotation().setValue(value);
- }
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEmbeddedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEmbeddedAnnotation.java
deleted file mode 100644
index 029d2a6ffd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEmbeddedAnnotation.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-
-/**
- * javax.persistence.Embedded
- */
-public final class NullEmbeddedAnnotation
- extends NullAnnotation
- implements EmbeddedAnnotation
-{
- protected NullEmbeddedAnnotation(JavaResourcePersistentAttribute parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEnumeratedAnnotation.java
deleted file mode 100644
index 1e45dd51a9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEnumeratedAnnotation.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.EnumType;
-import org.eclipse.jpt.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.Enumerated
- */
-public final class NullEnumeratedAnnotation
- extends NullAnnotation
- implements EnumeratedAnnotation
-{
- protected NullEnumeratedAnnotation(JavaResourcePersistentAttribute parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- protected EnumeratedAnnotation addAnnotation() {
- return (EnumeratedAnnotation) super.addAnnotation();
- }
-
- // ***** value
- public EnumType getValue() {
- return null;
- }
-
- public void setValue(EnumType value) {
- if (value != null) {
- this.addAnnotation().setValue(value);
- }
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullInheritanceAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullInheritanceAnnotation.java
deleted file mode 100644
index a4130b1b6e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullInheritanceAnnotation.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.InheritanceAnnotation;
-import org.eclipse.jpt.core.resource.java.InheritanceType;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.Inheritance
- */
-public final class NullInheritanceAnnotation
- extends NullAnnotation
- implements InheritanceAnnotation
-{
- protected NullInheritanceAnnotation(JavaResourcePersistentType parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- protected InheritanceAnnotation addAnnotation() {
- return (InheritanceAnnotation) super.addAnnotation();
- }
-
- // ***** strategy
- public InheritanceType getStrategy() {
- return null;
- }
-
- public void setStrategy(InheritanceType strategy) {
- if (strategy != null) {
- this.addAnnotation().setStrategy(strategy);
- }
- }
-
- public TextRange getStrategyTextRange(CompilationUnit astRoot) {
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinColumnAnnotation.java
deleted file mode 100644
index 32c74fa036..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinColumnAnnotation.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.JoinColumn
- */
-public final class NullJoinColumnAnnotation
- extends NullBaseColumnAnnotation
- implements JoinColumnAnnotation
-{
- public NullJoinColumnAnnotation(JavaResourceNode parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- protected JoinColumnAnnotation addAnnotation() {
- throw new UnsupportedOperationException();
- }
-
- // ***** referenced column name
- public String getReferencedColumnName() {
- return null;
- }
-
- public void setReferencedColumnName(String referencedColumnName) {
- throw new UnsupportedOperationException();
- }
-
- public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
- return false;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinTableAnnotation.java
deleted file mode 100644
index f54c7aac97..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinTableAnnotation.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import java.util.ListIterator;
-
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember.AnnotationInitializer;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-
-/**
- * javax.persistence.JoinTable
- */
-public class NullJoinTableAnnotation
- extends NullBaseTableAnnotation
- implements JoinTableAnnotation
-{
- public NullJoinTableAnnotation(JavaResourceNode parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- protected JoinTableAnnotation addAnnotation() {
- return (JoinTableAnnotation) super.addAnnotation();
- }
-
- @Override
- protected JoinColumnAnnotation addAnnotation(AnnotationInitializer initializer) {
- return (JoinColumnAnnotation) super.addAnnotation(initializer);
- }
-
- // ***** join columns
- public ListIterator<JoinColumnAnnotation> joinColumns() {
- return EmptyListIterator.instance();
- }
-
- public int joinColumnsSize() {
- return 0;
- }
-
- public JoinColumnAnnotation joinColumnAt(int index) {
- return null;
- }
-
- public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
- throw new UnsupportedOperationException();
- }
-
- public JoinColumnAnnotation addJoinColumn(int index) {
- // the JoinTable annotation is missing, add both it and a join column at the same time
- return addAnnotation(buildJoinColumnInitializer());
- }
-
- protected AnnotationInitializer buildJoinColumnInitializer() {
- return JOIN_COLUMN_INITIALIZER;
- }
-
- protected static final AnnotationInitializer JOIN_COLUMN_INITIALIZER =
- new AnnotationInitializer() {
- public Annotation initializeAnnotation(Annotation supportingAnnotation) {
- return ((JoinTableAnnotation) supportingAnnotation).initializeJoinColumns();
- }
- };
-
- public void moveJoinColumn(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void removeJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- public JoinColumnAnnotation initializeJoinColumns() {
- throw new UnsupportedOperationException();
- }
-
- // ***** inverse join columns
- public ListIterator<JoinColumnAnnotation> inverseJoinColumns() {
- return EmptyListIterator.instance();
- }
-
- public int inverseJoinColumnsSize() {
- return 0;
- }
-
- public JoinColumnAnnotation inverseJoinColumnAt(int index) {
- return null;
- }
-
- public int indexOfInverseJoinColumn(JoinColumnAnnotation joinColumn) {
- throw new UnsupportedOperationException();
- }
-
- public JoinColumnAnnotation addInverseJoinColumn(int index) {
- // the JoinTable annotation is missing, add both it and a join column at the same time
- return addAnnotation(buildInverseJoinColumnInitializer());
- }
-
- protected AnnotationInitializer buildInverseJoinColumnInitializer() {
- return INVERSE_JOIN_COLUMN_INITIALIZER;
- }
-
- protected static final AnnotationInitializer INVERSE_JOIN_COLUMN_INITIALIZER =
- new AnnotationInitializer() {
- public Annotation initializeAnnotation(Annotation supportingAnnotation) {
- return ((JoinTableAnnotation) supportingAnnotation).initializeInverseJoinColumns();
- }
- };
-
-
- public void moveInverseJoinColumn(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void removeInverseJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- public JoinColumnAnnotation initializeInverseJoinColumns() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullNamedColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullNamedColumnAnnotation.java
deleted file mode 100644
index 0ae2b8cf38..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullNamedColumnAnnotation.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NamedColumnAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.Column
- * javax.persistence.JoinColumn
- * javax.persistence.DiscriminatorColumn
- * javax.persistence.PrimaryKeyJoinColumn.
- */
-public abstract class NullNamedColumnAnnotation
- extends NullAnnotation
- implements NamedColumnAnnotation
-{
- protected NullNamedColumnAnnotation(JavaResourceNode parent) {
- super(parent);
- }
-
- public boolean isSpecified() {
- return false;
- }
-
- @Override
- protected NamedColumnAnnotation addAnnotation() {
- return (NamedColumnAnnotation) super.addAnnotation();
- }
-
- // ***** name
- public String getName() {
- return null;
- }
-
- public void setName(String name) {
- if (name != null) {
- this.addAnnotation().setName(name);
- }
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public boolean nameTouches(int pos, CompilationUnit astRoot) {
- return false;
- }
-
- // ***** column definition
- public String getColumnDefinition() {
- return null;
- }
-
- public void setColumnDefinition(String columnDefinition) {
- if (columnDefinition != null) {
- this.addAnnotation().setColumnDefinition(columnDefinition);
- }
- }
-
- public TextRange getColumnDefinitionTextRange(CompilationUnit astRoot) {
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullOneToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullOneToManyAnnotation.java
deleted file mode 100644
index 3d5d54013b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullOneToManyAnnotation.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-
-/**
- * javax.persistence.OneToMany
- */
-public class NullOneToManyAnnotation
- extends NullOwnableRelationshipMappingAnnotation
- implements OneToManyAnnotation
-{
- public NullOneToManyAnnotation(JavaResourcePersistentAttribute parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullOneToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullOneToOneAnnotation.java
deleted file mode 100644
index 747d95dabc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullOneToOneAnnotation.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.OneToOne
- */
-public class NullOneToOneAnnotation
- extends NullOwnableRelationshipMappingAnnotation
- implements OneToOneAnnotation
-{
- public NullOneToOneAnnotation(JavaResourcePersistentAttribute parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- protected OneToOneAnnotation addAnnotation() {
- return (OneToOneAnnotation) super.addAnnotation();
- }
-
- // ***** optional
- public Boolean getOptional() {
- return null;
- }
-
- public void setOptional(Boolean optional) {
- if (optional != null) {
- this.addAnnotation().setOptional(optional);
- }
- }
-
- public TextRange getOptionalTextRange(CompilationUnit astRoot) {
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullOwnableRelationshipMappingAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullOwnableRelationshipMappingAnnotation.java
deleted file mode 100644
index dd29a044d7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullOwnableRelationshipMappingAnnotation.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.OwnableRelationshipMappingAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.OneToMany
- * javax.persistence.OneToOne
- */
-public abstract class NullOwnableRelationshipMappingAnnotation
- extends NullAnnotation
- implements OwnableRelationshipMappingAnnotation
-{
- protected NullOwnableRelationshipMappingAnnotation(JavaResourcePersistentAttribute parent) {
- super(parent);
- }
-
-
- @Override
- protected OwnableRelationshipMappingAnnotation addAnnotation() {
- return (OwnableRelationshipMappingAnnotation) super.addAnnotation();
- }
-
-
- // ***** target entity
-
- public String getTargetEntity() {
- return null;
- }
-
- public void setTargetEntity(String targetEntity) {
- if (targetEntity != null) {
- this.addAnnotation().setTargetEntity(targetEntity);
- }
- }
-
- public TextRange getTargetEntityTextRange(CompilationUnit astRoot) {
- return null;
- }
-
-
- // ***** fully-qualified target entity class name
-
- public String getFullyQualifiedTargetEntityClassName() {
- return null;
- }
-
-
- // ***** mapped by
-
- public String getMappedBy() {
- return null;
- }
-
- public void setMappedBy(String mappedBy) {
- if (mappedBy != null) {
- this.addAnnotation().setMappedBy(mappedBy);
- }
- }
-
- public TextRange getMappedByTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public boolean mappedByTouches(int pos, CompilationUnit astRoot) {
- return false;
- }
-
-
- // ***** fetch
-
- public FetchType getFetch() {
- return null;
- }
-
- public void setFetch(FetchType fetch) {
- if (fetch != null) {
- this.addAnnotation().setFetch(fetch);
- }
- }
-
- public TextRange getFetchTextRange(CompilationUnit astRoot) {
- return null;
- }
-
-
- // ***** cascade all
-
- public boolean isCascadeAll() {
- return false;
- }
-
- public void setCascadeAll(boolean all) {
- this.addAnnotation().setCascadeAll(all);
- }
-
-
- // ***** cascade merge
-
- public boolean isCascadeMerge() {
- return false;
- }
-
- public void setCascadeMerge(boolean merge) {
- this.addAnnotation().setCascadeMerge(merge);
- }
-
-
- // ***** cascade persist
-
- public boolean isCascadePersist() {
- return false;
- }
-
- public void setCascadePersist(boolean persist) {
- this.addAnnotation().setCascadePersist(persist);
- }
-
-
- // ***** cascade refresh
-
- public boolean isCascadeRefresh() {
- return false;
- }
-
- public void setCascadeRefresh(boolean refresh) {
- this.addAnnotation().setCascadeRefresh(refresh);
- }
-
-
- // ***** cascade remove
-
- public boolean isCascadeRemove() {
- return false;
- }
-
- public void setCascadeRemove(boolean remove) {
- this.addAnnotation().setCascadeRemove(remove);
- }
-
- public TextRange getCascadeTextRange(CompilationUnit astRoot) {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullPrimaryKeyJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullPrimaryKeyJoinColumnAnnotation.java
deleted file mode 100644
index a2ff594c03..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullPrimaryKeyJoinColumnAnnotation.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NamedColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.PrimaryKeyJoinColumn
- */
-public final class NullPrimaryKeyJoinColumnAnnotation
- extends NullNamedColumnAnnotation
- implements PrimaryKeyJoinColumnAnnotation
-{
- public NullPrimaryKeyJoinColumnAnnotation(JavaResourceNode parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- protected NamedColumnAnnotation addAnnotation() {
- throw new UnsupportedOperationException();
- }
-
- // ***** referenced column name
- public String getReferencedColumnName() {
- return null;
- }
-
- public void setReferencedColumnName(String referencedColumnName) {
- throw new UnsupportedOperationException();
- }
-
- public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
- return false;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTableAnnotation.java
deleted file mode 100644
index bc831e7093..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTableAnnotation.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.TableAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember.AnnotationInitializer;
-
-/**
- * javax.persistence.Table
- */
-public final class NullTableAnnotation
- extends NullBaseTableAnnotation
- implements TableAnnotation
-{
- protected NullTableAnnotation(JavaResourcePersistentType parent) {
- super(parent);
- }
-
- @Override
- protected TableAnnotation addAnnotation() {
- return (TableAnnotation) super.addAnnotation();
- }
-
- @Override
- protected TableAnnotation addAnnotation(AnnotationInitializer initializer) {
- return (TableAnnotation) super.addAnnotation(initializer);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTemporalAnnotation.java
deleted file mode 100644
index ec38b00a84..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTemporalAnnotation.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.core.resource.java.TemporalType;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.Temporal
- */
-public final class NullTemporalAnnotation
- extends NullAnnotation
- implements TemporalAnnotation
-{
- protected NullTemporalAnnotation(JavaResourcePersistentAttribute parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- protected TemporalAnnotation addAnnotation() {
- return (TemporalAnnotation) super.addAnnotation();
- }
-
-
- // ********** TemporalAnnotation implementation **********
-
- // ***** value
- public TemporalType getValue() {
- return null;
- }
-
- public void setValue(TemporalType value) {
- if (value != null) {
- this.addAnnotation().setValue(value);
- }
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToManyAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToManyAnnotationDefinition.java
deleted file mode 100644
index 27e2e32181..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToManyAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.jpa1.resource.java.binary.BinaryOneToMany1_0Annotation;
-import org.eclipse.jpt.core.internal.jpa1.resource.java.source.SourceOneToMany1_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceOneToMany1_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- return new NullOneToManyAnnotation((JavaResourcePersistentAttribute) parent);
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryOneToMany1_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return OneToManyAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOneAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOneAnnotationDefinition.java
deleted file mode 100644
index cc3726aefc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOneAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.jpa1.resource.java.binary.BinaryOneToOne1_0Annotation;
-import org.eclipse.jpt.core.internal.jpa1.resource.java.source.SourceOneToOne1_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceOneToOne1_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- return new NullOneToOneAnnotation((JavaResourcePersistentAttribute) parent);
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryOneToOne1_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return OneToOneAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OrderByAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OrderByAnnotationDefinition.java
deleted file mode 100644
index 271aa8a070..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OrderByAnnotationDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryOrderByAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceOrderByAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.OrderByAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceOrderByAnnotation(parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryOrderByAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return OrderByAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnAnnotationDefinition.java
deleted file mode 100644
index 77499381c1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryPrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourcePrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.PrimaryKeyJoinColumn
- */
-public final class PrimaryKeyJoinColumnAnnotationDefinition
- implements AnnotationDefinition
-{
- // singleton
- private static final AnnotationDefinition INSTANCE = new PrimaryKeyJoinColumnAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static AnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private PrimaryKeyJoinColumnAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return SourcePrimaryKeyJoinColumnAnnotation.createPrimaryKeyJoinColumn(parent, member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryPrimaryKeyJoinColumnAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnsAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnsAnnotationDefinition.java
deleted file mode 100644
index 0c67aba310..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnsAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryPrimaryKeyJoinColumnsAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourcePrimaryKeyJoinColumnsAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.PrimaryKeyJoinColumns
- */
-public final class PrimaryKeyJoinColumnsAnnotationDefinition
- implements AnnotationDefinition
-{
- // singleton
- private static final AnnotationDefinition INSTANCE = new PrimaryKeyJoinColumnsAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static AnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private PrimaryKeyJoinColumnsAnnotationDefinition() {
- super();
- }
-
- public PrimaryKeyJoinColumnsAnnotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new SourcePrimaryKeyJoinColumnsAnnotation(parent, member);
- }
-
- public PrimaryKeyJoinColumnsAnnotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryPrimaryKeyJoinColumnsAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTableAnnotationDefinition.java
deleted file mode 100644
index cca983ff52..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTableAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinarySecondaryTableAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceSecondaryTableAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.SecondaryTable
- */
-public final class SecondaryTableAnnotationDefinition
- implements AnnotationDefinition
-{
- // singleton
- private static final AnnotationDefinition INSTANCE = new SecondaryTableAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static AnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private SecondaryTableAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return SourceSecondaryTableAnnotation.createSecondaryTable(parent, member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinarySecondaryTableAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return SecondaryTableAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTablesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTablesAnnotationDefinition.java
deleted file mode 100644
index 037c96894c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTablesAnnotationDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinarySecondaryTablesAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceSecondaryTablesAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.SecondaryTablesAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceSecondaryTablesAnnotation((JavaResourcePersistentType) parent, member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinarySecondaryTablesAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return SecondaryTablesAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGeneratorAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGeneratorAnnotationDefinition.java
deleted file mode 100644
index 884b36bb1a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGeneratorAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.jpa1.resource.java.binary.BinarySequenceGenerator1_0Annotation;
-import org.eclipse.jpt.core.internal.jpa1.resource.java.source.SourceSequenceGenerator1_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceSequenceGenerator1_0Annotation(parent, member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinarySequenceGenerator1_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return SequenceGeneratorAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableAnnotationDefinition.java
deleted file mode 100644
index 6de211ef15..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableAnnotationDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryTableAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceTableAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.TableAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceTableAnnotation(parent, member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- return new NullTableAnnotation((JavaResourcePersistentType) parent);
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryTableAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return TableAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableGeneratorAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableGeneratorAnnotationDefinition.java
deleted file mode 100644
index 428e818d4c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableGeneratorAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryTableGeneratorAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceTableGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceTableGeneratorAnnotation(parent, member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryTableGeneratorAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return TableGeneratorAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalAnnotationDefinition.java
deleted file mode 100644
index eb433e17f2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryTemporalAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceTemporalAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceTemporalAnnotation(parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- return new NullTemporalAnnotation((JavaResourcePersistentAttribute) parent);
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryTemporalAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return TemporalAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TransientAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TransientAnnotationDefinition.java
deleted file mode 100644
index 4d84704c0f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TransientAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryTransientAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceTransientAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.TransientAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceTransientAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryTransientAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return TransientAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/VersionAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/VersionAnnotationDefinition.java
deleted file mode 100644
index 3b11cce142..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/VersionAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryVersionAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceVersionAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.VersionAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * 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(JavaResourcePersistentMember parent, Member member) {
- return new SourceVersionAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryVersionAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return VersionAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAnnotation.java
deleted file mode 100644
index 7d5b6bf1ec..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAnnotation.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IMemberValuePair;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-
-/**
- * JAR annotation
- */
-public abstract class BinaryAnnotation
- extends BinaryNode
- implements Annotation
-{
- final IAnnotation jdtAnnotation;
-
- protected BinaryAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent);
- this.jdtAnnotation = jdtAnnotation;
- }
-
-
- // ********** convenience methods **********
-
- /**
- * Return the values of the JDT annotation's member with the specified name.
- */
- protected Object[] getJdtMemberValues(String memberName) {
- Object[] values = (Object[]) this.getJdtMemberValue(memberName);
- return (values != null) ? values : EMPTY_OBJECT_ARRAY;
- }
- private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
-
- /**
- * Return the value of the JDT annotation's member with the specified name.
- */
- protected Object getJdtMemberValue(String memberName) {
- IMemberValuePair pair = this.getJdtMemberValuePair(memberName);
- return (pair == null) ? null : pair.getValue();
- }
-
- /**
- * Return the JDT annotation's member-value pair with the specified name.
- */
- private IMemberValuePair getJdtMemberValuePair(String memberName) {
- for (IMemberValuePair pair : this.getJdtMemberValuePairs()) {
- if (pair.getMemberName().equals(memberName)) {
- return pair;
- }
- }
- return null;
- }
-
- private IMemberValuePair[] getJdtMemberValuePairs() {
- try {
- return this.jdtAnnotation.getMemberValuePairs();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return EMPTY_MEMBER_VALUE_PAIR_ARRAY;
- }
- }
- private static final IMemberValuePair[] EMPTY_MEMBER_VALUE_PAIR_ARRAY = new IMemberValuePair[0];
-
-
- // ********** Annotation implementation **********
- public org.eclipse.jdt.core.dom.Annotation getJdtAnnotation(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
- public void newAnnotation() {
- throw new UnsupportedOperationException();
- }
- public void removeAnnotation() {
- throw new UnsupportedOperationException();
- }
-
- // ********** NestableAnnotation implementation **********
- public void moveAnnotation(@SuppressWarnings("unused") int index) {
- throw new UnsupportedOperationException();
- }
- public void initializeFrom(@SuppressWarnings("unused") NestableAnnotation oldAnnotation) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java
deleted file mode 100644
index 439b0442b3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAssociationOverrideAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.AssociationOverride
- */
-public abstract class BinaryAssociationOverrideAnnotation
- extends BinaryOverrideAnnotation
- implements NestableAssociationOverrideAnnotation
-{
- private final Vector<JoinColumnAnnotation> joinColumns;
-
-
- protected BinaryAssociationOverrideAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.joinColumns = this.buildJoinColumns();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.updateJoinColumns();
- }
-
-
- // ********** BinaryOverrideAnnotation implementation **********
-
- @Override
- protected String getNameElementName() {
- return JPA.ASSOCIATION_OVERRIDE__NAME;
- }
-
-
- // ********** AssociationOverrideAnnotation implementation **********
-
- // ***** join columns
- public ListIterator<JoinColumnAnnotation> joinColumns() {
- return new CloneListIterator<JoinColumnAnnotation>(this.joinColumns);
- }
-
- public int joinColumnsSize() {
- return this.joinColumns.size();
- }
-
- public JoinColumnAnnotation joinColumnAt(int index) {
- return this.joinColumns.get(index);
- }
-
- public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
- return this.joinColumns.indexOf(joinColumn);
- }
-
- public JoinColumnAnnotation addJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- public void moveJoinColumn(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void removeJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- private Vector<JoinColumnAnnotation> buildJoinColumns() {
- Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.ASSOCIATION_OVERRIDE__JOIN_COLUMNS);
- Vector<JoinColumnAnnotation> result = new Vector<JoinColumnAnnotation>(jdtJoinColumns.length);
- for (Object jdtJoinColumn : jdtJoinColumns) {
- result.add(new BinaryJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn));
- }
- return result;
- }
-
- // TODO
- private void updateJoinColumns() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAssociationOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAssociationOverridesAnnotation.java
deleted file mode 100644
index 22a782a291..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAssociationOverridesAnnotation.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.AssociationOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAssociationOverrideAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.AssociationOverrides
- */
-public abstract class BinaryAssociationOverridesAnnotation
- extends BinaryContainerAnnotation<NestableAssociationOverrideAnnotation>
- implements AssociationOverridesAnnotation
-{
- private final Vector<NestableAssociationOverrideAnnotation> associationOverrides;
-
-
- protected BinaryAssociationOverridesAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.associationOverrides = this.buildAssociationOverrides();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public ListIterator<NestableAssociationOverrideAnnotation> nestedAnnotations() {
- return new CloneListIterator<NestableAssociationOverrideAnnotation>(this.associationOverrides);
- }
-
- public int nestedAnnotationsSize() {
- return this.associationOverrides.size();
- }
-
- private Vector<NestableAssociationOverrideAnnotation> buildAssociationOverrides() {
- Object[] jdtAssociationOverrides = this.getJdtMemberValues(JPA.ASSOCIATION_OVERRIDES__VALUE);
- Vector<NestableAssociationOverrideAnnotation> result = new Vector<NestableAssociationOverrideAnnotation>(jdtAssociationOverrides.length);
- for (Object jdtAssociationOverride : jdtAssociationOverrides) {
- result.add(buildAssociationOverride(jdtAssociationOverride));
- }
- return result;
- }
-
- protected abstract NestableAssociationOverrideAnnotation buildAssociationOverride(Object jdtAssociationOverride);
-
- @Override
- public void update() {
- super.update();
- this.updateAssociationOverrides();
- }
-
- // TODO
- private void updateAssociationOverrides() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java
deleted file mode 100644
index 37add8b4d8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.NullAttributeOverrideColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAttributeOverrideAnnotation;
-
-/**
- * javax.persistence.AttributeOverride
- */
-public final class BinaryAttributeOverrideAnnotation
- extends BinaryOverrideAnnotation
- implements NestableAttributeOverrideAnnotation
-{
- private ColumnAnnotation column;
-
-
- public BinaryAttributeOverrideAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.column = this.buildColumn();
- }
-
- 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 : new NullAttributeOverrideColumnAnnotation(this);
- }
-
- 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 buildColumn(IAnnotation jdtColumn) {
- return new BinaryColumnAnnotation(this, jdtColumn);
- }
-
- private IAnnotation getJdtColumn() {
- return (IAnnotation) this.getJdtMemberValue(JPA.ATTRIBUTE_OVERRIDE__COLUMN);
- }
-
- private void setColumn(ColumnAnnotation column) {
- ColumnAnnotation old = this.column;
- this.column = column;
- this.firePropertyChanged(COLUMN_PROPERTY, old, column);
- }
-
- // TODO
- private void updateColumn() {
- throw new UnsupportedOperationException();
-// IAnnotation jdtColumn = this.getJdtColumn();
-// if (jdtColumn == null) {
-// this.setColumn(null);
-// } else {
-// if (this.column == null) {
-// this.setColumn(this.buildColumn(jdtColumn));
-// } else {
-// this.column.update(jdtColumn);
-// }
-// }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAttributeOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAttributeOverridesAnnotation.java
deleted file mode 100644
index 2af0df8e18..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAttributeOverridesAnnotation.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAttributeOverrideAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.AttributeOverrides
- */
-public final class BinaryAttributeOverridesAnnotation
- extends BinaryContainerAnnotation<NestableAttributeOverrideAnnotation>
- implements AttributeOverridesAnnotation
-{
- private final Vector<NestableAttributeOverrideAnnotation> attributeOverrides;
-
-
- public BinaryAttributeOverridesAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.attributeOverrides = this.buildAttributeOverrides();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public ListIterator<NestableAttributeOverrideAnnotation> nestedAnnotations() {
- return new CloneListIterator<NestableAttributeOverrideAnnotation>(this.attributeOverrides);
- }
-
- public int nestedAnnotationsSize() {
- return this.attributeOverrides.size();
- }
-
- private Vector<NestableAttributeOverrideAnnotation> buildAttributeOverrides() {
- Object[] jdtAttributeOverrides = this.getJdtMemberValues(JPA.ATTRIBUTE_OVERRIDES__VALUE);
- Vector<NestableAttributeOverrideAnnotation> result = new Vector<NestableAttributeOverrideAnnotation>(jdtAttributeOverrides.length);
- for (Object jdtAttributeOverride : jdtAttributeOverrides) {
- result.add(new BinaryAttributeOverrideAnnotation(this, (IAnnotation) jdtAttributeOverride));
- }
- return result;
- }
-
- @Override
- public void update() {
- super.update();
- this.updateAttributeOverrides();
- }
-
- // TODO
- private void updateAttributeOverrides() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java
deleted file mode 100644
index 7e7d4f32e9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.BaseColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.Column
- * javax.persistence.JoinColumn
- */
-abstract class BinaryBaseColumnAnnotation
- extends BinaryNamedColumnAnnotation
- implements BaseColumnAnnotation
-{
- private String table;
- private Boolean unique;
- private Boolean nullable;
- private Boolean insertable;
- private Boolean updatable;
-
-
- 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());
- }
-
- 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());
- }
-
- 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());
- }
-
- 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());
- }
-
- 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());
- }
-
- abstract String getUpdatableElementName();
-
- public TextRange getUpdatableTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseNamedQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseNamedQueryAnnotation.java
deleted file mode 100644
index cb7745ef78..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseNamedQueryAnnotation.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.BaseNamedQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.QueryHintAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.NamedQuery
- * javax.persistence.NamedNativeQuery
- */
-abstract class BinaryBaseNamedQueryAnnotation
- extends BinaryAnnotation
- implements BaseNamedQueryAnnotation
-{
- String name;
- String query;
- final Vector<QueryHintAnnotation> hints;
-
-
- BinaryBaseNamedQueryAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.name = this.buildName();
- this.query = this.buildQuery();
- this.hints = this.buildHints();
- }
-
- @Override
- public void update() {
- super.update();
- this.setName_(this.buildName());
- this.setQuery_(this.buildQuery());
- this.updateHints();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** BaseNamedQueryAnnotation implementation **********
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- throw new UnsupportedOperationException();
- }
-
- private void setName_(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- private String buildName() {
- return (String) this.getJdtMemberValue(this.getNameElementName());
- }
-
- abstract String getNameElementName();
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** query
- public String getQuery() {
- return this.query;
- }
-
- public void setQuery(String query) {
- throw new UnsupportedOperationException();
- }
-
- private void setQuery_(String query) {
- String old = this.query;
- this.query = query;
- this.firePropertyChanged(QUERY_PROPERTY, old, query);
- }
-
- private String buildQuery() {
- return (String) this.getJdtMemberValue(this.getQueryElementName());
- }
-
- abstract String getQueryElementName();
-
- public TextRange getQueryTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** hints
- public ListIterator<QueryHintAnnotation> hints() {
- return new CloneListIterator<QueryHintAnnotation>(this.hints);
- }
-
- public int hintsSize() {
- return this.hints.size();
- }
-
- public QueryHintAnnotation hintAt(int index) {
- return this.hints.get(index);
- }
-
- public int indexOfHint(QueryHintAnnotation queryHint) {
- return this.hints.indexOf(queryHint);
- }
-
- public QueryHintAnnotation addHint(int index) {
- throw new UnsupportedOperationException();
- }
-
- public void moveHint(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void removeHint(int index) {
- throw new UnsupportedOperationException();
- }
-
- private Vector<QueryHintAnnotation> buildHints() {
- Object[] jdtHints = this.getJdtMemberValues(this.getHintsElementName());
- Vector<QueryHintAnnotation> result = new Vector<QueryHintAnnotation>(jdtHints.length);
- for (Object jdtHint : jdtHints) {
- result.add(new BinaryQueryHintAnnotation(this, (IAnnotation) jdtHint));
- }
- return result;
- }
-
- abstract String getHintsElementName();
-
- // TODO
- private void updateHints() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java
deleted file mode 100644
index ca8c3d4ed4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.BaseTableAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.Table
- * javax.persistence.JoinTable
- * javax.persistence.SecondaryTable
- */
-abstract class BinaryBaseTableAnnotation
- extends BinaryAnnotation
- implements BaseTableAnnotation
-{
- String name;
- String schema;
- String catalog;
- final Vector<UniqueConstraintAnnotation> uniqueConstraints;
-
-
- 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());
- }
-
- 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());
- }
-
- 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());
- }
-
- abstract String getCatalogElementName();
-
- public TextRange getCatalogTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean catalogTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** unique constraints
- public ListIterator<UniqueConstraintAnnotation> uniqueConstraints() {
- return new CloneListIterator<UniqueConstraintAnnotation>(this.uniqueConstraints);
- }
-
- public int uniqueConstraintsSize() {
- return this.uniqueConstraints.size();
- }
-
- public UniqueConstraintAnnotation uniqueConstraintAt(int index) {
- return this.uniqueConstraints.get(index);
- }
-
- public int indexOfUniqueConstraint(UniqueConstraintAnnotation uniqueConstraint) {
- return this.uniqueConstraints.indexOf(uniqueConstraint);
- }
-
- public UniqueConstraintAnnotation addUniqueConstraint(int index) {
- throw new UnsupportedOperationException();
- }
-
- public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void removeUniqueConstraint(int index) {
- throw new UnsupportedOperationException();
- }
-
- private Vector<UniqueConstraintAnnotation> buildUniqueConstraints() {
- Object[] jdtUniqueConstraints = this.getJdtMemberValues(this.getUniqueConstraintElementName());
- Vector<UniqueConstraintAnnotation> result = new Vector<UniqueConstraintAnnotation>(jdtUniqueConstraints.length);
- for (Object jdtUniqueConstraint : jdtUniqueConstraints) {
- result.add(new BinaryUniqueConstraintAnnotation(this, (IAnnotation) jdtUniqueConstraint));
- }
- return result;
- }
-
- abstract String getUniqueConstraintElementName();
-
- // TODO
- private void updateUniqueConstraints() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBasicAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBasicAnnotation.java
deleted file mode 100644
index 9db25330ce..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBasicAnnotation.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.Basic
- */
-public final class BinaryBasicAnnotation
- extends BinaryAnnotation
- implements BasicAnnotation
-{
- private Boolean optional;
- private FetchType fetch;
-
-
- public BinaryBasicAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.optional = this.buildOptional();
- this.fetch = this.buildFetch();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setOptional_(this.buildOptional());
- this.setFetch_(this.buildFetch());
- }
-
-
- //*************** Basic implementation ****************
-
- // ***** optional
- public Boolean getOptional() {
- return this.optional;
- }
-
- public void setOptional(Boolean optional) {
- throw new UnsupportedOperationException();
- }
-
- private void setOptional_(Boolean optional) {
- Boolean old = this.optional;
- this.optional = optional;
- this.firePropertyChanged(OPTIONAL_PROPERTY, old, optional);
- }
-
- private Boolean buildOptional() {
- return (Boolean) this.getJdtMemberValue(JPA.BASIC__OPTIONAL);
- }
-
- public TextRange getOptionalTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** fetch
- public FetchType getFetch() {
- return this.fetch;
- }
-
- public void setFetch(FetchType fetch) {
- throw new UnsupportedOperationException();
- }
-
- private void setFetch_(FetchType fetch) {
- FetchType old = this.fetch;
- this.fetch = fetch;
- this.firePropertyChanged(FETCH_PROPERTY, old, fetch);
- }
-
- private FetchType buildFetch() {
- return FetchType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA.BASIC__FETCH));
- }
-
- public TextRange getFetchTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryClassFile.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryClassFile.java
deleted file mode 100644
index 037eda1ea4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryClassFile.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IClassFile;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.core.resource.java.JavaResourceClassFile;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragment;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-
-/**
- * binary class file
- */
-final class BinaryClassFile
- extends BinaryNode
- implements JavaResourceClassFile
-{
- /** JDT class file */
- private final IClassFile classFile;
-
- /** class file's persistent type */
- private final JavaResourcePersistentType persistentType;
-
-
- // ********** construction/initialization **********
-
- /**
- * The JDT type gets passed in because the package fragment inspects it
- * beforehand to determine whether it is "persistable". (We only build
- * class files for "persistable" types.)
- */
- BinaryClassFile(JavaResourcePackageFragment parent, IClassFile classFile, IType jdtType) {
- super(parent);
- this.classFile = classFile;
- this.persistentType = this.buildPersistentType(jdtType);
- }
-
- private JavaResourcePersistentType buildPersistentType(IType jdtType) {
- return new BinaryPersistentType(this, jdtType);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.classFile.getElementName());
- }
-
-
- // ********** JavaResourceClassFile implementation **********
-
- public JavaResourcePersistentType getPersistentType() {
- return this.persistentType;
- }
-
- // TODO
- @Override
- public void update() {
- super.update();
-// this.persistentType.update(this.classFile.getType());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryColumnAnnotation.java
deleted file mode 100644
index 9251f9d9e0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryColumnAnnotation.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.Column
- */
-public final class BinaryColumnAnnotation
- extends BinaryBaseColumnAnnotation
- implements ColumnAnnotation
-{
- private Integer length;
- private Integer precision;
- private Integer scale;
-
-
- public BinaryColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.length = this.buildLength();
- this.precision = this.buildPrecision();
- this.scale = this.buildScale();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setLength_(this.buildLength());
- this.setPrecision_(this.buildPrecision());
- this.setScale_(this.buildScale());
- }
-
-
- // ********** JavaSourceNamedColumnAnnotation implementation **********
-
- @Override
- protected String getNameElementName() {
- return JPA.COLUMN__NAME;
- }
-
- @Override
- protected String getColumnDefinitionElementName() {
- return JPA.COLUMN__COLUMN_DEFINITION;
- }
-
-
- // ********** JavaSourceBaseColumnAnnotation implementation **********
-
- @Override
- String getTableElementName() {
- return JPA.COLUMN__TABLE;
- }
-
- @Override
- String getUniqueElementName() {
- return JPA.COLUMN__UNIQUE;
- }
-
- @Override
- String getNullableElementName() {
- return JPA.COLUMN__NULLABLE;
- }
-
- @Override
- String getInsertableElementName() {
- return JPA.COLUMN__INSERTABLE;
- }
-
- @Override
- String getUpdatableElementName() {
- return JPA.COLUMN__UPDATABLE;
- }
-
-
- // ********** Column 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(JPA.COLUMN__LENGTH);
- }
-
- public TextRange getLengthTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** 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(JPA.COLUMN__PRECISION);
- }
-
- public TextRange getPrecisionTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** 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(JPA.COLUMN__SCALE);
- }
-
- public TextRange getScaleTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryContainerAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryContainerAnnotation.java
deleted file mode 100644
index 871b9b54f1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryContainerAnnotation.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.ContainerAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-
-/**
- * JAR annotations do not support most of the container annotation protocol.
- */
-abstract class BinaryContainerAnnotation<T extends NestableAnnotation>
- extends BinaryAnnotation
- implements ContainerAnnotation<T>
-{
-
- public BinaryContainerAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getContainerAnnotationName() {
- throw new UnsupportedOperationException();
- }
-
- public Annotation getContainerJdtAnnotation(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public String getElementName() {
- throw new UnsupportedOperationException();
- }
-
- public String getNestableAnnotationName() {
- throw new UnsupportedOperationException();
- }
-
- public T addNestedAnnotationInternal() {
- throw new UnsupportedOperationException();
- }
-
- public void nestedAnnotationAdded(int index, T nestedAnnotation) {
- throw new UnsupportedOperationException();
- }
-
- public T moveNestedAnnotationInternal(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void nestedAnnotationMoved(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public T removeNestedAnnotationInternal(int index) {
- throw new UnsupportedOperationException();
- }
-
- public void nestedAnnotationRemoved(int index, T nestedAnnotation) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java
deleted file mode 100644
index 3215bc8100..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.DiscriminatorColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.DiscriminatorType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-
-/**
- * javax.persistence.DiscriminatorColumn
- */
-public final class BinaryDiscriminatorColumnAnnotation
- extends BinaryNamedColumnAnnotation
- implements DiscriminatorColumnAnnotation
-{
- private DiscriminatorType discriminatorType;
- private Integer length;
-
-
- public BinaryDiscriminatorColumnAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.discriminatorType = this.buildDiscriminatorType();
- this.length = this.buildLength();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setDiscriminatorType_(this.buildDiscriminatorType());
- this.setLength_(this.buildLength());
- }
-
-
- // ********** AbstractNamedColumn implementation **********
-
- @Override
- protected String getNameElementName() {
- return JPA.DISCRIMINATOR_COLUMN__NAME;
- }
-
- @Override
- protected String getColumnDefinitionElementName() {
- return JPA.DISCRIMINATOR_COLUMN__COLUMN_DEFINITION;
- }
-
-
- // ********** DiscriminatorColumn implementation **********
-
- // ***** discriminator type
- public DiscriminatorType getDiscriminatorType() {
- return null;
- }
-
- public void setDiscriminatorType(DiscriminatorType discriminatorType) {
- throw new UnsupportedOperationException();
- }
-
- private void setDiscriminatorType_(DiscriminatorType discriminatorType) {
- DiscriminatorType old = this.discriminatorType;
- this.discriminatorType = discriminatorType;
- this.firePropertyChanged(DISCRIMINATOR_TYPE_PROPERTY, old, discriminatorType);
- }
-
- private DiscriminatorType buildDiscriminatorType() {
- return DiscriminatorType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA.DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE));
- }
-
- // ***** length
- public Integer getLength() {
- return null;
- }
-
- public void setLength(Integer length) {
- throw new UnsupportedOperationException();
- }
-
- private void setLength_(Integer length) {
- Integer old = this.length;
- this.length = length;
- this.firePropertyChanged(LENGTH_PROPERTY, old, length);
- }
-
- private Integer buildLength() {
- return (Integer) this.getJdtMemberValue(JPA.DISCRIMINATOR_COLUMN__LENGTH);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java
deleted file mode 100644
index 883f99695f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.DiscriminatorValueAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.DiscriminatorValue
- */
-public final class BinaryDiscriminatorValueAnnotation
- extends BinaryAnnotation
- implements DiscriminatorValueAnnotation
-{
- private String value;
-
-
- public BinaryDiscriminatorValueAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.value = this.buildValue();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setValue_(this.buildValue());
- }
-
-
- // ********** DiscriminatorValueAnnotation implementation **********
-
- // ***** value
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- throw new UnsupportedOperationException();
- }
-
- private void setValue_(String value) {
- String old = this.value;
- this.value = value;
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private String buildValue() {
- return (String) this.getJdtMemberValue(JPA.DISCRIMINATOR_VALUE__VALUE);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java
deleted file mode 100644
index 91db09f2a2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-
-/**
- * javax.persistence.Embeddable
- */
-public final class BinaryEmbeddableAnnotation
- extends BinaryAnnotation
- implements EmbeddableAnnotation
-{
-
- public BinaryEmbeddableAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java
deleted file mode 100644
index 2fd143485d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-
-/**
- * javax.persistence.Embedded
- */
-public final class BinaryEmbeddedAnnotation
- extends BinaryAnnotation
- implements EmbeddedAnnotation
-{
-
- public BinaryEmbeddedAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java
deleted file mode 100644
index 604f5be572..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-
-/**
- * javax.persistence.EmbeddedId
- */
-public final class BinaryEmbeddedIdAnnotation
- extends BinaryAnnotation
- implements EmbeddedIdAnnotation
-{
-
- public BinaryEmbeddedIdAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEntityAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEntityAnnotation.java
deleted file mode 100644
index bd4acb47b9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEntityAnnotation.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.Entity
- */
-public final class BinaryEntityAnnotation
- extends BinaryAnnotation
- implements EntityAnnotation
-{
- private String name;
-
-
- public BinaryEntityAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.name = this.buildName();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setName_(this.buildName());
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** EntityAnnotation implementation **********
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- throw new UnsupportedOperationException();
- }
-
- private void setName_(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- private String buildName() {
- return (String) this.getJdtMemberValue(JPA.ENTITY__NAME);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java
deleted file mode 100644
index 0263fb7765..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.EnumType;
-import org.eclipse.jpt.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.Enumerated
- */
-public final class BinaryEnumeratedAnnotation
- extends BinaryAnnotation
- implements EnumeratedAnnotation
-{
- private EnumType value;
-
-
- public BinaryEnumeratedAnnotation(JavaResourceNode 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());
- }
-
-
- // ********** 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(JPA.ENUMERATED__VALUE));
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java
deleted file mode 100644
index a6b26366a0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.core.resource.java.GenerationType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.GeneratedValue
- */
-public final class BinaryGeneratedValueAnnotation
- extends BinaryAnnotation
- implements GeneratedValueAnnotation
-{
- private GenerationType strategy;
- private String generator;
-
-
- public BinaryGeneratedValueAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.strategy = this.buildStrategy();
- this.generator = this.buildGenerator();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setStrategy_(this.buildStrategy());
- this.setGenerator_(this.buildGenerator());
- }
-
-
- // ********** GeneratedValueAnnotation implementation **********
-
- // ***** strategy
- public GenerationType getStrategy() {
- return this.strategy;
- }
-
- public void setStrategy(GenerationType strategy) {
- throw new UnsupportedOperationException();
- }
-
- private void setStrategy_(GenerationType strategy) {
- GenerationType old = this.strategy;
- this.strategy = strategy;
- this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
- }
-
- private GenerationType buildStrategy() {
- return GenerationType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA.GENERATED_VALUE__STRATEGY));
- }
-
- public TextRange getStrategyTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** generator
- public String getGenerator() {
- return this.generator;
- }
-
- public void setGenerator(String generator) {
- throw new UnsupportedOperationException();
- }
-
- private void setGenerator_(String generator) {
- String old = this.generator;
- this.generator = generator;
- this.firePropertyChanged(GENERATOR_PROPERTY, old, generator);
- }
-
- private String buildGenerator() {
- return (String) this.getJdtMemberValue(JPA.GENERATED_VALUE__GENERATOR);
- }
-
- public TextRange getGeneratorTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean generatorTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java
deleted file mode 100644
index d89cff9ec8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.GeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.SequenceGenerator
- * javax.persistence.TableGenerator
- */
-abstract class BinaryGeneratorAnnotation
- extends BinaryAnnotation
- implements GeneratorAnnotation
-{
- String name;
- Integer initialValue;
- Integer allocationSize;
-
-
- BinaryGeneratorAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.name = this.buildName();
- this.initialValue = this.buildInitialValue();
- this.allocationSize = this.buildAllocationSize();
- }
-
- @Override
- public void update() {
- super.update();
- this.setName_(this.buildName());
- this.setInitialValue_(this.buildInitialValue());
- this.setAllocationSize_(this.buildAllocationSize());
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** GeneratorAnnotation implementation **********
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- throw new UnsupportedOperationException();
- }
-
- private void setName_(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- private String buildName() {
- return (String) this.getJdtMemberValue(this.getNameElementName());
- }
-
- abstract String getNameElementName();
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** initial value
- public Integer getInitialValue() {
- return this.initialValue;
- }
-
- public void setInitialValue(Integer initialValue) {
- throw new UnsupportedOperationException();
- }
-
- private void setInitialValue_(Integer initialValue) {
- Integer old = this.initialValue;
- this.initialValue = initialValue;
- this.firePropertyChanged(INITIAL_VALUE_PROPERTY, old, initialValue);
- }
-
- private Integer buildInitialValue() {
- return (Integer) this.getJdtMemberValue(this.getInitialValueElementName());
- }
-
- abstract String getInitialValueElementName();
-
- public TextRange getInitialValueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** name
- public Integer getAllocationSize() {
- return this.allocationSize;
- }
-
- public void setAllocationSize(Integer allocationSize) {
- throw new UnsupportedOperationException();
- }
-
- private void setAllocationSize_(Integer allocationSize) {
- Integer old = this.allocationSize;
- this.allocationSize = allocationSize;
- this.firePropertyChanged(NAME_PROPERTY, old, allocationSize);
- }
-
- private Integer buildAllocationSize() {
- return (Integer) this.getJdtMemberValue(this.getAllocationSizeElementName());
- }
-
- abstract String getAllocationSizeElementName();
-
- public TextRange getAllocationSizeTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryIdAnnotation.java
deleted file mode 100644
index 95946b447e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryIdAnnotation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-
-/**
- * javax.persistence.Id
- */
-public final class BinaryIdAnnotation
- extends BinaryAnnotation
- implements IdAnnotation
-{
-
- public BinaryIdAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryIdClassAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryIdClassAnnotation.java
deleted file mode 100644
index 74ff351246..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryIdClassAnnotation.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.IdClassAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.IdClass
- */
-public final class BinaryIdClassAnnotation
- extends BinaryAnnotation
- implements IdClassAnnotation
-{
- private String value;
-
-
- public BinaryIdClassAnnotation(JavaResourceNode 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);
- this.firePropertyChanged(FULLY_QUALIFIED_CLASS_NAME_PROPERTY, old, value);
- }
-
- private String buildValue() {
- return (String) this.getJdtMemberValue(JPA.ID_CLASS__VALUE);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** fully-qualified class name
- /**
- * binary is already fully-qualified
- */
- public String getFullyQualifiedClassName() {
- return this.value;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java
deleted file mode 100644
index 81711643ed..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.InheritanceAnnotation;
-import org.eclipse.jpt.core.resource.java.InheritanceType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.Inheritance
- */
-public final class BinaryInheritanceAnnotation
- extends BinaryAnnotation
- implements InheritanceAnnotation
-{
- private InheritanceType strategy;
-
-
- public BinaryInheritanceAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.strategy = this.buildStrategy();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setStrategy_(this.buildStrategy());
- }
-
-
- // ********** InheritanceAnnotation implementation **********
-
- // ***** strategy
- public InheritanceType getStrategy() {
- return this.strategy;
- }
-
- public void setStrategy(InheritanceType strategy) {
- throw new UnsupportedOperationException();
- }
-
- private void setStrategy_(InheritanceType strategy) {
- InheritanceType old = this.strategy;
- this.strategy = strategy;
- this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
- }
-
- private InheritanceType buildStrategy() {
- return InheritanceType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA.INHERITANCE__STRATEGY));
- }
-
- public TextRange getStrategyTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java
deleted file mode 100644
index d9f681de35..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableJoinColumnAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.JoinColumn
- */
-public final class BinaryJoinColumnAnnotation
- extends BinaryBaseColumnAnnotation
- implements NestableJoinColumnAnnotation
-{
- private String referencedColumnName;
-
-
- public BinaryJoinColumnAnnotation(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());
- }
-
-
- // ********** JavaSourceNamedColumnAnnotation implementation **********
-
- @Override
- protected String getNameElementName() {
- return JPA.JOIN_COLUMN__NAME;
- }
-
- @Override
- protected String getColumnDefinitionElementName() {
- return JPA.JOIN_COLUMN__COLUMN_DEFINITION;
- }
-
-
- // ********** JavaSourceNamedColumnAnnotation implementation **********
-
- @Override
- String getTableElementName() {
- return JPA.JOIN_COLUMN__TABLE;
- }
-
- @Override
- String getUniqueElementName() {
- return JPA.JOIN_COLUMN__UNIQUE;
- }
-
- @Override
- String getNullableElementName() {
- return JPA.JOIN_COLUMN__NULLABLE;
- }
-
- @Override
- String getInsertableElementName() {
- return JPA.JOIN_COLUMN__INSERTABLE;
- }
-
- @Override
- String getUpdatableElementName() {
- return JPA.JOIN_COLUMN__UPDATABLE;
- }
-
-
- //************ JoinColumn implementation ***************
-
- // referenced column name
- public String getReferencedColumnName() {
- return this.referencedColumnName;
- }
-
- public void setReferencedColumnName(String referencedColumnName) {
- throw new UnsupportedOperationException();
- }
-
- private void setReferencedColumnName_(String referencedColumnName) {
- String old = this.referencedColumnName;
- this.referencedColumnName = referencedColumnName;
- this.firePropertyChanged(REFERENCED_COLUMN_NAME_PROPERTY, old, referencedColumnName);
- }
-
- private String buildReferencedColumnName() {
- return (String) this.getJdtMemberValue(JPA.JOIN_COLUMN__REFERENCED_COLUMN_NAME);
- }
-
- public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinColumnsAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinColumnsAnnotation.java
deleted file mode 100644
index 196dd994d1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinColumnsAnnotation.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JoinColumnsAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableJoinColumnAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.JoinColumns
- */
-public final class BinaryJoinColumnsAnnotation
- extends BinaryContainerAnnotation<NestableJoinColumnAnnotation>
- implements JoinColumnsAnnotation
-{
- private final Vector<NestableJoinColumnAnnotation> joinColumns;
-
-
- public BinaryJoinColumnsAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.joinColumns = this.buildJoinColumns();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public ListIterator<NestableJoinColumnAnnotation> nestedAnnotations() {
- return new CloneListIterator<NestableJoinColumnAnnotation>(this.joinColumns);
- }
-
- public int nestedAnnotationsSize() {
- return this.joinColumns.size();
- }
-
- private Vector<NestableJoinColumnAnnotation> buildJoinColumns() {
- Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.JOIN_COLUMNS__VALUE);
- Vector<NestableJoinColumnAnnotation> result = new Vector<NestableJoinColumnAnnotation>(jdtJoinColumns.length);
- for (Object jdtJoinColumn : jdtJoinColumns) {
- result.add(new BinaryJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn));
- }
- return result;
- }
-
- @Override
- public void update() {
- super.update();
- this.updateJoinColumns();
- }
-
- // TODO
- private void updateJoinColumns() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java
deleted file mode 100644
index 615b84b17e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.JoinTable
- */
-public final class BinaryJoinTableAnnotation
- extends BinaryBaseTableAnnotation
- implements JoinTableAnnotation
-{
- private final Vector<JoinColumnAnnotation> joinColumns;
- private final Vector<JoinColumnAnnotation> inverseJoinColumns;
-
-
- public BinaryJoinTableAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.joinColumns = this.buildJoinColumns();
- this.inverseJoinColumns = this.buildInverseJoinColumns();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.updateJoinColumns();
- this.updateInverseJoinColumns();
- }
-
-
- // ********** AbstractBaseTableAnnotation implementation **********
-
- @Override
- String getNameElementName() {
- return JPA.JOIN_TABLE__NAME;
- }
-
- @Override
- String getSchemaElementName() {
- return JPA.JOIN_TABLE__SCHEMA;
- }
-
- @Override
- String getCatalogElementName() {
- return JPA.JOIN_TABLE__CATALOG;
- }
-
- @Override
- String getUniqueConstraintElementName() {
- return JPA.JOIN_TABLE__UNIQUE_CONSTRAINTS;
- }
-
-
- // ********** JoinTableAnnotation implementation **********
-
- // ***** join columns
- public ListIterator<JoinColumnAnnotation> joinColumns() {
- return new CloneListIterator<JoinColumnAnnotation>(this.joinColumns);
- }
-
- public int joinColumnsSize() {
- return this.joinColumns.size();
- }
-
- public JoinColumnAnnotation joinColumnAt(int index) {
- return this.joinColumns.get(index);
- }
-
- public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
- return this.joinColumns.indexOf(joinColumn);
- }
-
- public JoinColumnAnnotation addJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- public void moveJoinColumn(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void removeJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- private Vector<JoinColumnAnnotation> buildJoinColumns() {
- Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.JOIN_TABLE__JOIN_COLUMNS);
- Vector<JoinColumnAnnotation> result = new Vector<JoinColumnAnnotation>(jdtJoinColumns.length);
- for (Object jdtJoinColumn : jdtJoinColumns) {
- result.add(new BinaryJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn));
- }
- return result;
- }
-
- // TODO
- private void updateJoinColumns() {
- throw new UnsupportedOperationException();
- }
-
- public JoinColumnAnnotation initializeJoinColumns() {
- throw new UnsupportedOperationException();
- }
-
- // ***** inverse join columns
- public ListIterator<JoinColumnAnnotation> inverseJoinColumns() {
- return new CloneListIterator<JoinColumnAnnotation>(this.inverseJoinColumns);
- }
-
- public int inverseJoinColumnsSize() {
- return this.inverseJoinColumns.size();
- }
-
- public JoinColumnAnnotation inverseJoinColumnAt(int index) {
- return this.inverseJoinColumns.get(index);
- }
-
- public int indexOfInverseJoinColumn(JoinColumnAnnotation joinColumn) {
- return this.inverseJoinColumns.indexOf(joinColumn);
- }
-
- public JoinColumnAnnotation addInverseJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- public void moveInverseJoinColumn(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void removeInverseJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- private Vector<JoinColumnAnnotation> buildInverseJoinColumns() {
- Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.JOIN_TABLE__INVERSE_JOIN_COLUMNS);
- Vector<JoinColumnAnnotation> result = new Vector<JoinColumnAnnotation>(jdtJoinColumns.length);
- for (Object jdtJoinColumn : jdtJoinColumns) {
- result.add(new BinaryJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn));
- }
- return result;
- }
-
- // TODO
- private void updateInverseJoinColumns() {
- throw new UnsupportedOperationException();
- }
-
- public JoinColumnAnnotation initializeInverseJoinColumns() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryLobAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryLobAnnotation.java
deleted file mode 100644
index 2d5dc244cd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryLobAnnotation.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.LobAnnotation;
-
-/**
- * javax.persistence.Lob
- */
-public final class BinaryLobAnnotation
- extends BinaryAnnotation
- implements LobAnnotation
-{
- public BinaryLobAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java
deleted file mode 100644
index 5428fce84a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.ManyToManyAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.ManyToMany
- */
-public final class BinaryManyToManyAnnotation
- extends BinaryRelationshipMappingAnnotation
- implements ManyToManyAnnotation
-{
- private String mappedBy;
-
-
- public BinaryManyToManyAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.mappedBy = this.buildMappedBy();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setMappedBy_(this.buildMappedBy());
- }
-
-
- // ********** BinaryRelationshipMappingAnnotation implementation **********
-
- @Override
- String getTargetEntityElementName() {
- return JPA.MANY_TO_MANY__TARGET_ENTITY;
- }
-
- @Override
- String getFetchElementName() {
- return JPA.MANY_TO_MANY__FETCH;
- }
-
- @Override
- String getCascadeElementName() {
- return JPA.MANY_TO_MANY__CASCADE;
- }
-
-
- //**************** OwnableRelationshipMappingAnnotation implementation **************
-
- // ***** mapped by
- public String getMappedBy() {
- return this.mappedBy;
- }
-
- public void setMappedBy(String mappedBy) {
- throw new UnsupportedOperationException();
- }
-
- private void setMappedBy_(String mappedBy) {
- String old = this.mappedBy;
- this.mappedBy = mappedBy;
- this.firePropertyChanged(MAPPED_BY_PROPERTY, old, mappedBy);
- }
-
- private String buildMappedBy() {
- return (String) this.getJdtMemberValue(JPA.MANY_TO_MANY__MAPPED_BY);
- }
-
- public TextRange getMappedByTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean mappedByTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java
deleted file mode 100644
index 77ad757c4f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.ManyToOneAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.ManyToOne
- */
-public final class BinaryManyToOneAnnotation
- extends BinaryRelationshipMappingAnnotation
- implements ManyToOneAnnotation
-{
- private Boolean optional;
-
-
- public BinaryManyToOneAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.optional = this.buildOptional();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setOptional_(this.buildOptional());
- }
-
-
- // ********** BinaryRelationshipMappingAnnotation implementation **********
-
- @Override
- String getTargetEntityElementName() {
- return JPA.MANY_TO_ONE__TARGET_ENTITY;
- }
-
- @Override
- String getFetchElementName() {
- return JPA.MANY_TO_ONE__FETCH;
- }
-
- @Override
- String getCascadeElementName() {
- return JPA.MANY_TO_ONE__CASCADE;
- }
-
-
- // ********** ManyToOneMappingAnnotation implementation **********
-
- // ***** optional
- public Boolean getOptional() {
- return this.optional;
- }
-
- public void setOptional(Boolean optional) {
- throw new UnsupportedOperationException();
- }
-
- private void setOptional_(Boolean optional) {
- Boolean old = this.optional;
- this.optional = optional;
- this.firePropertyChanged(OPTIONAL_PROPERTY, old, optional);
- }
-
- private Boolean buildOptional() {
- return (Boolean) this.getJdtMemberValue(JPA.MANY_TO_ONE__OPTIONAL);
- }
-
- public TextRange getOptionalTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java
deleted file mode 100644
index 73b09dbed1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.MapKeyAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.MapKey
- */
-public final class BinaryMapKeyAnnotation
- extends BinaryAnnotation
- implements MapKeyAnnotation
-{
- private String name;
-
-
- public BinaryMapKeyAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.name = this.buildName();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setName_(this.buildName());
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** MapKeyAnnotation implementation **********
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- throw new UnsupportedOperationException();
- }
-
- private void setName_(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- private String buildName() {
- return (String) this.getJdtMemberValue(JPA.MAP_KEY__NAME);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean nameTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java
deleted file mode 100644
index 419bfaaa06..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.MappedSuperclassAnnotation;
-
-public final class BinaryMappedSuperclassAnnotation
- extends BinaryAnnotation
- implements MappedSuperclassAnnotation
-{
- public BinaryMappedSuperclassAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java
deleted file mode 100644
index 2230a57bca..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NamedColumnAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.Column
- * javax.persistence.JoinColumn
- * javax.persistence.DiscriminatorColumn
- * javax.persistence.PrimaryKeyJoinColumn.
- */
-public abstract class BinaryNamedColumnAnnotation
- extends BinaryAnnotation
- implements NamedColumnAnnotation
-{
- private String name;
- private String columnDefinition;
-
-
- protected BinaryNamedColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.name = this.buildName();
- this.columnDefinition = this.buildColumnDefinition();
- }
-
- @Override
- public void update() {
- super.update();
- this.setName_(this.buildName());
- this.setColumnDefinition_(this.buildColumnDefinition());
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** NamedColumn implementation **********
-
- public boolean isSpecified() {
- return true;
- }
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- throw new UnsupportedOperationException();
- }
-
- private void setName_(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- private String buildName() {
- return (String) this.getJdtMemberValue(this.getNameElementName());
- }
-
- protected abstract String getNameElementName();
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean nameTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** column definition
- public String getColumnDefinition() {
- return null;
- }
-
- public void setColumnDefinition(String columnDefinition) {
- throw new UnsupportedOperationException();
- }
-
- private void setColumnDefinition_(String columnDefinition) {
- String old = this.columnDefinition;
- this.columnDefinition = columnDefinition;
- this.firePropertyChanged(COLUMN_DEFINITION_PROPERTY, old, columnDefinition);
- }
-
- private String buildColumnDefinition() {
- return (String) this.getJdtMemberValue(this.getColumnDefinitionElementName());
- }
-
- protected abstract String getColumnDefinitionElementName();
-
- public TextRange getColumnDefinitionTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedNativeQueriesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedNativeQueriesAnnotation.java
deleted file mode 100644
index bc0ebc51e0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedNativeQueriesAnnotation.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableNamedNativeQueryAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.NamedNativeQueries
- */
-public final class BinaryNamedNativeQueriesAnnotation
- extends BinaryContainerAnnotation<NestableNamedNativeQueryAnnotation>
- implements NamedNativeQueriesAnnotation
-{
- private final Vector<NestableNamedNativeQueryAnnotation> namedNativeQueries;
-
-
- public BinaryNamedNativeQueriesAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.namedNativeQueries = this.buildNamedNativeQueries();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public ListIterator<NestableNamedNativeQueryAnnotation> nestedAnnotations() {
- return new CloneListIterator<NestableNamedNativeQueryAnnotation>(this.namedNativeQueries);
- }
-
- public int nestedAnnotationsSize() {
- return this.namedNativeQueries.size();
- }
-
- private Vector<NestableNamedNativeQueryAnnotation> buildNamedNativeQueries() {
- Object[] jdtQueries = this.getJdtMemberValues(JPA.NAMED_NATIVE_QUERIES__VALUE);
- Vector<NestableNamedNativeQueryAnnotation> result = new Vector<NestableNamedNativeQueryAnnotation>(jdtQueries.length);
- for (Object jdtQuery : jdtQueries) {
- result.add(new BinaryNamedNativeQueryAnnotation(this, (IAnnotation) jdtQuery));
- }
- return result;
- }
-
- @Override
- public void update() {
- super.update();
- this.updateNamedNativeQueries();
- }
-
- // TODO
- private void updateNamedNativeQueries() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java
deleted file mode 100644
index 7b96cfc170..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableNamedNativeQueryAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.NamedNativeQuery
- */
-public final class BinaryNamedNativeQueryAnnotation
- extends BinaryBaseNamedQueryAnnotation
- implements NestableNamedNativeQueryAnnotation
-{
- private String resultClass;
- private String resultSetMapping;
-
-
- public BinaryNamedNativeQueryAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.resultClass = this.buildResultClass();
- this.resultSetMapping = this.buildResultSetMapping();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setResultClass_(this.buildResultClass());
- this.setResultSetMapping_(this.buildResultSetMapping());
- }
-
-
- // ********** BinaryBaseNamedQueryAnnotation implementation **********
-
- @Override
- String getNameElementName() {
- return JPA.NAMED_NATIVE_QUERY__NAME;
- }
-
- @Override
- String getQueryElementName() {
- return JPA.NAMED_NATIVE_QUERY__QUERY;
- }
-
- @Override
- String getHintsElementName() {
- return JPA.NAMED_NATIVE_QUERY__HINTS;
- }
-
-
- // ********** NamedNativeQueryAnnotation implementation **********
-
- // ***** result class
- public String getResultClass() {
- return this.resultClass;
- }
-
- public void setResultClass(String resultClass) {
- throw new UnsupportedOperationException();
- }
-
- private void setResultClass_(String resultClass) {
- String old = this.resultClass;
- this.resultClass = resultClass;
- this.firePropertyChanged(RESULT_CLASS_PROPERTY, old, resultClass);
- }
-
- private String buildResultClass() {
- return (String) this.getJdtMemberValue(JPA.NAMED_NATIVE_QUERY__RESULT_CLASS);
- }
-
- public TextRange getResultClassTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** fully-qualified result class name
- public String getFullyQualifiedResultClassName() {
- return this.resultClass;
- }
-
- // ***** result set mapping
- public String getResultSetMapping() {
- return this.resultSetMapping;
- }
-
- public void setResultSetMapping(String resultSetMapping) {
- throw new UnsupportedOperationException();
- }
-
- private void setResultSetMapping_(String resultSetMapping) {
- String old = this.resultSetMapping;
- this.resultSetMapping = resultSetMapping;
- this.firePropertyChanged(RESULT_SET_MAPPING_PROPERTY, old, resultSetMapping);
- }
-
- private String buildResultSetMapping() {
- return (String) this.getJdtMemberValue(JPA.NAMED_NATIVE_QUERY__RESULT_CLASS);
- }
-
- public TextRange getResultSetMappingTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedQueriesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedQueriesAnnotation.java
deleted file mode 100644
index 4a069ab1c7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedQueriesAnnotation.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NamedQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableNamedQueryAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.NamedQueries
- */
-public abstract class BinaryNamedQueriesAnnotation
- extends BinaryContainerAnnotation<NestableNamedQueryAnnotation>
- implements NamedQueriesAnnotation
-{
- private final Vector<NestableNamedQueryAnnotation> namedQueries;
-
-
- public BinaryNamedQueriesAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.namedQueries = this.buildNamedQueries();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public ListIterator<NestableNamedQueryAnnotation> nestedAnnotations() {
- return new CloneListIterator<NestableNamedQueryAnnotation>(this.namedQueries);
- }
-
- public int nestedAnnotationsSize() {
- return this.namedQueries.size();
- }
-
- private Vector<NestableNamedQueryAnnotation> buildNamedQueries() {
- Object[] jdtQueries = this.getJdtMemberValues(JPA.NAMED_QUERIES__VALUE);
- Vector<NestableNamedQueryAnnotation> result = new Vector<NestableNamedQueryAnnotation>(jdtQueries.length);
- for (Object jdtQuery : jdtQueries) {
- result.add(this.buildNamedQuery(jdtQuery));
- }
- return result;
- }
-
- protected abstract NamedQueryAnnotation buildNamedQuery(Object jdtQuery);
-
- @Override
- public void update() {
- super.update();
- this.updateNamedQueries();
- }
-
- // TODO
- private void updateNamedQueries() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java
deleted file mode 100644
index 158384ddb8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableNamedQueryAnnotation;
-
-/**
- * javax.persistence.NamedQuery
- */
-public abstract class BinaryNamedQueryAnnotation
- extends BinaryBaseNamedQueryAnnotation
- implements NestableNamedQueryAnnotation, 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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNode.java
deleted file mode 100644
index 07a15f79a1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNode.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractJavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * Binary convenience methods
- */
-// TODO hopefully this class can go away with some sort of refactoring of the
-// source and binary hierarchies...
-public abstract class BinaryNode
- extends AbstractJavaResourceNode
-{
-
- // ********** construction **********
-
- protected BinaryNode(JavaResourceNode parent) {
- super(parent);
- }
-
-
- // ********** JavaResourceNode implementation **********
-
- @Override
- public IFile getFile() {
- return null; // only BinaryPackageFragmentRoot has a file...
- }
-
- public void update() {
- // nothing by default
- }
-
- public JavaResourceCompilationUnit getJavaResourceCompilationUnit() {
- throw new UnsupportedOperationException();
- }
-
- public TextRange getTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public void initialize(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public void update(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java
deleted file mode 100644
index 6f0e01dda1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.OneToMany
- */
-public abstract class BinaryOneToManyAnnotation
- extends BinaryRelationshipMappingAnnotation
- implements OneToManyAnnotation
-{
- private String mappedBy;
-
-
- public BinaryOneToManyAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.mappedBy = this.buildMappedBy();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setMappedBy_(this.buildMappedBy());
- }
-
-
- // ********** BinaryRelationshipMappingAnnotation implementation **********
-
- @Override
- String getTargetEntityElementName() {
- return JPA.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();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java
deleted file mode 100644
index e0571d669a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.OneToOne
- */
-public abstract class BinaryOneToOneAnnotation
- extends BinaryRelationshipMappingAnnotation
- implements OneToOneAnnotation
-{
- private Boolean optional;
- private String mappedBy;
-
- public BinaryOneToOneAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.optional = this.buildOptional();
- this.mappedBy = this.buildMappedBy();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setOptional_(this.buildOptional());
- this.setMappedBy_(this.buildMappedBy());
- }
-
-
- // ********** 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();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOrderByAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOrderByAnnotation.java
deleted file mode 100644
index 690fdc3263..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOrderByAnnotation.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.OrderByAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.OrderBy
- */
-public final class BinaryOrderByAnnotation
- extends BinaryAnnotation
- implements OrderByAnnotation
-{
- private String value;
-
-
- public BinaryOrderByAnnotation(JavaResourceNode parent, IAnnotation annotation) {
- super(parent, annotation);
- this.value = this.buildValue();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-
- // ********** OrderByAnnotation implementation **********
-
- // ***** value
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- throw new UnsupportedOperationException();
- }
-
- private void setValue_(String value) {
- String old = this.value;
- this.value = value;
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private String buildValue() {
- return (String) this.getJdtMemberValue(JPA.ORDER_BY__VALUE);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOverrideAnnotation.java
deleted file mode 100644
index 4e129f6372..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOverrideAnnotation.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.OverrideAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * Common behavior for
- * javax.persistence.AttributeOverride
- * javax.persistence.AssociationOverride
- */
-public abstract class BinaryOverrideAnnotation
- extends BinaryAnnotation
- implements OverrideAnnotation
-{
- private String name;
-
-
- public BinaryOverrideAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.name = this.buildName();
- }
-
- @Override
- public void update() {
- super.update();
- this.setName_(this.buildName());
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** OverrideAnnotation implementation **********
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- throw new UnsupportedOperationException();
- }
-
- private void setName_(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(OverrideAnnotation.NAME_PROPERTY, old, name);
- }
-
- private String buildName() {
- return (String) this.getJdtMemberValue(this.getNameElementName());
- }
-
- protected abstract String getNameElementName();
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean nameTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPackageFragment.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPackageFragment.java
deleted file mode 100644
index 734439b56d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPackageFragment.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jdt.core.IClassFile;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.resource.java.JavaResourceClassFile;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragment;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragmentRoot;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-/**
- * binary package fragment
- */
-final class BinaryPackageFragment
- extends BinaryNode
- implements JavaResourcePackageFragment
-{
- /** JDT package fragment */
- private final IPackageFragment packageFragment;
-
- /**
- * class files in the package fragment;
- * we only hold class files/types that are actually annotated;
- * if the unannotated types are needed (e.g. for orm.xml or an
- * inheritance tree) they can be discovered on the classpath as needed
- */
- private final Vector<JavaResourceClassFile> classFiles = new Vector<JavaResourceClassFile>();
-
-
- // ********** construction/initialization **********
-
- BinaryPackageFragment(JavaResourcePackageFragmentRoot parent, IPackageFragment packageFragment) {
- super(parent);
- this.packageFragment = packageFragment;
- this.classFiles.addAll(this.buildClassFiles());
- }
-
- private Collection<JavaResourceClassFile> buildClassFiles() {
- IJavaElement[] children = this.getJDTChildren();
- ArrayList<JavaResourceClassFile> result = new ArrayList<JavaResourceClassFile>(children.length);
- for (IJavaElement child : children) {
- IClassFile jdtClassFile = (IClassFile) child;
- IType jdtType = jdtClassFile.getType();
- if (BinaryPersistentType.typeIsPersistable(jdtType)) {
- JavaResourceClassFile classFile = new BinaryClassFile(this, jdtClassFile, jdtType);
- if (classFile.getPersistentType().isAnnotated()) { // we only hold annotated types
- result.add(classFile);
- }
- }
- }
- return result;
- }
-
-
- // ********** JarResourceNode implementation **********
-
- @Override
- public void update() {
- super.update();
- this.updateClassFiles();
- }
-
- // TODO
- private void updateClassFiles() {
- throw new UnsupportedOperationException();
- }
-
-
- // ********** JavaResourcePackageFragment implementation **********
-
- public ListIterator<JavaResourceClassFile> classFiles() {
- return new CloneListIterator<JavaResourceClassFile>(this.classFiles);
- }
-
- public int classFilesSize() {
- return this.classFiles.size();
- }
-
- public Iterator<JavaResourcePersistentType> persistedTypes() {
- return new TransformationIterator<JavaResourceClassFile, JavaResourcePersistentType>(this.classFiles()) {
- @Override
- protected JavaResourcePersistentType transform(JavaResourceClassFile classFile) {
- return classFile.getPersistentType(); // we only hold annotated types
- }
- };
- }
-
-
- // ********** misc **********
-
- private IJavaElement[] getJDTChildren() {
- try {
- return this.packageFragment.getChildren();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return EMPTY_JAVA_ELEMENT_ARRAY;
- }
- }
- protected static final IJavaElement[] EMPTY_JAVA_ELEMENT_ARRAY = new IJavaElement[0];
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.packageFragment.getElementName());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPackageFragmentRoot.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPackageFragmentRoot.java
deleted file mode 100644
index 52276c41a0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPackageFragmentRoot.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.io.FileNotFoundException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.core.JpaAnnotationProvider;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragment;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragmentRoot;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-/**
- * binary package fragment root
- */
-public final class BinaryPackageFragmentRoot
- extends RootBinaryNode
- implements JavaResourcePackageFragmentRoot
-{
- /** JDT package fragment root */
- private final IPackageFragmentRoot packageFragmentRoot;
-
- /** package fragments in the JAR */
- private final Vector<JavaResourcePackageFragment> packageFragments = new Vector<JavaResourcePackageFragment>();
-
-
- // ********** construction/initialization **********
-
- public BinaryPackageFragmentRoot(IPackageFragmentRoot packageFragmentRoot, JpaAnnotationProvider annotationProvider) {
- super(null, annotationProvider); // the package fragment root is the root of its sub-tree
- this.packageFragmentRoot = packageFragmentRoot;
- this.packageFragments.addAll(this.buildPackageFragments());
- }
-
- private Collection<JavaResourcePackageFragment> buildPackageFragments() {
- IJavaElement[] jdtChildren = this.getJDTChildren();
- ArrayList<JavaResourcePackageFragment> result = new ArrayList<JavaResourcePackageFragment>(jdtChildren.length);
- for (IJavaElement child : jdtChildren) {
- result.add(new BinaryPackageFragment(this, (IPackageFragment) child));
- }
- return result;
- }
-
-
- // ********** overrides **********
-
- @Override
- public IFile getFile() {
- return (IFile) this.packageFragmentRoot.getResource();
- }
-
- @Override
- public void update() {
- super.update();
- this.updatePackageFragments();
- }
-
- // TODO
- private void updatePackageFragments() {
- throw new UnsupportedOperationException();
- }
-
-
- // ********** JavaResourceNode.Root implementation **********
-
- /**
- * NB: we hold only annotated types
- */
- public Iterator<JavaResourcePersistentType> persistentTypes() {
- return new CompositeIterator<JavaResourcePersistentType>(this.persistedTypeIterators());
- }
-
- private Iterator<Iterator<JavaResourcePersistentType>> persistedTypeIterators() {
- return new TransformationIterator<JavaResourcePackageFragment, Iterator<JavaResourcePersistentType>>(this.packageFragments()) {
- @Override
- protected Iterator<JavaResourcePersistentType> transform(JavaResourcePackageFragment fragment) {
- return fragment.persistedTypes();
- }
- };
- }
-
-
- // ********** JavaResourcePackageFragmentRoot implementation **********
-
- public Iterator<JavaResourcePackageFragment> packageFragments() {
- return new CloneIterator<JavaResourcePackageFragment>(this.packageFragments);
- }
-
- public int packageFragmentsSize() {
- return this.packageFragments.size();
- }
-
-
- // ********** misc **********
-
- private IJavaElement[] getJDTChildren() {
- try {
- return this.packageFragmentRoot.getChildren();
- } catch (JavaModelException ex) {
- // ignore FNFE - which can happen when the workspace is out of synch with O/S file system
- if ( ! (ex.getCause() instanceof FileNotFoundException)) {
- JptCorePlugin.log(ex);
- }
- return EMPTY_JAVA_ELEMENT_ARRAY;
- }
- }
- private static final IJavaElement[] EMPTY_JAVA_ELEMENT_ARRAY = new IJavaElement[0];
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getFile().getName());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentAttribute.java
deleted file mode 100644
index 392396901d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentAttribute.java
+++ /dev/null
@@ -1,648 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.utility.jdt.JPTTools;
-import org.eclipse.jpt.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.core.resource.java.AccessType;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.MethodSignature;
-import org.eclipse.jpt.utility.internal.ClassTools;
-import org.eclipse.jpt.utility.internal.NameTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * binary persistent attribute (field or property)
- */
-final class BinaryPersistentAttribute
- extends BinaryPersistentMember
- implements JavaResourcePersistentAttribute
-{
- private int modifiers;
-
- private String typeName;
-
- private boolean typeIsInterface;
-
- private boolean typeIsEnum;
-
- private final Vector<String> typeSuperclassNames = new Vector<String>();
-
- private final Vector<String> typeInterfaceNames = new Vector<String>();
-
- private final Vector<String> typeTypeArgumentNames = new Vector<String>();
-
-
- BinaryPersistentAttribute(JavaResourcePersistentType parent, IField field) {
- this(parent, new FieldAdapter(field));
- }
-
- BinaryPersistentAttribute(JavaResourcePersistentType parent, IMethod method) {
- this(parent, new MethodAdapter(method));
- }
-
- private BinaryPersistentAttribute(JavaResourcePersistentType parent, Adapter adapter) {
- super(parent, adapter);
- this.modifiers = this.buildModifiers();
- this.typeName = this.buildTypeName();
-
- IType type = this.getType(); // shouldn't be an array...
- this.typeIsInterface = this.buildTypeIsInterface(type);
- this.typeIsEnum = this.buildTypeIsEnum(type);
- this.typeSuperclassNames.addAll(this.buildTypeSuperclassNames(type));
- this.typeInterfaceNames.addAll(this.buildTypeInterfaceNames(type));
-
- this.typeTypeArgumentNames.addAll(this.buildTypeTypeArgumentNames());
- }
-
-
- // ******** overrides ********
-
- @Override
- public void update() {
- super.update();
- this.setModifiers(this.buildModifiers());
- this.setTypeName(this.buildTypeName());
-
- IType type = this.getType(); // shouldn't be an array...
- this.setTypeIsInterface(this.buildTypeIsInterface(type));
- this.setTypeIsEnum(this.buildTypeIsEnum(type));
- this.setTypeSuperclassNames(this.buildTypeSuperclassNames(type));
- this.setTypeInterfaceNames(this.buildTypeInterfaceNames(type));
-
- this.setTypeTypeArgumentNames(this.buildTypeTypeArgumentNames());
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getName());
- }
-
-
- // ********** BinaryPersistentMember implementation **********
-
- private Adapter getAdapter() {
- return (Adapter) this.adapter;
- }
-
- @Override
- Iterator<String> validAnnotationNames() {
- return this.getAnnotationProvider().attributeAnnotationNames();
- }
-
- @Override
- Annotation buildAnnotation(IAnnotation jdtAnnotation) {
- return this.getAnnotationProvider().buildAttributeAnnotation(this, jdtAnnotation);
- }
-
- Annotation buildNullAnnotation_(String annotationName) {
- return this.getAnnotationProvider().buildNullAttributeAnnotation(this, annotationName);
- }
-
-
- // ********** JavaResourcePersistentAttribute implementation **********
-
- public String getName() {
- return this.getAdapter().getAttributeName();
- }
-
- @Override
- public Annotation buildNullAnnotation(String annotationName) {
- return (annotationName == null) ? null : this.buildNullAnnotation_(annotationName);
- }
-
- public boolean isField() {
- return this.getAdapter().isField();
- }
-
- public boolean isProperty() {
- return ! this.isField();
- }
-
- public boolean isFor(MethodSignature methodSignature, int occurrence) {
- throw new UnsupportedOperationException();
- }
-
- public AccessType getSpecifiedAccess() {
- Access2_0Annotation accessAnnotation = (Access2_0Annotation) this.getAnnotation(Access2_0Annotation.ANNOTATION_NAME);
- return accessAnnotation == null ? null : accessAnnotation.getValue();
- }
-
- public boolean typeIsSubTypeOf(String tn) {
- return ((this.typeName != null) && this.typeName.equals(tn))
- || this.typeInterfaceNames.contains(tn)
- || this.typeSuperclassNames.contains(tn);
- }
-
- public boolean typeIsVariablePrimitive() {
- return (this.typeName != null) && ClassTools.classNamedIsVariablePrimitive(this.typeName);
- }
-
- // ***** modifiers
- public int getModifiers() {
- return this.modifiers;
- }
-
- private void setModifiers(int modifiers) {
- int old = this.modifiers;
- this.modifiers = modifiers;
- this.firePropertyChanged(MODIFIERS_PROPERTY, old, modifiers);
- }
-
- /**
- * zero seems like a reasonable default...
- */
- private int buildModifiers() {
- try {
- return this.getMember().getFlags();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return 0;
- }
- }
-
- // ***** type name
- public String getTypeName() {
- return this.typeName;
- }
-
- private void setTypeName(String typeName) {
- String old = this.typeName;
- this.typeName = typeName;
- this.firePropertyChanged(TYPE_NAME_PROPERTY, old, typeName);
- }
-
- /**
- * JARs don't have array types;
- * also, no generic type parameters
- */
- private String buildTypeName() {
- return convertTypeSignatureToTypeName(this.getTypeSignature());
- }
-
- // ***** type is interface
- public boolean typeIsInterface() {
- return this.typeIsInterface;
- }
-
- private void setTypeIsInterface(boolean typeIsInterface) {
- boolean old = this.typeIsInterface;
- this.typeIsInterface = typeIsInterface;
- this.firePropertyChanged(TYPE_IS_INTERFACE_PROPERTY, old, typeIsInterface);
- }
-
- private boolean buildTypeIsInterface(IType type) {
- try {
- return (type != null) && type.isInterface();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return false;
- }
- }
-
- // ***** type is enum
- public boolean typeIsEnum() {
- return this.typeIsEnum;
- }
-
- private void setTypeIsEnum(boolean typeIsEnum) {
- boolean old = this.typeIsEnum;
- this.typeIsEnum = typeIsEnum;
- this.firePropertyChanged(TYPE_IS_ENUM_PROPERTY, old, typeIsEnum);
- }
-
- private boolean buildTypeIsEnum(IType type) {
- try {
- return (type != null) && type.isEnum();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return false;
- }
- }
-
- // ***** type superclass hierarchy
- public ListIterator<String> typeSuperclassNames() {
- return new CloneListIterator<String>(this.typeSuperclassNames);
- }
-
- public boolean typeSuperclassNamesContains(String superclassName) {
- return this.typeSuperclassNames.contains(superclassName);
- }
-
- private void setTypeSuperclassNames(List<String> typeSuperclassNames) {
- this.synchronizeList(typeSuperclassNames, this.typeSuperclassNames, TYPE_SUPERCLASS_NAMES_LIST);
- }
-
- private List<String> buildTypeSuperclassNames(IType type) {
- if (type == null) {
- return Collections.emptyList();
- }
-
- ArrayList<String> names = new ArrayList<String>();
- type = this.findSuperclass(type);
- while (type != null) {
- names.add(type.getFullyQualifiedName('.')); // no parameters are included here
- type = this.findSuperclass(type);
- }
- return names;
- }
-
- // ***** type interface hierarchy
- public Iterator<String> typeInterfaceNames() {
- return new CloneIterator<String>(this.typeInterfaceNames);
- }
-
- public boolean typeInterfaceNamesContains(String interfaceName) {
- return this.typeInterfaceNames.contains(interfaceName);
- }
-
- private void setTypeInterfaceNames(Collection<String> typeInterfaceNames) {
- this.synchronizeCollection(typeInterfaceNames, this.typeInterfaceNames, TYPE_INTERFACE_NAMES_COLLECTION);
- }
-
- private Collection<String> buildTypeInterfaceNames(IType type) {
- if (type == null) {
- return Collections.emptySet();
- }
-
- HashSet<String> names = new HashSet<String>();
- while (type != null) {
- this.addInterfaceNamesTo(type, names);
- type = this.findSuperclass(type);
- }
- return names;
- }
-
- private void addInterfaceNamesTo(IType type, HashSet<String> names) {
- for (String interfaceSignature : this.getSuperInterfaceTypeSignatures(type)) {
- String interfaceName = convertTypeSignatureToTypeName(interfaceSignature);
- names.add(interfaceName);
- IType interfaceType = this.findType(interfaceName);
- if (interfaceType != null) {
- this.addInterfaceNamesTo(interfaceType, names); // recurse
- }
- }
- }
-
- // ***** type type argument names
- public ListIterator<String> typeTypeArgumentNames() {
- return new CloneListIterator<String>(this.typeTypeArgumentNames);
- }
-
- public int typeTypeArgumentNamesSize() {
- return this.typeTypeArgumentNames.size();
- }
-
- public String getTypeTypeArgumentName(int index) {
- return this.typeTypeArgumentNames.get(index);
- }
-
- private void setTypeTypeArgumentNames(List<String> typeTypeArgumentNames) {
- this.synchronizeList(typeTypeArgumentNames, this.typeTypeArgumentNames, TYPE_TYPE_ARGUMENT_NAMES_LIST);
- }
-
- /**
- * these types can be arrays (e.g. "java.lang.String[]");
- * but they won't have any further nested generic type arguments
- * (e.g. "java.util.Collection<java.lang.String>")
- */
- private List<String> buildTypeTypeArgumentNames() {
- String typeSignature = this.getTypeSignature();
- if (typeSignature == null) {
- return Collections.emptyList();
- }
-
- String[] typeArgumentSignatures = Signature.getTypeArguments(typeSignature);
- if (typeArgumentSignatures.length == 0) {
- return Collections.emptyList();
- }
-
- ArrayList<String> names = new ArrayList<String>(typeArgumentSignatures.length);
- for (String typeArgumentSignature : typeArgumentSignatures) {
- names.add(convertTypeSignatureToTypeName(typeArgumentSignature));
- }
- return names;
- }
-
-
- // ********** convenience methods **********
-
- private String getTypeSignature() {
- try {
- return this.getAdapter().getTypeSignature();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return null;
- }
- }
-
- private IType findSuperclass(IType type) {
- return this.findTypeBySignature(this.getSuperclassSignature(type));
- }
-
- private String getSuperclassSignature(IType type) {
- try {
- return type.getSuperclassTypeSignature();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return null;
- }
- }
-
- private String[] getSuperInterfaceTypeSignatures(IType type) {
- try {
- return type.getSuperInterfaceTypeSignatures();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return EMPTY_STRING_ARRAY;
- }
- }
- private static final String[] EMPTY_STRING_ARRAY = new String[0];
-
- private IType findTypeBySignature(String typeSignature) {
- return (typeSignature == null) ? null : this.findType(convertTypeSignatureToTypeName_(typeSignature));
- }
-
- private IType getType() {
- return (this.typeName == null) ? null : this.findType(this.typeName);
- }
-
- private IType findType(String fullyQualifiedName) {
- try {
- return this.getJavaProject().findType(fullyQualifiedName);
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return null;
- }
- }
-
- private IJavaProject getJavaProject() {
- return this.getMember().getJavaProject();
- }
-
-
-
- // ********** adapters **********
-
- /**
- * Adapt an IField or IMethod.
- */
- interface Adapter
- extends BinaryPersistentMember.Adapter
- {
- /**
- * Return the field or getter method's "attribute" name
- * (e.g. field "foo" -> "foo"; method "getFoo" -> "foo").
- */
- String getAttributeName();
-
- /**
- * Return whether the attribute is a Java field (as opposed to a method).
- */
- boolean isField();
-
- /**
- * Return the attribute's type signature.
- */
- String getTypeSignature() throws JavaModelException;
- }
-
- /**
- * IField adapter
- */
- static class FieldAdapter
- implements Adapter
- {
- final IField field;
-
- FieldAdapter(IField field) {
- super();
- this.field = field;
- }
-
- public IField getMember() {
- return this.field;
- }
-
- public boolean isPersistable() {
- return this.field.exists() && JPTTools.fieldIsPersistable(new JPTToolsAdapter());
- }
-
- public IAnnotation[] getAnnotations() throws JavaModelException {
- return this.field.getAnnotations();
- }
-
- public String getAttributeName() {
- return this.field.getElementName();
- }
-
- public boolean isField() {
- return true;
- }
-
- public String getTypeSignature() throws JavaModelException {
- return this.field.getTypeSignature();
- }
-
- /**
- * JPTTools needs an adapter so it can work with either an IField
- * or an IVariableBinding etc.
- */
- class JPTToolsAdapter implements JPTTools.FieldAdapter {
- public int getModifiers() {
- try {
- return FieldAdapter.this.field.getFlags();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return 0;
- }
- }
-
- }
-
- }
-
- /**
- * IMethod adapter
- */
- static class MethodAdapter
- implements Adapter
- {
- final IMethod method;
- static final IMethod[] EMPTY_METHOD_ARRAY = new IMethod[0];
-
- MethodAdapter(IMethod method) {
- super();
- this.method = method;
- }
-
- public IMethod getMember() {
- return this.method;
- }
-
- public boolean isPersistable() {
- return JPTTools.methodIsPersistablePropertyGetter(new JPTToolsAdapter());
- }
-
- public IAnnotation[] getAnnotations() throws JavaModelException {
- return this.method.getAnnotations();
- }
-
- public String getAttributeName() {
- return NameTools.convertGetterMethodNameToPropertyName(this.method.getElementName());
- }
-
- public boolean isField() {
- return false;
- }
-
- public String getTypeSignature() throws JavaModelException {
- return this.method.getReturnType();
- }
-
- /**
- * JPTTools needs an adapter so it can work with either an IMethod
- * or an IMethodBinding etc.
- */
- abstract static class AbstractJPTToolsAdapter
- implements JPTTools.SimpleMethodAdapter
- {
- AbstractJPTToolsAdapter() {
- super();
- }
-
- abstract IMethod getMethod();
-
- public int getModifiers() {
- try {
- return this.getMethod().getFlags();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return 0;
- }
- }
-
- public String getReturnTypeErasureName() {
- return convertTypeSignatureToTypeName(this.getReturnTypeSignature());
- }
-
- private String getReturnTypeSignature() {
- try {
- return this.getMethod().getReturnType();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return null;
- }
- }
-
- public boolean isConstructor() {
- try {
- return this.getMethod().isConstructor();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return false;
- }
- }
-
- }
-
- static class SimpleJPTToolsAdapter
- extends AbstractJPTToolsAdapter
- {
- private final IMethod method;
-
- SimpleJPTToolsAdapter(IMethod method) {
- super();
- this.method = method;
- }
-
- @Override
- IMethod getMethod() {
- return this.method;
- }
-
- }
-
- class JPTToolsAdapter
- extends AbstractJPTToolsAdapter
- implements JPTTools.MethodAdapter
- {
- JPTToolsAdapter() {
- super();
- }
-
- @Override
- IMethod getMethod() {
- return MethodAdapter.this.method;
- }
-
- public String getName() {
- return this.getMethod().getElementName();
- }
-
- public int getParametersLength() {
- return this.getMethod().getParameterTypes().length;
- }
-
- public JPTTools.SimpleMethodAdapter getSibling(String name) {
- for (IMethod sibling : this.getSiblings()) {
- if ((sibling.getParameterTypes().length == 0)
- && sibling.getElementName().equals(name)) {
- return new SimpleJPTToolsAdapter(sibling);
- }
- }
- return null;
- }
-
- public JPTTools.SimpleMethodAdapter getSibling(String name, String parameterTypeErasureName) {
- for (IMethod sibling : this.getSiblings()) {
- String[] parmTypes = sibling.getParameterTypes();
- if ((parmTypes.length == 1)
- && sibling.getElementName().equals(name)
- && convertTypeSignatureToTypeName(parmTypes[0]).equals(parameterTypeErasureName)) {
- return new SimpleJPTToolsAdapter(sibling);
- }
- }
- return null;
- }
-
- private IMethod[] getSiblings() {
- try {
- return this.getMethod().getDeclaringType().getMethods();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return EMPTY_METHOD_ARRAY;
- }
- }
-
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentMember.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentMember.java
deleted file mode 100644
index 41892b9c4f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentMember.java
+++ /dev/null
@@ -1,282 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.Iterator;
-import java.util.Vector;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.ContainerAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.SingleElementIterator;
-
-/**
- * binary persistent member
- */
-abstract class BinaryPersistentMember
- extends BinaryNode
- implements JavaResourcePersistentMember
-{
- /** JDT member adapter */
- final Adapter adapter;
-
- /** annotations */
- final Vector<Annotation> annotations = new Vector<Annotation>();
-
- boolean persistable;
-
-
- // ********** construction/initialization **********
-
- public BinaryPersistentMember(JavaResourceNode parent, Adapter adapter) {
- super(parent);
- this.adapter = adapter;
- this.initializeAnnotations();
- this.persistable = this.buildPersistable();
- }
-
- private void initializeAnnotations() {
- for (IAnnotation annotation : this.getJdtAnnotations()) {
- this.addAnnotation(annotation);
- }
- }
-
- private void addAnnotation(IAnnotation jdtAnnotation) {
- if (this.annotationIsValid(jdtAnnotation)) {
- this.annotations.add(this.buildAnnotation(jdtAnnotation));
- }
- }
-
-
- // ********** updating **********
-
- @Override
- public void update() {
- super.update();
- this.updateAnnotations();
- this.setPersistable(this.buildPersistable());
- }
-
- // TODO
- private void updateAnnotations() {
- throw new UnsupportedOperationException();
- }
-
-
- // ********** annotations **********
-
- public Iterator<Annotation> annotations() {
- return this.getAnnotations().iterator();
- }
-
- private Iterable<Annotation> getAnnotations() {
- return new LiveCloneIterable<Annotation>(this.annotations);
- }
-
- public int annotationsSize() {
- return this.annotations.size();
- }
-
- public Annotation getAnnotation(String annotationName) {
- return this.selectAnnotationNamed(this.getAnnotations(), annotationName);
- }
-
- public Annotation getNonNullAnnotation(String annotationName) {
- Annotation annotation = this.getAnnotation(annotationName);
- return (annotation != null) ? annotation : this.buildNullAnnotation(annotationName);
- }
-
- public Iterator<NestableAnnotation> annotations(
- String nestableAnnotationName, String containerAnnotationName) {
- ContainerAnnotation<NestableAnnotation> containerAnnotation =
- getContainerAnnotation(containerAnnotationName);
- if (containerAnnotation != null) {
- return containerAnnotation.nestedAnnotations();
- }
- NestableAnnotation nestableAnnotation =
- getNestableAnnotation(nestableAnnotationName);
- return (nestableAnnotation == null) ?
- EmptyListIterator.<NestableAnnotation>instance() :
- new SingleElementIterator<NestableAnnotation>(nestableAnnotation);
- }
-
- private NestableAnnotation getNestableAnnotation(String annotationName) {
- return (NestableAnnotation) this.getAnnotation(annotationName);
- }
-
- @SuppressWarnings("unchecked")
- private ContainerAnnotation<NestableAnnotation> getContainerAnnotation(String annotationName) {
- return (ContainerAnnotation<NestableAnnotation>) this.getAnnotation(annotationName);
- }
-
- private boolean annotationIsValid(IAnnotation jdtAnnotation) {
- return CollectionTools.contains(
- this.validAnnotationNames(), jdtAnnotation.getElementName());
- }
-
- abstract Iterator<String> validAnnotationNames();
-
- abstract Annotation buildAnnotation(IAnnotation jdtAnnotation);
-
- abstract Annotation buildNullAnnotation(String annotationName);
-
-
- // ********** simple state **********
-
- public boolean isPersistable() {
- return this.persistable;
- }
-
- private void setPersistable(boolean persistable) {
- boolean old = this.persistable;
- this.persistable = persistable;
- this.firePropertyChanged(PERSISTABLE_PROPERTY, old, persistable);
- }
-
- private boolean buildPersistable() {
- return this.adapter.isPersistable();
- }
-
- public boolean isAnnotated() {
- return ! this.annotations.isEmpty();
- }
-
-
- // ********** miscellaneous **********
-
- IMember getMember() {
- return this.adapter.getMember();
- }
-
- private Annotation selectAnnotationNamed(Iterable<Annotation> annotations, String annotationName) {
- for (Annotation annotation : annotations) {
- if (annotation.getAnnotationName().equals(annotationName)) {
- return annotation;
- }
- }
- return null;
- }
-
- /**
- * convenience method
- */
- <T extends JavaResourcePersistentMember> Iterator<T> persistableMembers(Iterator<T> members) {
- return new FilteringIterator<T, T>(members) {
- @Override
- protected boolean accept(T m) {
- return m.isPersistable();
- }
- };
- }
-
- /**
- * Strip off the type signature's parameters if present.
- * Convert to a readable string.
- */
- static String convertTypeSignatureToTypeName(String typeSignature) {
- return (typeSignature == null) ? null : convertTypeSignatureToTypeName_(typeSignature);
- }
-
- /**
- * no null check
- */
- static String convertTypeSignatureToTypeName_(String typeSignature) {
- return Signature.toString(Signature.getTypeErasure(typeSignature));
- }
-
- private IAnnotation[] getJdtAnnotations() {
- try {
- return this.adapter.getAnnotations();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return EMPTY_JDT_ANNOTATION_ARRAY;
- }
- }
- private static final IAnnotation[] EMPTY_JDT_ANNOTATION_ARRAY = new IAnnotation[0];
-
-
- // ********** IMember adapter **********
-
- interface Adapter {
- /**
- * Return the adapter's JDT member (IType, IField, IMethod).
- */
- IMember getMember();
-
- /**
- * Return whether the adapter's member is "persistable"
- * (i.e. according to the JPA spec the member can be mapped)
- */
- boolean isPersistable();
-
- /**
- * Return the adapter's member's JDT annotations.
- */
- IAnnotation[] getAnnotations() throws JavaModelException;
- }
-
-
- // ********** unsupported JavaResourcePersistentMember implementation **********
-
- public Annotation addAnnotation(String annotationName) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation addAnnotation(String annotationName, AnnotationInitializer foo) {
- throw new UnsupportedOperationException();
- }
-
- public NestableAnnotation addAnnotation(
- int index, String nestableAnnotationName, String containerAnnotationName) {
- throw new UnsupportedOperationException();
- }
-
- public void moveAnnotation(
- int targetIndex, int sourceIndex, String containerAnnotationName) {
- throw new UnsupportedOperationException();
- }
-
- public void removeAnnotation(String annotationName) {
- throw new UnsupportedOperationException();
- }
-
- public void removeAnnotation(
- int index, String nestableAnnotationName, String containerAnnotationName) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation setPrimaryAnnotation(String primaryAnnotationName, Iterable<String> supportingAnnotationNames) {
- throw new UnsupportedOperationException();
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public void resolveTypes(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean isFor(String memberName, int occurrence) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentType.java
deleted file mode 100644
index 4a8778a721..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentType.java
+++ /dev/null
@@ -1,559 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.utility.jdt.JPTTools;
-import org.eclipse.jpt.core.jpa2.resource.java.GeneratedAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JavaResourcePersistentType2_0;
-import org.eclipse.jpt.core.resource.java.AccessType;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.MethodSignature;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-/**
- * binary persistent type
- */
-final class BinaryPersistentType
- extends BinaryPersistentMember
- implements JavaResourcePersistentType2_0
-{
- private String name;
-
- private String qualifiedName;
-
- private String superclassQualifiedName;
-
- private boolean abstract_; // 'abstract' is a reserved word
-
- private final Vector<JavaResourcePersistentAttribute> fields;
-
- private final Vector<JavaResourcePersistentAttribute> methods;
-
- private AccessType access;
-
-
- // ********** construction/initialization **********
-
- BinaryPersistentType(JavaResourceNode parent, IType type) {
- super(parent, new TypeAdapter(type));
- this.name = this.buildName();
- this.qualifiedName = this.buildQualifiedName();
- this.superclassQualifiedName = this.buildSuperclassQualifiedName();
- this.abstract_ = this.buildAbstract();
- this.fields = this.buildFields();
- this.methods = this.buildMethods();
- // need to wait until everything is built to calculate 'access'
- this.access = this.buildAccess();
- }
-
-
- // ********** overrides **********
-
- @Override
- public void update() {
- super.update();
- this.setName(this.buildName());
- this.setQualifiedName(this.buildQualifiedName());
- this.setSuperclassQualifiedName(this.buildSuperclassQualifiedName());
- this.setAbstract(this.buildAbstract());
- this.updateFields();
- this.updateMethods();
- // need to wait until everything is updated to calculate 'access'
- this.setAccess(this.buildAccess());
- }
-
- // TODO
- private void updateFields() {
- throw new UnsupportedOperationException();
- }
-
- // TODO
- private void updateMethods() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** BinaryPersistentMember implementation **********
-
- @Override
- Annotation buildAnnotation(IAnnotation jdtAnnotation) {
- return this.getAnnotationProvider().buildTypeAnnotation(this, jdtAnnotation);
- }
-
- @Override
- Annotation buildNullAnnotation(String annotationName) {
- return this.getAnnotationProvider().buildNullTypeAnnotation(this, annotationName);
- }
-
- @Override
- Iterator<String> validAnnotationNames() {
- return this.getAnnotationProvider().typeAnnotationNames();
- }
-
-
- // ********** JavaResourcePersistentType implementation **********
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- private void setName(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- private String buildName() {
- return this.getMember().getElementName();
- }
-
- // ***** qualified name
- public String getQualifiedName() {
- return this.qualifiedName;
- }
-
- private void setQualifiedName(String qualifiedName) {
- String old = this.qualifiedName;
- this.qualifiedName = qualifiedName;
- this.firePropertyChanged(QUALIFIED_NAME_PROPERTY, old, qualifiedName);
- }
-
- private String buildQualifiedName() {
- return this.getMember().getFullyQualifiedName('.'); // no parameters are included here
- }
-
- // ***** superclass qualified name
- public String getSuperclassQualifiedName() {
- return this.superclassQualifiedName;
- }
-
- private void setSuperclassQualifiedName(String superclassQualifiedName) {
- String old = this.superclassQualifiedName;
- this.superclassQualifiedName = superclassQualifiedName;
- this.firePropertyChanged(SUPERCLASS_QUALIFIED_NAME_PROPERTY, old, superclassQualifiedName);
- }
-
- private String buildSuperclassQualifiedName() {
- return convertTypeSignatureToTypeName(this.getSuperclassTypeSignature());
- }
-
- private String getSuperclassTypeSignature() {
- try {
- return this.getMember().getSuperclassTypeSignature();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return null;
- }
- }
-
- // ***** abstract
- public boolean isAbstract() {
- return this.abstract_;
- }
-
- private void setAbstract(boolean abstract_) {
- boolean old = this.abstract_;
- this.abstract_ = abstract_;
- this.firePropertyChanged(ABSTRACT_PROPERTY, old, abstract_);
- }
-
- private boolean buildAbstract() {
- try {
- return Flags.isAbstract(this.getMember().getFlags());
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return false;
- }
- }
-
- // ***** access
- public AccessType getAccess() {
- return this.access;
- }
-
- private void setAccess(AccessType access) {
- AccessType old = this.access;
- this.access = access;
- this.firePropertyChanged(ACCESS_PROPERTY, old, access);
- }
-
- private AccessType buildAccess() {
- return JPTTools.buildAccess(this);
- }
-
- public boolean isMapped() {
- for (Annotation each : CollectionTools.iterable(annotations())) {
- if (CollectionTools.contains(
- getAnnotationProvider().typeMappingAnnotationNames(),
- each.getAnnotationName())) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * check only persistable attributes
- */
- public boolean hasAnyAnnotatedAttributes() {
- for (Iterator<JavaResourcePersistentAttribute> stream = this.persistableAttributes(); stream.hasNext(); ) {
- if (stream.next().isAnnotated()) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public IType getMember() {
- return (IType) super.getMember();
- }
-
-
- // ********** fields **********
-
- public Iterator<JavaResourcePersistentAttribute> fields() {
- return this.getFields().iterator();
- }
-
- private Iterable<JavaResourcePersistentAttribute> getFields() {
- return new LiveCloneIterable<JavaResourcePersistentAttribute>(this.fields);
- }
-
- public Iterator<JavaResourcePersistentAttribute> persistableFields() {
- return this.persistableMembers(this.fields());
- }
-
- public Iterator<JavaResourcePersistentAttribute> persistableFieldsWithSpecifiedFieldAccess() {
- return new FilteringIterator<JavaResourcePersistentAttribute, JavaResourcePersistentAttribute>(this.persistableFields()) {
- @Override
- protected boolean accept(JavaResourcePersistentAttribute resourceAttribute) {
- return resourceAttribute.getSpecifiedAccess() == AccessType.FIELD;
- }
- };
- }
-
- private void addField(JavaResourcePersistentAttribute field) {
- this.addItemToCollection(field, this.fields, FIELDS_COLLECTION);
- }
-
- private JavaResourcePersistentAttribute getField(String fieldName, int occurrence) {
- for (JavaResourcePersistentAttribute field : this.getFields()) {
- if (field.isFor(fieldName, occurrence)) {
- return field;
- }
- }
- return null;
- }
-
- private void removeFields(Collection<JavaResourcePersistentAttribute> remove) {
- this.removeItemsFromCollection(remove, this.fields, FIELDS_COLLECTION);
- }
-
- private Vector<JavaResourcePersistentAttribute> buildFields() {
- IField[] jdtFields = this.getFields(this.getMember());
- Vector<JavaResourcePersistentAttribute> result = new Vector<JavaResourcePersistentAttribute>(jdtFields.length);
- for (IField jdtField : jdtFields) {
- result.add(this.buildField(jdtField));
- }
- return result;
- }
-
- private IField[] getFields(IType type) {
- try {
- return type.getFields();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return EMPTY_FIELD_ARRAY;
- }
- }
- private static final IField[] EMPTY_FIELD_ARRAY = new IField[0];
-
- private JavaResourcePersistentAttribute buildField(IField jdtField) {
- return new BinaryPersistentAttribute(this, jdtField);
- }
-
-
- // ********** methods **********
-
- public Iterator<JavaResourcePersistentAttribute> methods() {
- return this.getMethods().iterator();
- }
-
- private Iterable<JavaResourcePersistentAttribute> getMethods() {
- return new LiveCloneIterable<JavaResourcePersistentAttribute>(this.methods);
- }
-
- public Iterator<JavaResourcePersistentAttribute> persistableProperties() {
- return persistableMembers(this.methods());
- }
-
- public Iterator<JavaResourcePersistentAttribute> persistablePropertiesWithSpecifiedPropertyAccess() {
- return new FilteringIterator<JavaResourcePersistentAttribute, JavaResourcePersistentAttribute>(this.persistableProperties()) {
- @Override
- protected boolean accept(JavaResourcePersistentAttribute resourceAttribute) {
- return resourceAttribute.getSpecifiedAccess() == AccessType.PROPERTY;
- }
- };
- }
-
- private JavaResourcePersistentAttribute getMethod(MethodSignature signature, int occurrence) {
- for (JavaResourcePersistentAttribute method : this.getMethods()) {
- if (method.isFor(signature, occurrence)) {
- return method;
- }
- }
- return null;
- }
-
- private void addMethod(JavaResourcePersistentAttribute method) {
- this.addItemToCollection(method, this.methods, METHODS_COLLECTION);
- }
-
- private void removeMethods(Collection<JavaResourcePersistentAttribute> remove) {
- this.removeItemsFromCollection(remove, this.methods, METHODS_COLLECTION);
- }
-
- private Vector<JavaResourcePersistentAttribute> buildMethods() {
- IMethod[] jdtMethods = this.getMethods(this.getMember());
- Vector<JavaResourcePersistentAttribute> result = new Vector<JavaResourcePersistentAttribute>(jdtMethods.length);
- for (IMethod jdtMethod : jdtMethods) {
- result.add(this.buildMethod(jdtMethod));
- }
- return result;
- }
-
- private IMethod[] getMethods(IType type) {
- try {
- return type.getMethods();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return EMPTY_METHOD_ARRAY;
- }
- }
- private static final IMethod[] EMPTY_METHOD_ARRAY = new IMethod[0];
-
- private JavaResourcePersistentAttribute buildMethod(IMethod jdtMethod) {
- return new BinaryPersistentAttribute(this, jdtMethod);
- }
-
-
- // ********** attributes **********
-
- @SuppressWarnings("unchecked")
- public Iterator<JavaResourcePersistentAttribute> persistableAttributes() {
- return new CompositeIterator<JavaResourcePersistentAttribute>(
- this.persistableFields(),
- this.persistableProperties()
- );
- }
-
- public Iterator<JavaResourcePersistentAttribute> persistableAttributes(AccessType specifiedAccess) {
- if (specifiedAccess == null) {
- throw new IllegalArgumentException("specified access is null"); //$NON-NLS-1$
- }
- return (specifiedAccess == AccessType.FIELD) ?
- this.persistableAttributesForFieldAccessType() :
- this.persistableAttributesForPropertyAccessType();
- }
-
- @SuppressWarnings("unchecked")
- private Iterator<JavaResourcePersistentAttribute> persistableAttributesForFieldAccessType() {
- return new CompositeIterator<JavaResourcePersistentAttribute>(
- this.persistableFields(),
- this.persistablePropertiesWithSpecifiedPropertyAccess()
- );
- }
-
- @SuppressWarnings("unchecked")
- private Iterator<JavaResourcePersistentAttribute> persistableAttributesForPropertyAccessType() {
- return new CompositeIterator<JavaResourcePersistentAttribute>(
- this.persistableProperties(),
- this.persistableFieldsWithSpecifiedFieldAccess()
- );
- }
-
-
- // ********** IType adapter **********
-
- static class TypeAdapter implements Adapter {
- private final IType type;
-
- TypeAdapter(IType type) {
- super();
- this.type = type;
- }
-
- public IType getMember() {
- return this.type;
- }
-
- public boolean isPersistable() {
- return true; // we only build a JAR type if it is "persistable"
- }
-
- public IAnnotation[] getAnnotations() throws JavaModelException {
- return this.type.getAnnotations();
- }
-
- }
-
-
- // ********** "persistable" check **********
-
- static boolean typeIsPersistable(IType type) {
- return (type != null)
- && type.exists()
- && JPTTools.typeIsPersistable(new JPTToolsAdapter(type));
- }
-
-
- // ********** JPT tools adapter **********
-
- /**
- * JPTTools needs an adapter so it can work with either an IType
- * or an ITypeBinding etc.
- */
- static class JPTToolsAdapter implements JPTTools.TypeAdapter {
- private final IType type;
-
- protected JPTToolsAdapter(IType type) {
- super();
- if (type == null) {
- throw new NullPointerException();
- }
- this.type = type;
- }
-
- public int getModifiers() {
- try {
- return this.type.getFlags();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return 0;
- }
- }
-
- public boolean isAnnotation() {
- try {
- return this.type.isAnnotation();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return false;
- }
- }
-
- public boolean isAnonymous() {
- try {
- return this.type.isAnonymous();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return false;
- }
- }
-
- public boolean isArray() {
- return false; // ???
- }
-
- public boolean isEnum() {
- try {
- return this.type.isEnum();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return false;
- }
- }
-
- public boolean isInterface() {
- try {
- return this.type.isInterface();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return false;
- }
- }
-
- public boolean isLocal() {
- try {
- return this.type.isLocal();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return false;
- }
- }
-
- public boolean isMember() {
- try {
- return this.type.isMember();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return false;
- }
- }
-
- public boolean isPrimitive() {
- return false; // ???
- }
-
- }
-
-
- // ********** unsupported JavaResourcePersistentType implementation **********
-
- public Iterator<JavaResourcePersistentType> types() {
- throw new UnsupportedOperationException();
- }
-
- public Iterator<JavaResourcePersistentType> allTypes() {
- throw new UnsupportedOperationException();
- }
-
- public Iterator<JavaResourcePersistentType> persistableTypes() {
- throw new UnsupportedOperationException();
- }
-
- public boolean isGeneratedMetamodel(IPackageFragmentRoot sourceFolder) {
- throw new UnsupportedOperationException();
- }
-
- public boolean isGeneratedMetamodel() {
- throw new UnsupportedOperationException();
- }
-
- public GeneratedAnnotation getGeneratedAnnotation() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentTypeCache.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentTypeCache.java
deleted file mode 100644
index bc1b8a1225..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentTypeCache.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.core.JpaAnnotationProvider;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentTypeCache;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- * cache used to hold binary "external" Java resource persistent types
- * (typically derived from JARs on the project's build path)
- */
-public final class BinaryPersistentTypeCache
- extends RootBinaryNode
- implements JavaResourcePersistentTypeCache
-{
- /** populated on-demand */
- private final Vector<Entry> entries = new Vector<Entry>();
-
-
- // ********** construction **********
-
- public BinaryPersistentTypeCache(JpaAnnotationProvider annotationProvider) {
- super(null, annotationProvider);
- }
-
-
- // ********** JavaResourceNode.Root implementation **********
-
- public Iterator<JavaResourcePersistentType> persistentTypes() {
- return this.getPersistentTypes().iterator();
- }
-
- private Iterable<JavaResourcePersistentType> getPersistentTypes() {
- return new TransformationIterable<Entry, JavaResourcePersistentType>(this.getEntries()) {
- @Override
- protected JavaResourcePersistentType transform(Entry entry) {
- return entry.persistentType;
- }
- };
- }
-
- private Iterable<Entry> getEntries() {
- return new LiveCloneIterable<Entry>(this.entries);
- }
-
-
- // ********** JavaResourcePersistentTypeCache implementation **********
-
- public int persistentTypesSize() {
- return this.entries.size();
- }
-
- public JavaResourcePersistentType addPersistentType(IType jdtType) {
- Entry entry = this.buildEntry(jdtType);
- this.entries.add(entry);
- this.fireItemAdded(PERSISTENT_TYPES_COLLECTION, entry.persistentType);
- return entry.persistentType;
- }
-
- private Entry buildEntry(IType jdtType) {
- return new Entry(this.buildPersistentType(jdtType), jdtType.getResource());
- }
-
- private JavaResourcePersistentType buildPersistentType(IType jdtType) {
- return new BinaryPersistentType(this, jdtType);
- }
-
- public boolean removePersistentTypes(IFile jarFile) {
- boolean modified = false;
- for (Entry entry : this.getEntries()) {
- IResource resource = entry.resource;
- if ((resource != null) && resource.equals(jarFile)) {
- this.removeEntry(entry);
- modified = true;
- }
- }
- return modified;
- }
-
- private void removeEntry(Entry entry) {
- this.entries.remove(entry);
- this.fireItemRemoved(PERSISTENT_TYPES_COLLECTION, entry.persistentType);
- }
-
-
- // ********** overrides **********
-
- /**
- * Ignore changes to this collection. Adds can be ignored since they are triggered
- * by requests that will, themselves, trigger updates (typically during the
- * update of an object that calls a setter with the newly-created resource
- * type). Deletes will be accompanied by manual updates.
- */
- @Override
- protected void aspectChanged(String aspectName) {
- if ((aspectName != null) && ! aspectName.equals(PERSISTENT_TYPES_COLLECTION)) {
- super.aspectChanged(aspectName);
- }
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.entries);
- }
-
-
- // ********** cache entry **********
-
- /**
- * Associate a persistent type with its resource.
- * This will be a JAR in the case of a type loaded from a JAR that is in
- * the Eclipse workspace. The resource will be null for a type loaded
- * from a JAR or class directory outside of the workspace.
- */
- static class Entry {
- final JavaResourcePersistentType persistentType;
- final IResource resource;
-
- Entry(JavaResourcePersistentType persistentType, IResource resource) {
- super();
- this.persistentType = persistentType;
- this.resource = resource;
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.persistentType);
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java
deleted file mode 100644
index ba9b01d58c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.PrimaryKeyJoinColumn
- */
-public final class BinaryPrimaryKeyJoinColumnAnnotation
- extends BinaryNamedColumnAnnotation
- implements NestablePrimaryKeyJoinColumnAnnotation
-{
- private String referencedColumnName;
-
-
- public BinaryPrimaryKeyJoinColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.referencedColumnName = this.buildReferencedColumnName();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setReferencedColumnName_(this.buildReferencedColumnName());
- }
-
-
- // ********** AbstractNamedColumn 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) {
- throw new UnsupportedOperationException();
- }
-
- private void setReferencedColumnName_(String referencedColumnName) {
- String old = this.referencedColumnName;
- this.referencedColumnName = referencedColumnName;
- this.firePropertyChanged(REFERENCED_COLUMN_NAME_PROPERTY, old, referencedColumnName);
- }
-
- private String buildReferencedColumnName() {
- return (String) this.getJdtMemberValue(JPA.PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME);
- }
-
- public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnsAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnsAnnotation.java
deleted file mode 100644
index 0951dbc459..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnsAnnotation.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.PrimaryKeyJoinColumns
- */
-public final class BinaryPrimaryKeyJoinColumnsAnnotation
- extends BinaryContainerAnnotation<NestablePrimaryKeyJoinColumnAnnotation>
- implements PrimaryKeyJoinColumnsAnnotation
-{
- private final Vector<NestablePrimaryKeyJoinColumnAnnotation> pkJoinColumns;
-
-
- public BinaryPrimaryKeyJoinColumnsAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.pkJoinColumns = this.buildPkJoinColumns();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public ListIterator<NestablePrimaryKeyJoinColumnAnnotation> nestedAnnotations() {
- return new CloneListIterator<NestablePrimaryKeyJoinColumnAnnotation>(this.pkJoinColumns);
- }
-
- public int nestedAnnotationsSize() {
- return this.pkJoinColumns.size();
- }
-
- private Vector<NestablePrimaryKeyJoinColumnAnnotation> buildPkJoinColumns() {
- Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.PRIMARY_KEY_JOIN_COLUMNS__VALUE);
- Vector<NestablePrimaryKeyJoinColumnAnnotation> result = new Vector<NestablePrimaryKeyJoinColumnAnnotation>(jdtJoinColumns.length);
- for (Object jdtJoinColumn : jdtJoinColumns) {
- result.add(new BinaryPrimaryKeyJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn));
- }
- return result;
- }
-
- @Override
- public void update() {
- super.update();
- this.updatePkJoinColumns();
- }
-
- // TODO
- private void updatePkJoinColumns() {
- throw new UnsupportedOperationException();
- }
-
-}
-
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java
deleted file mode 100644
index c3f76581e6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.QueryHintAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.QueryHint
- */
-class BinaryQueryHintAnnotation
- extends BinaryAnnotation
- implements QueryHintAnnotation
-{
- private String name;
- private String value;
-
-
- BinaryQueryHintAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.name = this.buildName();
- this.value = this.buildValue();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setName_(this.buildName());
- this.setValue_(this.buildValue());
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** QueryHintAnnotation implementation **********
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- throw new UnsupportedOperationException();
- }
-
- private void setName_(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- private String buildName() {
- return (String) this.getJdtMemberValue(JPA.QUERY_HINT__NAME);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** value
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- throw new UnsupportedOperationException();
- }
-
- private void setValue_(String value) {
- String old = this.value;
- this.value = value;
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private String buildValue() {
- return (String) this.getJdtMemberValue(JPA.QUERY_HINT__VALUE);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java
deleted file mode 100644
index 1ba6e11ed3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.CascadeType;
-import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.RelationshipMappingAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-
-/**
- * javax.persistence.ManyToMany
- * javax.persistence.ManyToOne
- * javax.persistence.OneToMany
- * javax.persistence.OneToOne
- */
-abstract class BinaryRelationshipMappingAnnotation
- extends BinaryAnnotation
- implements RelationshipMappingAnnotation
-{
- String targetEntity;
- FetchType fetch;
- boolean cascadeAll;
- boolean cascadeMerge;
- boolean cascadePersist;
- boolean cascadeRefresh;
- boolean cascadeRemove;
-
-
- BinaryRelationshipMappingAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.targetEntity = this.buildTargetEntity();
- this.fetch = this.buildFetch();
-
- CascadeType[] cascadeTypes = this.buildCascadeTypes();
- 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);
- }
-
- @Override
- public void update() {
- super.update();
- this.setTargetEntity_(this.buildTargetEntity());
- this.setFetch_(this.buildFetch());
-
- CascadeType[] cascadeTypes = this.buildCascadeTypes();
- 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));
- }
-
-
- // ********** 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);
- this.firePropertyChanged(FULLY_QUALIFIED_TARGET_ENTITY_CLASS_NAME_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);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java
deleted file mode 100644
index dd8eaa1a7e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableSecondaryTableAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.SecondaryTable
- */
-public final class BinarySecondaryTableAnnotation
- extends BinaryBaseTableAnnotation
- implements NestableSecondaryTableAnnotation
-{
- private final Vector<PrimaryKeyJoinColumnAnnotation> pkJoinColumns;
-
- public BinarySecondaryTableAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.pkJoinColumns = this.buildPkJoinColumns();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.updatePkJoinColumns();
- }
-
-
- // ********** BinaryBaseTableAnnotation implementation **********
-
- @Override
- String getNameElementName() {
- return JPA.SECONDARY_TABLE__NAME;
- }
-
- @Override
- String getSchemaElementName() {
- return JPA.SECONDARY_TABLE__SCHEMA;
- }
-
- @Override
- String getCatalogElementName() {
- return JPA.SECONDARY_TABLE__CATALOG;
- }
-
- @Override
- String getUniqueConstraintElementName() {
- return JPA.SECONDARY_TABLE__UNIQUE_CONSTRAINTS;
- }
-
-
- // ************* SecondaryTable implementation *******************
-
- // ***** pk join columns
- public ListIterator<PrimaryKeyJoinColumnAnnotation> pkJoinColumns() {
- return new CloneListIterator<PrimaryKeyJoinColumnAnnotation>(this.pkJoinColumns);
- }
-
- public int pkJoinColumnsSize() {
- return this.pkJoinColumns.size();
- }
-
- public PrimaryKeyJoinColumnAnnotation pkJoinColumnAt(int index) {
- return this.pkJoinColumns.get(index);
- }
-
- public int indexOfPkJoinColumn(PrimaryKeyJoinColumnAnnotation pkJoinColumn) {
- return this.pkJoinColumns.indexOf(pkJoinColumn);
- }
-
- public PrimaryKeyJoinColumnAnnotation addPkJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- public void movePkJoinColumn(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void removePkJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- private Vector<PrimaryKeyJoinColumnAnnotation> buildPkJoinColumns() {
- Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.SECONDARY_TABLE__PK_JOIN_COLUMNS);
- Vector<PrimaryKeyJoinColumnAnnotation> result = new Vector<PrimaryKeyJoinColumnAnnotation>(jdtJoinColumns.length);
- for (Object jdtJoinColumn : jdtJoinColumns) {
- result.add(new BinaryPrimaryKeyJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn));
- }
- return result;
- }
-
- // TODO
- private void updatePkJoinColumns() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySecondaryTablesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySecondaryTablesAnnotation.java
deleted file mode 100644
index 01edfe1e8c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySecondaryTablesAnnotation.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NestableSecondaryTableAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTablesAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.SecondaryTables
- */
-public final class BinarySecondaryTablesAnnotation
- extends BinaryContainerAnnotation<NestableSecondaryTableAnnotation>
- implements SecondaryTablesAnnotation
-{
- private final Vector<NestableSecondaryTableAnnotation> secondaryTables;
-
-
- public BinarySecondaryTablesAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.secondaryTables = this.buildSecondaryTables();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public ListIterator<NestableSecondaryTableAnnotation> nestedAnnotations() {
- return new CloneListIterator<NestableSecondaryTableAnnotation>(this.secondaryTables);
- }
-
- public int nestedAnnotationsSize() {
- return this.secondaryTables.size();
- }
-
- private Vector<NestableSecondaryTableAnnotation> buildSecondaryTables() {
- Object[] jdtSecondaryTables = this.getJdtMemberValues(JPA.SECONDARY_TABLES__VALUE);
- Vector<NestableSecondaryTableAnnotation> result = new Vector<NestableSecondaryTableAnnotation>(jdtSecondaryTables.length);
- for (Object jdtSecondaryTable : jdtSecondaryTables) {
- result.add(new BinarySecondaryTableAnnotation(this, (IAnnotation) jdtSecondaryTable));
- }
- return result;
- }
-
- @Override
- public void update() {
- super.update();
- this.updateSecondaryTables();
- }
-
- // TODO
- private void updateSecondaryTables() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java
deleted file mode 100644
index cfe2c821ba..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.SequenceGenerator
- */
-public abstract class BinarySequenceGeneratorAnnotation
- extends BinaryGeneratorAnnotation
- implements SequenceGeneratorAnnotation
-{
- private String sequenceName;
-
-
- protected BinarySequenceGeneratorAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.sequenceName = this.buildSequenceName();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setSequenceName_(this.buildSequenceName());
- }
-
-
- // ********** BinaryGeneratorAnnotation implementation **********
-
- @Override
- String getNameElementName() {
- return JPA.SEQUENCE_GENERATOR__NAME;
- }
-
- @Override
- String getInitialValueElementName() {
- return JPA.SEQUENCE_GENERATOR__INITIAL_VALUE;
- }
-
- @Override
- String getAllocationSizeElementName() {
- return JPA.SEQUENCE_GENERATOR__ALLOCATION_SIZE;
- }
-
-
- // ********** SequenceGeneratorAnnotation implementation **********
-
- // ***** sequence name
- public String getSequenceName() {
- return this.sequenceName;
- }
-
- public void setSequenceName(String sequenceName) {
- throw new UnsupportedOperationException();
- }
-
- private void setSequenceName_(String sequenceName) {
- String old = this.sequenceName;
- this.sequenceName = sequenceName;
- this.firePropertyChanged(SEQUENCE_NAME_PROPERTY, old, sequenceName);
- }
-
- private String buildSequenceName() {
- return (String) this.getJdtMemberValue(JPA.SEQUENCE_GENERATOR__SEQUENCE_NAME);
- }
-
- public TextRange getSequenceNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean sequenceNameTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTableAnnotation.java
deleted file mode 100644
index bc456e6b8f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTableAnnotation.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.TableAnnotation;
-
-/**
- * javax.persistence.Table
- */
-public final class BinaryTableAnnotation
- extends BinaryBaseTableAnnotation
- implements TableAnnotation
-{
- public BinaryTableAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-
- // ********** BinaryBaseTableAnnotation implementation **********
-
- @Override
- String getNameElementName() {
- return JPA.TABLE__NAME;
- }
-
- @Override
- String getSchemaElementName() {
- return JPA.TABLE__SCHEMA;
- }
-
- @Override
- String getCatalogElementName() {
- return JPA.TABLE__CATALOG;
- }
-
- @Override
- String getUniqueConstraintElementName() {
- return JPA.TABLE__UNIQUE_CONSTRAINTS;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java
deleted file mode 100644
index 0ecdebbb42..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.TableGenerator
- */
-public final class BinaryTableGeneratorAnnotation
- extends BinaryGeneratorAnnotation
- implements TableGeneratorAnnotation
-{
- private String table;
- private String schema;
- private String catalog;
- private String pkColumnName;
- private String valueColumnName;
- private String pkColumnValue;
- private final Vector<UniqueConstraintAnnotation> uniqueConstraints;
-
-
- public BinaryTableGeneratorAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.table = this.buildTable();
- this.schema = this.buildSchema();
- this.catalog = this.buildCatalog();
- this.pkColumnName = this.buildPkColumnName();
- this.valueColumnName = this.buildValueColumnName();
- this.pkColumnValue = this.buildPkColumnValue();
- this.uniqueConstraints = this.buildUniqueConstraints();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setTable_(this.buildTable());
- this.setSchema_(this.buildSchema());
- this.setCatalog_(this.buildCatalog());
- this.setPkColumnName_(this.buildPkColumnName());
- this.setValueColumnName_(this.buildValueColumnName());
- this.setPkColumnValue_(this.buildPkColumnValue());
- this.updateUniqueConstraints();
- }
-
-
- // ********** AbstractGeneratorAnnotation implementation **********
-
- @Override
- String getNameElementName() {
- return JPA.TABLE_GENERATOR__NAME;
- }
-
- @Override
- String getInitialValueElementName() {
- return JPA.TABLE_GENERATOR__INITIAL_VALUE;
- }
-
- @Override
- String getAllocationSizeElementName() {
- return JPA.TABLE_GENERATOR__ALLOCATION_SIZE;
- }
-
-
- // ********** TableGeneratorAnnotation implementation **********
-
- // ***** table
- public String getTable() {
- return this.table;
- }
-
- public void setTable(String table) {
- throw new UnsupportedOperationException();
- }
-
- private void setTable_(String table) {
- String old = this.table;
- this.table = table;
- this.firePropertyChanged(TABLE_PROPERTY, old, table);
- }
-
- private String buildTable() {
- return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__TABLE);
- }
-
- public TextRange getTableTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean tableTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** schema
- public String getSchema() {
- return this.schema;
- }
-
- public void setSchema(String schema) {
- throw new UnsupportedOperationException();
- }
-
- private void setSchema_(String schema) {
- String old = this.schema;
- this.schema = schema;
- this.firePropertyChanged(SCHEMA_PROPERTY, old, schema);
- }
-
- private String buildSchema() {
- return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__SCHEMA);
- }
-
- public TextRange getSchemaTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean schemaTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** catalog
- public String getCatalog() {
- return this.catalog;
- }
-
- public void setCatalog(String catalog) {
- throw new UnsupportedOperationException();
- }
-
- private void setCatalog_(String catalog) {
- String old = this.catalog;
- this.catalog = catalog;
- this.firePropertyChanged(CATALOG_PROPERTY, old, catalog);
- }
-
- private String buildCatalog() {
- return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__CATALOG);
- }
-
- public TextRange getCatalogTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean catalogTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** pk column name
- public String getPkColumnName() {
- return this.pkColumnName;
- }
-
- public void setPkColumnName(String pkColumnName) {
- throw new UnsupportedOperationException();
- }
-
- private void setPkColumnName_(String pkColumnName) {
- String old = this.pkColumnName;
- this.pkColumnName = pkColumnName;
- this.firePropertyChanged(PK_COLUMN_NAME_PROPERTY, old, pkColumnName);
- }
-
- private String buildPkColumnName() {
- return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__PK_COLUMN_NAME);
- }
-
- public TextRange getPkColumnNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean pkColumnNameTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** value column name
- public String getValueColumnName() {
- return this.valueColumnName;
- }
-
- public void setValueColumnName(String valueColumnName) {
- throw new UnsupportedOperationException();
- }
-
- private void setValueColumnName_(String valueColumnName) {
- String old = this.valueColumnName;
- this.valueColumnName = valueColumnName;
- this.firePropertyChanged(VALUE_COLUMN_NAME_PROPERTY, old, valueColumnName);
- }
-
- private String buildValueColumnName() {
- return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__VALUE_COLUMN_NAME);
- }
-
- public TextRange getValueColumnNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean valueColumnNameTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** pk column value
- public String getPkColumnValue() {
- return this.pkColumnValue;
- }
-
- public void setPkColumnValue(String pkColumnValue) {
- throw new UnsupportedOperationException();
- }
-
- private void setPkColumnValue_(String pkColumnValue) {
- String old = this.pkColumnValue;
- this.pkColumnValue = pkColumnValue;
- this.firePropertyChanged(PK_COLUMN_VALUE_PROPERTY, old, pkColumnValue);
- }
-
- private String buildPkColumnValue() {
- return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__PK_COLUMN_VALUE);
- }
-
- public TextRange getPkColumnValueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean pkColumnValueTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** unique constraints
- public ListIterator<UniqueConstraintAnnotation> uniqueConstraints() {
- return new CloneListIterator<UniqueConstraintAnnotation>(this.uniqueConstraints);
- }
-
- public int uniqueConstraintsSize() {
- return this.uniqueConstraints.size();
- }
-
- public UniqueConstraintAnnotation uniqueConstraintAt(int index) {
- return this.uniqueConstraints.get(index);
- }
-
- public int indexOfUniqueConstraint(UniqueConstraintAnnotation uniqueConstraint) {
- return this.uniqueConstraints.indexOf(uniqueConstraint);
- }
-
- public UniqueConstraintAnnotation addUniqueConstraint(int index) {
- throw new UnsupportedOperationException();
- }
-
- public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void removeUniqueConstraint(int index) {
- throw new UnsupportedOperationException();
- }
-
- private Vector<UniqueConstraintAnnotation> buildUniqueConstraints() {
- Object[] jdtUniqueConstraints = this.getJdtMemberValues(JPA.TABLE_GENERATOR__UNIQUE_CONSTRAINTS);
- Vector<UniqueConstraintAnnotation> result = new Vector<UniqueConstraintAnnotation>(jdtUniqueConstraints.length);
- for (Object jdtUniqueConstraint : jdtUniqueConstraints) {
- result.add(new BinaryUniqueConstraintAnnotation(this, (IAnnotation) jdtUniqueConstraint));
- }
- return result;
- }
-
- // TODO
- private void updateUniqueConstraints() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTemporalAnnotation.java
deleted file mode 100644
index d2945aa198..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTemporalAnnotation.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.core.resource.java.TemporalType;
-import org.eclipse.jpt.core.utility.TextRange;
-
-/**
- * javax.persistence.Temporal
- */
-public final class BinaryTemporalAnnotation
- extends BinaryAnnotation
- implements TemporalAnnotation
-{
- private TemporalType value;
-
-
- public BinaryTemporalAnnotation(JavaResourceNode 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());
- }
-
-
- // ********** 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(JPA.TEMPORAL__VALUE));
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTransientAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTransientAnnotation.java
deleted file mode 100644
index 92e643fd4b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTransientAnnotation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.TransientAnnotation;
-
-/**
- * javax.persistence.Transient
- */
-public final class BinaryTransientAnnotation
- extends BinaryAnnotation
- implements TransientAnnotation
-{
-
- public BinaryTransientAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java
deleted file mode 100644
index 2d8af3aec7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.UniqueConstraint
- */
-final class BinaryUniqueConstraintAnnotation
- extends BinaryAnnotation
- implements UniqueConstraintAnnotation
-{
- private final Vector<String> columnNames;
-
-
- BinaryUniqueConstraintAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.columnNames = this.buildColumnNames();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.updateColumnNames();
- }
-
- // TODO
- private void updateColumnNames() {
- throw new UnsupportedOperationException();
- }
-
-
- // ********** UniqueConstraintAnnotation implementation **********
-
- // ***** column names
- public ListIterator<String> columnNames() {
- return new CloneListIterator<String>(this.columnNames);
- }
-
- public int columnNamesSize() {
- return this.columnNames.size();
- }
-
- private Vector<String> buildColumnNames() {
- Object[] jdtColumnNames = this.getJdtMemberValues(JPA.UNIQUE_CONSTRAINT__COLUMN_NAMES);
- Vector<String> result = new Vector<String>(jdtColumnNames.length);
- for (Object jdtColumnName : jdtColumnNames) {
- result.add((String) jdtColumnName);
- }
- return result;
- }
-
- public void addColumnName(String columnName) {
- throw new UnsupportedOperationException();
- }
-
- public void addColumnName(int index, String columnName) {
- throw new UnsupportedOperationException();
- }
-
- public void moveColumnName(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public boolean columnNamesTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public void removeColumnName(String columnName) {
- throw new UnsupportedOperationException();
- }
-
- public void removeColumnName(int index) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryVersionAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryVersionAnnotation.java
deleted file mode 100644
index 37f3256a19..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryVersionAnnotation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.VersionAnnotation;
-
-/**
- * javax.persistence.Version
- */
-public final class BinaryVersionAnnotation
- extends BinaryAnnotation
- implements VersionAnnotation
-{
-
- public BinaryVersionAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/RootBinaryNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/RootBinaryNode.java
deleted file mode 100644
index 7caa4969cd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/RootBinaryNode.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jpt.core.JpaAnnotationProvider;
-import org.eclipse.jpt.core.JpaResourceModelListener;
-import org.eclipse.jpt.core.JpaResourceType;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.utility.internal.ListenerList;
-
-/**
- * JAR and external types
- */
-abstract class RootBinaryNode
- extends BinaryNode
- implements JavaResourceNode.Root
-{
- /** pluggable annotation provider */
- private final JpaAnnotationProvider annotationProvider;
-
- /** listeners notified whenever the resource model changes */
- private final ListenerList<JpaResourceModelListener> resourceModelListenerList = new ListenerList<JpaResourceModelListener>(JpaResourceModelListener.class);
-
-
- // ********** construction **********
-
- RootBinaryNode(JavaResourceNode parent, JpaAnnotationProvider annotationProvider) {
- super(parent);
- this.annotationProvider = annotationProvider;
- }
-
-
- // ********** overrides **********
-
- @Override
- protected boolean requiresParent() {
- return false;
- }
-
- @Override
- public Root getRoot() {
- return this;
- }
-
- @Override
- public JpaAnnotationProvider getAnnotationProvider() {
- return this.annotationProvider;
- }
-
-
- // ********** JavaResourceNode.Root implementation **********
-
- public void resourceModelChanged() {
- for (JpaResourceModelListener listener : this.resourceModelListenerList.getListeners()) {
- listener.resourceModelChanged();
- }
- }
-
-
- // ********** JpaResourceModel implementation **********
-
- public JpaResourceType getResourceType() {
- return JptCorePlugin.JAR_RESOURCE_TYPE;
- }
-
- public void addResourceModelListener(JpaResourceModelListener listener) {
- this.resourceModelListenerList.add(listener);
- }
-
- public void removeResourceModelListener(JpaResourceModelListener listener) {
- this.resourceModelListenerList.remove(listener);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/AnnotationContainerTools.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/AnnotationContainerTools.java
deleted file mode 100644
index 97446b9da0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/AnnotationContainerTools.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.ArrayInitializer;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jdt.core.dom.MemberValuePair;
-import org.eclipse.jdt.core.dom.NormalAnnotation;
-import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
-import org.eclipse.jpt.core.resource.java.AnnotationContainer;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-/**
- * Utility methods for manipulating annotation containers.
- */
-public final class AnnotationContainerTools {
-
- /**
- * Add a nested annotation to the specified annotation container
- * at the specified index.
- * This method modifies both the model annotation container and the
- * AST; with the appropriate change notification occurring afterwards.
- */
- public static <T extends NestableAnnotation> NestableAnnotation addNestedAnnotation(int index, AnnotationContainer<T> annotationContainer) {
- // add a new annotation to the end of the list...
- int sourceIndex = annotationContainer.nestedAnnotationsSize();
- T nestedAnnotation = annotationContainer.addNestedAnnotationInternal();
- nestedAnnotation.newAnnotation();
- // ...then move it to the specified index...
- annotationContainer.moveNestedAnnotationInternal(index, sourceIndex);
- synchJavaAnnotationsAfterMove(index, sourceIndex, annotationContainer, nestedAnnotation);
- // ...then, when all is settled, tell the container to fire change notification
- annotationContainer.nestedAnnotationAdded(index, nestedAnnotation);
- return nestedAnnotation;
- }
-
- /**
- * Move the nested annotation at the specified source index in the
- * specified annotation container to the specified target index.
- * This method modifies both the model annotation container and the
- * AST; with the appropriate change notification occurring afterwards.
- */
- public static <T extends NestableAnnotation> void moveNestedAnnotation(int targetIndex, int sourceIndex, AnnotationContainer<T> annotationContainer) {
- NestableAnnotation nestedAnnotation = annotationContainer.moveNestedAnnotationInternal(targetIndex, sourceIndex);
- synchJavaAnnotationsAfterMove(targetIndex, sourceIndex, annotationContainer, nestedAnnotation);
- annotationContainer.nestedAnnotationMoved(targetIndex, sourceIndex);
- }
-
- /**
- * An annotation was moved within the specified annotation container from
- * the specified source index to the specified target index.
- * Synchronize the AST annotations with the model annotation container,
- * starting with the lower index to prevent overlap.
- */
- private static <T extends NestableAnnotation> void synchJavaAnnotationsAfterMove(int targetIndex, int sourceIndex, AnnotationContainer<T> annotationContainer, NestableAnnotation nestedAnnotationAnnotation) {
- // move the Java annotation to the end of the list...
- nestedAnnotationAnnotation.moveAnnotation(annotationContainer.nestedAnnotationsSize());
- // ...then shift the other Java annotations over one slot...
- List<T> nestableAnnotations = CollectionTools.list(annotationContainer.nestedAnnotations());
- if (sourceIndex < targetIndex) {
- for (int i = sourceIndex; i < targetIndex; i++) {
- nestableAnnotations.get(i).moveAnnotation(i);
- }
- } else {
- for (int i = sourceIndex; i > targetIndex; i-- ) {
- nestableAnnotations.get(i).moveAnnotation(i);
- }
- }
- // ...then move the Java annotation to the now empty slot at the target index
- nestedAnnotationAnnotation.moveAnnotation(targetIndex);
- }
-
- /**
- * Remove the nested annotation at the specified index in the
- * specified annotation container.
- * This method modifies both the model annotation container and the
- * AST; with the appropriate change notification occurring afterwards.
- */
- public static <T extends NestableAnnotation> void removeNestedAnnotation(int index, AnnotationContainer<T> annotationContainer) {
- T nestedAnnotation = annotationContainer.removeNestedAnnotationInternal(index);
- nestedAnnotation.removeAnnotation();
- synchJavaAnnotationsAfterRemove(index, annotationContainer);
- annotationContainer.nestedAnnotationRemoved(index, nestedAnnotation);
- }
-
- /**
- * An annotation was removed from the specified annotation container at the
- * specified index.
- * Synchronize the AST annotations with the model annotation container,
- * starting at the specified index to prevent overlap.
- */
- private static <T extends NestableAnnotation> void synchJavaAnnotationsAfterRemove(int index, AnnotationContainer<T> annotationContainer) {
- List<T> nestableAnnotations = CollectionTools.list(annotationContainer.nestedAnnotations());
- for (int i = index; i < nestableAnnotations.size(); i++) {
- // the indices are the same because the model annotations are
- // already in the proper locations - it's the Java annotations that
- // need to be moved to the same location
- nestableAnnotations.get(i).moveAnnotation(i);
- }
- }
-
- /**
- * Initialize the specified annotation container to be in synch with the
- * specified AST. No change notification will occur.
- */
- public static <T extends NestableAnnotation> void initialize(AnnotationContainer<T> annotationContainer, CompilationUnit astRoot) {
- // ignore the nested AST annotations themselves
- // (maybe someday we can use them during initialization...)
- int size = getNestedAstAnnotations(astRoot, annotationContainer).size();
- for (int i = 0; i < size; i++) {
- T nestedAnnotation = annotationContainer.addNestedAnnotationInternal();
- nestedAnnotation.initialize(astRoot);
- }
- }
-
- /**
- * Return a list of the nested AST annotations.
- */
- private static <T extends NestableAnnotation> ArrayList<Annotation> getNestedAstAnnotations(CompilationUnit astRoot, AnnotationContainer<T> annotationContainer) {
- ArrayList<Annotation> result = new ArrayList<Annotation>();
- Annotation containerAstAnnotation = annotationContainer.getContainerJdtAnnotation(astRoot);
- if (containerAstAnnotation.isMarkerAnnotation()) {
- // no nested annotations
- }
- else if (containerAstAnnotation.isSingleMemberAnnotation()) {
- if (annotationContainer.getElementName().equals("value")) { //$NON-NLS-1$
- Expression ex = ((SingleMemberAnnotation) containerAstAnnotation).getValue();
- addAstAnnotationsTo(ex, annotationContainer.getNestableAnnotationName(), result);
- } else {
- // no nested annotations
- }
- }
- else if (containerAstAnnotation.isNormalAnnotation()) {
- MemberValuePair pair = getMemberValuePair((NormalAnnotation) containerAstAnnotation, annotationContainer.getElementName());
- if (pair == null) {
- // no nested annotations
- } else {
- addAstAnnotationsTo(pair.getValue(), annotationContainer.getNestableAnnotationName(), result);
- }
- }
- return result;
- }
-
- /**
- * Add whatever annotations are represented by the specified expression to
- * the specified bag. Add null to the bag for any non-annotation expression.
- */
- private static void addAstAnnotationsTo(Expression expression, String annotationName, ArrayList<Annotation> astAnnotations) {
- if (expression == null) {
- astAnnotations.add(null); // not sure how we would get here...
- }
- else if (expression.getNodeType() == ASTNode.ARRAY_INITIALIZER) {
- addAstAnnotationsTo((ArrayInitializer) expression, annotationName, astAnnotations);
- }
- else {
- astAnnotations.add(getAstAnnotation_(expression, annotationName));
- }
- }
-
- private static void addAstAnnotationsTo(ArrayInitializer arrayInitializer, String annotationName, ArrayList<Annotation> astAnnotations) {
- @SuppressWarnings("unchecked")
- List<Expression> expressions = arrayInitializer.expressions();
- for (Expression expression : expressions) {
- astAnnotations.add(getAstAnnotation(expression, annotationName));
- }
- }
-
- /**
- * If the specified expression is an annotation with the specified name, return it;
- * otherwise return null.
- */
- private static Annotation getAstAnnotation(Expression expression, String annotationName) {
- // not sure how the expression could be null...
- return (expression == null) ? null : getAstAnnotation_(expression, annotationName);
- }
-
- /**
- * pre-condition: expression is not null
- */
- private static Annotation getAstAnnotation_(Expression expression, String annotationName) {
- switch (expression.getNodeType()) {
- case ASTNode.NORMAL_ANNOTATION:
- case ASTNode.SINGLE_MEMBER_ANNOTATION:
- case ASTNode.MARKER_ANNOTATION:
- Annotation astAnnotation = (Annotation) expression;
- if (getQualifiedName(astAnnotation).equals(annotationName)) {
- return astAnnotation;
- }
- return null;
- default:
- return null;
- }
- }
-
- private static String getQualifiedName(Annotation astAnnotation) {
- ITypeBinding typeBinding = astAnnotation.resolveTypeBinding();
- if (typeBinding != null) {
- String resolvedName = typeBinding.getQualifiedName();
- if (resolvedName != null) {
- return resolvedName;
- }
- }
- return astAnnotation.getTypeName().getFullyQualifiedName();
- }
-
- private static MemberValuePair getMemberValuePair(NormalAnnotation annotation, String elementName) {
- @SuppressWarnings("unchecked")
- List<MemberValuePair> pairs = annotation.values();
- for (MemberValuePair pair : pairs) {
- if (pair.getName().getFullyQualifiedName().equals(elementName)) {
- return pair;
- }
- }
- return null;
- }
-
- /**
- * Update the annotations in the specified annotation container to be in
- * synch with those in the specified AST. The appropriate change
- * notification will occur.
- */
- public static <T extends NestableAnnotation> void update(AnnotationContainer<T> annotationContainer, CompilationUnit astRoot) {
- ListIterator<Annotation> astAnnotations = getNestedAstAnnotations(astRoot, annotationContainer).listIterator();
-
- for (ListIterator<T> nestedAnnotations = annotationContainer.nestedAnnotations(); nestedAnnotations.hasNext(); ) {
- T nestedAnnotation = nestedAnnotations.next();
- if (astAnnotations.hasNext()) {
- // matching AST annotation is present - update the nested annotation
- astAnnotations.next(); // maybe someday we can pass this to the update
- nestedAnnotation.update(astRoot);
- } else {
- // no more AST annotations - remove the nested annotation at the end of the container's list
- int last = annotationContainer.nestedAnnotationsSize() - 1;
- T remove = annotationContainer.removeNestedAnnotationInternal(last);
- annotationContainer.nestedAnnotationRemoved(last, remove);
- }
- }
-
- // add nested annotations for the remaining AST annotations
- int i = annotationContainer.nestedAnnotationsSize();
- while (astAnnotations.hasNext()) {
- astAnnotations.next(); // maybe someday we can pass this to the initialize
- T nestedAnnotation = annotationContainer.addNestedAnnotationInternal();
- nestedAnnotation.initialize(astRoot);
- annotationContainer.nestedAnnotationAdded(i++, nestedAnnotation);
- }
- }
-
- private AnnotationContainerTools() {
- super();
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAnnotation.java
deleted file mode 100644
index 78e6e5ba82..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAnnotation.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jpt.core.internal.utility.jdt.ASTNodeTextRange;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * some common state and behavior for Java source annotations;
- * and lots of convenience methods
- */
-public abstract class SourceAnnotation<M extends Member>
- extends SourceNode
- implements Annotation
-{
- protected final M member;
-
- protected final DeclarationAnnotationAdapter daa;
-
- protected final AnnotationAdapter annotationAdapter;
-
-
- /**
- * constructor for straight member annotation
- */
- protected SourceAnnotation(JavaResourceNode parent, M member, DeclarationAnnotationAdapter daa) {
- this(parent, member, daa, new MemberAnnotationAdapter(member, daa));
- }
-
- /**
- * constructor for nested annotation (typically)
- */
- protected SourceAnnotation(JavaResourceNode parent, M member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent);
- this.member = member;
- this.daa = daa;
- this.annotationAdapter = annotationAdapter;
- }
-
-
- // ********** JavaResourceNode implementation **********
-
- public TextRange getTextRange(CompilationUnit astRoot) {
- return this.getAnnotationTextRange(astRoot);
- }
-
-
- // ********** Annotation implementation **********
-
- public org.eclipse.jdt.core.dom.Annotation getJdtAnnotation(CompilationUnit astRoot) {
- return this.annotationAdapter.getAnnotation(astRoot);
- }
-
- public void newAnnotation() {
- this.annotationAdapter.newMarkerAnnotation();
- }
-
- public void removeAnnotation() {
- this.annotationAdapter.removeAnnotation();
- }
-
-
- // ********** convenience methods **********
-
- /**
- * Return the text range corresponding to the annotation.
- * If the annotation is missing, return null.
- */
- protected TextRange getAnnotationTextRange(CompilationUnit astRoot) {
- return this.getTextRange(this.getJdtAnnotation(astRoot));
- }
-
- /**
- * Convenience method.
- * Return the text range corresponding to the specified element.
- * If the specified element is missing, return the annotation's text range instead.
- */
- protected TextRange getElementTextRange(DeclarationAnnotationElementAdapter<?> elementAdapter, CompilationUnit astRoot) {
- return this.getElementTextRange(this.getAnnotationElementTextRange(elementAdapter, astRoot), astRoot);
- }
-
- /**
- * Convenience method. If the specified element text range is null
- * return the member's text range instead.
- */
- protected TextRange getElementTextRange(TextRange elementTextRange, CompilationUnit astRoot) {
- return (elementTextRange != null) ? elementTextRange : this.getAnnotationTextRange(astRoot);
- }
-
- /**
- * Convenience method. Return whether the specified position exists and
- * touches the specified element.
- */
- protected boolean elementTouches(DeclarationAnnotationElementAdapter<?> elementAdapter, int pos, CompilationUnit astRoot) {
- return this.textRangeTouches(this.getAnnotationElementTextRange(elementAdapter, astRoot), pos);
- }
-
- /**
- * Convenience method. Return whether the specified text range is not
- * null (meaning the corresponding AST node exists) and the specified position touches it.
- */
- protected boolean textRangeTouches(TextRange textRange, int pos) {
- return (textRange != null) && textRange.touches(pos);
- }
-
- /**
- * Return the text range corresponding to the specified element.
- * If the element is missing, return null.
- */
- protected TextRange getAnnotationElementTextRange(DeclarationAnnotationElementAdapter<?> adapter, CompilationUnit astRoot) {
- return this.getTextRange(this.getAnnotationElementExpression(adapter, astRoot));
- }
-
- /**
- * Return the specified AST DOM element.
- */
- protected Expression getAnnotationElementExpression(DeclarationAnnotationElementAdapter<?> adapter, CompilationUnit astRoot) {
- return adapter.getExpression(this.member.getModifiedDeclaration(astRoot));
- }
-
- /**
- * Return the text range corresponding to the specified AST node.
- * If the AST node is null, return null.
- */
- protected TextRange getTextRange(ASTNode astNode) {
- return (astNode == null) ? null : new ASTNodeTextRange(astNode);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAssociationOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAssociationOverrideAnnotation.java
deleted file mode 100644
index 9f2ccc4032..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAssociationOverrideAnnotation.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.AnnotationContainer;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableJoinColumnAnnotation;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.AssociationOverride
- */
-public abstract class SourceAssociationOverrideAnnotation
- extends SourceOverrideAnnotation
- implements NestableAssociationOverrideAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final Vector<NestableJoinColumnAnnotation> joinColumns = new Vector<NestableJoinColumnAnnotation>();
- private final JoinColumnsAnnotationContainer joinColumnsContainer = new JoinColumnsAnnotationContainer();
-
-
- // ********** construction/initialization **********
-
- protected SourceAssociationOverrideAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- AnnotationContainerTools.initialize(this.joinColumnsContainer, astRoot);
- }
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
- AnnotationContainerTools.update(this.joinColumnsContainer, astRoot);
- }
-
-
- // ********** SourceOverrideAnnotation implementation **********
-
- @Override
- protected String getNameElementName() {
- return JPA.ASSOCIATION_OVERRIDE__NAME;
- }
-
-
- // ********** AssociationOverrideAnnotation implementation **********
-
- // ***** join columns
- public ListIterator<JoinColumnAnnotation> joinColumns() {
- return new CloneListIterator<JoinColumnAnnotation>(this.joinColumns);
- }
-
- ListIterator<NestableJoinColumnAnnotation> nestableJoinColumns() {
- return new CloneListIterator<NestableJoinColumnAnnotation>(this.joinColumns);
- }
-
- public int joinColumnsSize() {
- return this.joinColumns.size();
- }
-
- public NestableJoinColumnAnnotation joinColumnAt(int index) {
- return this.joinColumns.get(index);
- }
-
- public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
- return this.joinColumns.indexOf(joinColumn);
- }
-
- public NestableJoinColumnAnnotation addJoinColumn(int index) {
- return (NestableJoinColumnAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.joinColumnsContainer);
- }
-
- NestableJoinColumnAnnotation addJoinColumnInternal() {
- NestableJoinColumnAnnotation joinColumn = this.buildJoinColumn(this.joinColumns.size());
- this.joinColumns.add(joinColumn);
- return joinColumn;
- }
-
- private NestableJoinColumnAnnotation buildJoinColumn(int index) {
- return SourceJoinColumnAnnotation.createAssociationOverrideJoinColumn(this.daa, this, this.member, index);
- }
-
- void joinColumnAdded(int index, NestableJoinColumnAnnotation joinColumn) {
- this.fireItemAdded(JOIN_COLUMNS_LIST, index, joinColumn);
- }
-
- public void moveJoinColumn(int targetIndex, int sourceIndex) {
- AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.joinColumnsContainer);
- }
-
- NestableJoinColumnAnnotation moveJoinColumnInternal(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.joinColumns, targetIndex, sourceIndex).get(targetIndex);
- }
-
- void joinColumnMoved(int targetIndex, int sourceIndex) {
- this.fireItemMoved(JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
- }
-
- public void removeJoinColumn(int index) {
- AnnotationContainerTools.removeNestedAnnotation(index, this.joinColumnsContainer);
- }
-
- NestableJoinColumnAnnotation removeJoinColumnInternal(int index) {
- return this.joinColumns.remove(index);
- }
-
- void joinColumnRemoved(int index, NestableJoinColumnAnnotation joinColumn) {
- this.fireItemRemoved(JOIN_COLUMNS_LIST, index, joinColumn);
- }
-
-
- // ********** NestableAnnotation implementation **********
-
- @Override
- public void initializeFrom(NestableAnnotation oldAnnotation) {
- super.initializeFrom(oldAnnotation);
- AssociationOverrideAnnotation oldOverride = (AssociationOverrideAnnotation) oldAnnotation;
- for (JoinColumnAnnotation oldJoinColumn : CollectionTools.iterable(oldOverride.joinColumns())) {
- NestableJoinColumnAnnotation newJoinColumn = this.addJoinColumn(oldOverride.indexOfJoinColumn(oldJoinColumn));
- newJoinColumn.initializeFrom((NestableAnnotation) oldJoinColumn);
- }
- }
-
- // ********** join column container **********
-
- /**
- * adapt the AnnotationContainer interface to the override's join columns
- */
- class JoinColumnsAnnotationContainer
- implements AnnotationContainer<NestableJoinColumnAnnotation>
- {
- public String getContainerAnnotationName() {
- return SourceAssociationOverrideAnnotation.this.getAnnotationName();
- }
-
- public org.eclipse.jdt.core.dom.Annotation getContainerJdtAnnotation(CompilationUnit astRoot) {
- return SourceAssociationOverrideAnnotation.this.getJdtAnnotation(astRoot);
- }
-
- public String getElementName() {
- return JPA.ASSOCIATION_OVERRIDE__JOIN_COLUMNS;
- }
-
- public String getNestableAnnotationName() {
- return JoinColumnAnnotation.ANNOTATION_NAME;
- }
-
- public ListIterator<NestableJoinColumnAnnotation> nestedAnnotations() {
- return SourceAssociationOverrideAnnotation.this.nestableJoinColumns();
- }
-
- public int nestedAnnotationsSize() {
- return SourceAssociationOverrideAnnotation.this.joinColumnsSize();
- }
-
- public NestableJoinColumnAnnotation addNestedAnnotationInternal() {
- return SourceAssociationOverrideAnnotation.this.addJoinColumnInternal();
- }
-
- public void nestedAnnotationAdded(int index, NestableJoinColumnAnnotation nestedAnnotation) {
- SourceAssociationOverrideAnnotation.this.joinColumnAdded(index, nestedAnnotation);
- }
-
- public NestableJoinColumnAnnotation moveNestedAnnotationInternal(int targetIndex, int sourceIndex) {
- return SourceAssociationOverrideAnnotation.this.moveJoinColumnInternal(targetIndex, sourceIndex);
- }
-
- public void nestedAnnotationMoved(int targetIndex, int sourceIndex) {
- SourceAssociationOverrideAnnotation.this.joinColumnMoved(targetIndex, sourceIndex);
- }
-
- public NestableJoinColumnAnnotation removeNestedAnnotationInternal(int index) {
- return SourceAssociationOverrideAnnotation.this.removeJoinColumnInternal(index);
- }
-
- public void nestedAnnotationRemoved(int index, NestableJoinColumnAnnotation nestedAnnotation) {
- SourceAssociationOverrideAnnotation.this.joinColumnRemoved(index, nestedAnnotation);
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this);
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAssociationOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAssociationOverridesAnnotation.java
deleted file mode 100644
index 65acf31d66..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAssociationOverridesAnnotation.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AssociationOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAssociationOverrideAnnotation;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.AssociationOverrides
- */
-public abstract class SourceAssociationOverridesAnnotation
- extends SourceAnnotation<Member>
- implements AssociationOverridesAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final Vector<NestableAssociationOverrideAnnotation> associationOverrides = new Vector<NestableAssociationOverrideAnnotation>();
-
-
- protected SourceAssociationOverridesAnnotation(JavaResourceNode parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- AnnotationContainerTools.initialize(this, astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- AnnotationContainerTools.update(this, astRoot);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.associationOverrides);
- }
-
-
- // ********** AnnotationContainer implementation **********
-
- public String getContainerAnnotationName() {
- return this.getAnnotationName();
- }
-
- public org.eclipse.jdt.core.dom.Annotation getContainerJdtAnnotation(CompilationUnit astRoot) {
- return this.getJdtAnnotation(astRoot);
- }
-
- public String getElementName() {
- return JPA.ASSOCIATION_OVERRIDES__VALUE;
- }
-
- public String getNestableAnnotationName() {
- return AssociationOverrideAnnotation.ANNOTATION_NAME;
- }
-
- public ListIterator<NestableAssociationOverrideAnnotation> nestedAnnotations() {
- return new CloneListIterator<NestableAssociationOverrideAnnotation>(this.associationOverrides);
- }
-
- public int nestedAnnotationsSize() {
- return this.associationOverrides.size();
- }
-
- public NestableAssociationOverrideAnnotation addNestedAnnotationInternal() {
- NestableAssociationOverrideAnnotation associationOverride = this.buildAssociationOverride(this.associationOverrides.size());
- this.associationOverrides.add(associationOverride);
- return associationOverride;
- }
-
- protected abstract NestableAssociationOverrideAnnotation buildAssociationOverride(int index);
-
- public void nestedAnnotationAdded(int index, NestableAssociationOverrideAnnotation nestedAnnotation) {
- this.fireItemAdded(ASSOCIATION_OVERRIDES_LIST, index, nestedAnnotation);
- }
-
- public NestableAssociationOverrideAnnotation moveNestedAnnotationInternal(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.associationOverrides, targetIndex, sourceIndex).get(targetIndex);
- }
-
- public void nestedAnnotationMoved(int targetIndex, int sourceIndex) {
- this.fireItemMoved(ASSOCIATION_OVERRIDES_LIST, targetIndex, sourceIndex);
- }
-
- public NestableAssociationOverrideAnnotation removeNestedAnnotationInternal(int index) {
- return this.associationOverrides.remove(index);
- }
-
- public void nestedAnnotationRemoved(int index, NestableAssociationOverrideAnnotation nestedAnnotation) {
- this.fireItemRemoved(ASSOCIATION_OVERRIDES_LIST, index, nestedAnnotation);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAttributeOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAttributeOverrideAnnotation.java
deleted file mode 100644
index 5f7fdb2d8e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAttributeOverrideAnnotation.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.NullAttributeOverrideColumnAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberIndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableColumnAnnotation;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.AttributeOverride
- */
-public final class SourceAttributeOverrideAnnotation
- extends SourceOverrideAnnotation
- implements NestableAttributeOverrideAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final MemberAnnotationAdapter columnAdapter;
- private NestableColumnAnnotation column;
-
-
- // ********** construction/initialization **********
-
- public SourceAttributeOverrideAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
- this.columnAdapter = new MemberAnnotationAdapter(this.member, SourceColumnAnnotation.buildAttributeOverrideAnnotationAdapter(this.daa));
- }
-
- 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.member, this.daa);
- this.column.initialize(astRoot);
- }
- }
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
- this.updateColumn(astRoot);
- }
-
-
- // ********** SourceOverrideAnnotation implementation **********
-
- @Override
- protected String getNameElementName() {
- return JPA.ATTRIBUTE_OVERRIDE__NAME;
- }
-
-
- //************ AttributeOverride implementation ****************
-
- // ***** column
- public ColumnAnnotation getColumn() {
- return this.column;
- }
-
- public NestableColumnAnnotation addColumn() {
- NestableColumnAnnotation col = SourceColumnAnnotation.createAttributeOverrideColumn(this, this.member, this.daa);
- col.newAnnotation();
- this.setColumn(col);
- return col;
- }
-
- public void removeColumn() {
- this.column.removeAnnotation();
- setColumn(null);
- }
-
- private void setColumn(NestableColumnAnnotation column) {
- ColumnAnnotation old = this.column;
- this.column = column;
- this.firePropertyChanged(COLUMN_PROPERTY, old, column);
- }
-
- public ColumnAnnotation getNonNullColumn() {
- return (this.column != null) ? this.column : new NullAttributeOverrideColumnAnnotation(this);
- }
-
- private void updateColumn(CompilationUnit astRoot) {
- if (this.columnAdapter.getAnnotation(astRoot) == null) {
- this.setColumn(null);
- } else {
- if (this.column == null) {
- NestableColumnAnnotation col = SourceColumnAnnotation.createAttributeOverrideColumn(this, this.member, this.daa);
- col.initialize(astRoot);
- this.setColumn(col);
- } else {
- this.column.update(astRoot);
- }
- }
- }
-
-
- // ********** NestableAnnotation implementation **********
-
- @Override
- public void initializeFrom(NestableAnnotation oldAnnotation) {
- super.initializeFrom(oldAnnotation);
- AttributeOverrideAnnotation oldOverride = (AttributeOverrideAnnotation) oldAnnotation;
- ColumnAnnotation oldColumn = oldOverride.getColumn();
- if (oldColumn != null) {
- NestableColumnAnnotation newColumn = this.addColumn();
- newColumn.initializeFrom((NestableAnnotation) oldColumn);
- }
- }
-
-
- // ********** static methods **********
-
- public static SourceAttributeOverrideAnnotation buildAttributeOverride(JavaResourceNode parent, Member member) {
- return new SourceAttributeOverrideAnnotation(parent, member, DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER));
- }
-
- static SourceAttributeOverrideAnnotation buildNestedAttributeOverride(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
- IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter);
- IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(member, idaa);
- return new SourceAttributeOverrideAnnotation(parent, member, idaa, annotationAdapter);
- }
-
- private static IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
- return new NestedIndexedDeclarationAnnotationAdapter(attributeOverridesAdapter, index, JPA.ATTRIBUTE_OVERRIDE);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java
deleted file mode 100644
index 8d41766fe8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAttributeOverrideAnnotation;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.AttributeOverrides
- */
-public final class SourceAttributeOverridesAnnotation
- extends SourceAnnotation<Member>
- implements AttributeOverridesAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final Vector<NestableAttributeOverrideAnnotation> attributesOverrides = new Vector<NestableAttributeOverrideAnnotation>();
-
-
- public SourceAttributeOverridesAnnotation(JavaResourceNode parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- AnnotationContainerTools.initialize(this, astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- AnnotationContainerTools.update(this, astRoot);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.attributesOverrides);
- }
-
-
- // ********** AnnotationContainer implementation **********
-
- public String getContainerAnnotationName() {
- return this.getAnnotationName();
- }
-
- public org.eclipse.jdt.core.dom.Annotation getContainerJdtAnnotation(CompilationUnit astRoot) {
- return this.getJdtAnnotation(astRoot);
- }
-
- public String getElementName() {
- return JPA.ATTRIBUTE_OVERRIDES__VALUE;
- }
-
- public String getNestableAnnotationName() {
- return AttributeOverrideAnnotation.ANNOTATION_NAME;
- }
-
- public ListIterator<NestableAttributeOverrideAnnotation> nestedAnnotations() {
- return new CloneListIterator<NestableAttributeOverrideAnnotation>(this.attributesOverrides);
- }
-
- public int nestedAnnotationsSize() {
- return this.attributesOverrides.size();
- }
-
- public NestableAttributeOverrideAnnotation addNestedAnnotationInternal() {
- NestableAttributeOverrideAnnotation attributeOverride = this.buildAttributeOverride(this.attributesOverrides.size());
- this.attributesOverrides.add(attributeOverride);
- return attributeOverride;
- }
-
- private NestableAttributeOverrideAnnotation buildAttributeOverride(int index) {
- return SourceAttributeOverrideAnnotation.buildNestedAttributeOverride(this, this.member, index, this.daa);
- }
-
- public void nestedAnnotationAdded(int index, NestableAttributeOverrideAnnotation nestedAnnotation) {
- this.fireItemAdded(ATTRIBUTE_OVERRIDES_LIST, index, nestedAnnotation);
- }
-
- public NestableAttributeOverrideAnnotation moveNestedAnnotationInternal(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.attributesOverrides, targetIndex, sourceIndex).get(targetIndex);
- }
-
- public void nestedAnnotationMoved(int targetIndex, int sourceIndex) {
- this.fireItemMoved(ATTRIBUTE_OVERRIDES_LIST, targetIndex, sourceIndex);
- }
-
- public NestableAttributeOverrideAnnotation removeNestedAnnotationInternal(int index) {
- return this.attributesOverrides.remove(index);
- }
-
- public void nestedAnnotationRemoved(int index, NestableAttributeOverrideAnnotation nestedAnnotation) {
- this.fireItemRemoved(ATTRIBUTE_OVERRIDES_LIST, index, nestedAnnotation);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseColumnAnnotation.java
deleted file mode 100644
index 2fac36bf04..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseColumnAnnotation.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.BaseColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.Column
- * javax.persistence.JoinColumn
- */
-abstract class SourceBaseColumnAnnotation
- extends SourceNamedColumnAnnotation
- implements BaseColumnAnnotation
-{
- final DeclarationAnnotationElementAdapter<String> tableDeclarationAdapter;
- final AnnotationElementAdapter<String> tableAdapter;
- String table;
-
- final DeclarationAnnotationElementAdapter<Boolean> uniqueDeclarationAdapter;
- final AnnotationElementAdapter<Boolean> uniqueAdapter;
- Boolean unique;
-
- final DeclarationAnnotationElementAdapter<Boolean> nullableDeclarationAdapter;
- final AnnotationElementAdapter<Boolean> nullableAdapter;
- Boolean nullable;
-
- final DeclarationAnnotationElementAdapter<Boolean> insertableDeclarationAdapter;
- final AnnotationElementAdapter<Boolean> insertableAdapter;
- Boolean insertable;
-
- final DeclarationAnnotationElementAdapter<Boolean> updatableDeclarationAdapter;
- final AnnotationElementAdapter<Boolean> updatableAdapter;
- Boolean updatable;
-
-
- SourceBaseColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
- this(parent, member, daa, new MemberAnnotationAdapter(member, daa));
- }
-
- SourceBaseColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
- this.tableDeclarationAdapter = this.buildStringElementAdapter(this.getTableElementName());
- this.tableAdapter = this.buildShortCircuitElementAdapter(this.tableDeclarationAdapter);
- this.uniqueDeclarationAdapter = this.buildBooleanElementAdapter(this.getUniqueElementName());
- this.uniqueAdapter = this.buildShortCircuitBooleanElementAdapter(this.uniqueDeclarationAdapter);
- this.nullableDeclarationAdapter = this.buildBooleanElementAdapter(this.getNullableElementName());
- this.nullableAdapter = this.buildShortCircuitBooleanElementAdapter(this.nullableDeclarationAdapter);
- this.insertableDeclarationAdapter = this.buildBooleanElementAdapter(this.getInsertableElementName());
- this.insertableAdapter = this.buildShortCircuitBooleanElementAdapter(this.insertableDeclarationAdapter);
- this.updatableDeclarationAdapter = this.buildBooleanElementAdapter(this.getUpdatableElementName());
- this.updatableAdapter = this.buildShortCircuitBooleanElementAdapter(this.updatableDeclarationAdapter);
- }
-
- @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 update(CompilationUnit astRoot) {
- super.update(astRoot);
- this.setTable(this.buildTable(astRoot));
- this.setUnique(this.buildUnique(astRoot));
- this.setNullable(this.buildNullable(astRoot));
- this.setInsertable(this.buildInsertable(astRoot));
- this.setUpdatable(this.buildUpdatable(astRoot));
- }
-
-
- //************* BaseColumnAnnotation implementation *************
-
- // ***** table
- public String getTable() {
- return this.table;
- }
-
- public void setTable(String table) {
- if (this.attributeValueHasNotChanged(this.table, table)) {
- return;
- }
- String old = this.table;
- this.table = table;
- this.tableAdapter.setValue(table);
- this.firePropertyChanged(TABLE_PROPERTY, old, table);
- }
-
- 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);
- }
-
- abstract String getTableElementName();
-
- // ***** unique
- public Boolean getUnique() {
- return this.unique;
- }
-
- public void setUnique(Boolean unique) {
- if (this.attributeValueHasNotChanged(this.unique, unique)) {
- return;
- }
- Boolean old = this.unique;
- this.unique = unique;
- this.uniqueAdapter.setValue(unique);
- this.firePropertyChanged(UNIQUE_PROPERTY, old, unique);
- }
-
- private Boolean buildUnique(CompilationUnit astRoot) {
- return this.uniqueAdapter.getValue(astRoot);
- }
-
- public TextRange getUniqueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.uniqueDeclarationAdapter, astRoot);
- }
-
- abstract String getUniqueElementName();
-
- // ***** nullable
- public Boolean getNullable() {
- return this.nullable;
- }
-
- public void setNullable(Boolean nullable) {
- if (this.attributeValueHasNotChanged(this.nullable, nullable)) {
- return;
- }
- Boolean old = this.nullable;
- this.nullable = nullable;
- this.nullableAdapter.setValue(nullable);
- this.firePropertyChanged(NULLABLE_PROPERTY, old, nullable);
- }
-
- private Boolean buildNullable(CompilationUnit astRoot) {
- return this.nullableAdapter.getValue(astRoot);
- }
-
- public TextRange getNullableTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.nullableDeclarationAdapter, astRoot);
- }
-
- abstract String getNullableElementName();
-
- // ***** insertable
- public Boolean getInsertable() {
- return this.insertable;
- }
-
- public void setInsertable(Boolean insertable) {
- if (this.attributeValueHasNotChanged(this.insertable, insertable)) {
- return;
- }
- Boolean old = this.insertable;
- this.insertable = insertable;
- this.insertableAdapter.setValue(insertable);
- this.firePropertyChanged(INSERTABLE_PROPERTY, old, insertable);
- }
-
- private Boolean buildInsertable(CompilationUnit astRoot) {
- return this.insertableAdapter.getValue(astRoot);
- }
-
- public TextRange getInsertableTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.insertableDeclarationAdapter, astRoot);
- }
-
- abstract String getInsertableElementName();
-
- // ***** updatable
- public Boolean getUpdatable() {
- return this.updatable;
- }
-
- public void setUpdatable(Boolean updatable) {
- if (this.attributeValueHasNotChanged(this.updatable, updatable)) {
- return;
- }
- Boolean old = this.updatable;
- this.updatable = updatable;
- this.updatableAdapter.setValue(updatable);
- this.firePropertyChanged(UPDATABLE_PROPERTY, old, updatable);
- }
-
- private Boolean buildUpdatable(CompilationUnit astRoot) {
- return this.updatableAdapter.getValue(astRoot);
- }
-
- public TextRange getUpdatableTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.updatableDeclarationAdapter, astRoot);
- }
-
- abstract String getUpdatableElementName();
-
-
- //************* NestableAnnotation implementation *************
-
- @Override
- public void initializeFrom(NestableAnnotation oldAnnotation) {
- super.initializeFrom(oldAnnotation);
- BaseColumnAnnotation oldColumn = (BaseColumnAnnotation) oldAnnotation;
- this.setTable(oldColumn.getTable());
- this.setUnique(oldColumn.getUnique());
- this.setNullable(oldColumn.getNullable());
- this.setInsertable(oldColumn.getInsertable());
- this.setUpdatable(oldColumn.getUpdatable());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseNamedQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseNamedQueryAnnotation.java
deleted file mode 100644
index 530bcbcfe6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseNamedQueryAnnotation.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.resource.java.AnnotationContainer;
-import org.eclipse.jpt.core.resource.java.BaseNamedQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableQueryHintAnnotation;
-import org.eclipse.jpt.core.resource.java.QueryHintAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Type;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.NamedQuery
- * javax.persistence.NamedNativeQuery
- */
-abstract class SourceBaseNamedQueryAnnotation
- extends SourceAnnotation<Type>
- implements BaseNamedQueryAnnotation
-{
- final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
- final AnnotationElementAdapter<String> nameAdapter;
- String name;
-
- final DeclarationAnnotationElementAdapter<String> queryDeclarationAdapter;
- final AnnotationElementAdapter<String> queryAdapter;
- String query;
-
- final Vector<NestableQueryHintAnnotation> hints = new Vector<NestableQueryHintAnnotation>();
- final HintsAnnotationContainer hintsContainer = new HintsAnnotationContainer();
-
-
- SourceBaseNamedQueryAnnotation(JavaResourceNode parent, Type type,DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, type, daa, annotationAdapter);
- this.nameDeclarationAdapter = this.buildNameAdapter(daa);
- this.queryDeclarationAdapter = this.buildQueryAdapter(daa);
- this.nameAdapter = this.buildAdapter(this.nameDeclarationAdapter);
- this.queryAdapter = this.buildAdapter(this.queryDeclarationAdapter);
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.name = this.buildName(astRoot);
- this.query = this.buildQuery(astRoot);
- AnnotationContainerTools.initialize(this.hintsContainer, astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setName(this.buildName(astRoot));
- this.setQuery(this.buildQuery(astRoot));
- AnnotationContainerTools.update(this.hintsContainer, astRoot);
- }
-
- /**
- * convenience method
- */
- protected AnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationElementAdapter<String> daea) {
- return new ShortCircuitAnnotationElementAdapter<String>(this.member, daea);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** BaseNamedQueryAnnotation implementation **********
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- if (this.attributeValueHasNotChanged(this.name, name)) {
- return;
- }
- String old = this.name;
- this.name = name;
- this.nameAdapter.setValue(name);
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- private String buildName(CompilationUnit astRoot) {
- return this.nameAdapter.getValue(astRoot);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.nameDeclarationAdapter, astRoot);
- }
-
- private DeclarationAnnotationElementAdapter<String> buildNameAdapter(DeclarationAnnotationAdapter daAdapter) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(daAdapter, this.getNameElementName());
- }
-
- abstract String getNameElementName();
-
- // ***** query
- public String getQuery() {
- return this.query;
- }
-
- public void setQuery(String query) {
- if (this.attributeValueHasNotChanged(this.query, query)) {
- return;
- }
- String old = this.query;
- this.query = query;
- this.queryAdapter.setValue(query);
- this.firePropertyChanged(QUERY_PROPERTY, old, query);
- }
-
- private String buildQuery(CompilationUnit astRoot) {
- return this.queryAdapter.getValue(astRoot);
- }
-
- public TextRange getQueryTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.queryDeclarationAdapter, astRoot);
- }
-
- private DeclarationAnnotationElementAdapter<String> buildQueryAdapter(DeclarationAnnotationAdapter daAdapter) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(daAdapter, this.getQueryElementName());
- }
-
- abstract String getQueryElementName();
-
- // ***** hints
- public ListIterator<QueryHintAnnotation> hints() {
- return new CloneListIterator<QueryHintAnnotation>(this.hints);
- }
-
- ListIterator<NestableQueryHintAnnotation> nestableHints() {
- return new CloneListIterator<NestableQueryHintAnnotation>(this.hints);
- }
-
- public int hintsSize() {
- return this.hints.size();
- }
-
- public NestableQueryHintAnnotation hintAt(int index) {
- return this.hints.get(index);
- }
-
- public int indexOfHint(QueryHintAnnotation queryHint) {
- return this.hints.indexOf(queryHint);
- }
-
- public NestableQueryHintAnnotation addHint(int index) {
- return (NestableQueryHintAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.hintsContainer);
- }
-
- NestableQueryHintAnnotation addHintInternal() {
- NestableQueryHintAnnotation hint = this.buildQueryHint(this.hints.size());
- this.hints.add(hint);
- return hint;
- }
-
- abstract NestableQueryHintAnnotation buildQueryHint(int index);
-
- void hintAdded(int index, NestableQueryHintAnnotation hint) {
- this.fireItemAdded(HINTS_LIST, index, hint);
- }
-
- public void moveHint(int targetIndex, int sourceIndex) {
- AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.hintsContainer);
- }
-
- NestableQueryHintAnnotation moveHintInternal(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.hints, targetIndex, sourceIndex).get(targetIndex);
- }
-
- void hintMoved(int targetIndex, int sourceIndex) {
- this.fireItemMoved(HINTS_LIST, targetIndex, sourceIndex);
- }
-
- public void removeHint(int index) {
- AnnotationContainerTools.removeNestedAnnotation(index, this.hintsContainer);
- }
-
- NestableQueryHintAnnotation removeHintInternal(int index) {
- return this.hints.remove(index);
- }
-
- void hintRemoved(int index, NestableQueryHintAnnotation hint) {
- this.fireItemRemoved(HINTS_LIST, index, hint);
- }
-
- abstract String getHintsElementName();
-
-
- // ********** NestableAnnotation implementation **********
-
- /**
- * convenience implementation of method from NestableAnnotation interface
- * for subclasses
- */
- public void initializeFrom(NestableAnnotation oldAnnotation) {
- BaseNamedQueryAnnotation oldQuery = (BaseNamedQueryAnnotation) oldAnnotation;
- this.setName(oldQuery.getName());
- this.setQuery(oldQuery.getQuery());
- for (QueryHintAnnotation oldQueryHint : CollectionTools.iterable(oldQuery.hints())) {
- NestableQueryHintAnnotation newQueryHint = this.addHint(oldQuery.indexOfHint(oldQueryHint));
- newQueryHint.initializeFrom((NestableQueryHintAnnotation) oldQueryHint);
- }
- }
-
- /**
- * convenience implementation of method from NestableAnnotation interface
- * for subclasses
- */
- public void moveAnnotation(int newIndex) {
- this.getIndexedAnnotationAdapter().moveAnnotation(newIndex);
- }
-
- private IndexedAnnotationAdapter getIndexedAnnotationAdapter() {
- return (IndexedAnnotationAdapter) this.annotationAdapter;
- }
-
-
- // ********** hint container **********
-
- /**
- * adapt the AnnotationContainer interface to the override's join columns
- */
- class HintsAnnotationContainer
- implements AnnotationContainer<NestableQueryHintAnnotation>
- {
- public String getContainerAnnotationName() {
- return SourceBaseNamedQueryAnnotation.this.getAnnotationName();
- }
-
- public Annotation getContainerJdtAnnotation(CompilationUnit astRoot) {
- return SourceBaseNamedQueryAnnotation.this.getJdtAnnotation(astRoot);
- }
-
- public String getElementName() {
- return SourceBaseNamedQueryAnnotation.this.getHintsElementName();
- }
-
- public String getNestableAnnotationName() {
- return QueryHintAnnotation.ANNOTATION_NAME;
- }
-
- public ListIterator<NestableQueryHintAnnotation> nestedAnnotations() {
- return SourceBaseNamedQueryAnnotation.this.nestableHints();
- }
-
- public int nestedAnnotationsSize() {
- return SourceBaseNamedQueryAnnotation.this.hintsSize();
- }
-
- public NestableQueryHintAnnotation addNestedAnnotationInternal() {
- return SourceBaseNamedQueryAnnotation.this.addHintInternal();
- }
-
- public void nestedAnnotationAdded(int index, NestableQueryHintAnnotation nestedAnnotation) {
- SourceBaseNamedQueryAnnotation.this.hintAdded(index, nestedAnnotation);
- }
-
- public NestableQueryHintAnnotation moveNestedAnnotationInternal(int targetIndex, int sourceIndex) {
- return SourceBaseNamedQueryAnnotation.this.moveHintInternal(targetIndex, sourceIndex);
- }
-
- public void nestedAnnotationMoved(int targetIndex, int sourceIndex) {
- SourceBaseNamedQueryAnnotation.this.hintMoved(targetIndex, sourceIndex);
- }
-
- public NestableQueryHintAnnotation removeNestedAnnotationInternal(int index) {
- return SourceBaseNamedQueryAnnotation.this.removeHintInternal(index);
- }
-
- public void nestedAnnotationRemoved(int index, NestableQueryHintAnnotation nestedAnnotation) {
- SourceBaseNamedQueryAnnotation.this.hintRemoved(index, nestedAnnotation);
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this);
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseTableAnnotation.java
deleted file mode 100644
index 608f9c5cdb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseTableAnnotation.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.resource.java.AnnotationContainer;
-import org.eclipse.jpt.core.resource.java.BaseTableAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableUniqueConstraintAnnotation;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.Table
- * javax.persistence.JoinTable
- * javax.persistence.SecondaryTable
- */
-abstract class SourceBaseTableAnnotation
- extends SourceAnnotation<Member>
- implements BaseTableAnnotation
-{
- final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
- final AnnotationElementAdapter<String> nameAdapter;
- String name;
-
- final DeclarationAnnotationElementAdapter<String> schemaDeclarationAdapter;
- final AnnotationElementAdapter<String> schemaAdapter;
- String schema;
-
- final DeclarationAnnotationElementAdapter<String> catalogDeclarationAdapter;
- final AnnotationElementAdapter<String> catalogAdapter;
- String catalog;
-
- final Vector<NestableUniqueConstraintAnnotation> uniqueConstraints = new Vector<NestableUniqueConstraintAnnotation>();
- final UniqueConstraintsAnnotationContainer uniqueConstraintsContainer = new UniqueConstraintsAnnotationContainer();
-
-
- SourceBaseTableAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
- this(parent, member, daa, new MemberAnnotationAdapter(member, daa));
- }
-
- SourceBaseTableAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
- this.nameDeclarationAdapter = this.getNameAdapter(daa);
- this.schemaDeclarationAdapter = this.getSchemaAdapter(daa);
- this.catalogDeclarationAdapter = this.getCatalogAdapter(daa);
- this.nameAdapter = this.buildAnnotationElementAdapter(this.nameDeclarationAdapter);
- this.schemaAdapter = this.buildAnnotationElementAdapter(this.schemaDeclarationAdapter);
- this.catalogAdapter = this.buildAnnotationElementAdapter(this.catalogDeclarationAdapter);
- }
-
- private AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) {
- return new ShortCircuitAnnotationElementAdapter<String>(this.member, daea);
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.name = this.buildName(astRoot);
- this.schema = this.buildSchema(astRoot);
- this.catalog = this.buildCatalog(astRoot);
- AnnotationContainerTools.initialize(this.uniqueConstraintsContainer, astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setName(this.buildName(astRoot));
- this.setSchema(this.buildSchema(astRoot));
- this.setCatalog(this.buildCatalog(astRoot));
- AnnotationContainerTools.update(this.uniqueConstraintsContainer, astRoot);
- }
-
- /**
- * Return the uniqueConstraints element name
- */
- abstract String getUniqueConstraintsElementName();
-
- @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) {
- if (this.attributeValueHasNotChanged(this.name, name)) {
- return;
- }
- String old = this.name;
- this.name = name;
- this.nameAdapter.setValue(name);
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- 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 and return a declaration element adapter for the table's 'name' element
- */
- abstract DeclarationAnnotationElementAdapter<String> getNameAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter);
-
- // ***** schema
- public String getSchema() {
- return this.schema;
- }
-
- public void setSchema(String schema) {
- if (this.attributeValueHasNotChanged(this.schema, schema)) {
- return;
- }
- String old = this.schema;
- this.schema = schema;
- this.schemaAdapter.setValue(schema);
- this.firePropertyChanged(SCHEMA_PROPERTY, old, schema);
- }
-
- 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 and return a declaration element adapter for the table's 'schema' element
- */
- abstract DeclarationAnnotationElementAdapter<String> getSchemaAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter);
-
- // ***** catalog
- public String getCatalog() {
- return this.catalog;
- }
-
- public void setCatalog(String catalog) {
- if (this.attributeValueHasNotChanged(this.catalog, catalog)) {
- return;
- }
- String old = this.catalog;
- this.catalog = catalog;
- this.catalogAdapter.setValue(catalog);
- this.firePropertyChanged(CATALOG_PROPERTY, old, catalog);
- }
-
- 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 and return a declaration element adapter for the table's 'catalog' element
- */
- abstract DeclarationAnnotationElementAdapter<String> getCatalogAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter);
-
- // ***** unique constraints
- public ListIterator<UniqueConstraintAnnotation> uniqueConstraints() {
- return new CloneListIterator<UniqueConstraintAnnotation>(this.uniqueConstraints);
- }
-
- ListIterator<NestableUniqueConstraintAnnotation> nestableUniqueConstraints() {
- return new CloneListIterator<NestableUniqueConstraintAnnotation>(this.uniqueConstraints);
- }
-
- public int uniqueConstraintsSize() {
- return this.uniqueConstraints.size();
- }
-
- public NestableUniqueConstraintAnnotation uniqueConstraintAt(int index) {
- return this.uniqueConstraints.get(index);
- }
-
- public int indexOfUniqueConstraint(UniqueConstraintAnnotation uniqueConstraint) {
- return this.uniqueConstraints.indexOf(uniqueConstraint);
- }
-
- public NestableUniqueConstraintAnnotation addUniqueConstraint(int index) {
- return (NestableUniqueConstraintAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.uniqueConstraintsContainer);
- }
-
- NestableUniqueConstraintAnnotation addUniqueConstraintInternal() {
- NestableUniqueConstraintAnnotation uniqueConstraint = this.buildUniqueConstraint(this.uniqueConstraints.size());
- this.uniqueConstraints.add(uniqueConstraint);
- return uniqueConstraint;
- }
-
- NestableUniqueConstraintAnnotation buildUniqueConstraint(int index) {
- return new SourceUniqueConstraintAnnotation(this, this.member, buildUniqueConstraintAnnotationAdapter(index));
- }
-
- IndexedDeclarationAnnotationAdapter buildUniqueConstraintAnnotationAdapter(int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(this.daa, getUniqueConstraintsElementName(), index, JPA.UNIQUE_CONSTRAINT);
- }
-
- void uniqueConstraintAdded(int index, NestableUniqueConstraintAnnotation constraint) {
- this.fireItemAdded(UNIQUE_CONSTRAINTS_LIST, index, constraint);
- }
-
- public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.uniqueConstraintsContainer);
- }
-
- NestableUniqueConstraintAnnotation moveUniqueConstraintInternal(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.uniqueConstraints, targetIndex, sourceIndex).get(targetIndex);
- }
-
- void uniqueConstraintMoved(int targetIndex, int sourceIndex) {
- this.fireItemMoved(UNIQUE_CONSTRAINTS_LIST, targetIndex, sourceIndex);
- }
-
- public void removeUniqueConstraint(int index) {
- AnnotationContainerTools.removeNestedAnnotation(index, this.uniqueConstraintsContainer);
- }
-
- NestableUniqueConstraintAnnotation removeUniqueConstraintInternal(int index) {
- return this.uniqueConstraints.remove(index);
- }
-
- void uniqueConstraintRemoved(int index, NestableUniqueConstraintAnnotation constraint) {
- this.fireItemRemoved(UNIQUE_CONSTRAINTS_LIST, index, constraint);
- }
-
-
- // ********** NestableAnnotation implementation **********
-
- protected void initializeFrom(NestableAnnotation oldAnnotation) {
- BaseTableAnnotation oldTable = (BaseTableAnnotation) oldAnnotation;
- this.setName(oldTable.getName());
- this.setSchema(oldTable.getSchema());
- this.setCatalog(oldTable.getCatalog());
- for (UniqueConstraintAnnotation oldUniqueConstraint : CollectionTools.iterable(oldTable.uniqueConstraints())) {
- NestableUniqueConstraintAnnotation newUniqueConstraint = this.addUniqueConstraint(oldTable.indexOfUniqueConstraint(oldUniqueConstraint));
- newUniqueConstraint.initializeFrom((NestableAnnotation) oldUniqueConstraint);
- }
- }
-
- // ********** unique constraint container **********
-
- /**
- * adapt the AnnotationContainer interface to the table's unique constraints
- */
- class UniqueConstraintsAnnotationContainer
- implements AnnotationContainer<NestableUniqueConstraintAnnotation>
- {
- public String getContainerAnnotationName() {
- return SourceBaseTableAnnotation.this.getAnnotationName();
- }
-
- public Annotation getContainerJdtAnnotation(CompilationUnit astRoot) {
- return SourceBaseTableAnnotation.this.getJdtAnnotation(astRoot);
- }
-
- public String getElementName() {
- return SourceBaseTableAnnotation.this.getUniqueConstraintsElementName();
- }
-
- public String getNestableAnnotationName() {
- return UniqueConstraintAnnotation.ANNOTATION_NAME;
- }
-
- public ListIterator<NestableUniqueConstraintAnnotation> nestedAnnotations() {
- return SourceBaseTableAnnotation.this.nestableUniqueConstraints();
- }
-
- public int nestedAnnotationsSize() {
- return SourceBaseTableAnnotation.this.uniqueConstraintsSize();
- }
-
- public NestableUniqueConstraintAnnotation addNestedAnnotationInternal() {
- return SourceBaseTableAnnotation.this.addUniqueConstraintInternal();
- }
-
- public void nestedAnnotationAdded(int index, NestableUniqueConstraintAnnotation nestedAnnotation) {
- SourceBaseTableAnnotation.this.uniqueConstraintAdded(index, nestedAnnotation);
- }
-
- public NestableUniqueConstraintAnnotation moveNestedAnnotationInternal(int targetIndex, int sourceIndex) {
- return SourceBaseTableAnnotation.this.moveUniqueConstraintInternal(targetIndex, sourceIndex);
- }
-
- public void nestedAnnotationMoved(int targetIndex, int sourceIndex) {
- SourceBaseTableAnnotation.this.uniqueConstraintMoved(targetIndex, sourceIndex);
- }
-
- public NestableUniqueConstraintAnnotation removeNestedAnnotationInternal(int index) {
- return SourceBaseTableAnnotation.this.removeUniqueConstraintInternal(index);
- }
-
- public void nestedAnnotationRemoved(int index, NestableUniqueConstraintAnnotation nestedAnnotation) {
- SourceBaseTableAnnotation.this.uniqueConstraintRemoved(index, nestedAnnotation);
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this);
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBasicAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBasicAnnotation.java
deleted file mode 100644
index c9d4466863..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBasicAnnotation.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.BooleanExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-
-/**
- * javax.persistence.Basic
- */
-public final class SourceBasicAnnotation
- extends SourceAnnotation<Attribute>
- implements BasicAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<Boolean> OPTIONAL_ADAPTER = buildOptionalAdapter();
- private final AnnotationElementAdapter<Boolean> optionalAdapter;
- private Boolean optional;
-
- private static final DeclarationAnnotationElementAdapter<String> FETCH_ADAPTER = buildFetchAdapter();
- private final AnnotationElementAdapter<String> fetchAdapter;
- private FetchType fetch;
-
-
- public SourceBasicAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.optionalAdapter = new ShortCircuitAnnotationElementAdapter<Boolean>(attribute, OPTIONAL_ADAPTER);
- this.fetchAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, FETCH_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.optional = this.buildOptional(astRoot);
- this.fetch = this.buildFetch(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setOptional(this.buildOptional(astRoot));
- this.setFetch(this.buildFetch(astRoot));
- }
-
- @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.attributeValueHasNotChanged(this.optional, optional)) {
- return;
- }
- Boolean old = this.optional;
- this.optional = optional;
- this.optionalAdapter.setValue(optional);
- this.firePropertyChanged(OPTIONAL_PROPERTY, old, optional);
- }
-
- protected 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.attributeValueHasNotChanged(this.fetch, fetch)) {
- return;
- }
- FetchType old = this.fetch;
- this.fetch = fetch;
- this.fetchAdapter.setValue(FetchType.toJavaAnnotationValue(fetch));
- this.firePropertyChanged(FETCH_PROPERTY, old, fetch);
- }
-
- protected 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, false, BooleanExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildFetchAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.BASIC__FETCH, false);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceColumnAnnotation.java
deleted file mode 100644
index e9179ab0b6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceColumnAnnotation.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.NestedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableColumnAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.Column
- */
-public final class SourceColumnAnnotation
- extends SourceBaseColumnAnnotation
- implements NestableColumnAnnotation
-{
- // 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);
-
- private final DeclarationAnnotationElementAdapter<Integer> lengthDeclarationAdapter;
- private final AnnotationElementAdapter<Integer> lengthAdapter;
- private Integer length;
-
- private final DeclarationAnnotationElementAdapter<Integer> precisionDeclarationAdapter;
- private final AnnotationElementAdapter<Integer> precisionAdapter;
- private Integer precision;
-
- private final DeclarationAnnotationElementAdapter<Integer> scaleDeclarationAdapter;
- private final AnnotationElementAdapter<Integer> scaleAdapter;
- private Integer scale;
-
-
- public SourceColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
- super(parent, member, daa);
- this.lengthDeclarationAdapter = this.buildIntegerElementAdapter(JPA.COLUMN__LENGTH);
- this.lengthAdapter = this.buildShortCircuitIntegerElementAdapter(this.lengthDeclarationAdapter);
- this.precisionDeclarationAdapter = this.buildIntegerElementAdapter(JPA.COLUMN__PRECISION);
- this.precisionAdapter = this.buildShortCircuitIntegerElementAdapter(this.precisionDeclarationAdapter);
- this.scaleDeclarationAdapter = this.buildIntegerElementAdapter(JPA.COLUMN__SCALE);
- this.scaleAdapter = this.buildShortCircuitIntegerElementAdapter(this.scaleDeclarationAdapter);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @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 update(CompilationUnit astRoot) {
- super.update(astRoot);
- this.setLength(this.buildLength(astRoot));
- this.setPrecision(this.buildPrecision(astRoot));
- this.setScale(this.buildScale(astRoot));
- }
-
-
- // ********** JavaSourceNamedColumnAnnotation implementation **********
-
- @Override
- protected String getNameElementName() {
- return JPA.COLUMN__NAME;
- }
-
- @Override
- protected String getColumnDefinitionElementName() {
- return JPA.COLUMN__COLUMN_DEFINITION;
- }
-
-
- // ********** JavaSourceBaseColumnAnnotation implementation **********
-
- @Override
- String getTableElementName() {
- return JPA.COLUMN__TABLE;
- }
-
- @Override
- String getUniqueElementName() {
- return JPA.COLUMN__UNIQUE;
- }
-
- @Override
- String getNullableElementName() {
- return JPA.COLUMN__NULLABLE;
- }
-
- @Override
- String getInsertableElementName() {
- return JPA.COLUMN__INSERTABLE;
- }
-
- @Override
- String getUpdatableElementName() {
- return JPA.COLUMN__UPDATABLE;
- }
-
-
- // ********** Column implementation **********
-
- // ***** length
- public Integer getLength() {
- return this.length;
- }
-
- public void setLength(Integer length) {
- if (this.attributeValueHasNotChanged(this.length, length)) {
- return;
- }
- Integer old = this.length;
- this.length = length;
- this.lengthAdapter.setValue(length);
- this.firePropertyChanged(LENGTH_PROPERTY, old, length);
- }
-
- private Integer buildLength(CompilationUnit astRoot) {
- return this.lengthAdapter.getValue(astRoot);
- }
-
- public TextRange getLengthTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.lengthDeclarationAdapter, astRoot);
- }
-
- // ***** precision
- public Integer getPrecision() {
- return this.precision;
- }
-
- public void setPrecision(Integer precision) {
- if (this.attributeValueHasNotChanged(this.precision, precision)) {
- return;
- }
- Integer old = this.precision;
- this.precision = precision;
- this.precisionAdapter.setValue(precision);
- this.firePropertyChanged(PRECISION_PROPERTY, old, precision);
- }
-
- private Integer buildPrecision(CompilationUnit astRoot) {
- return this.precisionAdapter.getValue(astRoot);
- }
-
- public TextRange getPrecisionTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.precisionDeclarationAdapter, astRoot);
- }
-
- // ***** scale
- public Integer getScale() {
- return this.scale;
- }
-
- public void setScale(Integer scale) {
- if (this.attributeValueHasNotChanged(this.scale, scale)) {
- return;
- }
- Integer old = this.scale;
- this.scale = scale;
- this.scaleAdapter.setValue(scale);
- this.firePropertyChanged(SCALE_PROPERTY, old, scale);
- }
-
- private Integer buildScale(CompilationUnit astRoot) {
- return this.scaleAdapter.getValue(astRoot);
- }
-
- public TextRange getScaleTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.scaleDeclarationAdapter, astRoot);
- }
-
-
- // ********** NestableAnnotation implementation **********
-
- @Override
- public void initializeFrom(NestableAnnotation oldAnnotation) {
- super.initializeFrom(oldAnnotation);
- ColumnAnnotation oldColumn = (ColumnAnnotation) oldAnnotation;
- this.setLength(oldColumn.getLength());
- this.setPrecision(oldColumn.getPrecision());
- this.setScale(oldColumn.getScale());
- }
-
- public void moveAnnotation(int newIndex) {
- // the only place where a column annotation is nested is in an
- // attribute override; and that only nests a single column, not an array
- // of columns; so #moveAnnotation(int) is never called
- // TODO maybe NestableAnnotation should be split up;
- // moving this method to something like IndexableAnnotation
- throw new UnsupportedOperationException();
- }
-
-
- // ********** static methods **********
-
- static NestableColumnAnnotation createAttributeOverrideColumn(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter attributeOverrideAnnotationAdapter) {
- return new SourceColumnAnnotation(parent, member, buildAttributeOverrideAnnotationAdapter(attributeOverrideAnnotationAdapter));
- }
-
- static DeclarationAnnotationAdapter buildAttributeOverrideAnnotationAdapter(DeclarationAnnotationAdapter attributeOverrideAnnotationAdapter) {
- return new NestedDeclarationAnnotationAdapter(attributeOverrideAnnotationAdapter, JPA.ATTRIBUTE_OVERRIDE__COLUMN, JPA.COLUMN);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceCompilationUnit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceCompilationUnit.java
deleted file mode 100644
index 38cc87c241..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceCompilationUnit.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.TypeDeclaration;
-import org.eclipse.jpt.core.JpaAnnotationProvider;
-import org.eclipse.jpt.core.JpaResourceModelListener;
-import org.eclipse.jpt.core.JpaResourceType;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.utility.jdt.JDTTools;
-import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationEditFormatter;
-import org.eclipse.jpt.utility.CommandExecutor;
-import org.eclipse.jpt.utility.internal.ListenerList;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-
-/**
- * Java compilation unit (source file)
- */
-public final class SourceCompilationUnit
- extends SourceNode
- implements JavaResourceCompilationUnit
-{
- /** JDT compilation unit */
- private final ICompilationUnit compilationUnit;
-
- /** pluggable annotation provider */
- private final JpaAnnotationProvider annotationProvider;
-
- /** improved annotation formatting */
- private final AnnotationEditFormatter annotationEditFormatter;
-
- /** pluggable executor that allows the document to be modified on another thread */
- private final CommandExecutor modifySharedDocumentCommandExecutor;
-
- /** listeners notified whenever the resource model changes */
- private final ListenerList<JpaResourceModelListener> resourceModelListenerList;
-
- /**
- * The primary type of the AST compilation unit. We are not going to handle
- * multiple types defined in a single compilation unit. Entities must have
- * a public/protected no-arg constructor, and there is no way to access
- * the constructor in a package class (which is what all top-level,
- * non-primary classes must be).
- */
- protected JavaResourcePersistentType persistentType;
-
-
- // ********** construction **********
-
- public SourceCompilationUnit(
- ICompilationUnit compilationUnit,
- JpaAnnotationProvider annotationProvider,
- AnnotationEditFormatter annotationEditFormatter,
- CommandExecutor modifySharedDocumentCommandExecutor) {
- super(null); // the JPA compilation unit is the root of its sub-tree
- this.compilationUnit = compilationUnit;
- this.annotationProvider = annotationProvider;
- this.annotationEditFormatter = annotationEditFormatter;
- this.modifySharedDocumentCommandExecutor = modifySharedDocumentCommandExecutor;
- this.resourceModelListenerList = new ListenerList<JpaResourceModelListener>(JpaResourceModelListener.class);
- this.persistentType = this.buildPersistentType();
- }
-
- protected JavaResourcePersistentType buildPersistentType() {
- this.openCompilationUnit();
- CompilationUnit astRoot = this.buildASTRoot();
- this.closeCompilationUnit();
- return this.buildPersistentType(astRoot);
- }
-
- protected void openCompilationUnit() {
- try {
- this.compilationUnit.open(null);
- } catch (JavaModelException ex) {
- // do nothing - we just won't have a primary type in this case
- }
- }
-
- protected void closeCompilationUnit() {
- try {
- this.compilationUnit.close();
- } catch (JavaModelException ex) {
- // hmmm
- }
- }
-
- protected JavaResourcePersistentType buildPersistentType(CompilationUnit astRoot) {
- TypeDeclaration td = this.getPrimaryType(astRoot);
- return (td == null) ? null : this.buildPersistentType(astRoot, td);
- }
-
-
- private void setPersistentType(JavaResourcePersistentType newPersistentType) {
- JavaResourcePersistentType old = this.persistentType;
- this.persistentType = newPersistentType;
- this.firePropertyChanged(PERSISTENT_TYPES_COLLECTION, old, newPersistentType);
- }
-
- @Override
- protected boolean requiresParent() {
- return false;
- }
-
- public void initialize(CompilationUnit astRoot) {
- // never called?
- }
-
-
- // ********** AbstractJavaResourceNode overrides **********
-
- @Override
- public JavaResourceCompilationUnit getRoot() {
- return this;
- }
-
- @Override
- public IFile getFile() {
- return (IFile) this.compilationUnit.getResource();
- }
-
- @Override
- public JpaAnnotationProvider getAnnotationProvider() {
- return this.annotationProvider;
- }
-
-
- // ********** JavaResourceNode implementation **********
-
- public void update(CompilationUnit astRoot) {
- TypeDeclaration td = this.getPrimaryType(astRoot);
- if (td == null) {
- this.setPersistentType(null);
- } else {
- if (this.persistentType == null) {
- this.setPersistentType(this.buildPersistentType(astRoot, td));
- } else {
- this.persistentType.update(astRoot);
- }
- }
- }
-
- public TextRange getTextRange(CompilationUnit astRoot) {
- return null;
- }
-
-
- // ********** JavaResourceNode.Root implementation **********
-
- /**
- * NB: return *all* the persistent types since we build them all
- */
- public Iterator<JavaResourcePersistentType> persistentTypes() {
- return (this.persistentType == null) ?
- EmptyIterator.<JavaResourcePersistentType>instance() :
- this.persistentType.allTypes();
- }
-
- public void resourceModelChanged() {
- for (JpaResourceModelListener listener : this.resourceModelListenerList.getListeners()) {
- listener.resourceModelChanged();
- }
- }
-
-
- // ********** JavaResourceCompilationUnit implementation **********
-
- public ICompilationUnit getCompilationUnit() {
- return this.compilationUnit;
- }
-
- public void resolveTypes() {
- if (this.persistentType != null) {
- this.persistentType.resolveTypes(this.buildASTRoot());
- }
- }
-
- public CommandExecutor getModifySharedDocumentCommandExecutor() {
- return this.modifySharedDocumentCommandExecutor;
- }
-
- public AnnotationEditFormatter getAnnotationEditFormatter() {
- return this.annotationEditFormatter;
- }
-
- public CompilationUnit buildASTRoot() {
- return JDTTools.buildASTRoot(this.compilationUnit);
- }
-
-
- // ********** JpaResourceModel implementation **********
-
- public JpaResourceType getResourceType() {
- return JptCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
- }
-
- public void addResourceModelListener(JpaResourceModelListener listener) {
- this.resourceModelListenerList.add(listener);
- }
-
- public void removeResourceModelListener(JpaResourceModelListener listener) {
- this.resourceModelListenerList.remove(listener);
- }
-
-
- // ********** Java changes **********
-
- public void update() {
- this.update(this.buildASTRoot());
- }
-
-
- // ********** internal **********
-
- protected JavaResourcePersistentType buildPersistentType(CompilationUnit astRoot, TypeDeclaration typeDeclaration) {
- return SourcePersistentType.newInstance(this, typeDeclaration, astRoot);
- }
-
- /**
- * i.e. the type with the same name as the compilation unit;
- * return the first class or interface (ignore annotations and enums) with
- * the same name as the compilation unit (file);
- * NB: this type could be in error if there is an annotation or enum
- * with the same name preceding it in the compilation unit
- *
- * Return null if the parser did not resolve the type declaration's binding.
- * This can occur if the project JRE is removed (bug 225332).
- */
- protected TypeDeclaration getPrimaryType(CompilationUnit astRoot) {
- String primaryTypeName = this.getPrimaryTypeName();
- for (AbstractTypeDeclaration atd : types(astRoot)) {
- if ((atd.getNodeType() == ASTNode.TYPE_DECLARATION)
- && atd.getName().getFullyQualifiedName().equals(primaryTypeName)) {
- return (atd.resolveBinding() == null) ? null : (TypeDeclaration) atd;
- }
- }
- return null;
- }
-
- // minimize scope of suppressed warnings
- @SuppressWarnings("unchecked")
- protected static List<AbstractTypeDeclaration> types(CompilationUnit astRoot) {
- return astRoot.types();
- }
-
- /**
- * i.e. the name of the compilation unit
- */
- protected String getPrimaryTypeName() {
- return removeJavaExtension(this.compilationUnit.getElementName());
- }
-
- protected static String removeJavaExtension(String fileName) {
- int index = fileName.lastIndexOf(".java"); //$NON-NLS-1$
- return (index == -1) ? fileName : fileName.substring(0, index);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getPrimaryTypeName());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceDiscriminatorColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceDiscriminatorColumnAnnotation.java
deleted file mode 100644
index 048986b6d9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceDiscriminatorColumnAnnotation.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.DiscriminatorColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.DiscriminatorType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.DiscriminatorColumn
- */
-public final class SourceDiscriminatorColumnAnnotation
- extends SourceNamedColumnAnnotation
- implements DiscriminatorColumnAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> DISCRIMINATOR_TYPE_ADAPTER = buildDiscriminatorTypeAdapter();
- private final AnnotationElementAdapter<String> discriminatorTypeAdapter;
- private DiscriminatorType discriminatorType;
-
- private final DeclarationAnnotationElementAdapter<Integer> lengthDeclarationAdapter;
- private final AnnotationElementAdapter<Integer> lengthAdapter;
- private Integer length;
-
-
- public SourceDiscriminatorColumnAnnotation(JavaResourcePersistentType parent, Member member, DeclarationAnnotationAdapter daa) {
- super(parent, member, daa);
- this.discriminatorTypeAdapter = new ShortCircuitAnnotationElementAdapter<String>(member, DISCRIMINATOR_TYPE_ADAPTER);
- this.lengthDeclarationAdapter = this.buildIntegerElementAdapter(JPA.DISCRIMINATOR_COLUMN__LENGTH);
- this.lengthAdapter = this.buildShortCircuitIntegerElementAdapter(this.lengthDeclarationAdapter);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.discriminatorType = this.buildDiscriminatorType(astRoot);
- this.length = this.buildLength(astRoot);
- }
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
- this.setLength(this.buildLength(astRoot));
- this.setDiscriminatorType(this.buildDiscriminatorType(astRoot));
- }
-
-
- // ********** JavaSourceNamedColumnAnnotation implementation **********
-
- @Override
- protected String getNameElementName() {
- return JPA.DISCRIMINATOR_COLUMN__NAME;
- }
-
- @Override
- protected String getColumnDefinitionElementName() {
- return JPA.DISCRIMINATOR_COLUMN__COLUMN_DEFINITION;
- }
-
-
- // ********** DiscriminatorColumn implementation **********
-
- // ***** discriminator type
- public DiscriminatorType getDiscriminatorType() {
- return this.discriminatorType;
- }
-
- public void setDiscriminatorType(DiscriminatorType discriminatorType) {
- if (this.attributeValueHasNotChanged(this.discriminatorType, discriminatorType)) {
- return;
- }
- DiscriminatorType old = this.discriminatorType;
- this.discriminatorType = discriminatorType;
- this.discriminatorTypeAdapter.setValue(DiscriminatorType.toJavaAnnotationValue(discriminatorType));
- this.firePropertyChanged(DISCRIMINATOR_TYPE_PROPERTY, old, discriminatorType);
- }
-
- private DiscriminatorType buildDiscriminatorType(CompilationUnit astRoot) {
- return DiscriminatorType.fromJavaAnnotationValue(this.discriminatorTypeAdapter.getValue(astRoot));
- }
-
- // ***** length
- public Integer getLength() {
- return this.length;
- }
-
- public void setLength(Integer length) {
- if (this.attributeValueHasNotChanged(this.length, length)) {
- return;
- }
- Integer old = this.length;
- this.length = length;
- this.lengthAdapter.setValue(length);
- this.firePropertyChanged(LENGTH_PROPERTY, old, length);
- }
-
- private Integer buildLength(CompilationUnit astRoot) {
- return this.lengthAdapter.getValue(astRoot);
- }
-
-
- // ********** NestableAnnotation implementation **********
-
- @Override
- public void initializeFrom(NestableAnnotation oldAnnotation) {
- throw new UnsupportedOperationException("DiscriminatorColumn is not a nestable annotation"); //$NON-NLS-1$
- }
-
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter<String> buildDiscriminatorTypeAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceDiscriminatorValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceDiscriminatorValueAnnotation.java
deleted file mode 100644
index 33dac08ce5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceDiscriminatorValueAnnotation.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.DiscriminatorValueAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * javax.persistence.DiscriminatorValue
- */
-public final class SourceDiscriminatorValueAnnotation
- extends SourceAnnotation<Type>
- implements DiscriminatorValueAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter();
- private final AnnotationElementAdapter<String> valueAdapter;
- private String value;
-
-
- public SourceDiscriminatorValueAnnotation(JavaResourceNode parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(type, VALUE_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.buildValue(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setValue(this.buildValue(astRoot));
- }
-
- @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.attributeValueHasNotChanged(this.value, value)) {
- return;
- }
- String old = this.value;
- this.value = value;
- this.valueAdapter.setValue(value);
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private String buildValue(CompilationUnit astRoot) {
- return this.valueAdapter.getValue(astRoot);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(VALUE_ADAPTER, astRoot);
- }
-
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.DISCRIMINATOR_VALUE__VALUE);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddableAnnotation.java
deleted file mode 100644
index 787e136a18..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddableAnnotation.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * javax.persistence.Embeddable
- */
-public final class SourceEmbeddableAnnotation
- extends SourceAnnotation<Type>
- implements EmbeddableAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
-
- public SourceEmbeddableAnnotation(JavaResourcePersistentType parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- // nothing to initialize
- }
-
- public void update(CompilationUnit astRoot) {
- // nothing to update
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddedAnnotation.java
deleted file mode 100644
index 723086ad8a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddedAnnotation.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-
-/**
- * javax.persistence.Embedded
- */
-public final class SourceEmbeddedAnnotation
- extends SourceAnnotation<Attribute>
- implements EmbeddedAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
-
- public SourceEmbeddedAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- // nothing to initialize
- }
-
- public void update(CompilationUnit astRoot) {
- // nothing to update
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddedIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddedIdAnnotation.java
deleted file mode 100644
index c35382bb7d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddedIdAnnotation.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-
-/**
- * javax.persistence.EmbeddedId
- */
-public final class SourceEmbeddedIdAnnotation
- extends SourceAnnotation<Attribute>
- implements EmbeddedIdAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
-
- public SourceEmbeddedIdAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- // nothing to initialize
- }
-
- public void update(CompilationUnit astRoot) {
- // nothing to update
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEntityAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEntityAnnotation.java
deleted file mode 100644
index 55662448e9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEntityAnnotation.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * javax.persistence.Entity
- */
-public final class SourceEntityAnnotation
- extends SourceAnnotation<Type>
- implements EntityAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildNameAdapter();
- private final AnnotationElementAdapter<String> nameAdapter;
- private String name;
-
-
- public SourceEntityAnnotation(JavaResourcePersistentType parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- this.nameAdapter = new ShortCircuitAnnotationElementAdapter<String>(this.member, NAME_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.name = this.buildName(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setName(this.buildName(astRoot));
- }
-
- @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.attributeValueHasNotChanged(this.name, name)) {
- return;
- }
- String old = this.name;
- this.name = name;
- this.nameAdapter.setValue(name);
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- private String buildName(CompilationUnit astRoot) {
- return this.nameAdapter.getValue(astRoot);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(NAME_ADAPTER, astRoot);
- }
-
-
- //*********** static methods ****************
-
- private static DeclarationAnnotationElementAdapter<String> buildNameAdapter() {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.ENTITY__NAME, false); // false = do not remove annotation when empty
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEnumeratedAnnotation.java
deleted file mode 100644
index 9ba3ff5f65..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEnumeratedAnnotation.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.EnumType;
-import org.eclipse.jpt.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-
-/**
- * javax.persistence.Enumerated
- */
-public final class SourceEnumeratedAnnotation
- extends SourceAnnotation<Attribute>
- implements EnumeratedAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter();
- private final AnnotationElementAdapter<String> valueAdapter;
- private EnumType value;
-
-
- public SourceEnumeratedAnnotation(JavaResourceNode parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, VALUE_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.buildValue(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setValue(this.buildValue(astRoot));
- }
-
- @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.attributeValueHasNotChanged(this.value, value)) {
- return;
- }
- EnumType old = this.value;
- this.value = value;
- this.valueAdapter.setValue(EnumType.toJavaAnnotationValue(value));
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private EnumType buildValue(CompilationUnit astRoot) {
- return EnumType.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, JPA.ENUMERATED__VALUE, false);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceGeneratedValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceGeneratedValueAnnotation.java
deleted file mode 100644
index 8461845e88..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceGeneratedValueAnnotation.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.core.resource.java.GenerationType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.GeneratedValue
- */
-public final class SourceGeneratedValueAnnotation
- extends SourceAnnotation<Member>
- implements GeneratedValueAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> STRATEGY_ADAPTER = buildStrategyAdapter();
- private final AnnotationElementAdapter<String> strategyAdapter;
- private GenerationType strategy;
-
- private static final DeclarationAnnotationElementAdapter<String> GENERATOR_ADAPTER = buildGeneratorAdapter();
- private final AnnotationElementAdapter<String> generatorAdapter;
- private String generator;
-
-
- public SourceGeneratedValueAnnotation(JavaResourceNode parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- this.strategyAdapter = new ShortCircuitAnnotationElementAdapter<String>(member, STRATEGY_ADAPTER);
- this.generatorAdapter = new ShortCircuitAnnotationElementAdapter<String>(member, GENERATOR_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.strategy = this.buildStrategy(astRoot);
- this.generator = this.buildGenerator(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setStrategy(this.buildStrategy(astRoot));
- this.setGenerator(this.buildGenerator(astRoot));
- }
-
- @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.attributeValueHasNotChanged(this.strategy, strategy)) {
- return;
- }
- GenerationType old = this.strategy;
- this.strategy = strategy;
- this.strategyAdapter.setValue(GenerationType.toJavaAnnotationValue(strategy));
- this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
- }
-
- 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.attributeValueHasNotChanged(this.generator, generator)) {
- return;
- }
- String old = this.generator;
- this.generator = generator;
- this.generatorAdapter.setValue(generator);
- this.firePropertyChanged(GENERATOR_PROPERTY, old, generator);
- }
-
- 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, false);
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildGeneratorAdapter() {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.GENERATED_VALUE__GENERATOR, false);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceGeneratorAnnotation.java
deleted file mode 100644
index fd6d68a5ed..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceGeneratorAnnotation.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NumberIntegerExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.resource.java.GeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.SequenceGenerator
- * javax.persistence.TableGenerator
- */
-abstract class SourceGeneratorAnnotation
- extends SourceAnnotation<Member>
- implements GeneratorAnnotation
-{
- final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
- final AnnotationElementAdapter<String> nameAdapter;
- String name;
-
- final DeclarationAnnotationElementAdapter<Integer> initialValueDeclarationAdapter;
- final AnnotationElementAdapter<Integer> initialValueAdapter;
- Integer initialValue;
-
- final DeclarationAnnotationElementAdapter<Integer> allocationSizeDeclarationAdapter;
- final AnnotationElementAdapter<Integer> allocationSizeAdapter;
- Integer allocationSize;
-
-
- SourceGeneratorAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
- super(parent, member, daa);
- this.nameDeclarationAdapter = this.getNameAdapter();
- this.nameAdapter = this.buildAdapter(this.nameDeclarationAdapter);
- this.initialValueDeclarationAdapter = this.getInitialValueAdapter();
- this.initialValueAdapter = this.buildIntegerAdapter(this.initialValueDeclarationAdapter);
- this.allocationSizeDeclarationAdapter = this.getAllocationSizeAdapter();
- this.allocationSizeAdapter = this.buildIntegerAdapter(this.allocationSizeDeclarationAdapter);
- }
-
- protected AnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationElementAdapter<String> daea) {
- return new ShortCircuitAnnotationElementAdapter<String>(this.member, daea);
- }
-
- protected AnnotationElementAdapter<Integer> buildIntegerAdapter(DeclarationAnnotationElementAdapter<Integer> daea) {
- return new ShortCircuitAnnotationElementAdapter<Integer>(this.member, daea);
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.name = this.buildName(astRoot);
- this.initialValue = this.buildInitialValue(astRoot);
- this.allocationSize = this.buildAllocationSize(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setName(this.buildName(astRoot));
- this.setInitialValue(this.buildInitialValue(astRoot));
- this.setAllocationSize(this.buildAllocationSize(astRoot));
- }
-
- @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.attributeValueHasNotChanged(this.name, name)) {
- return;
- }
- String old = this.name;
- this.name = name;
- this.nameAdapter.setValue(name);
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- private String buildName(CompilationUnit astRoot) {
- return this.nameAdapter.getValue(astRoot);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.nameDeclarationAdapter, astRoot);
- }
-
- abstract DeclarationAnnotationElementAdapter<String> getNameAdapter();
-
- // ***** initial value
- public Integer getInitialValue() {
- return this.initialValue;
- }
-
- public void setInitialValue(Integer initialValue) {
- if (this.attributeValueHasNotChanged(this.initialValue, initialValue)) {
- return;
- }
- Integer old = this.initialValue;
- this.initialValue = initialValue;
- this.initialValueAdapter.setValue(initialValue);
- this.firePropertyChanged(INITIAL_VALUE_PROPERTY, old, initialValue);
- }
-
- 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.attributeValueHasNotChanged(this.allocationSize, allocationSize)) {
- return;
- }
- Integer old = this.allocationSize;
- this.allocationSize = allocationSize;
- this.allocationSizeAdapter.setValue(allocationSize);
- this.firePropertyChanged(ALLOCATION_SIZE_PROPERTY, old, allocationSize);
- }
-
- private Integer buildAllocationSize(CompilationUnit astRoot) {
- return this.allocationSizeAdapter.getValue(astRoot);
- }
-
- public TextRange getAllocationSizeTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.allocationSizeDeclarationAdapter, astRoot);
- }
-
- abstract DeclarationAnnotationElementAdapter<Integer> getAllocationSizeAdapter();
-
-
- // ********** static methods **********
-
- static DeclarationAnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(annotationAdapter, elementName);
- }
-
- static DeclarationAnnotationElementAdapter<Integer> buildIntegerAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return new ConversionDeclarationAnnotationElementAdapter<Integer>(annotationAdapter, elementName, NumberIntegerExpressionConverter.instance());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceIdAnnotation.java
deleted file mode 100644
index 224785258d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceIdAnnotation.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-
-/**
- * javax.persistence.Id
- */
-public final class SourceIdAnnotation
- extends SourceAnnotation<Attribute>
- implements IdAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
-
- public SourceIdAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- // nothing to initialize
- }
-
- public void update(CompilationUnit astRoot) {
- // nothing to update
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceIdClassAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceIdClassAnnotation.java
deleted file mode 100644
index 96712da0a5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceIdClassAnnotation.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.JDTTools;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
-import org.eclipse.jpt.core.resource.java.IdClassAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * javax.persistence.IdClass
- */
-public final class SourceIdClassAnnotation
- extends SourceAnnotation<Type>
- implements IdClassAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter();
- private final AnnotationElementAdapter<String> valueAdapter;
- private String value;
-
- private String fullyQualifiedClassName;
-
-
- public SourceIdClassAnnotation(JavaResourceNode parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(type, VALUE_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.buildValue(astRoot);
- this.fullyQualifiedClassName = this.buildFullyQualifiedClassName(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setValue(this.buildValue(astRoot));
- this.setFullyQualifiedClassName(this.buildFullyQualifiedClassName(astRoot));
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.value);
- }
-
-
- // ********** IdClassAnnotation implementation **********
-
- // ***** value
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- if (this.attributeValueHasNotChanged(this.value, value)) {
- return;
- }
- String old = this.value;
- this.value = value;
- this.valueAdapter.setValue(value);
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private String buildValue(CompilationUnit astRoot) {
- return this.valueAdapter.getValue(astRoot);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(VALUE_ADAPTER, astRoot);
- }
-
- // ***** fully-qualified class name
- public String getFullyQualifiedClassName() {
- return this.fullyQualifiedClassName;
- }
-
- private void setFullyQualifiedClassName(String fullyQualifiedClassName) {
- String old = this.fullyQualifiedClassName;
- this.fullyQualifiedClassName = fullyQualifiedClassName;
- this.firePropertyChanged(FULLY_QUALIFIED_CLASS_NAME_PROPERTY, old, fullyQualifiedClassName);
- }
-
- private String buildFullyQualifiedClassName(CompilationUnit astRoot) {
- return (this.value == null) ? null : JDTTools.resolveFullyQualifiedName(this.valueAdapter.getExpression(astRoot));
- }
-
-
- // ********** static methods **********
-
- protected static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, JPA.ID_CLASS__VALUE, SimpleTypeStringExpressionConverter.instance());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceInheritanceAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceInheritanceAnnotation.java
deleted file mode 100644
index 12957ce4b5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceInheritanceAnnotation.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.InheritanceAnnotation;
-import org.eclipse.jpt.core.resource.java.InheritanceType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * javax.persistence.Inheritance
- */
-public final class SourceInheritanceAnnotation
- extends SourceAnnotation<Type>
- implements InheritanceAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> STRATEGY_ADAPTER = buildStrategyAdapter();
- private final AnnotationElementAdapter<String> strategyAdapter;
- private InheritanceType strategy;
-
-
- public SourceInheritanceAnnotation(JavaResourcePersistentType parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- this.strategyAdapter = new ShortCircuitAnnotationElementAdapter<String>(type, STRATEGY_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.strategy = this.buildStrategy(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setStrategy(this.buildStrategy(astRoot));
- }
-
- @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.attributeValueHasNotChanged(this.strategy, strategy)) {
- return;
- }
- InheritanceType old = this.strategy;
- this.strategy = strategy;
- this.strategyAdapter.setValue(InheritanceType.toJavaAnnotationValue(strategy));
- this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
- }
-
- private InheritanceType buildStrategy(CompilationUnit astRoot) {
- return InheritanceType.fromJavaAnnotationValue(this.strategyAdapter.getValue(astRoot));
- }
-
- public TextRange getStrategyTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(STRATEGY_ADAPTER, astRoot);
- }
-
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter<String> buildStrategyAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.INHERITANCE__STRATEGY);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinColumnAnnotation.java
deleted file mode 100644
index 03fc7a6b8a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinColumnAnnotation.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberIndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableJoinColumnAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.JoinColumn
- */
-public final class SourceJoinColumnAnnotation
- extends SourceBaseColumnAnnotation
- implements NestableJoinColumnAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final DeclarationAnnotationElementAdapter<String> referencedColumnNameDeclarationAdapter;
- private final AnnotationElementAdapter<String> referencedColumnNameAdapter;
- private String referencedColumnName;
-
-
- public SourceJoinColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
- this.referencedColumnNameDeclarationAdapter = this.buildStringElementAdapter(JPA.JOIN_COLUMN__REFERENCED_COLUMN_NAME);
- this.referencedColumnNameAdapter = this.buildShortCircuitElementAdapter(this.referencedColumnNameDeclarationAdapter);
- }
-
- public SourceJoinColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
- this(parent, member, daa, new MemberAnnotationAdapter(member, daa));
- }
-
- public SourceJoinColumnAnnotation(JavaResourceNode parent, Member member, IndexedDeclarationAnnotationAdapter idaa) {
- this(parent, member, idaa, new MemberIndexedAnnotationAdapter(member, idaa));
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.referencedColumnName = this.buildReferencedColumnName(astRoot);
- }
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
- this.setReferencedColumnName(this.buildReferencedColumnName(astRoot));
- }
-
-
- // ********** JavaSourceNamedColumnAnnotation implementation **********
-
- @Override
- protected String getNameElementName() {
- return JPA.JOIN_COLUMN__NAME;
- }
-
- @Override
- protected String getColumnDefinitionElementName() {
- return JPA.JOIN_COLUMN__COLUMN_DEFINITION;
- }
-
-
- // ********** JavaSourceNamedColumnAnnotation implementation **********
-
- @Override
- String getTableElementName() {
- return JPA.JOIN_COLUMN__TABLE;
- }
-
- @Override
- String getUniqueElementName() {
- return JPA.JOIN_COLUMN__UNIQUE;
- }
-
- @Override
- String getNullableElementName() {
- return JPA.JOIN_COLUMN__NULLABLE;
- }
-
- @Override
- String getInsertableElementName() {
- return JPA.JOIN_COLUMN__INSERTABLE;
- }
-
- @Override
- String getUpdatableElementName() {
- return JPA.JOIN_COLUMN__UPDATABLE;
- }
-
-
- //************ JoinColumn implementation ***************
-
- // referenced column name
- public String getReferencedColumnName() {
- return this.referencedColumnName;
- }
-
- public void setReferencedColumnName(String referencedColumnName) {
- if (this.attributeValueHasNotChanged(this.referencedColumnName, referencedColumnName)) {
- return;
- }
- String old = this.referencedColumnName;
- this.referencedColumnName = referencedColumnName;
- this.referencedColumnNameAdapter.setValue(referencedColumnName);
- this.firePropertyChanged(REFERENCED_COLUMN_NAME_PROPERTY, old, referencedColumnName);
- }
-
- 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);
- }
-
-
- // ********** NestableAnnotation implementation **********
-
- @Override
- public void initializeFrom(NestableAnnotation oldAnnotation) {
- super.initializeFrom(oldAnnotation);
- JoinColumnAnnotation oldJoinColumn = (JoinColumnAnnotation) oldAnnotation;
- this.setReferencedColumnName(oldJoinColumn.getReferencedColumnName());
- }
-
- public void moveAnnotation(int newIndex) {
- this.getIndexedAnnotationAdapter().moveAnnotation(newIndex);
- }
-
- protected IndexedAnnotationAdapter getIndexedAnnotationAdapter() {
- return (IndexedAnnotationAdapter) this.annotationAdapter;
- }
-
-
- // ********** static methods **********
-
- public static SourceJoinColumnAnnotation createJoinColumn(JavaResourceNode parent, Member member) {
- return new SourceJoinColumnAnnotation(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- static SourceJoinColumnAnnotation createNestedJoinColumn(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter joinColumnsAdapter) {
- IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, joinColumnsAdapter);
- IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(member, idaa);
- return new SourceJoinColumnAnnotation(parent, member, idaa, annotationAdapter);
- }
-
- private static IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter joinColumnsAdapter) {
- return new NestedIndexedDeclarationAnnotationAdapter(joinColumnsAdapter, index, JPA.JOIN_COLUMN);
- }
-
- static NestableJoinColumnAnnotation createAssociationOverrideJoinColumn(DeclarationAnnotationAdapter associationOverrideAdapter, JavaResourceNode parent, Member member, int index) {
- return new SourceJoinColumnAnnotation(parent, member, buildAssociationOverrideAnnotationAdapter(associationOverrideAdapter, index));
- }
-
- private static IndexedDeclarationAnnotationAdapter buildAssociationOverrideAnnotationAdapter(DeclarationAnnotationAdapter associationOverrideAdapter, int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(associationOverrideAdapter, JPA.ASSOCIATION_OVERRIDE__JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinColumnsAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinColumnsAnnotation.java
deleted file mode 100644
index 30f633fd88..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinColumnsAnnotation.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinColumnsAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableJoinColumnAnnotation;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.JoinColumns
- */
-public final class SourceJoinColumnsAnnotation
- extends SourceAnnotation<Member>
- implements JoinColumnsAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final Vector<NestableJoinColumnAnnotation> joinColumns = new Vector<NestableJoinColumnAnnotation>();
-
-
- public SourceJoinColumnsAnnotation(JavaResourceNode parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- AnnotationContainerTools.initialize(this, astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- AnnotationContainerTools.update(this, astRoot);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.joinColumns);
- }
-
-
- // ********** AnnotationContainer implementation **********
-
- public String getContainerAnnotationName() {
- return this.getAnnotationName();
- }
-
- public org.eclipse.jdt.core.dom.Annotation getContainerJdtAnnotation(CompilationUnit astRoot) {
- return this.getJdtAnnotation(astRoot);
- }
-
- public String getElementName() {
- return JPA.JOIN_COLUMNS__VALUE;
- }
-
- public String getNestableAnnotationName() {
- return JoinColumnAnnotation.ANNOTATION_NAME;
- }
-
- public ListIterator<NestableJoinColumnAnnotation> nestedAnnotations() {
- return new CloneListIterator<NestableJoinColumnAnnotation>(this.joinColumns);
- }
-
- public int nestedAnnotationsSize() {
- return this.joinColumns.size();
- }
-
- public NestableJoinColumnAnnotation addNestedAnnotationInternal() {
- NestableJoinColumnAnnotation joinColumn = this.buildJoinColumn(this.joinColumns.size());
- this.joinColumns.add(joinColumn);
- return joinColumn;
- }
-
- private NestableJoinColumnAnnotation buildJoinColumn(int index) {
- return SourceJoinColumnAnnotation.createNestedJoinColumn(this, this.member, index, this.daa);
- }
-
- public void nestedAnnotationAdded(int index, NestableJoinColumnAnnotation nestedAnnotation) {
- this.fireItemAdded(JOIN_COLUMNS_LIST, index, nestedAnnotation);
- }
-
- public NestableJoinColumnAnnotation moveNestedAnnotationInternal(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.joinColumns, targetIndex, sourceIndex).get(targetIndex);
- }
-
- public void nestedAnnotationMoved(int targetIndex, int sourceIndex) {
- this.fireItemMoved(JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
- }
-
- public NestableJoinColumnAnnotation removeNestedAnnotationInternal(int index) {
- return this.joinColumns.remove(index);
- }
-
- public void nestedAnnotationRemoved(int index, NestableJoinColumnAnnotation nestedAnnotation) {
- this.fireItemRemoved(JOIN_COLUMNS_LIST, index, nestedAnnotation);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinTableAnnotation.java
deleted file mode 100644
index 56822b9f22..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinTableAnnotation.java
+++ /dev/null
@@ -1,381 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.AnnotationContainer;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableJoinTableAnnotation;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.JoinTable
- */
-public class SourceJoinTableAnnotation
- extends SourceBaseTableAnnotation
- implements NestableJoinTableAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JoinTableAnnotation.ANNOTATION_NAME);
-
-
- private final Vector<NestableJoinColumnAnnotation> joinColumns = new Vector<NestableJoinColumnAnnotation>();
- private final JoinColumnsAnnotationContainer joinColumnsContainer = new JoinColumnsAnnotationContainer();
-
- private final Vector<NestableJoinColumnAnnotation> inverseJoinColumns = new Vector<NestableJoinColumnAnnotation>();
- private final InverseJoinColumnsContainerAnnotation inverseJoinColumnsContainer = new InverseJoinColumnsContainerAnnotation();
-
-
- public SourceJoinTableAnnotation(JavaResourceNode parent, Member member) {
- this(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public SourceJoinTableAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
- super(parent, member, daa);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- AnnotationContainerTools.initialize(this.joinColumnsContainer, astRoot);
- AnnotationContainerTools.initialize(this.inverseJoinColumnsContainer, astRoot);
- }
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
- AnnotationContainerTools.update(this.joinColumnsContainer, astRoot);
- AnnotationContainerTools.update(this.inverseJoinColumnsContainer, astRoot);
- }
-
-
- // ********** AbstractBaseTableAnnotation implementation **********
-
- @Override
- DeclarationAnnotationElementAdapter<String> getNameAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(declarationAnnotationAdapter, JPA.JOIN_TABLE__NAME);
- }
-
- @Override
- DeclarationAnnotationElementAdapter<String> getSchemaAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(declarationAnnotationAdapter, JPA.JOIN_TABLE__SCHEMA);
- }
-
- @Override
- DeclarationAnnotationElementAdapter<String> getCatalogAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(declarationAnnotationAdapter, JPA.JOIN_TABLE__CATALOG);
- }
-
- @Override
- String getUniqueConstraintsElementName() {
- return JPA.JOIN_TABLE__UNIQUE_CONSTRAINTS;
- }
-
- // ********** JoinTableAnnotation implementation **********
-
- // ***** join columns
- public ListIterator<JoinColumnAnnotation> joinColumns() {
- return new CloneListIterator<JoinColumnAnnotation>(this.joinColumns);
- }
-
- ListIterator<NestableJoinColumnAnnotation> nestableJoinColumns() {
- return new CloneListIterator<NestableJoinColumnAnnotation>(this.joinColumns);
- }
-
- public int joinColumnsSize() {
- return this.joinColumns.size();
- }
-
- public NestableJoinColumnAnnotation joinColumnAt(int index) {
- return this.joinColumns.get(index);
- }
-
- public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
- return this.joinColumns.indexOf(joinColumn);
- }
-
- public NestableJoinColumnAnnotation addJoinColumn(int index) {
- return (NestableJoinColumnAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.joinColumnsContainer);
- }
-
- NestableJoinColumnAnnotation addJoinColumnInternal() {
- NestableJoinColumnAnnotation joinColumn = this.buildJoinColumn(this.joinColumns.size());
- this.joinColumns.add(joinColumn);
- return joinColumn;
- }
-
- private NestableJoinColumnAnnotation buildJoinColumn(int index) {
- return new SourceJoinColumnAnnotation(this, this.member, buildJoinColumnAnnotationAdapter(index));
- }
-
- private IndexedDeclarationAnnotationAdapter buildJoinColumnAnnotationAdapter(int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(this.daa, JPA.JOIN_TABLE__JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
- }
-
- void joinColumnAdded(int index, NestableJoinColumnAnnotation joinColumn) {
- this.fireItemAdded(JOIN_COLUMNS_LIST, index, joinColumn);
- }
-
- public void moveJoinColumn(int targetIndex, int sourceIndex) {
- AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.joinColumnsContainer);
- }
-
- NestableJoinColumnAnnotation moveJoinColumnInternal(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.joinColumns, targetIndex, sourceIndex).get(targetIndex);
- }
-
- void joinColumnMoved(int targetIndex, int sourceIndex) {
- this.fireItemMoved(JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
- }
-
- public void removeJoinColumn(int index) {
- AnnotationContainerTools.removeNestedAnnotation(index, this.joinColumnsContainer);
- }
-
- NestableJoinColumnAnnotation removeJoinColumnInternal(int index) {
- return this.joinColumns.remove(index);
- }
-
- void joinColumnRemoved(int index, NestableJoinColumnAnnotation joinColumn) {
- this.fireItemRemoved(JOIN_COLUMNS_LIST, index, joinColumn);
- }
-
- public JoinColumnAnnotation initializeJoinColumns() {
- return this.addJoinColumnInternal();
- }
-
- // ***** inverse join columns
- public ListIterator<JoinColumnAnnotation> inverseJoinColumns() {
- return new CloneListIterator<JoinColumnAnnotation>(this.inverseJoinColumns);
- }
-
- ListIterator<NestableJoinColumnAnnotation> nestableInverseJoinColumns() {
- return new CloneListIterator<NestableJoinColumnAnnotation>(this.inverseJoinColumns);
- }
-
- public int inverseJoinColumnsSize() {
- return this.inverseJoinColumns.size();
- }
-
- public NestableJoinColumnAnnotation inverseJoinColumnAt(int index) {
- return this.inverseJoinColumns.get(index);
- }
-
- public int indexOfInverseJoinColumn(JoinColumnAnnotation joinColumn) {
- return this.inverseJoinColumns.indexOf(joinColumn);
- }
-
- public NestableJoinColumnAnnotation addInverseJoinColumn(int index) {
- return (NestableJoinColumnAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.inverseJoinColumnsContainer);
- }
-
- NestableJoinColumnAnnotation addInverseJoinColumnInternal() {
- NestableJoinColumnAnnotation joinColumn = this.buildInverseJoinColumn(this.inverseJoinColumns.size());
- this.inverseJoinColumns.add(joinColumn);
- return joinColumn;
- }
-
- private NestableJoinColumnAnnotation buildInverseJoinColumn(int index) {
- return new SourceJoinColumnAnnotation(this, this.member, buildInverseJoinColumnAnnotationAdapter(index));
- }
-
- private IndexedDeclarationAnnotationAdapter buildInverseJoinColumnAnnotationAdapter(int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(this.daa, JPA.JOIN_TABLE__INVERSE_JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
- }
-
- void inverseJoinColumnAdded(int index, NestableJoinColumnAnnotation joinColumn) {
- this.fireItemAdded(INVERSE_JOIN_COLUMNS_LIST, index, joinColumn);
- }
-
- public void moveInverseJoinColumn(int targetIndex, int sourceIndex) {
- AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.inverseJoinColumnsContainer);
- }
-
- NestableJoinColumnAnnotation moveInverseJoinColumnInternal(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.inverseJoinColumns, targetIndex, sourceIndex).get(targetIndex);
- }
-
- void inverseJoinColumnMoved(int targetIndex, int sourceIndex) {
- this.fireItemMoved(INVERSE_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
- }
-
- public void removeInverseJoinColumn(int index) {
- AnnotationContainerTools.removeNestedAnnotation(index, this.inverseJoinColumnsContainer);
- }
-
- NestableJoinColumnAnnotation removeInverseJoinColumnInternal(int index) {
- return this.inverseJoinColumns.remove(index);
- }
-
- void inverseJoinColumnRemoved(int index, NestableJoinColumnAnnotation joinColumn) {
- this.fireItemRemoved(INVERSE_JOIN_COLUMNS_LIST, index, joinColumn);
- }
-
- public JoinColumnAnnotation initializeInverseJoinColumns() {
- return this.addInverseJoinColumnInternal();
- }
-
- // ********** NestableAnnotation implementation **********
-
- @Override
- public void initializeFrom(NestableAnnotation oldAnnotation) {
- super.initializeFrom(oldAnnotation);
- JoinTableAnnotation oldJoinTable = (JoinTableAnnotation) oldAnnotation;
- for (JoinColumnAnnotation oldJoinColumn : CollectionTools.iterable(oldJoinTable.joinColumns())) {
- NestableJoinColumnAnnotation newJoinColumn = this.addJoinColumn(oldJoinTable.indexOfJoinColumn(oldJoinColumn));
- newJoinColumn.initializeFrom((NestableAnnotation) oldJoinColumn);
- }
- for (JoinColumnAnnotation oldInverseJoinColumn : CollectionTools.iterable(oldJoinTable.inverseJoinColumns())) {
- NestableJoinColumnAnnotation newInverseJoinColumn = this.addInverseJoinColumn(oldJoinTable.indexOfInverseJoinColumn(oldInverseJoinColumn));
- newInverseJoinColumn.initializeFrom((NestableAnnotation) oldInverseJoinColumn);
- }
- }
-
- public void moveAnnotation(int newIndex) {
- // the only place where a join table annotation is nested is in an
- // association override; and that only nests a single join table, not an array
- // of join tables; so #moveAnnotation(int) is never called
- // TODO maybe NestableAnnotation should be split up;
- // moving this method to something like IndexableAnnotation
- throw new UnsupportedOperationException();
- }
-
- // ********** annotation containers **********
-
- abstract class AbstractJoinColumnAnnotationContainer
- implements AnnotationContainer<NestableJoinColumnAnnotation>
- {
- public String getContainerAnnotationName() {
- return SourceJoinTableAnnotation.this.getAnnotationName();
- }
-
- public org.eclipse.jdt.core.dom.Annotation getContainerJdtAnnotation(CompilationUnit astRoot) {
- return SourceJoinTableAnnotation.this.getJdtAnnotation(astRoot);
- }
-
- public String getNestableAnnotationName() {
- return JoinColumnAnnotation.ANNOTATION_NAME;
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this);
- }
- }
-
-
- /**
- * adapt the AnnotationContainer interface to the join table's join columns
- */
- class JoinColumnsAnnotationContainer
- extends AbstractJoinColumnAnnotationContainer
- {
- public String getElementName() {
- return JPA.JOIN_TABLE__JOIN_COLUMNS;
- }
-
- public ListIterator<NestableJoinColumnAnnotation> nestedAnnotations() {
- return SourceJoinTableAnnotation.this.nestableJoinColumns();
- }
-
- public int nestedAnnotationsSize() {
- return SourceJoinTableAnnotation.this.joinColumnsSize();
- }
-
- public NestableJoinColumnAnnotation addNestedAnnotationInternal() {
- return SourceJoinTableAnnotation.this.addJoinColumnInternal();
- }
-
- public void nestedAnnotationAdded(int index, NestableJoinColumnAnnotation nestedAnnotation) {
- SourceJoinTableAnnotation.this.joinColumnAdded(index, nestedAnnotation);
- }
-
- public NestableJoinColumnAnnotation moveNestedAnnotationInternal(int targetIndex, int sourceIndex) {
- return SourceJoinTableAnnotation.this.moveJoinColumnInternal(targetIndex, sourceIndex);
- }
-
- public void nestedAnnotationMoved(int targetIndex, int sourceIndex) {
- SourceJoinTableAnnotation.this.joinColumnMoved(targetIndex, sourceIndex);
- }
-
- public NestableJoinColumnAnnotation removeNestedAnnotationInternal(int index) {
- return SourceJoinTableAnnotation.this.removeJoinColumnInternal(index);
- }
-
- public void nestedAnnotationRemoved(int index, NestableJoinColumnAnnotation nestedAnnotation) {
- SourceJoinTableAnnotation.this.joinColumnRemoved(index, nestedAnnotation);
- }
- }
-
-
- /**
- * adapt the AnnotationContainer interface to the join table's inverse join columns
- */
- class InverseJoinColumnsContainerAnnotation
- extends AbstractJoinColumnAnnotationContainer
- {
- public String getElementName() {
- return JPA.JOIN_TABLE__INVERSE_JOIN_COLUMNS;
- }
-
- public ListIterator<NestableJoinColumnAnnotation> nestedAnnotations() {
- return SourceJoinTableAnnotation.this.nestableInverseJoinColumns();
- }
-
- public int nestedAnnotationsSize() {
- return SourceJoinTableAnnotation.this.inverseJoinColumnsSize();
- }
-
- public NestableJoinColumnAnnotation addNestedAnnotationInternal() {
- return SourceJoinTableAnnotation.this.addInverseJoinColumnInternal();
- }
-
- public void nestedAnnotationAdded(int index, NestableJoinColumnAnnotation nestedAnnotation) {
- SourceJoinTableAnnotation.this.inverseJoinColumnAdded(index, nestedAnnotation);
- }
-
- public NestableJoinColumnAnnotation moveNestedAnnotationInternal(int targetIndex, int sourceIndex) {
- return SourceJoinTableAnnotation.this.moveInverseJoinColumnInternal(targetIndex, sourceIndex);
- }
-
- public void nestedAnnotationMoved(int targetIndex, int sourceIndex) {
- SourceJoinTableAnnotation.this.inverseJoinColumnMoved(targetIndex, sourceIndex);
- }
-
- public NestableJoinColumnAnnotation removeNestedAnnotationInternal(int index) {
- return SourceJoinTableAnnotation.this.removeInverseJoinColumnInternal(index);
- }
-
- public void nestedAnnotationRemoved(int index, NestableJoinColumnAnnotation nestedAnnotation) {
- SourceJoinTableAnnotation.this.inverseJoinColumnRemoved(index, nestedAnnotation);
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceLobAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceLobAnnotation.java
deleted file mode 100644
index 05228b8d51..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceLobAnnotation.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.LobAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-
-/**
- * javax.persistence.Lob
- */
-public final class SourceLobAnnotation
- extends SourceAnnotation<Attribute>
- implements LobAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
-
- public SourceLobAnnotation(JavaResourceNode parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- // nothing to initialize
- }
-
- public void update(CompilationUnit astRoot) {
- // nothing to update
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceManyToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceManyToManyAnnotation.java
deleted file mode 100644
index 73d8ef8db2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceManyToManyAnnotation.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.ManyToManyAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-
-/**
- * javax.persistence.ManyToMany
- */
-public final class SourceManyToManyAnnotation
- extends SourceRelationshipMappingAnnotation
- implements ManyToManyAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> TARGET_ENTITY_ADAPTER = buildTargetEntityAdapter();
-
- private static final DeclarationAnnotationElementAdapter<String> FETCH_ADAPTER = buildFetchAdapter();
-
- private static final DeclarationAnnotationElementAdapter<String[]> CASCADE_ADAPTER = buildCascadeAdapter();
-
- private static final DeclarationAnnotationElementAdapter<String> MAPPED_BY_ADAPTER = buildMappedByAdapter();
- private final AnnotationElementAdapter<String> mappedByAdapter;
- private String mappedBy;
-
-
- public SourceManyToManyAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.mappedByAdapter = this.buildAnnotationElementAdapter(MAPPED_BY_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.mappedBy = this.buildMappedBy(astRoot);
- }
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
- this.setMappedBy(this.buildMappedBy(astRoot));
- }
-
-
- // ********** 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.attributeValueHasNotChanged(this.mappedBy, mappedBy)) {
- return;
- }
- String old = this.mappedBy;
- this.mappedBy = mappedBy;
- this.mappedByAdapter.setValue(mappedBy);
- this.firePropertyChanged(MAPPED_BY_PROPERTY, old, mappedBy);
- }
-
- 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, false); // false = do not remove annotation when empty
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildFetchAdapter() {
- return buildFetchAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_MANY__FETCH);
- }
-
- private static DeclarationAnnotationElementAdapter<String[]> buildCascadeAdapter() {
- return buildEnumArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_MANY__CASCADE);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceManyToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceManyToOneAnnotation.java
deleted file mode 100644
index 6883f3d1c6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceManyToOneAnnotation.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.BooleanExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.ManyToOneAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-
-/**
- * javax.persistence.ManyToOne
- */
-public final class SourceManyToOneAnnotation
- extends SourceRelationshipMappingAnnotation
- implements ManyToOneAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> TARGET_ENTITY_ADAPTER = buildTargetEntityAdapter();
-
- private static final DeclarationAnnotationElementAdapter<String> FETCH_ADAPTER = buildFetchAdapter();
-
- private static final DeclarationAnnotationElementAdapter<String[]> CASCADE_ADAPTER = buildCascadeAdapter();
-
- private static final DeclarationAnnotationElementAdapter<Boolean> OPTIONAL_ADAPTER = buildOptionalAdapter();
- private final AnnotationElementAdapter<Boolean> optionalAdapter;
- private Boolean optional;
-
-
- public SourceManyToOneAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.optionalAdapter = this.buildBooleanAnnotationElementAdapter(OPTIONAL_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.optional = this.buildOptional(astRoot);
- }
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
- this.setOptional(this.buildOptional(astRoot));
- }
-
-
- // ********** 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.attributeValueHasNotChanged(this.optional, optional)) {
- return;
- }
- Boolean old = this.optional;
- this.optional = optional;
- this.optionalAdapter.setValue(optional);
- this.firePropertyChanged(OPTIONAL_PROPERTY, old, optional);
- }
-
- 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, false, BooleanExpressionConverter.instance());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceMapKeyAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceMapKeyAnnotation.java
deleted file mode 100644
index 34f409fe27..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceMapKeyAnnotation.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.MapKeyAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-
-/**
- * javax.persistence.MapKey
- */
-public final class SourceMapKeyAnnotation
- extends SourceAnnotation<Attribute>
- implements MapKeyAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildNameAdapter();
- private final AnnotationElementAdapter<String> nameAdapter;
- private String name;
-
-
- public SourceMapKeyAnnotation(JavaResourceNode parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.nameAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, NAME_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.name = this.buildName(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setName(this.buildName(astRoot));
- }
-
- @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.attributeValueHasNotChanged(this.name, name)) {
- return;
- }
- String old = this.name;
- this.name = name;
- this.nameAdapter.setValue(name);
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- 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, false);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceMappedSuperclassAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceMappedSuperclassAnnotation.java
deleted file mode 100644
index 3703e3ab2e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceMappedSuperclassAnnotation.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.MappedSuperclassAnnotation;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * javax.persistence.MappedSuperclass
- */
-public final class SourceMappedSuperclassAnnotation
- extends SourceAnnotation<Type>
- implements MappedSuperclassAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
-
- public SourceMappedSuperclassAnnotation(JavaResourcePersistentType parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- // nothing to initialize
- }
-
- public void update(CompilationUnit astRoot) {
- // nothing to update
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedColumnAnnotation.java
deleted file mode 100644
index 76e30cf024..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedColumnAnnotation.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.BooleanExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NumberIntegerExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NamedColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.Column
- * javax.persistence.JoinColumn
- * javax.persistence.DiscriminatorColumn
- * javax.persistence.PrimaryKeyJoinColumn.
- */
-public abstract class SourceNamedColumnAnnotation
- extends SourceAnnotation<Member>
- implements NamedColumnAnnotation
-{
- private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
- private final AnnotationElementAdapter<String> nameAdapter;
- private String name;
-
- private final DeclarationAnnotationElementAdapter<String> columnDefinitionDeclarationAdapter;
- private final AnnotationElementAdapter<String> columnDefinitionAdapter;
- private String columnDefinition;
-
-
- SourceNamedColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
- this(parent, member, daa, new MemberAnnotationAdapter(member, daa));
- }
-
- protected SourceNamedColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
- this.nameDeclarationAdapter = this.buildStringElementAdapter(this.getNameElementName());
- this.nameAdapter = this.buildShortCircuitElementAdapter(this.nameDeclarationAdapter);
- this.columnDefinitionDeclarationAdapter = this.buildStringElementAdapter(this.getColumnDefinitionElementName());
- this.columnDefinitionAdapter = this.buildShortCircuitElementAdapter(this.columnDefinitionDeclarationAdapter);
- }
-
- protected DeclarationAnnotationElementAdapter<String> buildStringElementAdapter(String elementName) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(this.daa, elementName);
- }
-
- protected DeclarationAnnotationElementAdapter<Boolean> buildBooleanElementAdapter(String elementName) {
- return new ConversionDeclarationAnnotationElementAdapter<Boolean>(this.daa, elementName, BooleanExpressionConverter.instance());
- }
-
- DeclarationAnnotationElementAdapter<Integer> buildIntegerElementAdapter(String elementName) {
- return new ConversionDeclarationAnnotationElementAdapter<Integer>(this.daa, elementName, NumberIntegerExpressionConverter.instance());
- }
-
- AnnotationElementAdapter<String> buildShortCircuitElementAdapter(DeclarationAnnotationElementAdapter<String> daea) {
- return new ShortCircuitAnnotationElementAdapter<String>(this.member, daea);
- }
-
- protected AnnotationElementAdapter<Boolean> buildShortCircuitBooleanElementAdapter(DeclarationAnnotationElementAdapter<Boolean> daea) {
- return new ShortCircuitAnnotationElementAdapter<Boolean>(this.member, daea);
- }
-
- AnnotationElementAdapter<Integer> buildShortCircuitIntegerElementAdapter(DeclarationAnnotationElementAdapter<Integer> daea) {
- return new ShortCircuitAnnotationElementAdapter<Integer>(this.member, daea);
- }
-
- AnnotationElementAdapter<String> buildShortCircuitStringElementAdapter(String elementName) {
- return this.buildShortCircuitElementAdapter(this.buildStringElementAdapter(elementName));
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.name = this.buildName(astRoot);
- this.columnDefinition = this.buildColumnDefinition(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setName(this.buildName(astRoot));
- this.setColumnDefinition(this.buildColumnDefinition(astRoot));
- }
-
- @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) {
- if (this.attributeValueHasNotChanged(this.name, name)) {
- return;
- }
- String old = this.name;
- this.name = name;
- this.nameAdapter.setValue(name);
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- 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);
- }
-
- protected abstract String getNameElementName();
-
- // ***** column definition
- public String getColumnDefinition() {
- return this.columnDefinition;
- }
-
- public void setColumnDefinition(String columnDefinition) {
- if (this.attributeValueHasNotChanged(this.columnDefinition, columnDefinition)) {
- return;
- }
- String old = this.columnDefinition;
- this.columnDefinition = columnDefinition;
- this.columnDefinitionAdapter.setValue(columnDefinition);
- this.firePropertyChanged(COLUMN_DEFINITION_PROPERTY, old, columnDefinition);
- }
-
- private String buildColumnDefinition(CompilationUnit astRoot) {
- return this.columnDefinitionAdapter.getValue(astRoot);
- }
-
- public TextRange getColumnDefinitionTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.columnDefinitionDeclarationAdapter, astRoot);
- }
-
- protected abstract String getColumnDefinitionElementName();
-
-
- // ********** NestableAnnotation implementation **********
-
- public void initializeFrom(NestableAnnotation oldAnnotation) {
- NamedColumnAnnotation oldColumn = (NamedColumnAnnotation) oldAnnotation;
- this.setName(oldColumn.getName());
- this.setColumnDefinition(oldColumn.getColumnDefinition());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedNativeQueriesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedNativeQueriesAnnotation.java
deleted file mode 100644
index 966e3506d3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedNativeQueriesAnnotation.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableNamedNativeQueryAnnotation;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Type;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.NamedNativeQueries
- */
-public final class SourceNamedNativeQueriesAnnotation
- extends SourceAnnotation<Type>
- implements NamedNativeQueriesAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final Vector<NestableNamedNativeQueryAnnotation> namedNativeQueries = new Vector<NestableNamedNativeQueryAnnotation>();
-
-
- public SourceNamedNativeQueriesAnnotation(JavaResourceNode parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- AnnotationContainerTools.initialize(this, astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- AnnotationContainerTools.update(this, astRoot);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.namedNativeQueries);
- }
-
-
- // ********** AnnotationContainer implementation **********
-
- public String getContainerAnnotationName() {
- return this.getAnnotationName();
- }
-
- public org.eclipse.jdt.core.dom.Annotation getContainerJdtAnnotation(CompilationUnit astRoot) {
- return this.getJdtAnnotation(astRoot);
- }
-
- public String getElementName() {
- return JPA.NAMED_NATIVE_QUERIES__VALUE;
- }
-
- public String getNestableAnnotationName() {
- return NamedNativeQueryAnnotation.ANNOTATION_NAME;
- }
-
- public ListIterator<NestableNamedNativeQueryAnnotation> nestedAnnotations() {
- return new CloneListIterator<NestableNamedNativeQueryAnnotation>(this.namedNativeQueries);
- }
-
- public int nestedAnnotationsSize() {
- return this.namedNativeQueries.size();
- }
-
- public NestableNamedNativeQueryAnnotation addNestedAnnotationInternal() {
- NestableNamedNativeQueryAnnotation namedNativeQuery = this.buildNamedNativeQuery(this.namedNativeQueries.size());
- this.namedNativeQueries.add(namedNativeQuery);
- return namedNativeQuery;
- }
-
- private NestableNamedNativeQueryAnnotation buildNamedNativeQuery(int index) {
- return SourceNamedNativeQueryAnnotation.createNestedNamedNativeQuery(this, this.member, index, this.daa);
- }
-
- public void nestedAnnotationAdded(int index, NestableNamedNativeQueryAnnotation nestedAnnotation) {
- this.fireItemAdded(NAMED_NATIVE_QUERIES_LIST, index, nestedAnnotation);
- }
-
- public NestableNamedNativeQueryAnnotation moveNestedAnnotationInternal(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.namedNativeQueries, targetIndex, sourceIndex).get(targetIndex);
- }
-
- public void nestedAnnotationMoved(int targetIndex, int sourceIndex) {
- this.fireItemMoved(NAMED_NATIVE_QUERIES_LIST, targetIndex, sourceIndex);
- }
-
- public NestableNamedNativeQueryAnnotation removeNestedAnnotationInternal(int index) {
- return this.namedNativeQueries.remove(index);
- }
-
- public void nestedAnnotationRemoved(int index, NestableNamedNativeQueryAnnotation nestedAnnotation) {
- this.fireItemRemoved(NAMED_NATIVE_QUERIES_LIST, index, nestedAnnotation);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedNativeQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedNativeQueryAnnotation.java
deleted file mode 100644
index 0c5cadde71..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedNativeQueryAnnotation.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.JDTTools;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberIndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableNamedNativeQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableQueryHintAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * javax.persistence.NamedNativeQuery
- */
-public final class SourceNamedNativeQueryAnnotation
- extends SourceBaseNamedQueryAnnotation
- implements NestableNamedNativeQueryAnnotation
-{
- public static final SimpleDeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final DeclarationAnnotationElementAdapter<String> resultClassDeclarationAdapter;
- private final AnnotationElementAdapter<String> resultClassAdapter;
- private String resultClass;
-
- private String fullyQualifiedResultClassName;
-
- private final DeclarationAnnotationElementAdapter<String> resultSetMappingDeclarationAdapter;
- private final AnnotationElementAdapter<String> resultSetMappingAdapter;
- private String resultSetMapping;
-
-
- public SourceNamedNativeQueryAnnotation(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, type, daa, annotationAdapter);
- this.resultClassDeclarationAdapter = this.buildResultClassAdapter(daa);
- this.resultClassAdapter = this.buildAdapter(this.resultClassDeclarationAdapter);
- this.resultSetMappingDeclarationAdapter = this.buildResultSetMappingAdapter(daa);
- this.resultSetMappingAdapter = this.buildAdapter(this.resultSetMappingDeclarationAdapter);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.resultClass = this.buildResultClass(astRoot);
- this.fullyQualifiedResultClassName = this.buildFullyQualifiedResultClassName(astRoot);
- this.resultSetMapping = this.buildResultSetMapping(astRoot);
- }
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
- this.setResultClass(this.buildResultClass(astRoot));
- this.setFullyQualifiedResultClassName(this.buildFullyQualifiedResultClassName(astRoot));
- this.setResultSetMapping(this.buildResultSetMapping(astRoot));
- }
-
-
- // ********** AbstractBaseNamedQueryAnnotation implementation **********
-
- @Override
- String getNameElementName() {
- return JPA.NAMED_NATIVE_QUERY__NAME;
- }
-
- @Override
- String getQueryElementName() {
- return JPA.NAMED_NATIVE_QUERY__QUERY;
- }
-
- @Override
- String getHintsElementName() {
- return JPA.NAMED_NATIVE_QUERY__HINTS;
- }
-
- @Override
- NestableQueryHintAnnotation buildQueryHint(int index) {
- return SourceQueryHintAnnotation.createNamedNativeQueryQueryHint(this, this.member, this.daa, index);
- }
-
-
- // ********** NamedNativeQueryAnnotation implementation **********
-
- // ***** result class
- public String getResultClass() {
- return this.resultClass;
- }
-
- public void setResultClass(String resultClass) {
- if (this.attributeValueHasNotChanged(this.resultClass, resultClass)) {
- return;
- }
- String old = this.resultClass;
- this.resultClass = resultClass;
- this.resultClassAdapter.setValue(resultClass);
- this.firePropertyChanged(RESULT_CLASS_PROPERTY, old, resultClass);
- }
-
- private String buildResultClass(CompilationUnit astRoot) {
- return this.resultClassAdapter.getValue(astRoot);
- }
-
- public TextRange getResultClassTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.resultClassDeclarationAdapter, astRoot);
- }
-
- private DeclarationAnnotationElementAdapter<String> buildResultClassAdapter(DeclarationAnnotationAdapter daAdapter) {
- return new ConversionDeclarationAnnotationElementAdapter<String>(daAdapter, JPA.NAMED_NATIVE_QUERY__RESULT_CLASS, SimpleTypeStringExpressionConverter.instance());
- }
-
- // ***** fully-qualified result class name
- public String getFullyQualifiedResultClassName() {
- return this.fullyQualifiedResultClassName;
- }
-
- private void setFullyQualifiedResultClassName(String name) {
- String old = this.fullyQualifiedResultClassName;
- this.fullyQualifiedResultClassName = name;
- this.firePropertyChanged(FULLY_QUALIFIED_RESULT_CLASS_NAME_PROPERTY, old, name);
- }
-
- private String buildFullyQualifiedResultClassName(CompilationUnit astRoot) {
- return (this.resultClass == null) ? null : JDTTools.resolveFullyQualifiedName(this.resultClassAdapter.getExpression(astRoot));
- }
-
- // ***** result set mapping
- public String getResultSetMapping() {
- return this.resultSetMapping;
- }
-
- public void setResultSetMapping(String resultSetMapping) {
- if (this.attributeValueHasNotChanged(this.resultSetMapping, resultSetMapping)) {
- return;
- }
- String old = this.resultSetMapping;
- this.resultSetMapping = resultSetMapping;
- this.resultSetMappingAdapter.setValue(resultSetMapping);
- this.firePropertyChanged(RESULT_SET_MAPPING_PROPERTY, old, resultSetMapping);
- }
-
- 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);
- }
-
-
- // ********** NestableAnnotation implementation **********
-
- @Override
- public void initializeFrom(NestableAnnotation oldAnnotation) {
- super.initializeFrom(oldAnnotation);
- NamedNativeQueryAnnotation oldQuery = (NamedNativeQueryAnnotation) oldAnnotation;
- this.setResultClass(oldQuery.getResultClass());
- this.setResultSetMapping(oldQuery.getResultSetMapping());
- }
-
-
- // ********** static methods **********
-
- public static SourceNamedNativeQueryAnnotation createNamedNativeQuery(JavaResourceNode parent, Type type) {
- return new SourceNamedNativeQueryAnnotation(parent, type, DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(type, DECLARATION_ANNOTATION_ADAPTER));
- }
-
- static SourceNamedNativeQueryAnnotation createNestedNamedNativeQuery(JavaResourceNode parent, Type type, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
- IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter);
- IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(type, idaa);
- return new SourceNamedNativeQueryAnnotation(parent, type, idaa, annotationAdapter);
- }
-
- private static IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter namedQueriesAdapter) {
- return new NestedIndexedDeclarationAnnotationAdapter(namedQueriesAdapter, index, JPA.NAMED_NATIVE_QUERY);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedQueriesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedQueriesAnnotation.java
deleted file mode 100644
index 334e628a28..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedQueriesAnnotation.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NamedQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableNamedQueryAnnotation;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Type;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.NamedQueries
- */
-public class SourceNamedQueriesAnnotation
- extends SourceAnnotation<Type>
- implements NamedQueriesAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final Vector<NestableNamedQueryAnnotation> namedQueries = new Vector<NestableNamedQueryAnnotation>();
-
-
- public SourceNamedQueriesAnnotation(JavaResourceNode parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- AnnotationContainerTools.initialize(this, astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- AnnotationContainerTools.update(this, astRoot);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.namedQueries);
- }
-
-
- // ********** AnnotationContainer implementation **********
-
- public String getContainerAnnotationName() {
- return this.getAnnotationName();
- }
-
- public org.eclipse.jdt.core.dom.Annotation getContainerJdtAnnotation(CompilationUnit astRoot) {
- return this.getJdtAnnotation(astRoot);
- }
-
- public String getElementName() {
- return JPA.NAMED_QUERIES__VALUE;
- }
-
- public String getNestableAnnotationName() {
- return NamedQueryAnnotation.ANNOTATION_NAME;
- }
-
- public ListIterator<NestableNamedQueryAnnotation> nestedAnnotations() {
- return new CloneListIterator<NestableNamedQueryAnnotation>(this.namedQueries);
- }
-
- public int nestedAnnotationsSize() {
- return this.namedQueries.size();
- }
-
- public NestableNamedQueryAnnotation addNestedAnnotationInternal() {
- NestableNamedQueryAnnotation namedQuery = this.buildNamedQuery(this.namedQueries.size());
- this.namedQueries.add(namedQuery);
- return namedQuery;
- }
-
- protected NestableNamedQueryAnnotation buildNamedQuery(int index) {
- return SourceNamedQueryAnnotation.createNestedNamedQuery(this, member, index, this.daa);
- }
-
- public void nestedAnnotationAdded(int index, NestableNamedQueryAnnotation nestedAnnotation) {
- this.fireItemAdded(NAMED_QUERIES_LIST, index, nestedAnnotation);
- }
-
- public NestableNamedQueryAnnotation moveNestedAnnotationInternal(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.namedQueries, targetIndex, sourceIndex).get(targetIndex);
- }
-
- public void nestedAnnotationMoved(int targetIndex, int sourceIndex) {
- this.fireItemMoved(NAMED_QUERIES_LIST, targetIndex, sourceIndex);
- }
-
- public NestableNamedQueryAnnotation removeNestedAnnotationInternal(int index) {
- return this.namedQueries.remove(index);
- }
-
- public void nestedAnnotationRemoved(int index, NestableNamedQueryAnnotation nestedAnnotation) {
- this.fireItemRemoved(NAMED_QUERIES_LIST, index, nestedAnnotation);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedQueryAnnotation.java
deleted file mode 100644
index a1cab17e6f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedQueryAnnotation.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jpt.core.internal.jpa1.resource.java.source.SourceNamedQuery1_0Annotation;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberIndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableQueryHintAnnotation;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * javax.persistence.NamedQuery
- */
-public abstract class SourceNamedQueryAnnotation
- extends SourceBaseNamedQueryAnnotation
- implements NamedQueryAnnotation
-{
- public static final SimpleDeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- // ********** constructors **********
- public SourceNamedQueryAnnotation(JavaResourceNode parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(type, DECLARATION_ANNOTATION_ADAPTER));
- }
-
- public SourceNamedQueryAnnotation(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, type, daa, annotationAdapter);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-
- // ********** AbstractBaseNamedQueryAnnotation implementation **********
-
- @Override
- String getNameElementName() {
- return JPA.NAMED_QUERY__NAME;
- }
-
- @Override
- String getQueryElementName() {
- return JPA.NAMED_QUERY__QUERY;
- }
-
- @Override
- String getHintsElementName() {
- return JPA.NAMED_QUERY__HINTS;
- }
-
- @Override
- NestableQueryHintAnnotation buildQueryHint(int index) {
- return SourceQueryHintAnnotation.createNamedQueryQueryHint(this, this.member, this.daa, index);
- }
-
-
- // ********** static methods **********
-
- static SourceNamedQueryAnnotation createNestedNamedQuery(JavaResourceNode parent, Type type, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
- IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter);
- IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(type, idaa);
-
- return new SourceNamedQuery1_0Annotation(parent, type, idaa, annotationAdapter);
- }
-
- private static IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter namedQueriesAdapter) {
- return new NestedIndexedDeclarationAnnotationAdapter(namedQueriesAdapter, index, JPA.NAMED_QUERY);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNode.java
deleted file mode 100644
index 354ba9d633..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNode.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jpt.core.internal.resource.java.AbstractJavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-
-/**
- * Source convenience methods
- */
-public abstract class SourceNode
- extends AbstractJavaResourceNode
-{
-
- public SourceNode(JavaResourceNode parent) {
- super(parent);
- }
-
- public JavaResourceCompilationUnit getJavaResourceCompilationUnit() {
- return (JavaResourceCompilationUnit) this.getRoot();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOneToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOneToManyAnnotation.java
deleted file mode 100644
index 8e379f9923..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOneToManyAnnotation.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-
-/**
- * javax.persistence.OneToMany
- */
-public abstract class SourceOneToManyAnnotation
- extends SourceRelationshipMappingAnnotation
- implements OneToManyAnnotation
-{
- 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;
-
-
- public SourceOneToManyAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.mappedByAdapter = this.buildAnnotationElementAdapter(MAPPED_BY_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.mappedBy = this.buildMappedBy(astRoot);
- }
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
- this.setMappedBy(this.buildMappedBy(astRoot));
- }
-
-
- // ********** 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.attributeValueHasNotChanged(this.mappedBy, mappedBy)) {
- return;
- }
- String old = this.mappedBy;
- this.mappedBy = mappedBy;
- this.mappedByAdapter.setValue(mappedBy);
- this.firePropertyChanged(MAPPED_BY_PROPERTY, old, mappedBy);
- }
-
- 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);
- }
-
-
- // ********** 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, false); // false = do not remove annotation when empty
- }
-
- 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);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOneToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOneToOneAnnotation.java
deleted file mode 100644
index cf1d474d64..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOneToOneAnnotation.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.BooleanExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-
-/**
- * javax.persistence.OneToOne
- */
-public abstract class SourceOneToOneAnnotation
- extends SourceRelationshipMappingAnnotation
- implements OneToOneAnnotation
-{
- 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<Boolean> OPTIONAL_ADAPTER = buildOptionalAdapter();
- private final AnnotationElementAdapter<Boolean> optionalAdapter;
- private Boolean optional;
-
- private static final DeclarationAnnotationElementAdapter<String> MAPPED_BY_ADAPTER = buildMappedByAdapter();
- private final AnnotationElementAdapter<String> mappedByAdapter;
- private String mappedBy;
-
-
- public SourceOneToOneAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.mappedByAdapter = this.buildAnnotationElementAdapter(MAPPED_BY_ADAPTER);
- this.optionalAdapter = this.buildBooleanAnnotationElementAdapter(OPTIONAL_ADAPTER);
- }
-
- 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);
- }
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
- this.setMappedBy(this.buildMappedBy(astRoot));
- this.setOptional(this.buildOptional(astRoot));
- }
-
-
- // ********** 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.attributeValueHasNotChanged(this.mappedBy, mappedBy)) {
- return;
- }
- String old = this.mappedBy;
- this.mappedBy = mappedBy;
- this.mappedByAdapter.setValue(mappedBy);
- this.firePropertyChanged(MAPPED_BY_PROPERTY, old, mappedBy);
- }
-
- 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.attributeValueHasNotChanged(this.optional, optional)) {
- return;
- }
- Boolean old = this.optional;
- this.optional = optional;
- this.optionalAdapter.setValue(optional);
- this.firePropertyChanged(OPTIONAL_PROPERTY, old, optional);
- }
-
- 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.ONE_TO_ONE__TARGET_ENTITY);
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildMappedByAdapter() {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_ONE__MAPPED_BY, false); // false = do not remove annotation when empty
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildFetchAdapter() {
- return buildFetchAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_ONE__FETCH);
- }
-
- private static DeclarationAnnotationElementAdapter<Boolean> buildOptionalAdapter() {
- return buildOptionalAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_ONE__OPTIONAL);
- }
-
- private static DeclarationAnnotationElementAdapter<Boolean> buildOptionalAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return new ConversionDeclarationAnnotationElementAdapter<Boolean>(annotationAdapter, elementName, false, BooleanExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter<String[]> buildCascadeAdapter() {
- return buildEnumArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_ONE__CASCADE);
- }
-
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOrderByAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOrderByAnnotation.java
deleted file mode 100644
index 6aeb27ca59..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOrderByAnnotation.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.OrderByAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-
-/**
- * javax.persistence.OrderBy
- */
-public final class SourceOrderByAnnotation
- extends SourceAnnotation<Attribute>
- implements OrderByAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter();
- private final AnnotationElementAdapter<String> valueAdapter;
- private String value;
-
-
- public SourceOrderByAnnotation(JavaResourceNode parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, VALUE_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.buildValue(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setValue(this.buildValue(astRoot));
- }
-
- @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.attributeValueHasNotChanged(this.value, value)) {
- return;
- }
- String old = this.value;
- this.value = value;
- this.valueAdapter.setValue(value);
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- 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, false);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOverrideAnnotation.java
deleted file mode 100644
index 8d0758b647..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOverrideAnnotation.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.OverrideAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * Common behavior for
- * javax.persistence.AttributeOverride
- * javax.persistence.AssociationOverride
- */
-abstract class SourceOverrideAnnotation
- extends SourceAnnotation<Member>
- implements OverrideAnnotation
-{
- final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
- final AnnotationElementAdapter<String> nameAdapter;
- String name;
-
-
- // ********** construction/initialization **********
-
- SourceOverrideAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
- this.nameDeclarationAdapter = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, this.getNameElementName(), false); // false = do not remove annotation when empty
- this.nameAdapter = new ShortCircuitAnnotationElementAdapter<String>(this.member, this.nameDeclarationAdapter);
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.name = this.buildName(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setName(this.buildName(astRoot));
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** OverrideAnnotation implementation **********
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- if (this.attributeValueHasNotChanged(this.name, name)) {
- return;
- }
- String old = this.name;
- this.name = name;
- this.nameAdapter.setValue(name);
- this.firePropertyChanged(OverrideAnnotation.NAME_PROPERTY, old, name);
- }
-
- 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);
- }
-
- protected abstract String getNameElementName();
-
-
- // ********** NestableAnnotation implementation **********
-
- void initializeFrom(NestableAnnotation oldAnnotation) {
- OverrideAnnotation oldOverride = (OverrideAnnotation) oldAnnotation;
- this.setName(oldOverride.getName());
- }
-
- /**
- * convenience implementation of method from NestableAnnotation interface
- * for subclasses
- */
- public void moveAnnotation(int index) {
- this.getIndexedAnnotationAdapter().moveAnnotation(index);
- }
-
- private IndexedAnnotationAdapter getIndexedAnnotationAdapter() {
- return (IndexedAnnotationAdapter) this.annotationAdapter;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentAttribute.java
deleted file mode 100644
index fead1ebddb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentAttribute.java
+++ /dev/null
@@ -1,389 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.IBinding;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jpt.core.internal.utility.jdt.JDTFieldAttribute;
-import org.eclipse.jpt.core.internal.utility.jdt.JDTMethodAttribute;
-import org.eclipse.jpt.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.core.resource.java.AccessType;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.MethodAttribute;
-import org.eclipse.jpt.core.utility.jdt.Type;
-import org.eclipse.jpt.utility.MethodSignature;
-import org.eclipse.jpt.utility.internal.ClassTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * Java source persistent attribute (field or property)
- */
-final class SourcePersistentAttribute
- extends SourcePersistentMember<Attribute>
- implements JavaResourcePersistentAttribute
-{
- private int modifiers;
-
- private String typeName;
-
- private boolean typeIsInterface;
-
- private boolean typeIsEnum;
-
- private final Vector<String> typeSuperclassNames = new Vector<String>();
-
- private final Vector<String> typeInterfaceNames = new Vector<String>();
-
- private final Vector<String> typeTypeArgumentNames = new Vector<String>();
-
-
- /**
- * construct field attribute
- */
- static JavaResourcePersistentAttribute newInstance(
- JavaResourcePersistentType parent,
- Type declaringType,
- String name,
- int occurrence,
- JavaResourceCompilationUnit javaResourceCompilationUnit,
- CompilationUnit astRoot) {
- Attribute attribute = new JDTFieldAttribute(
- declaringType,
- name,
- occurrence,
- javaResourceCompilationUnit.getCompilationUnit(),
- javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(),
- javaResourceCompilationUnit.getAnnotationEditFormatter());
- JavaResourcePersistentAttribute jrpa = new SourcePersistentAttribute(parent, attribute);
- jrpa.initialize(astRoot);
- return jrpa;
- }
-
- /**
- * construct property attribute
- */
- static JavaResourcePersistentAttribute newInstance(
- JavaResourcePersistentType parent,
- Type declaringType,
- MethodSignature signature,
- int occurrence,
- JavaResourceCompilationUnit javaResourceCompilationUnit,
- CompilationUnit astRoot) {
- Attribute attribute = JDTMethodAttribute.newInstance(
- declaringType,
- signature,
- occurrence,
- javaResourceCompilationUnit.getCompilationUnit(),
- javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(),
- javaResourceCompilationUnit.getAnnotationEditFormatter());
- JavaResourcePersistentAttribute jrpa = new SourcePersistentAttribute(parent, attribute);
- jrpa.initialize(astRoot);
- return jrpa;
- }
-
- private SourcePersistentAttribute(JavaResourcePersistentType parent, Attribute attribute){
- super(parent, attribute);
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.modifiers = this.buildModifiers(astRoot);
- this.typeName = this.buildTypeName(astRoot);
- this.typeIsInterface = this.buildTypeIsInterface(astRoot);
- this.typeIsEnum = this.buildTypeIsEnum(astRoot);
- this.typeSuperclassNames.addAll(this.buildTypeSuperclassNames(astRoot));
- this.typeInterfaceNames.addAll(this.buildTypeInterfaceNames(astRoot));
- this.typeTypeArgumentNames.addAll(this.buildTypeTypeArgumentNames(astRoot));
- }
-
-
- // ******** overrides ********
-
- @Override
- public void resolveTypes(CompilationUnit astRoot) {
- super.resolveTypes(astRoot);
- this.setTypeName(this.buildTypeName(astRoot));
- this.setTypeSuperclassNames(this.buildTypeSuperclassNames(astRoot));
- this.setTypeInterfaceNames(this.buildTypeInterfaceNames(astRoot));
- this.setTypeTypeArgumentNames(this.buildTypeTypeArgumentNames(astRoot));
- }
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
- this.setModifiers(this.buildModifiers(astRoot));
- this.setTypeName(this.buildTypeName(astRoot));
- this.setTypeIsInterface(this.buildTypeIsInterface(astRoot));
- this.setTypeIsEnum(this.buildTypeIsEnum(astRoot));
- this.setTypeSuperclassNames(this.buildTypeSuperclassNames(astRoot));
- this.setTypeInterfaceNames(this.buildTypeInterfaceNames(astRoot));
- this.setTypeTypeArgumentNames(this.buildTypeTypeArgumentNames(astRoot));
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getName());
- }
-
-
- // ******** AbstractJavaResourcePersistentMember implementation ********
-
- @Override
- Iterator<String> validAnnotationNames() {
- return this.getAnnotationProvider().attributeAnnotationNames();
- }
-
- @Override
- Annotation buildAnnotation(String annotationName) {
- return this.getAnnotationProvider().buildAttributeAnnotation(this, this.member, annotationName);
- }
-
- Annotation buildNullAnnotation_(String annotationName) {
- return this.getAnnotationProvider().buildNullAttributeAnnotation(this, annotationName);
- }
-
- public boolean isFor(MethodSignature signature, int occurrence) {
- return ((MethodAttribute) this.member).matches(signature, occurrence);
- }
-
-
- // ******** JavaResourcePersistentAttribute implementation ********
-
- public String getName() {
- return this.member.getAttributeName();
- }
-
- @Override
- public Annotation buildNullAnnotation(String annotationName) {
- return (annotationName == null) ? null : this.buildNullAnnotation_(annotationName);
- }
-
- public boolean isField() {
- return this.member.isField();
- }
-
- public boolean isProperty() {
- return ! this.isField();
- }
-
- public AccessType getSpecifiedAccess() {
- Access2_0Annotation accessAnnotation = this.getAccessAnnotation();
- return (accessAnnotation == null) ? null : accessAnnotation.getValue();
- }
-
- private Access2_0Annotation getAccessAnnotation() {
- return (Access2_0Annotation) this.getAnnotation(Access2_0Annotation.ANNOTATION_NAME);
- }
-
- public boolean typeIsSubTypeOf(String tn) {
- if (this.typeName == null) {
- return false;
- }
- return this.typeName.equals(tn)
- || this.typeInterfaceNames.contains(tn)
- || this.typeSuperclassNames.contains(tn);
- }
-
- public boolean typeIsVariablePrimitive() {
- return (this.typeName != null) && ClassTools.classNamedIsVariablePrimitive(this.typeName);
- }
-
- private ITypeBinding getTypeBinding(CompilationUnit astRoot) {
- return this.member.getTypeBinding(astRoot);
- }
-
-
- // ***** modifiers
- public int getModifiers() {
- return this.modifiers;
- }
-
- private void setModifiers(int modifiers) {
- int old = this.modifiers;
- this.modifiers = modifiers;
- this.firePropertyChanged(MODIFIERS_PROPERTY, old, modifiers);
- }
-
- /**
- * zero seems like a reasonable default...
- */
- private int buildModifiers(CompilationUnit astRoot) {
- IBinding binding = this.member.getBinding(astRoot);
- return (binding == null) ? 0 : binding.getModifiers();
- }
-
- // ***** type name
- public String getTypeName() {
- return this.typeName;
- }
-
- private void setTypeName(String typeName) {
- String old = this.typeName;
- this.typeName = typeName;
- this.firePropertyChanged(TYPE_NAME_PROPERTY, old, typeName);
- }
-
- /**
- * this can be an array (e.g. "java.lang.String[]");
- * but no generic type arguments
- */
- private String buildTypeName(CompilationUnit astRoot) {
- ITypeBinding typeBinding = this.getTypeBinding(astRoot);
- return (typeBinding == null) ? null : typeBinding.getTypeDeclaration().getQualifiedName();
- }
-
- // ***** type is interface
- public boolean typeIsInterface() {
- return this.typeIsInterface;
- }
-
- private void setTypeIsInterface(boolean typeIsInterface) {
- boolean old = this.typeIsInterface;
- this.typeIsInterface = typeIsInterface;
- this.firePropertyChanged(TYPE_IS_INTERFACE_PROPERTY, old, typeIsInterface);
- }
-
- private boolean buildTypeIsInterface(CompilationUnit astRoot) {
- ITypeBinding typeBinding = this.getTypeBinding(astRoot);
- return (typeBinding != null) && ( ! typeBinding.isArray()) && typeBinding.isInterface();
- }
-
- // ***** type is enum
- public boolean typeIsEnum() {
- return this.typeIsEnum;
- }
-
- private void setTypeIsEnum(boolean typeIsEnum) {
- boolean old = this.typeIsEnum;
- this.typeIsEnum = typeIsEnum;
- this.firePropertyChanged(TYPE_IS_ENUM_PROPERTY, old, typeIsEnum);
- }
-
- private boolean buildTypeIsEnum(CompilationUnit astRoot) {
- ITypeBinding typeBinding = this.getTypeBinding(astRoot);
- return (typeBinding != null) && ( ! typeBinding.isArray()) && typeBinding.isEnum();
- }
-
- // ***** type superclass hierarchy
- public ListIterator<String> typeSuperclassNames() {
- return new CloneListIterator<String>(this.typeSuperclassNames);
- }
-
- private void setTypeSuperclassNames(List<String> typeSuperclassNames) {
- this.synchronizeList(typeSuperclassNames, this.typeSuperclassNames, TYPE_SUPERCLASS_NAMES_LIST);
- }
-
- private List<String> buildTypeSuperclassNames(CompilationUnit astRoot) {
- ITypeBinding typeBinding = this.getTypeBinding(astRoot);
- if (typeBinding == null) {
- return Collections.emptyList();
- }
- ArrayList<String> names = new ArrayList<String>();
- typeBinding = typeBinding.getSuperclass();
- while (typeBinding != null) {
- names.add(typeBinding.getQualifiedName());
- typeBinding = typeBinding.getSuperclass();
- }
- return names;
- }
-
- // ***** type interface hierarchy
- public Iterator<String> typeInterfaceNames() {
- return new CloneIterator<String>(this.typeInterfaceNames);
- }
-
-// private boolean typeInterfaceNamesContains(String interfaceName) {
-// return this.typeInterfaceNames.contains(interfaceName);
-// }
-//
- private void setTypeInterfaceNames(Collection<String> typeInterfaceNames) {
- this.synchronizeCollection(typeInterfaceNames, this.typeInterfaceNames, TYPE_INTERFACE_NAMES_COLLECTION);
- }
-
- private Collection<String> buildTypeInterfaceNames(CompilationUnit astRoot) {
- ITypeBinding typeBinding = this.getTypeBinding(astRoot);
- if (typeBinding == null) {
- return Collections.emptySet();
- }
- HashSet<String> names = new HashSet<String>();
- while (typeBinding != null) {
- this.addInterfaceNamesTo(typeBinding, names);
- typeBinding = typeBinding.getSuperclass();
- }
- return names;
- }
-
- private void addInterfaceNamesTo(ITypeBinding typeBinding, HashSet<String> names) {
- for (ITypeBinding interfaceBinding : typeBinding.getInterfaces()) {
- names.add(interfaceBinding.getTypeDeclaration().getQualifiedName());
- this.addInterfaceNamesTo(interfaceBinding, names); // recurse
- }
- }
-
- // ***** type type argument names
- public ListIterator<String> typeTypeArgumentNames() {
- return new CloneListIterator<String>(this.typeTypeArgumentNames);
- }
-
- public int typeTypeArgumentNamesSize() {
- return this.typeTypeArgumentNames.size();
- }
-
- public String getTypeTypeArgumentName(int index) {
- return this.typeTypeArgumentNames.get(index);
- }
-
- private void setTypeTypeArgumentNames(List<String> typeTypeArgumentNames) {
- this.synchronizeList(typeTypeArgumentNames, this.typeTypeArgumentNames, TYPE_TYPE_ARGUMENT_NAMES_LIST);
- }
-
- /**
- * these types can be arrays (e.g. "java.lang.String[]");
- * but they won't have any further nested generic type arguments
- * (e.g. "java.util.Collection<java.lang.String>")
- */
- private List<String> buildTypeTypeArgumentNames(CompilationUnit astRoot) {
- ITypeBinding typeBinding = this.getTypeBinding(astRoot);
- if (typeBinding == null) {
- return Collections.emptyList();
- }
-
- ITypeBinding[] typeArguments = typeBinding.getTypeArguments();
- if (typeArguments.length == 0) {
- return Collections.emptyList();
- }
-
- ArrayList<String> names = new ArrayList<String>(typeArguments.length);
- for (ITypeBinding typeArgument : typeArguments) {
- if (typeArgument == null) {
- names.add(null);
- } else {
- names.add(typeArgument.getTypeDeclaration().getQualifiedName());
- }
- }
- return names;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentMember.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentMember.java
deleted file mode 100644
index 6fc6b5b38c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentMember.java
+++ /dev/null
@@ -1,535 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.ASTVisitor;
-import org.eclipse.jdt.core.dom.BodyDeclaration;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.MarkerAnnotation;
-import org.eclipse.jdt.core.dom.NormalAnnotation;
-import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.ASTNodeTextRange;
-import org.eclipse.jpt.core.internal.utility.jdt.JDTTools;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.ContainerAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.SingleElementIterator;
-
-/**
- * Java source persistent member (annotations, "persistable")
- */
-abstract class SourcePersistentMember<E extends Member>
- extends SourceNode
- implements JavaResourcePersistentMember
-{
- final E member;
-
- /**
- * annotations; no duplicates (java compiler has an error for duplicates)
- */
- final Vector<Annotation> annotations = new Vector<Annotation>();
-
- boolean persistable;
-
-
- // ********** construction/initialization **********
-
- SourcePersistentMember(JavaResourceNode parent, E member) {
- super(parent);
- this.member = member;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.member.getBodyDeclaration(astRoot).accept(this.buildInitialAnnotationVisitor(astRoot));
- this.persistable = this.buildPersistable(astRoot);
- }
-
- private ASTVisitor buildInitialAnnotationVisitor(CompilationUnit astRoot) {
- return new InitialAnnotationVisitor(astRoot, this.member.getBodyDeclaration(astRoot));
- }
-
- /**
- * called from {@link InitialAnnotationVisitor}
- */
- /* private */ void addInitialAnnotation(org.eclipse.jdt.core.dom.Annotation node, CompilationUnit astRoot) {
- String jdtAnnotationName = JDTTools.resolveAnnotation(node);
- if (jdtAnnotationName != null) {
- this.addInitialAnnotation(jdtAnnotationName, astRoot);
- }
- }
-
- /**
- * pre-condition: jdtAnnotationName is not null
- */
- void addInitialAnnotation(String jdtAnnotationName, CompilationUnit astRoot) {
- if (this.annotationIsValid(jdtAnnotationName)) {
- if (this.selectAnnotationNamed(this.annotations, jdtAnnotationName) == null) { // ignore duplicates
- Annotation annotation = this.buildAnnotation(jdtAnnotationName);
- annotation.initialize(astRoot);
- this.annotations.add(annotation);
- }
- }
- }
-
-
- // ********** annotations **********
-
- public Iterator<Annotation> annotations() {
- return this.getAnnotations().iterator();
- }
-
- Iterable<Annotation> getAnnotations() {
- return new LiveCloneIterable<Annotation>(this.annotations);
- }
-
- public int annotationsSize() {
- return this.annotations.size();
- }
-
- public Annotation getAnnotation(String annotationName) {
- return this.selectAnnotationNamed(this.getAnnotations(), annotationName);
- }
-
- public Annotation getNonNullAnnotation(String annotationName) {
- Annotation annotation = this.getAnnotation(annotationName);
- return (annotation != null) ? annotation : this.buildNullAnnotation(annotationName);
- }
-
- public Iterator<NestableAnnotation> annotations(String nestableAnnotationName, String containerAnnotationName) {
- ContainerAnnotation<NestableAnnotation> containerAnnotation = this.getContainerAnnotation(containerAnnotationName);
- if (containerAnnotation != null) {
- return containerAnnotation.nestedAnnotations();
- }
- NestableAnnotation nestableAnnotation = this.getNestableAnnotation(nestableAnnotationName);
- if (nestableAnnotation != null) {
- return new SingleElementIterator<NestableAnnotation>(nestableAnnotation);
- }
- return EmptyIterator.instance();
- }
-
- // minimize scope of suppressed warnings
- @SuppressWarnings("unchecked")
- private ContainerAnnotation<NestableAnnotation> getContainerAnnotation(String annotationName) {
- return (ContainerAnnotation<NestableAnnotation>) this.getAnnotation(annotationName);
- }
-
- private NestableAnnotation getNestableAnnotation(String annotationName) {
- return (NestableAnnotation) this.getAnnotation(annotationName);
- }
-
- public Annotation addAnnotation(String annotationName) {
- Annotation annotation = this.buildAnnotation(annotationName);
- this.annotations.add(annotation);
- annotation.newAnnotation();
- this.fireItemAdded(ANNOTATIONS_COLLECTION, annotation);
- return annotation;
- }
-
- public Annotation addAnnotation(String annotationName, AnnotationInitializer annotationInitializer) {
- Annotation annotation = this.buildAnnotation(annotationName);
- this.annotations.add(annotation);
- annotation.newAnnotation();
- Annotation nestedAnnotation = annotationInitializer.initializeAnnotation(annotation);
- nestedAnnotation.newAnnotation();
- this.fireItemAdded(ANNOTATIONS_COLLECTION, annotation);
- return nestedAnnotation;
- }
-
- /**
- * 1. check for a container annotation;
- * if it is present, add a nested annotation to it
- * 2. check for a stand-alone nested annotation;
- * if it is missing, add a stand-alone nested annotation
- * 3. if there is an existing stand-alone nested annotation,
- * add a container annotation and move the stand-alone nested annotation to it
- * and add a new nested annotation to it also
- */
- public NestableAnnotation addAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) {
- ContainerAnnotation<NestableAnnotation> containerAnnotation = this.getContainerAnnotation(containerAnnotationName);
- if (containerAnnotation != null) {
- // ignore any stand-alone nestable annotations and just add to the container annotation
- return AnnotationContainerTools.addNestedAnnotation(index, containerAnnotation);
- }
- NestableAnnotation standAloneAnnotation = this.getNestableAnnotation(nestableAnnotationName);
- if (standAloneAnnotation == null) {
- // add a stand-alone nestable annotation since neither the nestable nor the container exist
- return (NestableAnnotation) this.addAnnotation(nestableAnnotationName);
- }
- // move the stand-alone nestable annotation to a container and add another nestable
- return this.addSecondNestedAnnotation(index, containerAnnotationName, standAloneAnnotation);
- }
-
- /**
- * "move" the existing nestable annotation to a new container annotation and
- * add a new nestable annotation at the specified index (which should be 0 or 1)
- *
- * NB: we make all the necessary changes to the resource model and the
- * Java source code *before* we fire any events; so that everything is in
- * place when the context model gets an "update" and looks at the resource
- * model to determine what has changed
- */
- private NestableAnnotation addSecondNestedAnnotation(int index, String containerAnnotationName, NestableAnnotation standAloneAnnotation) {
- ContainerAnnotation<NestableAnnotation> containerAnnotation = this.buildContainerAnnotation(containerAnnotationName);
- this.annotations.add(containerAnnotation);
- containerAnnotation.newAnnotation();
-
- NestableAnnotation nestedAnnotation0 = containerAnnotation.addNestedAnnotationInternal();
- nestedAnnotation0.newAnnotation();
- NestableAnnotation nestedAnnotation1 = containerAnnotation.addNestedAnnotationInternal();
- nestedAnnotation1.newAnnotation();
- this.removeAnnotation(standAloneAnnotation);
- this.fireItemAdded(ANNOTATIONS_COLLECTION, containerAnnotation);
-
- if (index == 0) {
- // adding new annotation at 0, so stand-alone is "copied" to slot 1
- nestedAnnotation1.initializeFrom(standAloneAnnotation);
- } else {
- // adding new annotation at 1, so stand-alone is "copied" to slot 0
- nestedAnnotation0.initializeFrom(standAloneAnnotation);
- }
-
- return (index == 0) ? nestedAnnotation0 : nestedAnnotation1;
- }
-
- public void moveAnnotation(int targetIndex, int sourceIndex, String containerAnnotationName) {
- this.moveAnnotation(targetIndex, sourceIndex, this.getContainerAnnotation(containerAnnotationName));
- }
-
- private void moveAnnotation(int targetIndex, int sourceIndex, ContainerAnnotation<NestableAnnotation> containerAnnotation) {
- AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, containerAnnotation);
- }
-
- public void removeAnnotation(String annotationName) {
- Annotation annotation = this.getAnnotation(annotationName);
- if (annotation != null) {
- this.removeAnnotation(annotation);
- }
- }
-
- private void removeAnnotation(Annotation annotation) {
- this.annotations.remove(annotation);
- annotation.removeAnnotation();
- this.fireItemRemoved(ANNOTATIONS_COLLECTION, annotation);
- }
-
- public void removeAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) {
- ContainerAnnotation<NestableAnnotation> containerAnnotation = this.getContainerAnnotation(containerAnnotationName);
- if (containerAnnotation == null) { // assume the index is 0
- this.removeAnnotation(this.getAnnotation(nestableAnnotationName));
- } else {
- this.removeAnnotation(index, containerAnnotation);
- }
- }
-
- /**
- * after we remove the nested annotation, check to see whether we need to
- * either remove the container (if it is empty) or convert the last nested
- * annotation to a stand-alone annotation
- */
- private void removeAnnotation(int index, ContainerAnnotation<NestableAnnotation> containerAnnotation) {
- AnnotationContainerTools.removeNestedAnnotation(index, containerAnnotation);
- switch (containerAnnotation.nestedAnnotationsSize()) {
- case 0:
- this.removeAnnotation(containerAnnotation);
- break;
- case 1:
- this.convertLastNestedAnnotation(containerAnnotation);
- break;
- default:
- break;
- }
- }
-
- /**
- * convert the last nested annotation in the container to a stand-alone
- * annotation
- *
- * NB: we make all the necessary changes to the resource model and the
- * Java source code *before* we fire any events; so that everything is in
- * place when the context model gets an "update" and looks at the resource
- * model to determine what has changed
- */
- private void convertLastNestedAnnotation(ContainerAnnotation<NestableAnnotation> containerAnnotation) {
- NestableAnnotation lastNestedAnnotation = containerAnnotation.nestedAnnotations().next();
- annotations.remove(containerAnnotation);
- containerAnnotation.removeAnnotation();
-
- NestableAnnotation standAloneAnnotation = this.buildNestableAnnotation(lastNestedAnnotation.getAnnotationName());
- this.annotations.add(standAloneAnnotation);
- standAloneAnnotation.newAnnotation();
- this.fireItemRemoved(ANNOTATIONS_COLLECTION, containerAnnotation);
- this.fireItemAdded(ANNOTATIONS_COLLECTION, standAloneAnnotation);
- standAloneAnnotation.initializeFrom(lastNestedAnnotation);
- }
-
- public Annotation setPrimaryAnnotation(String primaryAnnotationName, Iterable<String> supportingAnnotationNames) {
- ArrayList<String> annotationNames = new ArrayList<String>();
- CollectionTools.addAll(annotationNames, supportingAnnotationNames);
- if (primaryAnnotationName != null) {
- annotationNames.add(primaryAnnotationName);
- }
- for (Annotation annotation : this.getAnnotations()) {
- if ( ! CollectionTools.contains(annotationNames, annotation.getAnnotationName())) {
- this.annotations.remove(annotation);
- annotation.removeAnnotation();
- }
- }
- Annotation newPrimaryAnnotation = null;
- if ((primaryAnnotationName != null) && (this.getAnnotation(primaryAnnotationName) == null)) {
- newPrimaryAnnotation = this.buildAnnotation(primaryAnnotationName);
- this.annotations.add(newPrimaryAnnotation);
- newPrimaryAnnotation.newAnnotation();
- }
- // fire collection change event after all annotation changes are done
- this.fireCollectionChanged(ANNOTATIONS_COLLECTION, this.annotations);
- return newPrimaryAnnotation;
- }
-
- private boolean annotationIsValid(String annotationName) {
- return CollectionTools.contains(this.validAnnotationNames(), annotationName);
- }
-
- abstract Iterator<String> validAnnotationNames();
-
- abstract Annotation buildAnnotation(String mappingAnnotationName);
-
- abstract Annotation buildNullAnnotation(String annotationName);
-
- // minimize scope of suppressed warnings
- @SuppressWarnings("unchecked")
- private ContainerAnnotation<NestableAnnotation> buildContainerAnnotation(String annotationName) {
- return (ContainerAnnotation<NestableAnnotation>) this.buildAnnotation(annotationName);
- }
-
- private NestableAnnotation buildNestableAnnotation(String annotationName) {
- return (NestableAnnotation) this.buildAnnotation(annotationName);
- }
-
-
- // ********** simple state **********
-
- public boolean isPersistable() {
- return this.persistable;
- }
-
- private void setPersistable(boolean persistable) {
- boolean old = this.persistable;
- this.persistable = persistable;
- this.firePropertyChanged(PERSISTABLE_PROPERTY, old, persistable);
- }
-
- private boolean buildPersistable(CompilationUnit astRoot) {
- return this.member.isPersistable(astRoot);
- }
-
- public boolean isAnnotated() {
- return ! this.annotations.isEmpty();
- }
-
- public boolean isFor(String memberName, int occurrence) {
- return this.member.matches(memberName, occurrence);
- }
-
- public TextRange getTextRange(CompilationUnit astRoot) {
- return this.fullTextRange(astRoot);
- }
-
- private TextRange fullTextRange(CompilationUnit astRoot) {
- return this.buildTextRange(this.member.getBodyDeclaration(astRoot));
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return this.member.getNameTextRange(astRoot);
- }
-
-
- // ********** update **********
-
- public void update(CompilationUnit astRoot) {
- this.updateAnnotations(astRoot);
- this.setPersistable(this.buildPersistable(astRoot));
- }
-
- private void updateAnnotations(CompilationUnit astRoot) {
- HashSet<Annotation> annotationsToRemove = new HashSet<Annotation>(this.annotations);
-
- this.member.getBodyDeclaration(astRoot).accept(this.buildUpdateAnnotationVisitor(astRoot, annotationsToRemove));
-
- for (Annotation annotation : annotationsToRemove) {
- this.removeItemFromCollection(annotation, this.annotations, ANNOTATIONS_COLLECTION);
- }
- }
-
- private ASTVisitor buildUpdateAnnotationVisitor(CompilationUnit astRoot, Set<Annotation> annotationsToRemove) {
- return new UpdateAnnotationVisitor(astRoot, this.member.getBodyDeclaration(astRoot), annotationsToRemove);
- }
-
- /**
- * called from {@link UpdateAnnotationVisitor}
- */
- /* private */ void addOrUpdateAnnotation(org.eclipse.jdt.core.dom.Annotation node, CompilationUnit astRoot, Set<Annotation> annotationsToRemove) {
- String jdtAnnotationName = JDTTools.resolveAnnotation(node);
- if (jdtAnnotationName != null) {
- this.addOrUpdateAnnotation(jdtAnnotationName, astRoot, annotationsToRemove);
- }
- }
-
- /**
- * pre-condition: jdtAnnotationName is not null
- */
- void addOrUpdateAnnotation(String jdtAnnotationName, CompilationUnit astRoot, Set<Annotation> annotationsToRemove) {
- if (this.annotationIsValid(jdtAnnotationName)) {
- this.addOrUpdateAnnotation_(jdtAnnotationName, astRoot, annotationsToRemove);
- }
- }
-
- /**
- * pre-condition: jdtAnnotationName is valid
- */
- private void addOrUpdateAnnotation_(String jdtAnnotationName, CompilationUnit astRoot, Set<Annotation> annotationsToRemove) {
- Annotation annotation = this.selectAnnotationNamed(annotationsToRemove, jdtAnnotationName);
- if (annotation != null) {
- annotation.update(astRoot);
- annotationsToRemove.remove(annotation);
- } else {
- annotation = this.buildAnnotation(jdtAnnotationName);
- annotation.initialize(astRoot);
- this.addItemToCollection(annotation, this.annotations, ANNOTATIONS_COLLECTION);
- }
- }
-
-
- // ********** miscellaneous **********
-
- public void resolveTypes(CompilationUnit astRoot) {
- this.setPersistable(this.buildPersistable(astRoot));
- }
-
- private Annotation selectAnnotationNamed(Iterable<Annotation> list, String annotationName) {
- for (Annotation annotation : list) {
- if (annotation.getAnnotationName().equals(annotationName)) {
- return annotation;
- }
- }
- return null;
- }
-
- private TextRange buildTextRange(ASTNode astNode) {
- return (astNode == null) ? null : new ASTNodeTextRange(astNode);
- }
-
- /**
- * convenience method
- */
- <T extends JavaResourcePersistentMember> Iterator<T> persistableMembers(Iterator<T> members) {
- return new FilteringIterator<T, T>(members) {
- @Override
- protected boolean accept(T m) {
- return m.isPersistable();
- }
- };
- }
-
-
- // ********** AST visitors **********
-
- /**
- * annotation visitor
- */
- protected static abstract class AnnotationVisitor
- extends ASTVisitor
- {
- protected final CompilationUnit astRoot;
- protected final BodyDeclaration bodyDeclaration;
-
- protected AnnotationVisitor(CompilationUnit astRoot, BodyDeclaration bodyDeclaration) {
- super();
- this.astRoot = astRoot;
- this.bodyDeclaration = bodyDeclaration;
- }
-
- @Override
- public boolean visit(SingleMemberAnnotation node) {
- return visit_(node);
- }
-
- @Override
- public boolean visit(NormalAnnotation node) {
- return visit_(node);
- }
-
- @Override
- public boolean visit(MarkerAnnotation node) {
- return visit_(node);
- }
-
- protected boolean visit_(org.eclipse.jdt.core.dom.Annotation node) {
- // ignore annotations for child members, only this member
- if (node.getParent() == this.bodyDeclaration) {
- this.visitChildAnnotation(node);
- }
- return false;
- }
-
- protected abstract void visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation node);
- }
-
-
- /**
- * initial annotation visitor
- */
- protected class InitialAnnotationVisitor
- extends AnnotationVisitor
- {
- protected InitialAnnotationVisitor(CompilationUnit astRoot, BodyDeclaration bodyDeclaration) {
- super(astRoot, bodyDeclaration);
- }
-
- @Override
- protected void visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation node) {
- SourcePersistentMember.this.addInitialAnnotation(node, this.astRoot);
- }
- }
-
-
- /**
- * update annotation visitor
- */
- protected class UpdateAnnotationVisitor
- extends AnnotationVisitor
- {
- protected final Set<Annotation> annotationsToRemove;
-
- protected UpdateAnnotationVisitor(CompilationUnit astRoot, BodyDeclaration bodyDeclaration, Set<Annotation> annotationsToRemove) {
- super(astRoot, bodyDeclaration);
- this.annotationsToRemove = annotationsToRemove;
- }
-
- @Override
- protected void visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation node) {
- SourcePersistentMember.this.addOrUpdateAnnotation(node, this.astRoot, this.annotationsToRemove);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentType.java
deleted file mode 100644
index ad8f496833..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentType.java
+++ /dev/null
@@ -1,724 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.FieldDeclaration;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jdt.core.dom.MethodDeclaration;
-import org.eclipse.jdt.core.dom.Modifier;
-import org.eclipse.jdt.core.dom.TypeDeclaration;
-import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.GeneratedAnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.StaticMetamodelAnnotationDefinition;
-import org.eclipse.jpt.core.internal.utility.jdt.JDTTools;
-import org.eclipse.jpt.core.internal.utility.jdt.JDTType;
-import org.eclipse.jpt.core.internal.utility.jdt.JPTTools;
-import org.eclipse.jpt.core.jpa2.resource.java.GeneratedAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JavaResourcePersistentType2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.StaticMetamodelAnnotation;
-import org.eclipse.jpt.core.resource.java.AccessType;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.jdt.Type;
-import org.eclipse.jpt.utility.MethodSignature;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.IntReference;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TreeIterator;
-
-/**
- * Java source persistent type
- */
-final class SourcePersistentType
- extends SourcePersistentMember<Type>
- implements JavaResourcePersistentType2_0
-{
- private String name;
-
- private String qualifiedName;
-
- private String superclassQualifiedName;
-
- private boolean abstract_; // 'abstract' is a reserved word
-
- private final Vector<JavaResourcePersistentType> types;
-
- private final Vector<JavaResourcePersistentAttribute> fields;
-
- private final Vector<JavaResourcePersistentAttribute> methods;
-
- private AccessType access;
-
- private StaticMetamodelAnnotation staticMetamodelAnnotation;
-
- private GeneratedAnnotation generatedAnnotation;
-
-
- private static final StaticMetamodelAnnotationDefinition STATIC_METAMODEL_ANNOTATION_DEFINITION = StaticMetamodelAnnotationDefinition.instance();
- private static final GeneratedAnnotationDefinition GENERATED_ANNOTATION_DEFINITION = GeneratedAnnotationDefinition.instance();
-
-
- // ********** construction/initialization **********
-
- /**
- * build top-level persistent type
- */
- static JavaResourcePersistentType newInstance(
- JavaResourceCompilationUnit javaResourceCompilationUnit,
- TypeDeclaration typeDeclaration,
- CompilationUnit astRoot) {
- Type type = new JDTType(
- typeDeclaration,
- javaResourceCompilationUnit.getCompilationUnit(),
- javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(),
- javaResourceCompilationUnit.getAnnotationEditFormatter());
- JavaResourcePersistentType jrpt = new SourcePersistentType(javaResourceCompilationUnit, type);
- jrpt.initialize(astRoot);
- return jrpt;
- }
-
- /**
- * build nested persistent type
- */
- private static JavaResourcePersistentType newInstance(
- JavaResourceCompilationUnit javaResourceCompilationUnit,
- Type declaringType,
- TypeDeclaration typeDeclaration,
- int occurrence,
- CompilationUnit astRoot) {
- Type type = new JDTType(
- declaringType,
- typeDeclaration,
- occurrence,
- javaResourceCompilationUnit.getCompilationUnit(),
- javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(),
- javaResourceCompilationUnit.getAnnotationEditFormatter());
- JavaResourcePersistentType jrpt = new SourcePersistentType(javaResourceCompilationUnit, type);
- jrpt.initialize(astRoot);
- return jrpt;
- }
-
- private SourcePersistentType(JavaResourceCompilationUnit javaResourceCompilationUnit, Type type) {
- super(javaResourceCompilationUnit, type);
- this.types = new Vector<JavaResourcePersistentType>();
- this.fields = new Vector<JavaResourcePersistentAttribute>();
- this.methods = new Vector<JavaResourcePersistentAttribute>();
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.name = this.buildName(astRoot);
- this.qualifiedName = this.buildQualifiedName(astRoot);
- this.superclassQualifiedName = this.buildSuperclassQualifiedName(astRoot);
- this.abstract_ = this.buildAbstract(astRoot);
- this.initializeTypes(astRoot);
- this.initializeFields(astRoot);
- this.initializeMethods(astRoot);
- // need to wait until everything is built to calculate 'access'
- this.access = this.buildAccess();
- }
-
- /**
- * Handle the <code>StaticMetamodel</code> and <code>Generated</code>
- * annotations differently, since they are not really JPA "mapping"
- * annotations....
- */
- @Override
- void addInitialAnnotation(String jdtAnnotationName, CompilationUnit astRoot) {
- if (jdtAnnotationName.equals(STATIC_METAMODEL_ANNOTATION_DEFINITION.getAnnotationName())) {
- if (this.staticMetamodelAnnotation == null) { // ignore duplicates
- this.staticMetamodelAnnotation = STATIC_METAMODEL_ANNOTATION_DEFINITION.buildAnnotation(this, this.member);
- this.staticMetamodelAnnotation.initialize(astRoot);
- }
- } else if (jdtAnnotationName.equals(GENERATED_ANNOTATION_DEFINITION.getAnnotationName())) {
- if (this.generatedAnnotation == null) { // ignore duplicates
- this.generatedAnnotation = GENERATED_ANNOTATION_DEFINITION.buildAnnotation(this, this.member);
- this.generatedAnnotation.initialize(astRoot);
- }
- } else {
- super.addInitialAnnotation(jdtAnnotationName, astRoot);
- }
- }
-
-
- // ********** update **********
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
- this.setName(this.buildName(astRoot));
- this.setQualifiedName(this.buildQualifiedName(astRoot));
- this.setSuperclassQualifiedName(this.buildSuperclassQualifiedName(astRoot));
- this.setAbstract(this.buildAbstract(astRoot));
- this.updateTypes(astRoot);
- this.updateFields(astRoot);
- this.updateMethods(astRoot);
- // need to wait until everything is built to calculate 'access'
- this.setAccess(this.buildAccess());
- }
-
- /**
- * Handle the <code>StaticMetamodel</code> and <code>Generated</code>
- * annotations differently, since they are not really JPA "mapping"
- * annotations....
- */
- @Override
- void addOrUpdateAnnotation(String jdtAnnotationName, CompilationUnit astRoot, Set<Annotation> annotationsToRemove) {
- if (jdtAnnotationName.equals(STATIC_METAMODEL_ANNOTATION_DEFINITION.getAnnotationName())) {
- if (this.staticMetamodelAnnotation != null) {
- this.staticMetamodelAnnotation.update(astRoot);
- } else {
- this.staticMetamodelAnnotation = STATIC_METAMODEL_ANNOTATION_DEFINITION.buildAnnotation(this, this.member);
- this.staticMetamodelAnnotation.initialize(astRoot);
- }
- } else if (jdtAnnotationName.equals(GENERATED_ANNOTATION_DEFINITION.getAnnotationName())) {
- if (this.generatedAnnotation != null) {
- this.generatedAnnotation.update(astRoot);
- } else {
- this.generatedAnnotation = GENERATED_ANNOTATION_DEFINITION.buildAnnotation(this, this.member);
- this.generatedAnnotation.initialize(astRoot);
- }
- } else {
- super.addOrUpdateAnnotation(jdtAnnotationName, astRoot, annotationsToRemove);
- }
- }
-
-
- // ********** SourcePersistentMember implementation **********
-
- @Override
- Iterator<String> validAnnotationNames() {
- return this.getAnnotationProvider().typeAnnotationNames();
- }
-
- @Override
- Annotation buildAnnotation(String mappingAnnotationName) {
- return this.getAnnotationProvider().buildTypeAnnotation(this, this.member, mappingAnnotationName);
- }
-
- @Override
- Annotation buildNullAnnotation(String annotationName) {
- return this.getAnnotationProvider().buildNullTypeAnnotation(this, annotationName);
- }
-
- @Override
- public void resolveTypes(CompilationUnit astRoot) {
- super.resolveTypes(astRoot);
-
- this.setSuperclassQualifiedName(this.buildSuperclassQualifiedName(astRoot));
-
- for (JavaResourcePersistentAttribute field : this.getFields()) {
- field.resolveTypes(astRoot);
- }
-
- // a new type can trigger a method parameter type to be a resolved,
- // fully-qualified name, so we need to rebuild our list of methods:
- // "setFoo(Foo)" is not the same as "setFoo(com.bar.Foo)"
- // and, vice-versa, a removed type can "unresolve" a parameter type
- this.updateMethods(astRoot);
-
- for (JavaResourcePersistentAttribute method : this.getMethods()) {
- method.resolveTypes(astRoot);
- }
- for (JavaResourcePersistentType type : this.getTypes()) {
- type.resolveTypes(astRoot);
- }
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ******** JavaResourcePersistentType implementation ********
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- private void setName(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- private String buildName(CompilationUnit astRoot) {
- ITypeBinding binding = this.member.getBinding(astRoot);
- return (binding == null) ? null : binding.getName();
- }
-
- // ***** qualified name
- public String getQualifiedName() {
- return this.qualifiedName;
- }
-
- private void setQualifiedName(String qualifiedName) {
- String old = this.qualifiedName;
- this.qualifiedName = qualifiedName;
- this.firePropertyChanged(QUALIFIED_NAME_PROPERTY, old, qualifiedName);
- }
-
- private String buildQualifiedName(CompilationUnit astRoot) {
- ITypeBinding binding = this.member.getBinding(astRoot);
- return (binding == null) ? null : binding.getQualifiedName();
- }
-
- // ***** superclass qualified name
- public String getSuperclassQualifiedName() {
- return this.superclassQualifiedName;
- }
-
- private void setSuperclassQualifiedName(String superclassQualifiedName) {
- String old = this.superclassQualifiedName;
- this.superclassQualifiedName = superclassQualifiedName;
- this.firePropertyChanged(SUPERCLASS_QUALIFIED_NAME_PROPERTY, old, superclassQualifiedName);
- }
-
- private String buildSuperclassQualifiedName(CompilationUnit astRoot) {
- ITypeBinding binding = this.member.getBinding(astRoot);
- if (binding == null) {
- return null;
- }
- ITypeBinding superclass = binding.getSuperclass();
- return (superclass == null) ? null : superclass.getTypeDeclaration().getQualifiedName();
- }
-
- // ***** abstract
- public boolean isAbstract() {
- return this.abstract_;
- }
-
- private void setAbstract(boolean abstract_) {
- boolean old = this.abstract_;
- this.abstract_ = abstract_;
- this.firePropertyChanged(ABSTRACT_PROPERTY, old, abstract_);
- }
-
- private boolean buildAbstract(CompilationUnit astRoot) {
- ITypeBinding binding = this.member.getBinding(astRoot);
- return (binding == null) ? false : Modifier.isAbstract(binding.getModifiers());
- }
-
- // ***** access
- public AccessType getAccess() {
- return this.access;
- }
-
- // TODO
- //seems we could have a public changeAccess() api which would
- //move all annotations from fields to their corresponding methods or vice versa
- //though of course it's more complicated than that since what if the
- //corresponding field/method does not exist?
- //making this internal since it should only be set based on changes in the source, the
- //context model should not need to set this
- private void setAccess(AccessType access) {
- AccessType old = this.access;
- this.access = access;
- this.firePropertyChanged(ACCESS_PROPERTY, old, access);
- }
-
- private AccessType buildAccess() {
- return JPTTools.buildAccess(this);
- }
-
- public boolean isMapped() {
- for (Annotation each : this.getAnnotations()) {
- if (this.annotationIsMappingAnnotation(each)) {
- return true;
- }
- }
- return false;
- }
-
- private boolean annotationIsMappingAnnotation(Annotation annotation) {
- return CollectionTools.contains(this.mappingAnnotationNames(), annotation.getAnnotationName());
- }
-
- private Iterator<String> mappingAnnotationNames() {
- return this.getAnnotationProvider().typeMappingAnnotationNames();
- }
-
- /**
- * check only persistable attributes
- */
- public boolean hasAnyAnnotatedAttributes() {
- for (Iterator<JavaResourcePersistentAttribute> stream = this.persistableAttributes(); stream.hasNext(); ) {
- if (stream.next().isAnnotated()) {
- return true;
- }
- }
- return false;
- }
-
-
- // ********** types **********
-
- public Iterator<JavaResourcePersistentType> types() {
- return this.getTypes().iterator();
- }
-
- private Iterable<JavaResourcePersistentType> getTypes() {
- return new LiveCloneIterable<JavaResourcePersistentType>(this.types); // read-only
- }
-
- public Iterator<JavaResourcePersistentType> allTypes() {
- return new TreeIterator<JavaResourcePersistentType>(this) {
- @Override
- protected Iterator<? extends JavaResourcePersistentType> children(JavaResourcePersistentType type) {
- return type.types();
- }
- };
- }
-
- public Iterator<JavaResourcePersistentType> persistableTypes() {
- return this.persistableMembers(this.types());
- }
-
- private JavaResourcePersistentType getType(String typeName, int occurrence) {
- for (JavaResourcePersistentType type : this.getTypes()) {
- if (type.isFor(typeName, occurrence)) {
- return type;
- }
- }
- return null;
- }
-
- private void addType(JavaResourcePersistentType type) {
- this.addItemToCollection(type, this.types, TYPES_COLLECTION);
- }
-
- private void removeTypes(Collection<JavaResourcePersistentType> remove) {
- this.removeItemsFromCollection(remove, this.types, TYPES_COLLECTION);
- }
-
- private void initializeTypes(CompilationUnit astRoot) {
- TypeDeclaration[] typeDeclarations = this.member.getTypes(astRoot);
- CounterMap counters = new CounterMap(typeDeclarations.length);
- for (TypeDeclaration td : typeDeclarations) {
- String tdName = td.getName().getFullyQualifiedName();
- int occurrence = counters.increment(tdName);
- this.types.add(this.buildType(td, occurrence, astRoot));
- }
- }
-
- private void updateTypes(CompilationUnit astRoot) {
- TypeDeclaration[] typeDeclarations = this.member.getTypes(astRoot);
- CounterMap counters = new CounterMap(typeDeclarations.length);
- HashSet<JavaResourcePersistentType> typesToRemove = new HashSet<JavaResourcePersistentType>(this.types);
- for (TypeDeclaration typeDeclaration : typeDeclarations) {
- String tdName = typeDeclaration.getName().getFullyQualifiedName();
- int occurrence = counters.increment(tdName);
-
- JavaResourcePersistentType type = this.getType(tdName, occurrence);
- if (type == null) {
- this.addType(this.buildType(typeDeclaration, occurrence, astRoot));
- } else {
- typesToRemove.remove(type);
- type.update(astRoot);
- }
- }
- this.removeTypes(typesToRemove);
- }
-
- private JavaResourcePersistentType buildType(TypeDeclaration nestedTypeDeclaration, int occurrence, CompilationUnit astRoot) {
- return newInstance(this.getJavaResourceCompilationUnit(), this.member, nestedTypeDeclaration, occurrence, astRoot);
- }
-
-
- // ********** fields **********
-
- public Iterator<JavaResourcePersistentAttribute> fields() {
- return this.getFields().iterator();
- }
-
- private Iterable<JavaResourcePersistentAttribute> getFields() {
- return new LiveCloneIterable<JavaResourcePersistentAttribute>(this.fields);
- }
-
- public Iterator<JavaResourcePersistentAttribute> persistableFields() {
- return this.persistableMembers(this.fields());
- }
-
- public Iterator<JavaResourcePersistentAttribute> persistableFieldsWithSpecifiedFieldAccess() {
- return new FilteringIterator<JavaResourcePersistentAttribute, JavaResourcePersistentAttribute>(this.persistableFields()) {
- @Override
- protected boolean accept(JavaResourcePersistentAttribute resourceAttribute) {
- return resourceAttribute.getSpecifiedAccess() == AccessType.FIELD;
- }
- };
- }
-
- private void addField(JavaResourcePersistentAttribute field) {
- this.addItemToCollection(field, this.fields, FIELDS_COLLECTION);
- }
-
- private JavaResourcePersistentAttribute getField(String fieldName, int occurrence) {
- for (JavaResourcePersistentAttribute field : this.getFields()) {
- if (field.isFor(fieldName, occurrence)) {
- return field;
- }
- }
- return null;
- }
-
- private void removeFields(Collection<JavaResourcePersistentAttribute> remove) {
- this.removeItemsFromCollection(remove, this.fields, FIELDS_COLLECTION);
- }
-
- private void initializeFields(CompilationUnit astRoot) {
- FieldDeclaration[] fieldDeclarations = this.member.getFields(astRoot);
- CounterMap counters = new CounterMap(fieldDeclarations.length);
- for (FieldDeclaration fieldDeclaration : fieldDeclarations) {
- for (VariableDeclarationFragment fragment : fragments(fieldDeclaration)) {
- String fieldName = fragment.getName().getFullyQualifiedName();
- int occurrence = counters.increment(fieldName);
- this.fields.add(this.buildField(fieldName, occurrence, astRoot));
- }
- }
- }
-
- private void updateFields(CompilationUnit astRoot) {
- FieldDeclaration[] fieldDeclarations = this.member.getFields(astRoot);
- CounterMap counters = new CounterMap(fieldDeclarations.length);
- HashSet<JavaResourcePersistentAttribute> fieldsToRemove = new HashSet<JavaResourcePersistentAttribute>(this.fields);
- for (FieldDeclaration fieldDeclaration : fieldDeclarations) {
- for (VariableDeclarationFragment fragment : fragments(fieldDeclaration)) {
- String fieldName = fragment.getName().getFullyQualifiedName();
- int occurrence = counters.increment(fieldName);
-
- JavaResourcePersistentAttribute field = this.getField(fieldName, occurrence);
- if (field == null) {
- this.addField(this.buildField(fieldName, occurrence, astRoot));
- } else {
- fieldsToRemove.remove(field);
- field.update(astRoot);
- }
- }
- }
- this.removeFields(fieldsToRemove);
- }
-
- private JavaResourcePersistentAttribute buildField(String fieldName, int occurrence, CompilationUnit astRoot) {
- return SourcePersistentAttribute.newInstance(this, this.member, fieldName, occurrence, this.getJavaResourceCompilationUnit(), astRoot);
- }
-
- // minimize scope of suppressed warnings
- @SuppressWarnings("unchecked")
- private static List<VariableDeclarationFragment> fragments(FieldDeclaration fd) {
- return fd.fragments();
- }
-
-
- // ********** methods **********
-
- public Iterator<JavaResourcePersistentAttribute> methods() {
- return this.getMethods().iterator();
- }
-
- private Iterable<JavaResourcePersistentAttribute> getMethods() {
- return new LiveCloneIterable<JavaResourcePersistentAttribute>(this.methods);
- }
-
- public Iterator<JavaResourcePersistentAttribute> persistableProperties() {
- return this.persistableMembers(this.methods());
- }
-
- public Iterator<JavaResourcePersistentAttribute> persistablePropertiesWithSpecifiedPropertyAccess() {
- return new FilteringIterator<JavaResourcePersistentAttribute, JavaResourcePersistentAttribute>(this.persistableProperties()) {
- @Override
- protected boolean accept(JavaResourcePersistentAttribute resourceAttribute) {
- return resourceAttribute.getSpecifiedAccess() == AccessType.PROPERTY;
- }
- };
- }
-
- private JavaResourcePersistentAttribute getMethod(MethodSignature signature, int occurrence) {
- for (JavaResourcePersistentAttribute method : this.getMethods()) {
- if (method.isFor(signature, occurrence)) {
- return method;
- }
- }
- return null;
- }
-
- private void addMethod(JavaResourcePersistentAttribute method) {
- this.addItemToCollection(method, this.methods, METHODS_COLLECTION);
- }
-
- private void removeMethods(Collection<JavaResourcePersistentAttribute> remove) {
- this.removeItemsFromCollection(remove, this.methods, METHODS_COLLECTION);
- }
-
- private void initializeMethods(CompilationUnit astRoot) {
- MethodDeclaration[] methodDeclarations = this.member.getMethods(astRoot);
- CounterMap counters = new CounterMap(methodDeclarations.length);
- for (MethodDeclaration methodDeclaration : methodDeclarations) {
- MethodSignature signature = JDTTools.buildMethodSignature(methodDeclaration);
- int occurrence = counters.increment(signature);
- this.methods.add(this.buildMethod(signature, occurrence, astRoot));
- }
- }
-
- private void updateMethods(CompilationUnit astRoot) {
- MethodDeclaration[] methodDeclarations = this.member.getMethods(astRoot);
- CounterMap counters = new CounterMap(methodDeclarations.length);
- HashSet<JavaResourcePersistentAttribute> methodsToRemove = new HashSet<JavaResourcePersistentAttribute>(this.methods);
- for (MethodDeclaration methodDeclaration : methodDeclarations) {
- MethodSignature signature = JDTTools.buildMethodSignature(methodDeclaration);
- int occurrence = counters.increment(signature);
-
- JavaResourcePersistentAttribute method = this.getMethod(signature, occurrence);
- if (method == null) {
- this.addMethod(this.buildMethod(signature, occurrence, astRoot));
- } else {
- methodsToRemove.remove(method);
- method.update(astRoot);
- }
- }
- this.removeMethods(methodsToRemove);
- }
-
- private JavaResourcePersistentAttribute buildMethod(MethodSignature signature, int occurrence, CompilationUnit astRoot) {
- return SourcePersistentAttribute.newInstance(this, this.member, signature, occurrence, this.getJavaResourceCompilationUnit(), astRoot);
- }
-
-
- // ********** attributes **********
-
- @SuppressWarnings("unchecked")
- public Iterator<JavaResourcePersistentAttribute> persistableAttributes() {
- return new CompositeIterator<JavaResourcePersistentAttribute>(
- this.persistableFields(),
- this.persistableProperties()
- );
- }
-
- public Iterator<JavaResourcePersistentAttribute> persistableAttributes(AccessType specifiedAccess) {
- if (specifiedAccess == null) {
- throw new IllegalArgumentException("specified access is null"); //$NON-NLS-1$
- }
- return (specifiedAccess == AccessType.FIELD) ?
- this.persistableAttributesForFieldAccessType() :
- this.persistableAttributesForPropertyAccessType();
- }
-
- @SuppressWarnings("unchecked")
- private Iterator<JavaResourcePersistentAttribute> persistableAttributesForFieldAccessType() {
- return new CompositeIterator<JavaResourcePersistentAttribute>(
- this.persistableFields(),
- this.persistablePropertiesWithSpecifiedPropertyAccess()
- );
- }
-
- @SuppressWarnings("unchecked")
- private Iterator<JavaResourcePersistentAttribute> persistableAttributesForPropertyAccessType() {
- return new CompositeIterator<JavaResourcePersistentAttribute>(
- this.persistableProperties(),
- this.persistableFieldsWithSpecifiedFieldAccess()
- );
- }
-
-
- // ********** metamodel **********
-
- public GeneratedAnnotation getGeneratedAnnotation() {
- return this.generatedAnnotation;
- }
-
- /**
- * The type must be:<ul>
- * <li>in the specified source folder
- * <li>annotated with <code>&#64;javax.persistence.metamodel.StaticMetamodel</code>
- * <li>annotated with <code>&#64;javax.annotation.Generated</code> with the appropriate
- * <code>value</code>
- * </ul>
- */
- public boolean isGeneratedMetamodel(IPackageFragmentRoot sourceFolder) {
- if ( ! this.getSourceFolder().equals(sourceFolder)) {
- return false;
- }
- return this.isGeneratedMetamodel();
- }
-
- /**
- * The type must be:<ul>
- * <li>annotated with <code>&#64;javax.persistence.metamodel.StaticMetamodel</code>
- * <li>annotated with <code>&#64;javax.annotation.Generated</code> with the appropriate
- * <code>value</code> and <code>date</code>
- * </ul>
- */
- public boolean isGeneratedMetamodel() {
- if (this.staticMetamodelAnnotation == null) {
- return false;
- }
- if (this.generatedAnnotation == null) {
- return false;
- }
- if (this.generatedAnnotation.valuesSize() != 1) {
- return false;
- }
- if ( ! this.generatedAnnotation.getValue(0).equals(METAMODEL_GENERATED_ANNOTATION_VALUE)) {
- return false;
- }
- if (StringTools.stringIsEmpty(this.generatedAnnotation.getDate())) {
- return false;
- }
- return true;
- }
-
- private IPackageFragmentRoot getSourceFolder() {
- return (IPackageFragmentRoot) this.getJavaResourceCompilationUnit().getCompilationUnit().getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
- }
-
-
- // ********** CounterMap **********
-
- private static class CounterMap {
- private final HashMap<Object, IntReference> counters;
-
- protected CounterMap(int initialCapacity) {
- super();
- this.counters = new HashMap<Object, IntReference>(initialCapacity);
- }
-
- /**
- * Return the incremented count for the specified object.
- */
- int increment(Object o) {
- IntReference counter = this.counters.get(o);
- if (counter == null) {
- counter = new IntReference();
- this.counters.put(o, counter);
- }
- counter.increment();
- return counter.getValue();
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnAnnotation.java
deleted file mode 100644
index 1b190855fd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnAnnotation.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberIndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.PrimaryKeyJoinColumn
- */
-public final class SourcePrimaryKeyJoinColumnAnnotation
- extends SourceNamedColumnAnnotation
- implements NestablePrimaryKeyJoinColumnAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final DeclarationAnnotationElementAdapter<String> referencedColumnNameDeclarationAdapter;
- private final AnnotationElementAdapter<String> referencedColumnNameAdapter;
- private String referencedColumnName;
-
-
- public SourcePrimaryKeyJoinColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
- this.referencedColumnNameDeclarationAdapter = this.buildStringElementAdapter(JPA.PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME);
- this.referencedColumnNameAdapter = this.buildShortCircuitElementAdapter(this.referencedColumnNameDeclarationAdapter);
- }
-
- public SourcePrimaryKeyJoinColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
- this(parent, member, daa, new MemberAnnotationAdapter(member, daa));
- }
-
- public SourcePrimaryKeyJoinColumnAnnotation(JavaResourceNode parent, Member member, IndexedDeclarationAnnotationAdapter idaa) {
- this(parent, member, idaa, new MemberIndexedAnnotationAdapter(member, idaa));
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.referencedColumnName = this.buildReferencedColumnName(astRoot);
- }
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
- this.setReferencedColumnName(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.attributeValueHasNotChanged(this.referencedColumnName, referencedColumnName)) {
- return;
- }
- String old = this.referencedColumnName;
- this.referencedColumnName = referencedColumnName;
- this.referencedColumnNameAdapter.setValue(referencedColumnName);
- this.firePropertyChanged(REFERENCED_COLUMN_NAME_PROPERTY, old, referencedColumnName);
- }
-
- 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);
- }
-
-
- // ********** NestableAnnotation implementation **********
-
- @Override
- public void initializeFrom(NestableAnnotation oldAnnotation) {
- super.initializeFrom(oldAnnotation);
- PrimaryKeyJoinColumnAnnotation oldJoinColumn = (PrimaryKeyJoinColumnAnnotation) oldAnnotation;
- this.setReferencedColumnName(oldJoinColumn.getReferencedColumnName());
- }
-
- public void moveAnnotation(int newIndex) {
- this.getIndexedAnnotationAdapter().moveAnnotation(newIndex);
- }
-
- protected IndexedAnnotationAdapter getIndexedAnnotationAdapter() {
- return (IndexedAnnotationAdapter) this.annotationAdapter;
- }
-
-
- // ********** static methods **********
-
- public static SourcePrimaryKeyJoinColumnAnnotation createPrimaryKeyJoinColumn(JavaResourceNode parent, Member member) {
- return new SourcePrimaryKeyJoinColumnAnnotation(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- static SourcePrimaryKeyJoinColumnAnnotation createNestedPrimaryKeyJoinColumn(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter pkJoinColumnsAdapter) {
- IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, pkJoinColumnsAdapter);
- IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(member, idaa);
- return new SourcePrimaryKeyJoinColumnAnnotation(parent, member, idaa, annotationAdapter);
- }
-
- private static IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter pkJoinColumnsAdapter) {
- return new NestedIndexedDeclarationAnnotationAdapter(pkJoinColumnsAdapter, index, JPA.PRIMARY_KEY_JOIN_COLUMN);
- }
-
- static NestablePrimaryKeyJoinColumnAnnotation createSecondaryTablePrimaryKeyJoinColumn(DeclarationAnnotationAdapter secondaryTableAdapter, JavaResourceNode parent, Member member, int index) {
- return new SourcePrimaryKeyJoinColumnAnnotation(parent, member, buildSecondaryTableAnnotationAdapter(secondaryTableAdapter, index));
- }
-
- private static IndexedDeclarationAnnotationAdapter buildSecondaryTableAnnotationAdapter(DeclarationAnnotationAdapter secondaryTableAdapter, int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(secondaryTableAdapter, JPA.SECONDARY_TABLE__PK_JOIN_COLUMNS, index, JPA.PRIMARY_KEY_JOIN_COLUMN);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnsAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnsAnnotation.java
deleted file mode 100644
index 0a3ea82674..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnsAnnotation.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.PrimaryKeyJoinColumns
- */
-public final class SourcePrimaryKeyJoinColumnsAnnotation
- extends SourceAnnotation<Member>
- implements PrimaryKeyJoinColumnsAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final Vector<NestablePrimaryKeyJoinColumnAnnotation> pkJoinColumns = new Vector<NestablePrimaryKeyJoinColumnAnnotation>();
-
-
- public SourcePrimaryKeyJoinColumnsAnnotation(JavaResourceNode parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- AnnotationContainerTools.initialize(this, astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- AnnotationContainerTools.update(this, astRoot);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.pkJoinColumns);
- }
-
-
- // ********** AnnotationContainer Implementation **********
-
- public String getContainerAnnotationName() {
- return this.getAnnotationName();
- }
-
- public org.eclipse.jdt.core.dom.Annotation getContainerJdtAnnotation(CompilationUnit astRoot) {
- return this.getJdtAnnotation(astRoot);
- }
-
- public String getElementName() {
- return JPA.PRIMARY_KEY_JOIN_COLUMNS__VALUE;
- }
-
- public String getNestableAnnotationName() {
- return PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME;
- }
-
- public ListIterator<NestablePrimaryKeyJoinColumnAnnotation> nestedAnnotations() {
- return new CloneListIterator<NestablePrimaryKeyJoinColumnAnnotation>(this.pkJoinColumns);
- }
-
- public int nestedAnnotationsSize() {
- return this.pkJoinColumns.size();
- }
-
- public NestablePrimaryKeyJoinColumnAnnotation addNestedAnnotationInternal() {
- NestablePrimaryKeyJoinColumnAnnotation pkJoinColumn = this.buildPrimaryKeyJoinColumn(this.pkJoinColumns.size());
- this.pkJoinColumns.add(pkJoinColumn);
- return pkJoinColumn;
- }
-
- private NestablePrimaryKeyJoinColumnAnnotation buildPrimaryKeyJoinColumn(int index) {
- return SourcePrimaryKeyJoinColumnAnnotation.createNestedPrimaryKeyJoinColumn(this, this.member, index, this.daa);
- }
-
- public void nestedAnnotationAdded(int index, NestablePrimaryKeyJoinColumnAnnotation nestedAnnotation) {
- this.fireItemAdded(PK_JOIN_COLUMNS_LIST, index, nestedAnnotation);
- }
-
- public NestablePrimaryKeyJoinColumnAnnotation moveNestedAnnotationInternal(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.pkJoinColumns, targetIndex, sourceIndex).get(targetIndex);
- }
-
- public void nestedAnnotationMoved(int targetIndex, int sourceIndex) {
- this.fireItemMoved(PK_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
- }
-
- public NestablePrimaryKeyJoinColumnAnnotation removeNestedAnnotationInternal(int index) {
- return this.pkJoinColumns.remove(index);
- }
-
- public void nestedAnnotationRemoved(int index, NestablePrimaryKeyJoinColumnAnnotation nestedAnnotation) {
- this.fireItemRemoved(PK_JOIN_COLUMNS_LIST, index, nestedAnnotation);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceQueryHintAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceQueryHintAnnotation.java
deleted file mode 100644
index 23484c15f1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceQueryHintAnnotation.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberIndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableQueryHintAnnotation;
-import org.eclipse.jpt.core.resource.java.QueryHintAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Type;
-
-/**
- * javax.persistence.QueryHint
- */
-public final class SourceQueryHintAnnotation
- extends SourceAnnotation<Type>
- implements NestableQueryHintAnnotation
-{
- private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
- private final AnnotationElementAdapter<String> nameAdapter;
- private String name;
-
- private final DeclarationAnnotationElementAdapter<String> valueDeclarationAdapter;
- private final AnnotationElementAdapter<String> valueAdapter;
- private String value;
-
-
- public SourceQueryHintAnnotation(JavaResourceNode parent, Type type, IndexedDeclarationAnnotationAdapter idaa) {
- super(parent, type, idaa, new MemberIndexedAnnotationAdapter(type, idaa));
- this.nameDeclarationAdapter = this.buildNameAdapter(idaa);
- this.nameAdapter = this.buildAdapter(this.nameDeclarationAdapter);
- this.valueDeclarationAdapter = this.buildValueAdapter(idaa);
- this.valueAdapter = this.buildAdapter(this.valueDeclarationAdapter);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- private AnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationElementAdapter<String> daea) {
- return new ShortCircuitAnnotationElementAdapter<String>(this.member, daea);
- }
-
- private DeclarationAnnotationElementAdapter<String> buildNameAdapter(DeclarationAnnotationAdapter adapter) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(adapter, JPA.QUERY_HINT__NAME);
- }
-
- private DeclarationAnnotationElementAdapter<String> buildValueAdapter(DeclarationAnnotationAdapter adapter) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(adapter, JPA.QUERY_HINT__VALUE);
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.name = this.buildName(astRoot);
- this.value = this.buildValue(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setName(this.buildName(astRoot));
- this.setValue(this.buildValue(astRoot));
- }
-
- public IndexedAnnotationAdapter getIndexedAnnotationAdapter() {
- return (IndexedAnnotationAdapter) this.annotationAdapter;
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** QueryHintAnnotation implementation **********
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- if (this.attributeValueHasNotChanged(this.name, name)) {
- return;
- }
- String old = this.name;
- this.name = name;
- this.nameAdapter.setValue(name);
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- private String buildName(CompilationUnit astRoot) {
- return this.nameAdapter.getValue(astRoot);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.nameDeclarationAdapter, astRoot);
- }
-
- // ***** value
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- if (this.attributeValueHasNotChanged(this.value, value)) {
- return;
- }
- String old = this.value;
- this.value = value;
- this.valueAdapter.setValue(value);
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private String buildValue(CompilationUnit astRoot) {
- return this.valueAdapter.getValue(astRoot);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.valueDeclarationAdapter, astRoot);
- }
-
-
- // ********** NestableAnnotation implementation **********
-
- public void initializeFrom(NestableAnnotation oldAnnotation) {
- QueryHintAnnotation oldHint = (QueryHintAnnotation) oldAnnotation;
- this.setName(oldHint.getName());
- this.setValue(oldHint.getValue());
- }
-
- public void moveAnnotation(int newIndex) {
- this.getIndexedAnnotationAdapter().moveAnnotation(newIndex);
- }
-
-
- // ********** static methods **********
-
- static SourceQueryHintAnnotation createNamedQueryQueryHint(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter namedQueryAdapter, int index) {
- return new SourceQueryHintAnnotation(parent, type, buildNamedQueryQueryHintAnnotationAdapter(namedQueryAdapter, index));
- }
-
- private static IndexedDeclarationAnnotationAdapter buildNamedQueryQueryHintAnnotationAdapter(DeclarationAnnotationAdapter namedQueryAdapter, int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(namedQueryAdapter, JPA.NAMED_QUERY__HINTS, index, JPA.QUERY_HINT);
- }
-
- static SourceQueryHintAnnotation createNamedNativeQueryQueryHint(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter namedNativeQueryAdapter, int index) {
- return new SourceQueryHintAnnotation(parent, type, buildNamedNativeQueryQueryHintAnnotationAdapter(namedNativeQueryAdapter, index));
- }
-
- private static IndexedDeclarationAnnotationAdapter buildNamedNativeQueryQueryHintAnnotationAdapter(DeclarationAnnotationAdapter namedNativeQueryAdapter, int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(namedNativeQueryAdapter, JPA.NAMED_NATIVE_QUERY__HINTS, index, JPA.QUERY_HINT);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceRelationshipMappingAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceRelationshipMappingAnnotation.java
deleted file mode 100644
index db7f070ea9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceRelationshipMappingAnnotation.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.EnumArrayDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.JDTTools;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitArrayAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
-import org.eclipse.jpt.core.resource.java.CascadeType;
-import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.RelationshipMappingAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-
-/**
- * javax.persistence.ManyToMany
- * javax.persistence.ManyToOne
- * javax.persistence.OneToMany
- * javax.persistence.OneToOne
- */
-abstract class SourceRelationshipMappingAnnotation
- extends SourceAnnotation<Attribute>
- implements RelationshipMappingAnnotation
-{
- final DeclarationAnnotationElementAdapter<String> targetEntityDeclarationAdapter;
- final AnnotationElementAdapter<String> targetEntityAdapter;
- String targetEntity;
-
- String fullyQualifiedTargetEntityClassName;
-
- final DeclarationAnnotationElementAdapter<String> fetchDeclarationAdapter;
- final AnnotationElementAdapter<String> fetchAdapter;
- FetchType fetch;
-
- final DeclarationAnnotationElementAdapter<String[]> cascadeDeclarationAdapter;
- final AnnotationElementAdapter<String[]> cascadeAdapter;
- boolean cascadeAll;
- boolean cascadePersist;
- boolean cascadeMerge;
- boolean cascadeRemove;
- boolean cascadeRefresh;
-
-
- SourceRelationshipMappingAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute, DeclarationAnnotationAdapter daa) {
- super(parent, attribute, daa);
- this.targetEntityDeclarationAdapter = this.getTargetEntityAdapter();
- this.targetEntityAdapter = this.buildAnnotationElementAdapter(this.targetEntityDeclarationAdapter);
- this.fetchDeclarationAdapter = this.getFetchAdapter();
- this.fetchAdapter = this.buildAnnotationElementAdapter(this.fetchDeclarationAdapter);
- this.cascadeDeclarationAdapter = this.getCascadeAdapter();
- this.cascadeAdapter = new ShortCircuitArrayAnnotationElementAdapter<String>(attribute, this.cascadeDeclarationAdapter);
- }
-
- protected AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) {
- return new ShortCircuitAnnotationElementAdapter<String>(this.member, daea);
- }
-
- protected AnnotationElementAdapter<Boolean> buildBooleanAnnotationElementAdapter(DeclarationAnnotationElementAdapter<Boolean> daea) {
- return new ShortCircuitAnnotationElementAdapter<Boolean>(this.member, daea);
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.targetEntity = this.buildTargetEntity(astRoot);
- this.fullyQualifiedTargetEntityClassName = this.buildFullyQualifiedTargetEntityClassName(astRoot);
- this.fetch = this.buildFetch(astRoot);
- this.initializeCascadeTypes(astRoot);
- }
-
- private void initializeCascadeTypes(CompilationUnit astRoot) {
- CascadeType[] cascadeTypes = CascadeType.fromJavaAnnotationValues(this.cascadeAdapter.getValue(astRoot));
- 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);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setFetch(this.buildFetch(astRoot));
- this.setTargetEntity(this.buildTargetEntity(astRoot));
- this.setFullyQualifiedTargetEntityClassName(this.buildFullyQualifiedTargetEntityClassName(astRoot));
- this.updateCascade(astRoot);
- }
-
- private void updateCascade(CompilationUnit astRoot) {
- CascadeType[] cascadeTypes = CascadeType.fromJavaAnnotationValues(this.cascadeAdapter.getValue(astRoot));
- 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));
- }
-
- @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.attributeValueHasNotChanged(this.targetEntity, targetEntity)) {
- return;
- }
- String old = this.targetEntity;
- this.targetEntity = targetEntity;
- this.targetEntityAdapter.setValue(targetEntity);
- this.firePropertyChanged(TARGET_ENTITY_PROPERTY, old, targetEntity);
- }
-
- 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() {
- return this.fullyQualifiedTargetEntityClassName;
- }
-
- private void setFullyQualifiedTargetEntityClassName(String name) {
- String old = this.fullyQualifiedTargetEntityClassName;
- this.fullyQualifiedTargetEntityClassName = name;
- this.firePropertyChanged(FULLY_QUALIFIED_TARGET_ENTITY_CLASS_NAME_PROPERTY, old, name);
- }
-
- private String buildFullyQualifiedTargetEntityClassName(CompilationUnit astRoot) {
- return (this.targetEntity == null) ? null : JDTTools.resolveFullyQualifiedName(this.targetEntityAdapter.getExpression(astRoot));
- }
-
- // ***** fetch
- public FetchType getFetch() {
- return this.fetch;
- }
-
- public void setFetch(FetchType fetch) {
- if (this.attributeValueHasNotChanged(this.fetch, fetch)) {
- return;
- }
- FetchType old = this.fetch;
- this.fetch = fetch;
- this.fetchAdapter.setValue(FetchType.toJavaAnnotationValue(fetch));
- this.firePropertyChanged(FETCH_PROPERTY, old, fetch);
- }
-
- 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
- private void setCascadeTypes(CascadeType[] cascadeTypes) {
- this.cascadeAdapter.setValue(CascadeType.toJavaAnnotationValues(cascadeTypes));
- }
-
- private void setCascade(CascadeType cascadeType, boolean set) {
- String[] javaValues = this.cascadeAdapter.getValue();
- CascadeType[] cascadeTypes = CascadeType.fromJavaAnnotationValues(javaValues);
-
- boolean present = ArrayTools.contains(cascadeTypes, cascadeType);
- if (set) {
- if ( ! present) {
- this.setCascadeTypes(ArrayTools.add(cascadeTypes, cascadeType));
- }
- } else {
- if (present) {
- this.setCascadeTypes(ArrayTools.remove(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.cascadeAll;
- }
-
- public void setCascadeAll(boolean cascadeAll) {
- if (this.cascadeAll == cascadeAll) {
- return;
- }
- boolean old = this.cascadeAll;
- this.cascadeAll = cascadeAll;
- this.setCascade(CascadeType.ALL, cascadeAll);
- this.firePropertyChanged(CASCADE_ALL_PROPERTY, old, cascadeAll);
- }
-
- // ***** cascade persist
- public boolean isCascadePersist() {
- return this.cascadePersist;
- }
-
- public void setCascadePersist(boolean cascadePersist) {
- if (this.cascadePersist == cascadePersist) {
- return;
- }
- boolean old = this.cascadePersist;
- this.cascadePersist = cascadePersist;
- this.setCascade(CascadeType.PERSIST, cascadePersist);
- this.firePropertyChanged(CASCADE_PERSIST_PROPERTY, old, cascadePersist);
- }
-
- // ***** cascade merge
- public boolean isCascadeMerge() {
- return this.cascadeMerge;
- }
-
- public void setCascadeMerge(boolean cascadeMerge) {
- if (this.cascadeMerge == cascadeMerge) {
- return;
- }
- boolean old = this.cascadeMerge;
- this.cascadeMerge = cascadeMerge;
- this.setCascade(CascadeType.MERGE, cascadeMerge);
- this.firePropertyChanged(CASCADE_MERGE_PROPERTY, old, cascadeMerge);
- }
-
- // ***** cascade remove
- public boolean isCascadeRemove() {
- return this.cascadeRemove;
- }
-
- public void setCascadeRemove(boolean cascadeRemove) {
- if (this.cascadeRemove == cascadeRemove) {
- return;
- }
- boolean old = this.cascadeRemove;
- this.cascadeRemove = cascadeRemove;
- this.setCascade(CascadeType.REMOVE, cascadeRemove);
- this.firePropertyChanged(CASCADE_REMOVE_PROPERTY, old, cascadeRemove);
- }
-
- // ***** cascade refresh
- public boolean isCascadeRefresh() {
- return this.cascadeRefresh;
- }
-
- public void setCascadeRefresh(boolean cascadeRefresh) {
- if (this.cascadeRefresh == cascadeRefresh) {
- return;
- }
- boolean old = this.cascadeRefresh;
- this.cascadeRefresh = cascadeRefresh;
- this.setCascade(CascadeType.REFRESH, cascadeRefresh);
- this.firePropertyChanged(CASCADE_REFRESH_PROPERTY, old, cascadeRefresh);
- }
-
-
- // ********** 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, false, converter);
- }
-
- static DeclarationAnnotationElementAdapter<String> buildFetchAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return new EnumDeclarationAnnotationElementAdapter(annotationAdapter, elementName, false);
- }
-
- static DeclarationAnnotationElementAdapter<String[]> buildEnumArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return new EnumArrayDeclarationAnnotationElementAdapter(annotationAdapter, elementName, false);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSecondaryTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSecondaryTableAnnotation.java
deleted file mode 100644
index ada1107dc3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSecondaryTableAnnotation.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberIndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.AnnotationContainer;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableSecondaryTableAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.SecondaryTable
- */
-public final class SourceSecondaryTableAnnotation
- extends SourceBaseTableAnnotation
- implements NestableSecondaryTableAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(SecondaryTableAnnotation.ANNOTATION_NAME);
-
- private final Vector<NestablePrimaryKeyJoinColumnAnnotation> pkJoinColumns = new Vector<NestablePrimaryKeyJoinColumnAnnotation>();
- private final PkJoinColumnsAnnotationContainer pkJoinColumnsContainer = new PkJoinColumnsAnnotationContainer();
-
-
- public SourceSecondaryTableAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- AnnotationContainerTools.initialize(this.pkJoinColumnsContainer, astRoot);
- }
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
- AnnotationContainerTools.update(this.pkJoinColumnsContainer, astRoot);
- }
-
-
- // ********** AbstractBaseTableAnnotation implementation **********
-
- @Override
- DeclarationAnnotationElementAdapter<String> getNameAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(declarationAnnotationAdapter, JPA.SECONDARY_TABLE__NAME);
- }
-
- @Override
- DeclarationAnnotationElementAdapter<String> getSchemaAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(declarationAnnotationAdapter, JPA.SECONDARY_TABLE__SCHEMA);
- }
-
- @Override
- DeclarationAnnotationElementAdapter<String> getCatalogAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(declarationAnnotationAdapter, JPA.SECONDARY_TABLE__CATALOG);
- }
-
- @Override
- String getUniqueConstraintsElementName() {
- return JPA.SECONDARY_TABLE__UNIQUE_CONSTRAINTS;
- }
-
-
- // ************* SecondaryTable implementation *******************
-
- // ***** pk join columns
- public ListIterator<PrimaryKeyJoinColumnAnnotation> pkJoinColumns() {
- return new CloneListIterator<PrimaryKeyJoinColumnAnnotation>(this.pkJoinColumns);
- }
-
- ListIterator<NestablePrimaryKeyJoinColumnAnnotation> nestablePkJoinColumns() {
- return new CloneListIterator<NestablePrimaryKeyJoinColumnAnnotation>(this.pkJoinColumns);
- }
-
- public int pkJoinColumnsSize() {
- return this.pkJoinColumns.size();
- }
-
- public NestablePrimaryKeyJoinColumnAnnotation pkJoinColumnAt(int index) {
- return this.pkJoinColumns.get(index);
- }
-
- public int indexOfPkJoinColumn(PrimaryKeyJoinColumnAnnotation joinColumn) {
- return this.pkJoinColumns.indexOf(joinColumn);
- }
-
- public NestablePrimaryKeyJoinColumnAnnotation addPkJoinColumn(int index) {
- return (NestablePrimaryKeyJoinColumnAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.pkJoinColumnsContainer);
- }
-
- NestablePrimaryKeyJoinColumnAnnotation addPkJoinColumnInternal() {
- NestablePrimaryKeyJoinColumnAnnotation pkJoinColumn = this.buildPrimaryKeyJoinColumn(this.pkJoinColumns.size());
- this.pkJoinColumns.add(pkJoinColumn);
- return pkJoinColumn;
- }
-
- private NestablePrimaryKeyJoinColumnAnnotation buildPrimaryKeyJoinColumn(int index) {
- return SourcePrimaryKeyJoinColumnAnnotation.createSecondaryTablePrimaryKeyJoinColumn(this.daa, this, this.member, index);
- }
-
- void pkJoinColumnAdded(int index, NestablePrimaryKeyJoinColumnAnnotation joinColumn) {
- this.fireItemAdded(PK_JOIN_COLUMNS_LIST, index, joinColumn);
- }
-
- public void movePkJoinColumn(int targetIndex, int sourceIndex) {
- AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.pkJoinColumnsContainer);
- }
-
- NestablePrimaryKeyJoinColumnAnnotation movePkJoinColumnInternal(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.pkJoinColumns, targetIndex, sourceIndex).get(targetIndex);
- }
-
- void pkJoinColumnMoved(int targetIndex, int sourceIndex) {
- this.fireItemMoved(PK_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
- }
-
- public void removePkJoinColumn(int index) {
- AnnotationContainerTools.removeNestedAnnotation(index, this.pkJoinColumnsContainer);
- }
-
- NestablePrimaryKeyJoinColumnAnnotation removePkJoinColumnInternal(int index) {
- return this.pkJoinColumns.remove(index);
- }
-
- void pkJoinColumnRemoved(int index, NestablePrimaryKeyJoinColumnAnnotation joinColumn) {
- this.fireItemRemoved(PK_JOIN_COLUMNS_LIST, index, joinColumn);
- }
-
-
- // ********** NestableAnnotation implementation **********
-
- public void moveAnnotation(int newIndex) {
- this.getIndexedAnnotationAdapter().moveAnnotation(newIndex);
- }
-
- protected IndexedAnnotationAdapter getIndexedAnnotationAdapter() {
- return (IndexedAnnotationAdapter) this.annotationAdapter;
- }
-
- @Override
- public void initializeFrom(NestableAnnotation oldAnnotation) {
- super.initializeFrom(oldAnnotation);
- SecondaryTableAnnotation oldTable = (SecondaryTableAnnotation) oldAnnotation;
- for (PrimaryKeyJoinColumnAnnotation oldPkJoinColumn : CollectionTools.iterable(oldTable.pkJoinColumns())) {
- NestablePrimaryKeyJoinColumnAnnotation newPkJoinColumn = this.addPkJoinColumn(oldTable.indexOfPkJoinColumn(oldPkJoinColumn));
- newPkJoinColumn.initializeFrom((NestableAnnotation) oldPkJoinColumn);
- }
- }
-
-
- // ********** static methods **********
-
- public static SourceSecondaryTableAnnotation createSecondaryTable(JavaResourceNode parent, Member member) {
- return new SourceSecondaryTableAnnotation(parent, member, DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER));
- }
-
- static SourceSecondaryTableAnnotation createNestedSecondaryTable(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter secondaryTablesAdapter) {
- IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, secondaryTablesAdapter);
- IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(member, idaa);
- return new SourceSecondaryTableAnnotation(parent, member, idaa, annotationAdapter);
- }
-
- private static IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter secondaryTablesAdapter) {
- return new NestedIndexedDeclarationAnnotationAdapter(secondaryTablesAdapter, index, JPA.SECONDARY_TABLE);
- }
-
-
- // ********** pk join column container **********
-
- /**
- * adapt the AnnotationContainer interface to the secondary table's
- * primary key join columns
- */
- class PkJoinColumnsAnnotationContainer
- implements AnnotationContainer<NestablePrimaryKeyJoinColumnAnnotation>
- {
- public String getContainerAnnotationName() {
- return SourceSecondaryTableAnnotation.this.getAnnotationName();
- }
-
- public org.eclipse.jdt.core.dom.Annotation getContainerJdtAnnotation(CompilationUnit astRoot) {
- return SourceSecondaryTableAnnotation.this.getJdtAnnotation(astRoot);
- }
-
- public String getElementName() {
- return JPA.SECONDARY_TABLE__PK_JOIN_COLUMNS;
- }
-
- public String getNestableAnnotationName() {
- return PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME;
- }
-
- public ListIterator<NestablePrimaryKeyJoinColumnAnnotation> nestedAnnotations() {
- return SourceSecondaryTableAnnotation.this.nestablePkJoinColumns();
- }
-
- public int nestedAnnotationsSize() {
- return SourceSecondaryTableAnnotation.this.pkJoinColumnsSize();
- }
-
- public NestablePrimaryKeyJoinColumnAnnotation addNestedAnnotationInternal() {
- return SourceSecondaryTableAnnotation.this.addPkJoinColumnInternal();
- }
-
- public void nestedAnnotationAdded(int index, NestablePrimaryKeyJoinColumnAnnotation nestedAnnotation) {
- SourceSecondaryTableAnnotation.this.pkJoinColumnAdded(index, nestedAnnotation);
- }
-
- public NestablePrimaryKeyJoinColumnAnnotation moveNestedAnnotationInternal(int targetIndex, int sourceIndex) {
- return SourceSecondaryTableAnnotation.this.movePkJoinColumnInternal(targetIndex, sourceIndex);
- }
-
- public void nestedAnnotationMoved(int targetIndex, int sourceIndex) {
- SourceSecondaryTableAnnotation.this.pkJoinColumnMoved(targetIndex, sourceIndex);
- }
-
- public NestablePrimaryKeyJoinColumnAnnotation removeNestedAnnotationInternal(int index) {
- return SourceSecondaryTableAnnotation.this.removePkJoinColumnInternal(index);
- }
-
- public void nestedAnnotationRemoved(int index, NestablePrimaryKeyJoinColumnAnnotation nestedAnnotation) {
- SourceSecondaryTableAnnotation.this.pkJoinColumnRemoved(index, nestedAnnotation);
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this);
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSecondaryTablesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSecondaryTablesAnnotation.java
deleted file mode 100644
index bf37125772..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSecondaryTablesAnnotation.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NestableSecondaryTableAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTablesAnnotation;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.SecondaryTables
- */
-public final class SourceSecondaryTablesAnnotation
- extends SourceAnnotation<Member>
- implements SecondaryTablesAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final Vector<NestableSecondaryTableAnnotation> secondaryTables = new Vector<NestableSecondaryTableAnnotation>();
-
-
- public SourceSecondaryTablesAnnotation(JavaResourcePersistentType parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- AnnotationContainerTools.initialize(this, astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- AnnotationContainerTools.update(this, astRoot);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.secondaryTables);
- }
-
-
- // ********** AnnotationContainer implementation **********
-
- public String getContainerAnnotationName() {
- return this.getAnnotationName();
- }
-
- public org.eclipse.jdt.core.dom.Annotation getContainerJdtAnnotation(CompilationUnit astRoot) {
- return this.getJdtAnnotation(astRoot);
- }
-
- public String getElementName() {
- return JPA.SECONDARY_TABLES__VALUE;
- }
-
- public String getNestableAnnotationName() {
- return SecondaryTableAnnotation.ANNOTATION_NAME;
- }
-
- public ListIterator<NestableSecondaryTableAnnotation> nestedAnnotations() {
- return new CloneListIterator<NestableSecondaryTableAnnotation>(this.secondaryTables);
- }
-
- public int nestedAnnotationsSize() {
- return this.secondaryTables.size();
- }
-
- public NestableSecondaryTableAnnotation addNestedAnnotationInternal() {
- NestableSecondaryTableAnnotation secondaryTable = this.buildSecondaryTable(this.secondaryTables.size());
- this.secondaryTables.add(secondaryTable);
- return secondaryTable;
- }
-
- private NestableSecondaryTableAnnotation buildSecondaryTable(int index) {
- return SourceSecondaryTableAnnotation.createNestedSecondaryTable(this, this.member, index, this.daa);
- }
-
- public void nestedAnnotationAdded(int index, NestableSecondaryTableAnnotation nestedAnnotation) {
- this.fireItemAdded(SECONDARY_TABLES_LIST, index, nestedAnnotation);
- }
-
- public NestableSecondaryTableAnnotation moveNestedAnnotationInternal(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.secondaryTables, targetIndex, sourceIndex).get(targetIndex);
- }
-
- public void nestedAnnotationMoved(int targetIndex, int sourceIndex) {
- this.fireItemMoved(SECONDARY_TABLES_LIST, targetIndex, sourceIndex);
- }
-
- public NestableSecondaryTableAnnotation removeNestedAnnotationInternal(int index) {
- return this.secondaryTables.remove(index);
- }
-
- public void nestedAnnotationRemoved(int index, NestableSecondaryTableAnnotation nestedAnnotation) {
- this.fireItemRemoved(SECONDARY_TABLES_LIST, index, nestedAnnotation);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java
deleted file mode 100644
index 90387e4bf8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.SequenceGenerator
- */
-public abstract class SourceSequenceGeneratorAnnotation
- extends SourceGeneratorAnnotation
- implements SequenceGeneratorAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildAdapter(JPA.SEQUENCE_GENERATOR__NAME);
-
- private static final DeclarationAnnotationElementAdapter<Integer> INITIAL_VALUE_ADAPTER = buildIntegerAdapter(JPA.SEQUENCE_GENERATOR__INITIAL_VALUE);
-
- private static final DeclarationAnnotationElementAdapter<Integer> ALLOCATION_SIZE_ADAPTER = buildIntegerAdapter(JPA.SEQUENCE_GENERATOR__ALLOCATION_SIZE);
-
- private static final DeclarationAnnotationElementAdapter<String> SEQUENCE_NAME_ADAPTER = buildAdapter(JPA.SEQUENCE_GENERATOR__SEQUENCE_NAME);
- private final AnnotationElementAdapter<String> sequenceNameAdapter;
- private String sequenceName;
-
-
- protected SourceSequenceGeneratorAnnotation(JavaResourceNode parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- this.sequenceNameAdapter = this.buildAdapter(SEQUENCE_NAME_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.sequenceName = this.buildSequenceName(astRoot);
- }
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
- this.setSequenceName(this.buildSequenceName(astRoot));
- }
-
-
- // ********** 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.attributeValueHasNotChanged(this.sequenceName, sequenceName)) {
- return;
- }
- String old = this.sequenceName;
- this.sequenceName = sequenceName;
- this.sequenceNameAdapter.setValue(sequenceName);
- this.firePropertyChanged(SEQUENCE_NAME_PROPERTY, old, sequenceName);
- }
-
- private String buildSequenceName(CompilationUnit astRoot) {
- return this.sequenceNameAdapter.getValue(astRoot);
- }
-
- public TextRange getSequenceNameTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(SEQUENCE_NAME_ADAPTER, astRoot);
- }
-
- public boolean sequenceNameTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(SEQUENCE_NAME_ADAPTER, pos, astRoot);
- }
-
-
- // ********** static methods **********
-
- protected static DeclarationAnnotationElementAdapter<String> buildAdapter(String elementName) {
- return buildAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
- }
-
- protected static DeclarationAnnotationElementAdapter<Integer> buildIntegerAdapter(String elementName) {
- return buildIntegerAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTableAnnotation.java
deleted file mode 100644
index 546ebe3e49..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTableAnnotation.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.TableAnnotation;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * javax.persistence.Table
- */
-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(JavaResourceNode parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-
- // ********** AbstractBaseTableAnnotation implementation **********
-
- @Override
- DeclarationAnnotationElementAdapter<String> getNameAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter) {
- // ignore the daa passed in, @Table is never nested
- return NAME_ADAPTER;
- }
-
- @Override
- DeclarationAnnotationElementAdapter<String> getSchemaAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter) {
- // ignore the daa passed in, @Table is never nested
- return SCHEMA_ADAPTER;
- }
-
- @Override
- DeclarationAnnotationElementAdapter<String> getCatalogAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter) {
- // ignore the daa passed in, @Table is never nested
- return CATALOG_ADAPTER;
- }
-
- @Override
- String getUniqueConstraintsElementName() {
- return JPA.TABLE__UNIQUE_CONSTRAINTS;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java
deleted file mode 100644
index 328cdf6727..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java
+++ /dev/null
@@ -1,440 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.AnnotationContainer;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableUniqueConstraintAnnotation;
-import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.TableGenerator
- */
-public final class SourceTableGeneratorAnnotation
- extends SourceGeneratorAnnotation
- implements TableGeneratorAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__NAME);
-
- private static final DeclarationAnnotationElementAdapter<Integer> INITIAL_VALUE_ADAPTER = buildIntegerAdapter(JPA.TABLE_GENERATOR__INITIAL_VALUE);
-
- private static final DeclarationAnnotationElementAdapter<Integer> ALLOCATION_SIZE_ADAPTER = buildIntegerAdapter(JPA.TABLE_GENERATOR__ALLOCATION_SIZE);
-
- private static final DeclarationAnnotationElementAdapter<String> TABLE_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__TABLE);
- private final AnnotationElementAdapter<String> tableAdapter;
- private String table;
-
- private static final DeclarationAnnotationElementAdapter<String> SCHEMA_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__SCHEMA);
- private final AnnotationElementAdapter<String> schemaAdapter;
- private String schema;
-
- private static final DeclarationAnnotationElementAdapter<String> CATALOG_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__CATALOG);
- private final AnnotationElementAdapter<String> catalogAdapter;
- private String catalog;
-
- private static final DeclarationAnnotationElementAdapter<String> PK_COLUMN_NAME_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__PK_COLUMN_NAME);
- private final AnnotationElementAdapter<String> pkColumnNameAdapter;
- private String pkColumnName;
-
- private static final DeclarationAnnotationElementAdapter<String> VALUE_COLUMN_NAME_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__VALUE_COLUMN_NAME);
- private final AnnotationElementAdapter<String> valueColumnNameAdapter;
- private String valueColumnName;
-
- private static final DeclarationAnnotationElementAdapter<String> PK_COLUMN_VALUE_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__PK_COLUMN_VALUE);
- private final AnnotationElementAdapter<String> pkColumnValueAdapter;
- private String pkColumnValue;
-
- private final Vector<NestableUniqueConstraintAnnotation> uniqueConstraints = new Vector<NestableUniqueConstraintAnnotation>();
- private final UniqueConstraintsAnnotationContainer uniqueConstraintsContainer = new UniqueConstraintsAnnotationContainer();
-
-
- public SourceTableGeneratorAnnotation(JavaResourceNode parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- this.tableAdapter = this.buildAdapter(TABLE_ADAPTER);
- this.catalogAdapter = this.buildAdapter(CATALOG_ADAPTER);
- this.schemaAdapter = this.buildAdapter(SCHEMA_ADAPTER);
- this.pkColumnNameAdapter = this.buildAdapter(PK_COLUMN_NAME_ADAPTER);
- this.valueColumnNameAdapter = this.buildAdapter(VALUE_COLUMN_NAME_ADAPTER);
- this.pkColumnValueAdapter = this.buildAdapter(PK_COLUMN_VALUE_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.table = this.buildTable(astRoot);
- this.schema = this.buildSchema(astRoot);
- this.catalog = this.buildCatalog(astRoot);
- this.pkColumnName = this.buildPkColumnName(astRoot);
- this.valueColumnName = this.buildValueColumnName(astRoot);
- this.pkColumnValue = this.buildPkColumnValue(astRoot);
- AnnotationContainerTools.initialize(this.uniqueConstraintsContainer, astRoot);
- }
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
- this.setTable(this.buildTable(astRoot));
- this.setSchema(this.buildSchema(astRoot));
- this.setCatalog(this.buildCatalog(astRoot));
- this.setPkColumnName(this.buildPkColumnName(astRoot));
- this.setValueColumnName(this.buildValueColumnName(astRoot));
- this.setPkColumnValue(this.buildPkColumnValue(astRoot));
- AnnotationContainerTools.update(this.uniqueConstraintsContainer, astRoot);
- }
-
-
- // ********** 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.attributeValueHasNotChanged(this.table, table)) {
- return;
- }
- String old = this.table;
- this.table = table;
- this.tableAdapter.setValue(table);
- this.firePropertyChanged(TABLE_PROPERTY, old, table);
- }
-
- 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.attributeValueHasNotChanged(this.schema, schema)) {
- return;
- }
- String old = this.schema;
- this.schema = schema;
- this.schemaAdapter.setValue(schema);
- this.firePropertyChanged(SCHEMA_PROPERTY, old, schema);
- }
-
- 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.attributeValueHasNotChanged(this.catalog, catalog)) {
- return;
- }
- String old = this.catalog;
- this.catalog = catalog;
- this.catalogAdapter.setValue(catalog);
- this.firePropertyChanged(CATALOG_PROPERTY, old, catalog);
- }
-
- 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.attributeValueHasNotChanged(this.pkColumnName, pkColumnName)) {
- return;
- }
- String old = this.pkColumnName;
- this.pkColumnName = pkColumnName;
- this.pkColumnNameAdapter.setValue(pkColumnName);
- this.firePropertyChanged(PK_COLUMN_NAME_PROPERTY, old, pkColumnName);
- }
-
- 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.attributeValueHasNotChanged(this.valueColumnName, valueColumnName)) {
- return;
- }
- String old = this.valueColumnName;
- this.valueColumnName = valueColumnName;
- this.valueColumnNameAdapter.setValue(valueColumnName);
- this.firePropertyChanged(VALUE_COLUMN_NAME_PROPERTY, old, valueColumnName);
- }
-
- 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.attributeValueHasNotChanged(this.pkColumnValue, pkColumnValue)) {
- return;
- }
- String old = this.pkColumnValue;
- this.pkColumnValue = pkColumnValue;
- this.pkColumnValueAdapter.setValue(pkColumnValue);
- this.firePropertyChanged(PK_COLUMN_VALUE_PROPERTY, old, pkColumnValue);
- }
-
- private String buildPkColumnValue(CompilationUnit astRoot) {
- return this.pkColumnValueAdapter.getValue(astRoot);
- }
-
- public TextRange getPkColumnValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(PK_COLUMN_VALUE_ADAPTER, astRoot);
- }
-
- public boolean pkColumnValueTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(PK_COLUMN_VALUE_ADAPTER, pos, astRoot);
- }
-
- // ***** unique constraints
- public ListIterator<UniqueConstraintAnnotation> uniqueConstraints() {
- return new CloneListIterator<UniqueConstraintAnnotation>(this.uniqueConstraints);
- }
-
- ListIterator<NestableUniqueConstraintAnnotation> nestableUniqueConstraints() {
- return new CloneListIterator<NestableUniqueConstraintAnnotation>(this.uniqueConstraints);
- }
-
- public int uniqueConstraintsSize() {
- return this.uniqueConstraints.size();
- }
-
- public NestableUniqueConstraintAnnotation uniqueConstraintAt(int index) {
- return this.uniqueConstraints.get(index);
- }
-
- public int indexOfUniqueConstraint(UniqueConstraintAnnotation uniqueConstraint) {
- return this.uniqueConstraints.indexOf(uniqueConstraint);
- }
-
- public NestableUniqueConstraintAnnotation addUniqueConstraint(int index) {
- return (NestableUniqueConstraintAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.uniqueConstraintsContainer);
- }
-
- NestableUniqueConstraintAnnotation addUniqueConstraintInternal() {
- NestableUniqueConstraintAnnotation uniqueConstraint = this.buildUniqueConstraint(this.uniqueConstraints.size());
- this.uniqueConstraints.add(uniqueConstraint);
- return uniqueConstraint;
- }
-
- NestableUniqueConstraintAnnotation buildUniqueConstraint(int index) {
- return new SourceUniqueConstraintAnnotation(this, this.member, buildUniqueConstraintAnnotationAdapter(index));
- }
-
- IndexedDeclarationAnnotationAdapter buildUniqueConstraintAnnotationAdapter(int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(this.daa, JPA.TABLE_GENERATOR__UNIQUE_CONSTRAINTS, index, JPA.UNIQUE_CONSTRAINT);
- }
-
- void uniqueConstraintAdded(int index, NestableUniqueConstraintAnnotation constraint) {
- this.fireItemAdded(UNIQUE_CONSTRAINTS_LIST, index, constraint);
- }
-
- public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.uniqueConstraintsContainer);
- }
-
- NestableUniqueConstraintAnnotation moveUniqueConstraintInternal(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.uniqueConstraints, targetIndex, sourceIndex).get(targetIndex);
- }
-
- void uniqueConstraintMoved(int targetIndex, int sourceIndex) {
- this.fireItemMoved(UNIQUE_CONSTRAINTS_LIST, targetIndex, sourceIndex);
- }
-
- public void removeUniqueConstraint(int index) {
- AnnotationContainerTools.removeNestedAnnotation(index, this.uniqueConstraintsContainer);
- }
-
- NestableUniqueConstraintAnnotation removeUniqueConstraintInternal(int index) {
- return this.uniqueConstraints.remove(index);
- }
-
- void uniqueConstraintRemoved(int index, NestableUniqueConstraintAnnotation constraint) {
- this.fireItemRemoved(UNIQUE_CONSTRAINTS_LIST, index, constraint);
- }
-
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter<String> buildAdapter(String elementName) {
- return buildAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
- }
-
- private static DeclarationAnnotationElementAdapter<Integer> buildIntegerAdapter(String elementName) {
- return buildIntegerAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
- }
-
-
- // ********** unique constraint container **********
-
- /**
- * adapt the AnnotationContainer interface to the table generator's unique constraints
- */
- class UniqueConstraintsAnnotationContainer
- implements AnnotationContainer<NestableUniqueConstraintAnnotation>
- {
- public String getContainerAnnotationName() {
- return SourceTableGeneratorAnnotation.this.getAnnotationName();
- }
-
- public org.eclipse.jdt.core.dom.Annotation getContainerJdtAnnotation(CompilationUnit astRoot) {
- return SourceTableGeneratorAnnotation.this.getJdtAnnotation(astRoot);
- }
-
- public String getElementName() {
- return JPA.TABLE_GENERATOR__UNIQUE_CONSTRAINTS;
- }
-
- public String getNestableAnnotationName() {
- return UniqueConstraintAnnotation.ANNOTATION_NAME;
- }
-
- public ListIterator<NestableUniqueConstraintAnnotation> nestedAnnotations() {
- return SourceTableGeneratorAnnotation.this.nestableUniqueConstraints();
- }
-
- public int nestedAnnotationsSize() {
- return SourceTableGeneratorAnnotation.this.uniqueConstraintsSize();
- }
-
- public NestableUniqueConstraintAnnotation addNestedAnnotationInternal() {
- return SourceTableGeneratorAnnotation.this.addUniqueConstraintInternal();
- }
-
- public void nestedAnnotationAdded(int index, NestableUniqueConstraintAnnotation nestedAnnotation) {
- SourceTableGeneratorAnnotation.this.uniqueConstraintAdded(index, nestedAnnotation);
- }
-
- public NestableUniqueConstraintAnnotation moveNestedAnnotationInternal(int targetIndex, int sourceIndex) {
- return SourceTableGeneratorAnnotation.this.moveUniqueConstraintInternal(targetIndex, sourceIndex);
- }
-
- public void nestedAnnotationMoved(int targetIndex, int sourceIndex) {
- SourceTableGeneratorAnnotation.this.uniqueConstraintMoved(targetIndex, sourceIndex);
- }
-
- public NestableUniqueConstraintAnnotation removeNestedAnnotationInternal(int index) {
- return SourceTableGeneratorAnnotation.this.removeUniqueConstraintInternal(index);
- }
-
- public void nestedAnnotationRemoved(int index, NestableUniqueConstraintAnnotation nestedAnnotation) {
- SourceTableGeneratorAnnotation.this.uniqueConstraintRemoved(index, nestedAnnotation);
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this);
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTemporalAnnotation.java
deleted file mode 100644
index e2811269a1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTemporalAnnotation.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.core.resource.java.TemporalType;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-
-/**
- * javax.persistence.Temporal
- */
-public final class SourceTemporalAnnotation
- extends SourceAnnotation<Attribute>
- implements TemporalAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter();
- private final AnnotationElementAdapter<String> valueAdapter;
- private TemporalType value;
-
-
- public SourceTemporalAnnotation(JavaResourceNode parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, VALUE_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.buildValue(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setValue(this.buildValue(astRoot));
- }
-
- @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.attributeValueHasNotChanged(this.value, value)) {
- return;
- }
- TemporalType old = this.value;
- this.value = value;
- this.valueAdapter.setValue(TemporalType.toJavaAnnotationValue(value));
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private TemporalType buildValue(CompilationUnit astRoot) {
- return TemporalType.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, JPA.TEMPORAL__VALUE);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTransientAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTransientAnnotation.java
deleted file mode 100644
index b41ff19a6e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTransientAnnotation.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.TransientAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-
-/**
- * javax.persistence.Transient
- */
-public final class SourceTransientAnnotation
- extends SourceAnnotation<Attribute>
- implements TransientAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
-
- public SourceTransientAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- // nothing to initialize
- }
-
- public void update(CompilationUnit astRoot) {
- // nothing to update
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java
deleted file mode 100644
index 6240b36fa4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import java.util.Arrays;
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.AnnotationStringArrayExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberIndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitArrayAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableUniqueConstraintAnnotation;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
-import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.persistence.UniqueConstraint
- */
-public final class SourceUniqueConstraintAnnotation
- extends SourceAnnotation<Member>
- implements NestableUniqueConstraintAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final DeclarationAnnotationElementAdapter<String[]> columnNamesDeclarationAdapter;
- private final AnnotationElementAdapter<String[]> columnNamesAdapter;
- private final Vector<String> columnNames = new Vector<String>();
-
-
- public SourceUniqueConstraintAnnotation(JavaResourceNode parent, Member member, IndexedDeclarationAnnotationAdapter idaa) {
- super(parent, member, idaa, new MemberIndexedAnnotationAdapter(member, idaa));
- this.columnNamesDeclarationAdapter = buildArrayAnnotationElementAdapter(idaa, JPA.UNIQUE_CONSTRAINT__COLUMN_NAMES);
- this.columnNamesAdapter = this.buildAnnotationElementAdapter(this.columnNamesDeclarationAdapter);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- private AnnotationElementAdapter<String[]> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String[]> daea) {
- return new ShortCircuitArrayAnnotationElementAdapter<String>(this.member, 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, false, converter);
- }
-
- public void initialize(CompilationUnit astRoot) {
- String[] javaColumnNames = this.columnNamesAdapter.getValue(astRoot);
- for (int i = 0; i < javaColumnNames.length; i++) {
- this.columnNames.add(javaColumnNames[i]);
- }
- }
-
- public void update(CompilationUnit astRoot) {
- this.updateColumnNames(astRoot);
- }
-
- private void updateColumnNames(CompilationUnit astRoot) {
- String[] javaColumnNames = this.columnNamesAdapter.getValue(astRoot);
- this.synchronizeList(Arrays.asList(javaColumnNames), this.columnNames, COLUMN_NAMES_LIST);
- }
-
- public IndexedAnnotationAdapter getIndexedAnnotationAdapter() {
- return (IndexedAnnotationAdapter) this.annotationAdapter;
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.columnNames);
- }
-
-
- // ********** UniqueConstraintAnnotation implementation **********
-
- // ***** column names
- public ListIterator<String> columnNames() {
- return new CloneListIterator<String>(this.columnNames);
- }
-
- public int columnNamesSize() {
- return this.columnNames.size();
- }
-
- public void addColumnName(String columnName) {
- this.addColumnName(this.columnNames.size(), columnName);
- }
-
- public void addColumnName(int index, String columnName) {
- this.addColumnName_(index, columnName);
- this.columnNamesAdapter.setValue(this.columnNames.toArray(new String[this.columnNames.size()]));
- }
-
- private void addColumnName_(int index, String columnName) {
- this.addItemToList(index, columnName, this.columnNames, COLUMN_NAMES_LIST);
- }
-
- public void moveColumnName(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.columnNames, COLUMN_NAMES_LIST);
- this.columnNamesAdapter.setValue(this.columnNames.toArray(new String[this.columnNames.size()]));
- }
-
- public boolean columnNamesTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(this.columnNamesDeclarationAdapter, pos, astRoot);
- }
-
- public void removeColumnName(String columnName) {
- this.removeItemFromList(columnName, this.columnNames, COLUMN_NAMES_LIST);
- this.columnNamesAdapter.setValue(this.columnNames.toArray(new String[this.columnNames.size()]));
- }
-
- public void removeColumnName(int index) {
- this.removeItemFromList(index, this.columnNames, COLUMN_NAMES_LIST);
- this.columnNamesAdapter.setValue(this.columnNames.toArray(new String[this.columnNames.size()]));
- }
-
-
- // ********** NestableAnnotation implementation **********
-
- public void initializeFrom(NestableAnnotation oldAnnotation) {
- UniqueConstraintAnnotation oldConstraint = (UniqueConstraintAnnotation) oldAnnotation;
- for (String columnName : CollectionTools.iterable(oldConstraint.columnNames())) {
- this.addColumnName(columnName);
- }
- }
-
- public void moveAnnotation(int newIndex) {
- this.getIndexedAnnotationAdapter().moveAnnotation(newIndex);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceVersionAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceVersionAnnotation.java
deleted file mode 100644
index 2b27d2c6c4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceVersionAnnotation.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.VersionAnnotation;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-
-/**
- * javax.persistence.Version
- */
-public final class SourceVersionAnnotation
- extends SourceAnnotation<Attribute>
- implements VersionAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
-
- public SourceVersionAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- // nothing to initialize
- }
-
- public void update(CompilationUnit astRoot) {
- // nothing to update
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmXmlResourceProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmXmlResourceProvider.java
deleted file mode 100644
index 523bacf3ee..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmXmlResourceProvider.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.orm;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProperties;
-import org.eclipse.jpt.core.resource.AbstractXmlResourceProvider;
-import org.eclipse.jpt.core.resource.orm.AccessType;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.core.resource.orm.XmlPersistenceUnitDefaults;
-import org.eclipse.jpt.core.resource.orm.XmlPersistenceUnitMetadata;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class OrmXmlResourceProvider
- extends AbstractXmlResourceProvider
- implements OrmFileCreationDataModelProperties
-{
- /**
- * (Convenience method) Returns an ORM resource model provider for
- * the given file.
- */
- public static OrmXmlResourceProvider getXmlResourceProvider(IFile file) {
- return getXmlResourceProvider_(file.getProject(), file.getFullPath().toString());
- }
-
- /**
- * (Convenience method) Returns an ORM resource model provider for
- * the given project in the specified deploy location
- */
- public static OrmXmlResourceProvider getXmlResourceProvider(IProject project, String deployLocation) {
- return getXmlResourceProvider_(project, JptCorePlugin.getDeploymentURI(project, deployLocation));
- }
-
- /**
- * (Convenience method) Returns an ORM resource model provider for
- * the given project in the default deploy location
- */
- public static OrmXmlResourceProvider getDefaultXmlResourceProvider(IProject project) {
- return getXmlResourceProvider(project, JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
- }
-
- private static OrmXmlResourceProvider getXmlResourceProvider_(IProject project, String location) {
- return new OrmXmlResourceProvider(project, new Path(location));
- }
-
-
- public OrmXmlResourceProvider(IProject project) {
- this(project, new Path(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH));
- }
-
- public OrmXmlResourceProvider(IProject project, IPath filePath) {
- super(project, filePath, JptCorePlugin.ORM_XML_CONTENT_TYPE);
- }
-
- @Override
- protected void populateRoot(Object config) {
- IDataModel dataModel = (IDataModel) config;
- XmlEntityMappings entityMappings = OrmFactory.eINSTANCE.createXmlEntityMappings();
- entityMappings.setVersion(dataModel.getStringProperty(VERSION));
- getResourceContents().add(entityMappings);
-
- AccessType defaultAccess = (AccessType) dataModel.getProperty(DEFAULT_ACCESS);
- if (defaultAccess != null) {
- XmlPersistenceUnitMetadata puMetadata = OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata();
- entityMappings.setPersistenceUnitMetadata(puMetadata);
- XmlPersistenceUnitDefaults puDefaults = OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults();
- puMetadata.setPersistenceUnitDefaults(puDefaults);
- puDefaults.setAccess(defaultAccess);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceXmlResourceProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceXmlResourceProvider.java
deleted file mode 100644
index 7db90820f7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceXmlResourceProvider.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.persistence;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.operations.PersistenceFileCreationDataModelProperties;
-import org.eclipse.jpt.core.resource.AbstractXmlResourceProvider;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistence;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class PersistenceXmlResourceProvider
- extends AbstractXmlResourceProvider
- implements PersistenceFileCreationDataModelProperties
-{
- /**
- * (Convenience method) Returns a persistence resource model provider for
- * the given file.
- */
- public static PersistenceXmlResourceProvider getXmlResourceProvider(IFile file) {
- return getXmlResourceProvider_(file.getProject(), file.getFullPath().toString());
- }
-
- /**
- * (Convenience method) Returns an persistence resource model provider for
- * the given project in the specified deploy location
- */
- public static PersistenceXmlResourceProvider getXmlResourceProvider(IProject project, String deployLocation) {
- return getXmlResourceProvider_(project, JptCorePlugin.getDeploymentURI(project, deployLocation));
- }
-
- /**
- * (Convenience method) Returns a persistence resource model provider for
- * the given project in the default deploy location
- */
- public static PersistenceXmlResourceProvider getDefaultXmlResourceProvider(IProject project) {
- return getXmlResourceProvider(project, JptCorePlugin.DEFAULT_PERSISTENCE_XML_FILE_PATH);
- }
-
- private static PersistenceXmlResourceProvider getXmlResourceProvider_(IProject project, String location) {
- return new PersistenceXmlResourceProvider(project, new Path(location));
- }
-
-
- public PersistenceXmlResourceProvider(IProject project) {
- this(project, new Path(JptCorePlugin.DEFAULT_PERSISTENCE_XML_FILE_PATH));
- }
-
- public PersistenceXmlResourceProvider(IProject project, IPath filePath) {
- super(project, filePath, JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE);
- }
-
-
- @Override
- protected void populateRoot(Object config) {
- IDataModel dataModel = (IDataModel) config;
- XmlPersistence persistence = PersistenceFactory.eINSTANCE.createXmlPersistence();
- persistence.setVersion(dataModel.getStringProperty(VERSION));
- XmlPersistenceUnit persistenceUnit = PersistenceFactory.eINSTANCE.createXmlPersistenceUnit();
- persistenceUnit.setName(getProject().getName());
- persistence.getPersistenceUnits().add(persistenceUnit);
- getResourceContents().add(persistence);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/xml/JpaXmlResourceAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/xml/JpaXmlResourceAdapterFactory.java
deleted file mode 100644
index c03f4b15b8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/xml/JpaXmlResourceAdapterFactory.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.xml;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jpt.core.JpaFile;
-import org.eclipse.jpt.core.JpaResourceModel;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-
-public class JpaXmlResourceAdapterFactory
- implements IAdapterFactory
-{
- private static final Class<?>[] ADAPTER_LIST = new Class[] { JpaXmlResource.class };
-
- public Class<?>[] getAdapterList() {
- return ADAPTER_LIST;
- }
-
- public Object getAdapter(Object adaptableObject, @SuppressWarnings("unchecked") Class adapterType) {
- if (adaptableObject instanceof IFile) {
- return this.getAdapter((IFile) adaptableObject, adapterType);
- }
- return null;
- }
-
- private Object getAdapter(final IFile file, Class <?>adapterType) {
- if (adapterType == JpaXmlResource.class) {
- JpaFile jpaFile = JptCorePlugin.getJpaFile(file);
- if (jpaFile != null) {
- JpaResourceModel resourceModel = jpaFile.getResourceModel();
- if (resourceModel instanceof JpaXmlResource) {
- return resourceModel;
- }
- }
- }
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/xml/JpaXmlResourcePropertyTester.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/xml/JpaXmlResourcePropertyTester.java
deleted file mode 100644
index 6bb19d5084..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/xml/JpaXmlResourcePropertyTester.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.xml;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.context.XmlFile;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-
-public class JpaXmlResourcePropertyTester
- extends PropertyTester
-{
- public static final String IS_LATEST_SUPPORTED_VERSION = "isLatestSupportedVersion";
-
-
- 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 expectedIsLatestSupportedVersion = (Boolean) expectedValue;
- JpaProject jpaProject = xmlResource.getJpaProject();
- IContentType contentType = xmlResource.getContentType();
- Boolean actualIsLatestSupportedVersion =
- xmlResource.getVersion() != null
- && xmlResource.getVersion().equals(
- jpaProject.getJpaPlatform().getMostRecentSupportedResourceType(contentType).getVersion());
-
- return actualIsLatestSupportedVersion == expectedIsLatestSupportedVersion;
- }
-
- return false;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/synch/SynchronizeClassesJob.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/synch/SynchronizeClassesJob.java
deleted file mode 100644
index 5220171279..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/synch/SynchronizeClassesJob.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.synch;
-
-import java.util.Iterator;
-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.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.core.internal.JptCoreMessages;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlJavaClassRef;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistence;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-/**
- * 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(final IProgressMonitor monitor) {
- monitor.beginTask(JptCoreMessages.SYNCHRONIZING_CLASSES_TASK, 200);
-
- if (monitor.isCanceled()) {
- return Status.CANCEL_STATUS;
- }
-
- final JpaProject jpaProject = JptCorePlugin.getJpaProject(this.persistenceXmlFile.getProject());
- final JpaXmlResource resource = jpaProject.getPersistenceXmlResource();
- if (resource == null) {
- //the resource would only be null if the persistence.xml file had an invalid content type
- return Status.OK_STATUS;
- }
-
- monitor.worked(25);
-
- 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);
- }
-
- persistenceUnit.getClasses().clear();
-
- monitor.worked(25);
-
- for (Iterator<String> stream = mappedClassNames(jpaProject, '$'); stream.hasNext(); ) {
- String fullyQualifiedTypeName = stream.next();
- if ( ! mappingFileContains(jpaProject, fullyQualifiedTypeName)) {
- XmlJavaClassRef classRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
- classRef.setJavaClass(fullyQualifiedTypeName);
- persistenceUnit.getClasses().add(classRef);
- }
- }
-
- monitor.worked(100);
- }
- });
-
- monitor.done();
-
- return Status.OK_STATUS;
- }
-
- protected Iterator<String> mappedClassNames(final JpaProject jpaProject, final char enclosingTypeSeparator) {
- return new TransformationIterator<String, String>(jpaProject.mappedJavaSourceClassNames()) {
- @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 getJavaProject(jpaProject).findType(typeName);
- } catch (JavaModelException ex) {
- return null; // ignore exception?
- }
- }
-
- public IJavaProject getJavaProject(JpaProject jpaProject) {
- return JavaCore.create(jpaProject.getProject());
- }
-
- boolean mappingFileContains(JpaProject jpaProject, String fullyQualifiedTypeName) {
- PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
- if (persistenceXml == null) {
- return false;
- }
- Persistence persistence = persistenceXml.getPersistence();
- if (persistence == null) {
- return false;
- }
- if (persistence.persistenceUnitsSize() == 0) {
- return false;
- }
- PersistenceUnit persistenceUnit = persistence.persistenceUnits().next();
- for (MappingFileRef mappingFileRef : CollectionTools.iterable(persistenceUnit.mappingFileRefs())) {
- if (mappingFileRef.getPersistentType(fullyQualifiedTypeName) != null) {
- return true;
- }
- }
- return false;
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/CallbackJobSynchronizer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/CallbackJobSynchronizer.java
deleted file mode 100644
index 7ddb587da5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/CallbackJobSynchronizer.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jpt.utility.internal.ListenerList;
-import org.eclipse.jpt.utility.internal.synchronizers.CallbackSynchronizer;
-
-/**
- * Extend the job synchronizer to notify listeners
- * when a synchronization "cycle" is complete; i.e. the synchronization has,
- * for the moment, handled every "synchronize" request and quiesced.
- * This notification is <em>not</em> guaranteed to occur with <em>every</em>
- * synchronization "cycle";
- * since other, unrelated, synchronizations can be triggered concurrently.
- */
-public class CallbackJobSynchronizer
- extends JobSynchronizer
- implements CallbackSynchronizer
-{
- private final ListenerList<Listener> listenerList = new ListenerList<Listener>(Listener.class);
-
-
- // ********** construction **********
-
- /**
- * Construct a callback job synchronizer that uses the specified job command to
- * perform the synchronization. Assign the generated Eclipse job the
- * specified name.
- */
- public CallbackJobSynchronizer(String jobName, JobCommand command) {
- super(jobName, command);
- }
-
- /**
- * Construct a callback job synchronizer that uses the specified job command to
- * perform the synchronization. Assign the generated Eclipse job the
- * specified name and scheduling rule.
- */
- public CallbackJobSynchronizer(String jobName, JobCommand command, ISchedulingRule schedulingRule) {
- super(jobName, command, schedulingRule);
- }
-
- /**
- * Build a job that will let us know when the synchronization has
- * quiesced.
- */
- @Override
- SynchronizationJob buildJob(String jobName, JobCommand command, ISchedulingRule schedulingRule) {
- return new CallbackSynchronizationJob(jobName, command, schedulingRule);
- }
-
-
- // ********** CallbackSynchronizer implementation **********
-
- public void addListener(Listener listener) {
- this.listenerList.add(listener);
- }
-
- public void removeListener(Listener listener) {
- this.listenerList.remove(listener);
- }
-
- /**
- * Notify our listeners.
- */
- void synchronizationQuiesced() {
- for (Listener listener : this.listenerList.getListeners()) {
- listener.synchronizationQuiesced(this);
- }
- }
-
-
- // ********** synchronization job **********
-
- /**
- * Extend {@link JobSynchronizer.SynchronizationJob}
- * to notify the synchronizer when the synchronization has quiesced
- * (i.e. the command has finished executing and there are no further
- * requests for synchronization).
- * Because synchronization occurs during the job's execution,
- * no other thread will be able to
- * initiate another synchronization until the synchronizer's listeners have been
- * notified. Note also, the synchronizer's listeners can, themselves,
- * trigger another synchronization (by directly or indirectly calling
- * {@link org.eclipse.jpt.utility.internal.synchronizers.Synchronizer#synchronize());
- * but this synchronization will not occur until <em>after</em> all the
- * listeners have been notified.
- */
- class CallbackSynchronizationJob
- extends SynchronizationJob
- {
- /**
- * When this flag is set to true, the job has been scheduled to run.
- * We need this because {@link org.eclipse.core.runtime.jobs.Job Job}
- * has no public API for discovering whether a job is "scheduled".
- */
- // use 'volatile' because synchronization isn't really required
- private volatile boolean scheduled;
-
-
- CallbackSynchronizationJob(String jobName, JobCommand command, ISchedulingRule schedulingRule) {
- super(jobName, command, schedulingRule);
- this.scheduled = false;
- }
-
- /**
- * If we are allowing the job to be scheduled (i.e. {@link #start()}
- * was called), set the "scheduled" flag.
- */
- @Override
- void synchronize() {
- if (this.shouldSchedule) {
- this.scheduled = true;
- }
- super.synchronize();
- }
-
- /**
- * Clear the "scheduled" flag; perform the synchronization; and,
- * if the "scheduled" flag is still clear (i.e. there have been no
- * further calls to {@link #synchronize()}), notify our listeners.
- */
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- this.scheduled = false;
- IStatus status = super.run(monitor);
- // hmmm - we will notify listeners even when we our job is "stopped";
- // that seems ok... ~bjv
- if ( ! this.scheduled) {
- CallbackJobSynchronizer.this.synchronizationQuiesced();
- }
- return status;
- }
-
- @Override
- void stop() {
- this.scheduled = false;
- super.stop();
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/JobCommand.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/JobCommand.java
deleted file mode 100644
index f4b1a0d7d0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/JobCommand.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility;
-
-import java.io.Serializable;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-/**
- * Simple interface for implementing the GOF Command design pattern in an
- * Eclipse job.
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- */
-public interface JobCommand {
-
- /**
- * Execute the command. The semantics of the command
- * is determined by the contract between the client and server.
- * The command should check, as appropriate, whether the specified progress
- * monitor is {@link IProgressMonitor#isCanceled() "canceled"}; if it is,
- * the command should throw an
- * {@link org.eclipse.core.runtime.OperationCanceledException OperationCanceledException}.
- * @see IProgressMonitor#isCanceled()
- */
- IStatus execute(IProgressMonitor monitor);
-
- /**
- * Singleton implementation of the job command interface that will do
- * nothing when executed.
- */
- final class Null implements JobCommand, Serializable {
- public static final JobCommand INSTANCE = new Null();
- public static JobCommand instance() {
- return INSTANCE;
- }
- // ensure single instance
- private Null() {
- super();
- }
- public IStatus execute(IProgressMonitor arg0) {
- return Status.OK_STATUS;
- }
- @Override
- public String toString() {
- return "JobCommand.Null"; //$NON-NLS-1$
- }
- private static final long serialVersionUID = 1L;
- private Object readResolve() {
- // replace this object with the singleton
- return INSTANCE;
- }
- }
-
- /**
- * Singleton implementation of the job command interface that will throw an
- * exception when executed.
- */
- final class Disabled implements JobCommand, Serializable {
- public static final JobCommand INSTANCE = new Disabled();
- public static JobCommand instance() {
- return INSTANCE;
- }
- // ensure single instance
- private Disabled() {
- super();
- }
- // throw an exception
- public IStatus execute(IProgressMonitor arg0) {
- throw new UnsupportedOperationException();
- }
- @Override
- public String toString() {
- return "JobCommand.Disabled"; //$NON-NLS-1$
- }
- private static final long serialVersionUID = 1L;
- private Object readResolve() {
- // replace this object with the singleton
- return INSTANCE;
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/JobSynchronizer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/JobSynchronizer.java
deleted file mode 100644
index 30d5cf3648..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/JobSynchronizer.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.synchronizers.Synchronizer;
-
-/**
- * This synchronizer will perform synchronizations in an Eclipse job on a
- * separate thread, allowing calls to {@link Synchronizer#synchronize()}
- * to return immediately.
- * <p>
- * If necessary, the client-supplied job command should handle any
- * exceptions appropriately. Although, the default exception-handling provided
- * by the Eclipse Job Framework is probably adequate in most cases:<ul>
- * <li>An {@link org.eclipse.core.runtime.OperationCanceledException OperationCanceledException}
- * results in a {@link org.eclipse.core.runtime.Status#CANCEL_STATUS CANCEL_STATUS}.
- * <li>Any non-{@link ThreadDeath} {@link Throwable}
- * results in a {@link org.eclipse.core.runtime.IStatus#ERROR ERROR}
- * {@link org.eclipse.core.runtime.IStatus IStatus}
- * </ul>
- * @see org.eclipse.core.internal.jobs.Worker#run()
- */
-public class JobSynchronizer
- implements Synchronizer
-{
- /**
- * The synchronization is performed by this job. The same job is used
- * for every start/stop cycle (since a job can be re-started).
- */
- private final SynchronizationJob job;
-
-
- // ********** construction **********
-
- /**
- * Construct a job synchronizer that uses the specified job command to
- * perform the synchronization. Assign the generated Eclipse job the
- * specified name.
- */
- public JobSynchronizer(String jobName, JobCommand command) {
- this(jobName, command, null);
- }
-
- /**
- * Construct a job synchronizer that uses the specified job command to
- * perform the synchronization. Assign the generated Eclipse job the
- * specified name and scheduling rule.
- */
- public JobSynchronizer(String jobName, JobCommand command, ISchedulingRule schedulingRule) {
- super();
- this.job = this.buildJob(jobName, command, schedulingRule);
- }
-
- SynchronizationJob buildJob(String jobName, JobCommand command, ISchedulingRule schedulingRule) {
- return new SynchronizationJob(jobName, command, schedulingRule);
- }
-
-
- // ********** Synchronizer implementation **********
-
- /**
- * Allow the job to be scheduled, but postpone the first synchronization
- * until requested, via {@link #synchronize()}.
- */
- public void start() {
- this.job.start();
- }
-
- /**
- * "Schedule" the job.
- */
- public void synchronize() {
- this.job.synchronize();
- }
-
- /**
- * Wait for the current job execution to complete.
- */
- public void stop() {
- this.job.stop();
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.job);
- }
-
-
- // ********** synchronization job **********
-
- /**
- * This is the job that gets scheduled by the job synchronizer.
- * When the job is run it executes the client-supplied job command.
- */
- static class SynchronizationJob extends Job {
- /**
- * The client-supplied job command that executes every time the job
- * runs.
- */
- private final JobCommand command;
-
- /**
- * When this flag is set to false, the job does not stop immediately;
- * but it will not be scheduled to run again.
- */
- // use 'volatile' because synchronization isn't really required
- volatile boolean shouldSchedule;
-
-
- SynchronizationJob(String jobName, JobCommand command, ISchedulingRule schedulingRule) {
- super(jobName);
- if (command == null) {
- throw new NullPointerException();
- }
- this.command = command;
- this.shouldSchedule = false;
- this.setRule(schedulingRule);
- }
-
- /**
- * Just set the "should schedule" flag so the job <em>can</em> be
- * scheduled; but don't actually schedule it.
- */
- void start() {
- if (this.shouldSchedule) {
- throw new IllegalStateException("The Synchronizer was not stopped."); //$NON-NLS-1$
- }
- this.shouldSchedule = true;
- }
-
- /**
- * Simply re-schedule the job, allowing the current execution
- * to run to completion (i.e. do not try to cancel it prematurely).
- * This should minimize the number of times the job is re-executed
- * (recursively and otherwise).
- */
- void synchronize() {
- this.schedule();
- }
-
- /**
- * Any uncaught exceptions thrown by the command will be reasonably
- * handled by the Job Framework.
- * @see org.eclipse.core.internal.jobs.Worker#run()
- */
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- return this.command.execute(monitor);
- }
-
- /**
- * Prevent the job from running again and wait for the current
- * execution, if there is any, to end before returning.
- */
- void stop() {
- if ( ! this.shouldSchedule) {
- throw new IllegalStateException("The Synchronizer was not started."); //$NON-NLS-1$
- }
- // this will prevent the job from being scheduled to run again
- this.shouldSchedule = false;
- // this will cancel the job if it has already been scheduled, but is currently WAITING
- this.cancel();
- try {
- // if the job is currently RUNNING, wait until it is done before returning
- this.join();
- } catch (InterruptedException ex) {
- // the thread that called #stop() was interrupted while waiting to
- // join the synchronization job - ignore;
- // 'shouldSchedule' is still set to 'false', so the job loop will still stop - we
- // just won't wait around for it...
- }
- }
-
- /**
- * This is part of the normal {@link Job} behavior. By default, it is
- * not used (i.e. it always returns <code>true</code>).
- * We implement it here.
- */
- @Override
- public boolean shouldSchedule() {
- return this.shouldSchedule;
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/PlatformTools.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/PlatformTools.java
deleted file mode 100644
index 48bdb82f02..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/PlatformTools.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility;
-
-import java.io.IOException;
-import java.io.InputStream;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.core.runtime.content.IContentTypeManager;
-import org.eclipse.jpt.core.JptCorePlugin;
-
-/**
- * A collection of utilities for dealing with the Eclipse platform API.
- */
-public class PlatformTools {
-
- /**
- * Return the specified file's content type,
- * using the Eclipse platform's content type manager.
- */
- public static IContentType getContentType(IFile file) {
- String fileName = file.getName();
- InputStream fileContents = null;
- try {
- fileContents = file.getContents();
- } catch (CoreException ex) {
- // seems like we can ignore any exception that might occur here;
- // e.g. we get a FNFE if the workspace is out of synch with the O/S file system
- // JptCorePlugin.log(ex);
-
- // look for content type based on the file name only(?)
- return findContentTypeFor(fileName);
- }
-
- IContentType contentType = null;
- try {
- contentType = findContentTypeFor(fileContents, fileName);
- } catch (IOException ex) {
- JptCorePlugin.log(ex);
- } finally {
- try {
- fileContents.close();
- } catch (IOException ex) {
- JptCorePlugin.log(ex);
- }
- }
- return contentType;
- }
-
- private static IContentType findContentTypeFor(InputStream fileContents, String fileName) throws IOException {
- return getContentTypeManager().findContentTypeFor(fileContents, fileName);
- }
-
- private static IContentType findContentTypeFor(String fileName) {
- return getContentTypeManager().findContentTypeFor(fileName);
- }
-
- private static IContentTypeManager getContentTypeManager() {
- return Platform.getContentTypeManager();
- }
-
- private PlatformTools() {
- super();
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/SimpleSchedulingRule.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/SimpleSchedulingRule.java
deleted file mode 100644
index b51b33c87e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/SimpleSchedulingRule.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility;
-
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- * A job scheduling rule that conflicts only with itself.
- */
-public final class SimpleSchedulingRule
- implements ISchedulingRule
-{
- public SimpleSchedulingRule() {
- super();
- }
-
- public boolean contains(ISchedulingRule rule) {
- return rule == this;
- }
-
- public boolean isConflicting(ISchedulingRule rule) {
- return rule == this;
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/SimpleTextRange.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/SimpleTextRange.java
deleted file mode 100644
index bbb398fc84..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/SimpleTextRange.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility;
-
-import org.eclipse.jpt.core.utility.AbstractTextRange;
-
-/**
- * Straightforward implementation of TextRange.
- */
-public class SimpleTextRange extends AbstractTextRange {
- private final int offset;
- private final int length;
- private final int lineNumber;
-
- public SimpleTextRange(int offset, int length, int lineNumber) {
- super();
- this.offset = offset;
- this.length = length;
- this.lineNumber = lineNumber;
- }
-
- public int getOffset() {
- return this.offset;
- }
-
- public int getLength() {
- return this.length;
- }
-
- public int getLineNumber() {
- return this.lineNumber;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/ASTNodeTextRange.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/ASTNodeTextRange.java
deleted file mode 100644
index 1cb404987c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/ASTNodeTextRange.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.utility.AbstractTextRange;
-
-/**
- * Adapt an ASTNode to the TextRange interface.
- */
-public class ASTNodeTextRange extends AbstractTextRange {
- private final ASTNode astNode;
-
- public ASTNodeTextRange(ASTNode astNode) {
- super();
- this.astNode = astNode;
- }
-
- public int getOffset() {
- return this.astNode.getStartPosition();
- }
-
- public int getLength() {
- return this.astNode.getLength();
- }
-
- public int getLineNumber() {
- return ((CompilationUnit) this.astNode.getRoot()).getLineNumber(this.getOffset());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AbstractAnnotationAdapter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AbstractAnnotationAdapter.java
deleted file mode 100644
index 09631dee2e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AbstractAnnotationAdapter.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- * Adapt a member and a declaration annotation adapter.
- */
-public abstract class AbstractAnnotationAdapter implements AnnotationAdapter {
- private final Member member;
- private final DeclarationAnnotationAdapter daa;
-
-
- // ********** constructor **********
-
- public AbstractAnnotationAdapter(Member member, DeclarationAnnotationAdapter daa) {
- super();
- this.member = member;
- this.daa = daa;
- }
-
-
- // ********** AnnotationAdapter implementation **********
-
- public Annotation getAnnotation(CompilationUnit astRoot) {
- return this.daa.getAnnotation(this.member.getModifiedDeclaration(astRoot));
- }
-
- public void newMarkerAnnotation() {
- this.edit(this.buildNewMarkerAnnotationEditor());
- }
-
- public void newSingleMemberAnnotation() {
- this.edit(this.buildNewSingleMemberAnnotationEditor());
- }
-
- public void newNormalAnnotation() {
- this.edit(this.buildNewNormalAnnotationEditor());
- }
-
- public void removeAnnotation() {
- this.edit(this.buildRemoveAnnotationEditor());
- }
-
- public ASTNode getAstNode(CompilationUnit astRoot) {
- return this.daa.getAstNode(this.member.getModifiedDeclaration(astRoot));
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.daa);
- }
-
-
- // ********** internal methods **********
-
- protected void edit(Member.Editor editor) {
- this.member.edit(editor);
- }
-
-
- // ********** factory methods **********
-
- protected Member.Editor buildNewMarkerAnnotationEditor() {
- return new NewMarkerAnnotationEditor(this.daa);
- }
-
- protected Member.Editor buildNewSingleMemberAnnotationEditor() {
- return new NewSingleMemberAnnotationEditor(this.daa);
- }
-
- protected Member.Editor buildNewNormalAnnotationEditor() {
- return new NewNormalAnnotationEditor(this.daa);
- }
-
- protected Member.Editor buildRemoveAnnotationEditor() {
- return new RemoveAnnotationEditor(this.daa);
- }
-
-
- // ********** member classes **********
-
- protected static class NewMarkerAnnotationEditor implements Member.Editor {
- private final DeclarationAnnotationAdapter daa;
-
- NewMarkerAnnotationEditor(DeclarationAnnotationAdapter daa) {
- super();
- this.daa = daa;
- }
- public void edit(ModifiedDeclaration declaration) {
- this.daa.newMarkerAnnotation(declaration);
- }
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this);
- }
- }
-
-
- protected static class NewSingleMemberAnnotationEditor implements Member.Editor {
- private final DeclarationAnnotationAdapter daa;
-
- NewSingleMemberAnnotationEditor(DeclarationAnnotationAdapter daa) {
- super();
- this.daa = daa;
- }
- public void edit(ModifiedDeclaration declaration) {
- this.daa.newSingleMemberAnnotation(declaration);
- }
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this);
- }
- }
-
-
- protected static class NewNormalAnnotationEditor implements Member.Editor {
- private final DeclarationAnnotationAdapter daa;
-
- NewNormalAnnotationEditor(DeclarationAnnotationAdapter daa) {
- super();
- this.daa = daa;
- }
- public void edit(ModifiedDeclaration declaration) {
- this.daa.newNormalAnnotation(declaration);
- }
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this);
- }
- }
-
-
- protected static class RemoveAnnotationEditor implements Member.Editor {
- private final DeclarationAnnotationAdapter daa;
-
- RemoveAnnotationEditor(DeclarationAnnotationAdapter daa) {
- super();
- this.daa = daa;
- }
- public void edit(ModifiedDeclaration declaration) {
- this.daa.removeAnnotation(declaration);
- }
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this);
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AbstractDeclarationAnnotationAdapter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AbstractDeclarationAnnotationAdapter.java
deleted file mode 100644
index 85c4983f16..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AbstractDeclarationAnnotationAdapter.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.MarkerAnnotation;
-import org.eclipse.jdt.core.dom.MemberValuePair;
-import org.eclipse.jdt.core.dom.NormalAnnotation;
-import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- *
- */
-public abstract class AbstractDeclarationAnnotationAdapter implements DeclarationAnnotationAdapter {
- private final String annotationName;
-
-
- // ********** constructors **********
-
- protected AbstractDeclarationAnnotationAdapter(String annotationName) {
- super();
- this.annotationName = annotationName;
- }
-
-
- // ********** DeclarationAnnotationAdapter implementation **********
-
- public MarkerAnnotation newMarkerAnnotation(ModifiedDeclaration declaration) {
- MarkerAnnotation annotation = this.newMarkerAnnotation(declaration.getAst());
- this.addAnnotationAndImport(declaration, annotation);
- return annotation;
- }
-
- public SingleMemberAnnotation newSingleMemberAnnotation(ModifiedDeclaration declaration) {
- SingleMemberAnnotation annotation = this.newSingleMemberAnnotation(declaration.getAst());
- this.addAnnotationAndImport(declaration, annotation);
- return annotation;
- }
-
- public NormalAnnotation newNormalAnnotation(ModifiedDeclaration declaration) {
- NormalAnnotation annotation = this.newNormalAnnotation(declaration.getAst());
- this.addAnnotationAndImport(declaration, annotation);
- return annotation;
- }
-
- /**
- * Add the appropriate import statement, then shorten the annotation's
- * name before adding it to the declaration.
- */
- protected void addAnnotationAndImport(ModifiedDeclaration declaration, Annotation annotation) {
- annotation.setTypeName(declaration.getAst().newName(this.getSourceCodeAnnotationName(declaration)));
- this.addAnnotation(declaration, annotation);
- }
-
- /**
- * Return the annotation's name as it can be used in source code;
- * i.e. if we can add it to the compilation unit's imports, return the short
- * name; if we can't (because of a collision), return the fully-qualified name.
- * NB: an import may be added as a side-effect :-(
- */
- protected String getSourceCodeAnnotationName(ModifiedDeclaration declaration) {
- return declaration.addImport(this.annotationName) ? this.getShortAnnotationName() : this.annotationName;
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.annotationName);
- }
-
- /**
- * Add the specified annotation to the specified declaration,
- * replacing the original annotation if present.
- */
- protected abstract void addAnnotation(ModifiedDeclaration declaration, Annotation annotation);
-
-
- // ********** public methods **********
-
- /**
- * This is 'public' because we use it in CombinationIndexedDeclarationAnnotationAdapter
- * to get the annotation name from a NestedIndexedDeclarationAnnotationAdapter.
- */
- public String getAnnotationName() {
- return this.annotationName;
- }
-
-
- // ********** helper methods **********
-
- protected boolean nameMatches(ModifiedDeclaration declaration, Annotation annotation) {
- return this.nameMatches(declaration, annotation, this.annotationName);
- }
-
- protected boolean nameMatches(ModifiedDeclaration declaration, Annotation annotation, String name) {
- return declaration.annotationIsNamed(annotation, name);
- }
-
- protected MarkerAnnotation newMarkerAnnotation(AST ast) {
- return this.newMarkerAnnotation(ast, this.annotationName);
- }
-
- protected MarkerAnnotation newMarkerAnnotation(AST ast, String name) {
- MarkerAnnotation annotation = ast.newMarkerAnnotation();
- annotation.setTypeName(ast.newName(name));
- return annotation;
- }
-
- protected SingleMemberAnnotation newSingleMemberAnnotation(AST ast) {
- return this.newSingleMemberAnnotation(ast, this.annotationName);
- }
-
- protected SingleMemberAnnotation newSingleMemberAnnotation(AST ast, String name) {
- SingleMemberAnnotation annotation = ast.newSingleMemberAnnotation();
- annotation.setTypeName(ast.newName(name));
- return annotation;
- }
-
- protected NormalAnnotation newNormalAnnotation(AST ast) {
- return this.newNormalAnnotation(ast, this.annotationName);
- }
-
- protected NormalAnnotation newNormalAnnotation(AST ast, String name) {
- NormalAnnotation annotation = ast.newNormalAnnotation();
- annotation.setTypeName(ast.newName(name));
- return annotation;
- }
-
- protected String getShortAnnotationName() {
- return convertToShortName(this.annotationName);
- }
-
- protected static String convertToShortName(String name) {
- return name.substring(name.lastIndexOf('.') + 1);
- }
-
- @SuppressWarnings("unchecked")
- protected List<MemberValuePair> values(NormalAnnotation na) {
- return na.values();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AbstractExpressionConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AbstractExpressionConverter.java
deleted file mode 100644
index a4bde672a8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AbstractExpressionConverter.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- * Gather together the common implementation behavior.
- * T is the type of the object to be converted to and from an expression.
- *
- * We're still figuring out Java Generics here.... The methods in this abstract
- * class work fine with any subclass of Expression E; but a ClassCastException
- * will occur as soon as we call any method implemented by a subclass
- * (e.g. StringExpressionConverter) that expects a particular subclass of
- * Expression (e.g. StringLiteral).
- */
-public abstract class AbstractExpressionConverter<T>
- implements ExpressionConverter<T>
-{
-
- protected AbstractExpressionConverter() {
- super();
- }
-
-
- // ********** object -> expression **********
-
- public Expression convert(T object, AST ast) {
- return (object == null) ? this.convertNull(ast) : this.convertObject(object, ast);
- }
-
- /**
- * Return the expression for a null object. By default, a null object will
- * be converted into a null expression.
- */
- protected Expression convertNull(@SuppressWarnings("unused") AST ast) {
- return null;
- }
-
- /**
- * The specified object is not null.
- * @see #convert(T, AST)
- */
- protected abstract Expression convertObject(T object, AST ast);
-
-
- // ********** expression -> object **********
-
- public T convert(Expression expression) {
- return (expression == null) ? this.convertNull() : this.convertExpression(expression);
- }
-
- /**
- * Return the object for a null expression. By default, a null expression will
- * be converted into a null object.
- */
- protected T convertNull() {
- return null;
- }
-
- /**
- * The specified expression is not null.
- * @see #convert(Expression)
- */
- protected abstract T convertExpression(Expression expression);
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AbstractNestedDeclarationAnnotationAdapter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AbstractNestedDeclarationAnnotationAdapter.java
deleted file mode 100644
index 9606e65926..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AbstractNestedDeclarationAnnotationAdapter.java
+++ /dev/null
@@ -1,422 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jdt.core.dom.MarkerAnnotation;
-import org.eclipse.jdt.core.dom.MemberValuePair;
-import org.eclipse.jdt.core.dom.NormalAnnotation;
-import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
-
-/**
- * Pull together some of the behavior common to NestedDeclarationAnnotationAdapter
- * and IndexedNestedDeclarationAnnotationAdapter
- */
-public abstract class AbstractNestedDeclarationAnnotationAdapter extends AbstractDeclarationAnnotationAdapter {
- private final DeclarationAnnotationAdapter outerAnnotationAdapter;
- private final String elementName;
- private final boolean removeOuterAnnotationWhenEmpty;
-
- // reduce NLS checks
- protected static final String VALUE = "value"; //$NON-NLS-1$
-
-
- // ********** constructors **********
-
- /**
- * default element name is "value";
- * default behavior is to remove the outer annotation when it is empty
- */
- protected AbstractNestedDeclarationAnnotationAdapter(DeclarationAnnotationAdapter outerAnnotationAdapter, String annotationName) {
- this(outerAnnotationAdapter, VALUE, annotationName);
- }
-
- /**
- * default behavior is to remove the outer annotation when it is empty
- */
- protected AbstractNestedDeclarationAnnotationAdapter(DeclarationAnnotationAdapter outerAnnotationAdapter, String elementName, String annotationName) {
- this(outerAnnotationAdapter, elementName, annotationName, true);
- }
-
- protected AbstractNestedDeclarationAnnotationAdapter(DeclarationAnnotationAdapter outerAnnotationAdapter, String elementName, String annotationName, boolean removeOuterAnnotationWhenEmpty) {
- super(annotationName);
- this.outerAnnotationAdapter = outerAnnotationAdapter;
- this.elementName = elementName;
- this.removeOuterAnnotationWhenEmpty = removeOuterAnnotationWhenEmpty;
- }
-
-
- // ********** DeclarationAnnotationAdapter implementation **********
-
- public Annotation getAnnotation(ModifiedDeclaration declaration) {
- Annotation outer = this.outerAnnotationAdapter.getAnnotation(declaration);
- if (outer == null) {
- return null;
- }
- Expression value = this.elementValue(outer);
- if (value == null) {
- return null;
- }
- Annotation inner = this.getAnnotation(value);
- if (inner == null) {
- return null;
- }
- // return the annotation only if it has a matching name(?)
- return this.nameMatches(declaration, inner) ? inner : null;
- }
-
- public void removeAnnotation(ModifiedDeclaration declaration) {
- Annotation outer = this.outerAnnotationAdapter.getAnnotation(declaration);
- if (outer == null) {
- return;
- }
- Expression value = this.elementValue(outer);
- if (value == null) {
- return;
- }
- // hack to allow short-circuit when the value is an array initializer
- if (this.removeAnnotation(declaration, outer, value)) {
- return;
- }
- Annotation inner = this.annotationValue(value);
- if (inner == null) {
- return;
- }
- // remove the annotation only if it has a matching name(?)
- if (this.nameMatches(declaration, inner)) {
- this.removeElementAndNormalize(declaration, outer);
- }
- }
-
- public ASTNode getAstNode(ModifiedDeclaration declaration) {
- // if the annotation is missing, return the outer annotation's node
- Annotation annotation = this.getAnnotation(declaration);
- return (annotation != null) ? annotation : this.outerAnnotationAdapter.getAstNode(declaration);
- }
-
- @Override
- protected void addAnnotation(ModifiedDeclaration declaration, Annotation inner) {
- Annotation outer = this.outerAnnotationAdapter.getAnnotation(declaration);
- if (outer == null) {
- this.buildNewOuterAnnotation(declaration, inner);
- } else if (outer.isMarkerAnnotation()) {
- this.modifyAnnotation(declaration, (MarkerAnnotation) outer, inner);
- } else if (outer.isSingleMemberAnnotation()) {
- this.modifyAnnotation(declaration, (SingleMemberAnnotation) outer, inner);
- } else if (outer.isNormalAnnotation()) {
- this.modifyAnnotation(declaration, (NormalAnnotation) outer, inner);
- } else {
- throw new IllegalStateException("unknown annotation type: " + outer); //$NON-NLS-1$
- }
- }
-
-
- // ********** abstract methods **********
-
- /**
- * Return an annotation extracted from the specified expression,
- * which is the value of the adapter's element.
- */
- protected abstract Annotation getAnnotation(Expression value);
-
- /**
- * Remove the annotation from the specified expression,
- * which is the value of the adapter's element.
- * Return whether the removal was successful.
- */
- protected abstract boolean removeAnnotation(ModifiedDeclaration declaration, Annotation outer, Expression value);
-
- /**
- * Set the value of the specified outer annotation to the
- * specified inner annotation.
- */
- protected abstract void modifyAnnotationValue(SingleMemberAnnotation outer, Annotation inner);
-
- /**
- * Set the value of the specified member value pair to the
- * specified inner annotation.
- */
- protected abstract void modifyMemberValuePair(MemberValuePair pair, Annotation inner);
-
-
- // ********** public methods **********
-
- public DeclarationAnnotationAdapter getOuterAnnotationAdapter() {
- return this.outerAnnotationAdapter;
- }
-
- public String getElementName() {
- return this.elementName;
- }
-
-
- // ********** internal methods **********
-
- /**
- * If the specified expression is an annotation, cast it to an annotation;
- * otherwise return null.
- */
- protected Annotation annotationValue(Expression expression) {
- switch (expression.getNodeType()) {
- case ASTNode.NORMAL_ANNOTATION:
- case ASTNode.SINGLE_MEMBER_ANNOTATION:
- case ASTNode.MARKER_ANNOTATION:
- return (Annotation) expression;
- default:
- return null;
- }
- }
-
- /**
- * Remove the *first* annotation element with the specified name
- * from the specified annotation, converting the annotation as appropriate.
- */
- protected void removeElementAndNormalize(ModifiedDeclaration declaration, Annotation outer) {
- if (outer.isNormalAnnotation()) {
- this.removeElementAndNormalize(declaration, (NormalAnnotation) outer);
- } else if (outer.isSingleMemberAnnotation()) {
- this.removeElementAndNormalize(declaration, (SingleMemberAnnotation) outer);
- } else if (outer.isMarkerAnnotation()) {
- this.removeElementAndNormalize(declaration, (MarkerAnnotation) outer);
- } else {
- throw new IllegalArgumentException("unknown annotation type: " + outer); //$NON-NLS-1$
- }
- }
-
- /**
- * Remove the *first* annotation element with the adapter's element name
- * from the specified annotation. Convert the annotation to
- * a marker annotation or single member annotation if appropriate.
- * <pre>
- * &#64;Outer(name="Fred", foo=&#64;Inner) => &#64;Outer(name="Fred")
- * &#64;Outer(foo=&#64;Inner) => &#64;Outer
- * </pre>
- */
- protected void removeElementAndNormalize(ModifiedDeclaration declaration, NormalAnnotation outer) {
- this.removeElement(outer);
- this.normalizeAnnotation(declaration, outer);
- }
-
- /**
- * Remove from the specified annotation the element with
- * the adapter's element name.
- */
- protected void removeElement(NormalAnnotation annotation) {
- for (Iterator<MemberValuePair> stream = this.values(annotation).iterator(); stream.hasNext(); ) {
- MemberValuePair pair = stream.next();
- if (pair.getName().getFullyQualifiedName().equals(this.elementName)) {
- stream.remove();
- break;
- }
- }
- }
-
- /**
- * Convert the specified normal annotation to a marker annotation or
- * single member annotation if appropriate.
- */
- protected void normalizeAnnotation(ModifiedDeclaration declaration, NormalAnnotation outer) {
- List<MemberValuePair> values = this.values(outer);
- switch (values.size()) {
- case 0:
- // if the elements are all gone, remove the annotation or convert it to a marker annotation
- if (this.removeOuterAnnotationWhenEmpty) {
- this.outerAnnotationAdapter.removeAnnotation(declaration);
- } else {
- // convert the annotation to a marker annotation
- this.outerAnnotationAdapter.newMarkerAnnotation(declaration);
- }
- break;
- case 1:
- MemberValuePair pair = values.get(0);
- if (pair.getName().getFullyQualifiedName().equals(VALUE)) {
- // if the last remaining element is 'value', convert the annotation to a single member annotation
- Expression vv = pair.getValue();
- vv = (Expression) ASTNode.copySubtree(vv.getAST(), vv);
- this.outerAnnotationAdapter.newSingleMemberAnnotation(declaration).setValue(vv);
- }
- break;
- default:
- // do nothing
- break;
- }
- }
-
- /**
- * Convert the specified single member annotation to a marker annotation
- * if the adapter's element name is "value".
- */
- protected void removeElementAndNormalize(ModifiedDeclaration declaration, @SuppressWarnings("unused") SingleMemberAnnotation outer) {
- if (this.elementName.equals(VALUE)) {
- if (this.removeOuterAnnotationWhenEmpty) {
- this.outerAnnotationAdapter.removeAnnotation(declaration);
- } else {
- // convert the annotation to a marker annotation
- this.outerAnnotationAdapter.newMarkerAnnotation(declaration);
- }
- }
- }
-
- protected void removeElementAndNormalize(ModifiedDeclaration declaration, @SuppressWarnings("unused") MarkerAnnotation outer) {
- if (this.removeOuterAnnotationWhenEmpty) {
- this.outerAnnotationAdapter.removeAnnotation(declaration);
- }
- }
-
- /**
- * Return the value of the *first* annotation element
- * with the adapter's element name.
- * Return null if the annotation has no such element.
- * (An element name of "value" will return the value of a single
- * member annotation.)
- */
- protected Expression elementValue(Annotation annotation) {
- if (annotation.isNormalAnnotation()) {
- return this.elementValue((NormalAnnotation) annotation);
- }
- if (annotation.isSingleMemberAnnotation()) {
- return this.elementValue((SingleMemberAnnotation) annotation);
- }
- return null;
- }
-
- protected Expression elementValue(NormalAnnotation annotation) {
- MemberValuePair pair = this.memberValuePair(annotation);
- return (pair == null) ? null : pair.getValue();
- }
-
- /**
- * If the adapter's element name is "value", return the value of the
- * annotation, otherwise return null.
- */
- protected Expression elementValue(SingleMemberAnnotation annotation) {
- return this.elementName.equals(VALUE) ? annotation.getValue() : null;
- }
-
- /**
- * Return the *first* member value pair for the adapter's element name.
- * Return null if the specified annotation has no such element.
- */
- protected MemberValuePair memberValuePair(NormalAnnotation annotation) {
- for (MemberValuePair pair : this.values(annotation)) {
- if (pair.getName().getFullyQualifiedName().equals(this.elementName)) {
- return pair;
- }
- }
- return null;
- }
-
- /**
- * Build a new outer annotation and add the specified
- * inner annotation to it:
- * <pre>
- * &#64;Outer(&#64;Inner)
- * </pre>
- * or
- * <pre>
- * &#64;Outer(foo=&#64;Inner)
- * </pre>
- */
- protected void buildNewOuterAnnotation(ModifiedDeclaration declaration, Annotation inner) {
- if (this.elementName.equals(VALUE)) {
- this.outerAnnotationAdapter.newSingleMemberAnnotation(declaration).setValue(this.buildNewInnerExpression(inner));
- } else {
- List<MemberValuePair> values = this.values(this.outerAnnotationAdapter.newNormalAnnotation(declaration));
- values.add(this.newMemberValuePair(this.buildNewInnerExpression(inner)));
- }
- }
-
- /**
- * Build an expression to be added to a new outer annotation
- * for the specified inner annotation.
- */
- protected abstract Expression buildNewInnerExpression(Annotation inner);
-
- /**
- * Build a new member value pair with the specified name and value.
- */
- protected MemberValuePair newMemberValuePair(String name, Expression value) {
- AST ast = value.getAST();
- MemberValuePair pair = ast.newMemberValuePair();
- pair.setName(ast.newSimpleName(name));
- pair.setValue(value);
- return pair;
- }
-
- /**
- * Build a new member value pair with the adapter's element name
- * and the specified inner annotation.
- */
- protected MemberValuePair newMemberValuePair(Expression value) {
- return this.newMemberValuePair(this.elementName, value);
- }
-
- /**
- * Add the specified inner annotation to the marker annotation.
- */
- protected void modifyAnnotation(ModifiedDeclaration declaration, @SuppressWarnings("unused") MarkerAnnotation outer, Annotation inner) {
- this.buildNewOuterAnnotation(declaration, inner);
- }
-
- /**
- * Add the specified inner annotation to the single member annotation.
- */
- protected void modifyAnnotation(ModifiedDeclaration declaration, SingleMemberAnnotation outer, Annotation inner) {
- if (this.elementName.equals(VALUE)) {
- this.modifyAnnotationValue(outer, inner);
- } else {
- this.modifyAnnotationNonValue(declaration, outer, inner);
- }
- }
-
- /**
- * Add the specified inner annotation to the single member annotation,
- * converting it to a normal annotation:
- * <pre>
- * &#64;Outer("lorem ipsum") => &#64;Outer(value="lorem ipsum", foo=&#64;Inner)
- * </pre>
- */
- protected void modifyAnnotationNonValue(ModifiedDeclaration declaration, SingleMemberAnnotation outer, Annotation inner) {
- Expression vv = outer.getValue();
- vv = (Expression) ASTNode.copySubtree(vv.getAST(), vv);
- NormalAnnotation newOuter = this.outerAnnotationAdapter.newNormalAnnotation(declaration);
- List<MemberValuePair> values = this.values(newOuter);
- values.add(this.newMemberValuePair(VALUE, vv));
- values.add(this.newMemberValuePair(this.buildNewInnerExpression(inner)));
- }
-
- /**
- * Add the specified inner annotation to the normal annotation:
- * <pre>
- * &#64;Outer(bar="lorem ipsum") => &#64;Outer(bar="lorem ipsum", foo=&#64;Inner)
- * </pre>
- * or
- * <pre>
- * &#64;Outer(foo=&#64;Inner("lorem ipsum")) => &#64;Outer(foo=&#64;Inner)
- * </pre>
- */
- protected void modifyAnnotation(@SuppressWarnings("unused") ModifiedDeclaration declaration, NormalAnnotation outer, Annotation inner) {
- MemberValuePair pair = this.memberValuePair(outer);
- if (pair == null) {
- List<MemberValuePair> values = this.values(outer);
- values.add(this.newMemberValuePair(inner));
- } else {
- this.modifyMemberValuePair(pair, inner);
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AnnotationStringArrayExpressionConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AnnotationStringArrayExpressionConverter.java
deleted file mode 100644
index 889b59ea63..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/AnnotationStringArrayExpressionConverter.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.ArrayInitializer;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
-
-/**
- * Convert an array initializer or single expression to/from an array of
- * strings (e.g. {"text0", "text1"}).
- * E is the type of the expressions to be found either standalone or
- * as elements in the array initializer.
- */
-public class AnnotationStringArrayExpressionConverter
- extends AbstractExpressionConverter<String[]>
-{
- private final ExpressionConverter<String> elementConverter;
- private final StringArrayExpressionConverter arrayConverter;
-
-
- /**
- * The default behavior is to remove the array initializer if it is empty.
- */
- public AnnotationStringArrayExpressionConverter(ExpressionConverter<String> elementConverter) {
- this(elementConverter, true);
- }
-
- public AnnotationStringArrayExpressionConverter(ExpressionConverter<String> elementConverter, boolean removeArrayInitializerWhenEmpty) {
- super();
- this.elementConverter = elementConverter;
- this.arrayConverter = new StringArrayExpressionConverter(elementConverter, removeArrayInitializerWhenEmpty);
- }
-
- /**
- * if we only have a single string in the array return the single expression,
- * without braces, instead of an array initializer
- */
- @Override
- protected Expression convertObject(String[] strings, AST ast) {
- return (strings.length == 1) ?
- this.elementConverter.convert(strings[0], ast)
- :
- this.arrayConverter.convertObject(strings, ast);
- }
-
- @Override
- protected String[] convertNull() {
- return this.arrayConverter.convertNull();
- }
-
- /**
- * check for a single expression with no surrounding braces, implying a
- * single-entry array
- */
- @Override
- protected String[] convertExpression(Expression expression) {
- return (expression.getNodeType() == ASTNode.ARRAY_INITIALIZER) ?
- this.arrayConverter.convertArrayInitializer((ArrayInitializer) expression)
- :
- new String[] {this.elementConverter.convert(expression)};
- }
-
-
- // ********** factory methods **********
-
- /**
- * Build an expression converter for an annotation element of type String[].
- * @Foo(bar={"text0", "text1"})
- * or
- * @Foo(bar="text0")
- */
- public static AnnotationStringArrayExpressionConverter forStrings() {
- return new AnnotationStringArrayExpressionConverter(StringExpressionConverter.instance());
- }
-
- /**
- * Build an expression converter for an annotation element of type <enum>[].
- * @Foo(bar={BAZ, BAT})
- * or
- * @Foo(bar=BAZ)
- */
- public static AnnotationStringArrayExpressionConverter forNames() {
- return new AnnotationStringArrayExpressionConverter(NameStringExpressionConverter.instance());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/BooleanExpressionConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/BooleanExpressionConverter.java
deleted file mode 100644
index d6fc40d886..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/BooleanExpressionConverter.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.BooleanLiteral;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
-
-/**
- * Convert a boolean literal to/from a Boolean
- * (e.g. Boolean.TRUE).
- */
-public final class BooleanExpressionConverter
- extends AbstractExpressionConverter<Boolean>
-{
- private static final ExpressionConverter<Boolean> INSTANCE = new BooleanExpressionConverter();
-
- /**
- * Return the singleton.
- */
- public static ExpressionConverter<Boolean> instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private BooleanExpressionConverter() {
- super();
- }
-
- @Override
- protected BooleanLiteral convertObject(Boolean booleanObject, AST ast) {
- return ast.newBooleanLiteral(booleanObject.booleanValue());
- }
-
- @Override
- protected Boolean convertExpression(Expression expression) {
- Object value = expression.resolveConstantExpressionValue();
- return (value instanceof Boolean) ? ((Boolean) value) : null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/CharacterStringExpressionConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/CharacterStringExpressionConverter.java
deleted file mode 100644
index 1da206b188..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/CharacterStringExpressionConverter.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.CharacterLiteral;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
-
-/**
- * Convert a character literal to/from a string representation of a character
- * (e.g. "A").
- */
-public final class CharacterStringExpressionConverter
- extends AbstractExpressionConverter<String>
-{
- private static final ExpressionConverter<String> INSTANCE = new CharacterStringExpressionConverter();
-
- /**
- * Return the singleton.
- */
- public static ExpressionConverter<String> instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private CharacterStringExpressionConverter() {
- super();
- }
-
- @Override
- protected CharacterLiteral convertObject(String string, AST ast) {
- CharacterLiteral characterLiteral = ast.newCharacterLiteral();
- characterLiteral.setCharValue(string.charAt(0));
- return characterLiteral;
- }
-
- @Override
- protected String convertExpression(Expression expression) {
- Object value = expression.resolveConstantExpressionValue();
- return (value instanceof Character) ? ((Character) value).toString() : null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/CombinationIndexedDeclarationAnnotationAdapter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/CombinationIndexedDeclarationAnnotationAdapter.java
deleted file mode 100644
index e43a30e97c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/CombinationIndexedDeclarationAnnotationAdapter.java
+++ /dev/null
@@ -1,496 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jdt.core.dom.MarkerAnnotation;
-import org.eclipse.jdt.core.dom.MemberValuePair;
-import org.eclipse.jdt.core.dom.NormalAnnotation;
-import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- * Manipulate an annotation that either occurs stand-alone, e.g.
- * <pre>
- * &#64;Inner("zero")
- * private int id;
- * </pre>
- *
- * or is embedded in an element array within another annotation, e.g.
- * <pre>
- * &#64;Outer(foo={&#64;Inner("zero"), &#64;Inner("one"), &#64;Inner("two")})
- * private int id;
- *
- * annotationName = "Inner"
- * containerAnnotationName = "Outer"
- * elementName = "foo"
- * index = 0-2
- * </pre>
- *
- * This is a useful pattern because a declaration cannot have more
- * than one annotation of the same type, and allowing the stand-alone
- * configuration reduces clutter.
- * <br>
- * NB: This configuration only makes sense for "top-level" annotations, as
- * opposed to "nested" annotations. This is because annotation elements
- * can only be declared with a type of a single annotation and annotations
- * cannot be part of an inheritance hierarchy.
- * For example, the following configurations cannot *both* be supported:
- * <pre>
- * &#64;Foo(bar=&#64;Outer(...))
- * private int id;
- *
- * &#64;Foo(bar=&#64;Inner(...)) // not allowed
- * private int id;
- * </pre>
- *
- * NB: Behavior is undefined when both the stand-alone and the nested
- * configurations annotate the same declaration, e.g.
- * <pre>
- * // undefined behavior
- * &#64;Inner("zero")
- * &#64;Outer(foo={&#64;Inner("zero"), &#64;Inner("one"), &#64;Inner("two")})
- * private int id;
- * </pre>
- */
-public class CombinationIndexedDeclarationAnnotationAdapter
- implements IndexedDeclarationAnnotationAdapter
-{
-
- /**
- * this adapter is used when the annotation is "stand-alone":
- * <pre>
- * &#64;Inner("zero")
- * </pre>
- * and is only used when the index is 0 or 1
- */
- private final SimpleDeclarationAnnotationAdapter standAloneAnnotationAdapter;
-
- /**
- * this adapter is used when the annotation is "nested":
- * <pre>
- * &#64;Outer(foo={&#64;Inner("zero"), &#64;Inner("one")})
- * </pre>
- */
- private final NestedIndexedDeclarationAnnotationAdapter nestedAnnotationAdapter;
-
- /**
- * this adapter is for the "nested" annotation at the zero index;
- * and is only used when the index is 1
- */
- private final NestedIndexedDeclarationAnnotationAdapter zeroNestedAnnotationAdapter;
-
- // reduce NLS checks
- protected static final String VALUE = "value"; //$NON-NLS-1$
-
-
- // ********** constructors **********
-
- /**
- * default element name is "value"
- * <pre>
- * &#64;Inner("zero")
- * &#64;Outer({&#64;Inner("zero"), &#64;Inner("one")})
- * </pre>
- */
- public CombinationIndexedDeclarationAnnotationAdapter(String annotationName, String containerAnnotationName, int index) {
- this(annotationName, containerAnnotationName, VALUE, index);
- }
-
- public CombinationIndexedDeclarationAnnotationAdapter(String annotationName, String containerAnnotationName, String elementName, int index) {
- this(new SimpleDeclarationAnnotationAdapter(annotationName), new SimpleDeclarationAnnotationAdapter(containerAnnotationName), elementName, index, annotationName);
- }
-
- /**
- * default element name is "value"
- */
- public CombinationIndexedDeclarationAnnotationAdapter(
- SimpleDeclarationAnnotationAdapter standAloneAnnotationAdapter,
- SimpleDeclarationAnnotationAdapter containerAnnotationAdapter,
- int index,
- String nestedAnnotationName
- ) {
- this(standAloneAnnotationAdapter, containerAnnotationAdapter, VALUE, index, nestedAnnotationName);
- }
-
- public CombinationIndexedDeclarationAnnotationAdapter(
- SimpleDeclarationAnnotationAdapter standAloneAnnotationAdapter,
- SimpleDeclarationAnnotationAdapter containerAnnotationAdapter,
- String elementName,
- int index,
- String nestedAnnotationName
- ) {
- super();
- this.standAloneAnnotationAdapter = standAloneAnnotationAdapter;
- this.nestedAnnotationAdapter = new NestedIndexedDeclarationAnnotationAdapter(containerAnnotationAdapter, elementName, index, nestedAnnotationName);
- this.zeroNestedAnnotationAdapter = new NestedIndexedDeclarationAnnotationAdapter(containerAnnotationAdapter, elementName, 0, nestedAnnotationName);
- }
-
-
- // ********** DeclarationAnnotationAdapter implementation **********
-
- public Annotation getAnnotation(ModifiedDeclaration declaration) {
- if (this.getIndex() == 0) {
- // check for the stand-alone annotation
- Annotation standAloneAnnotation = this.getStandAloneAnnotation(declaration);
- if (standAloneAnnotation != null) {
- return standAloneAnnotation;
- }
- }
- return this.getNestedAnnotation(declaration);
- }
-
- /**
- * <pre>
- * [none] => &#64;Inner
- * or
- * &#64;Inner("lorem ipsum") => &#64;Inner
- * or
- * &#64;Inner(text="lorem ipsum") => &#64;Inner
- * or
- * &#64;Outer(foo={&#64;Inner, &#64;Inner}) => &#64;Outer(foo={&#64;Inner, &#64;Inner, &#64;Inner})
- * or
- * &#64;Outer(foo=&#64;Inner) => &#64;Outer(foo={&#64;Inner, &#64;Inner})
- * or
- * &#64;Inner => &#64;Outer(foo={&#64;Inner, &#64;Inner})
- * etc.
- * </pre>
- */
- public MarkerAnnotation newMarkerAnnotation(ModifiedDeclaration declaration) {
- return (MarkerAnnotation) this.newAnnotation(MARKER_ANNOTATION_FACTORY, declaration);
- }
-
- public SingleMemberAnnotation newSingleMemberAnnotation(ModifiedDeclaration declaration) {
- return (SingleMemberAnnotation) this.newAnnotation(SINGLE_MEMBER_ANNOTATION_FACTORY, declaration);
- }
-
- public NormalAnnotation newNormalAnnotation(ModifiedDeclaration declaration) {
- return (NormalAnnotation) this.newAnnotation(NORMAL_ANNOTATION_FACTORY, declaration);
- }
-
- public void removeAnnotation(ModifiedDeclaration declaration) {
- if (this.getIndex() == 0) {
- // check for the stand-alone annotation
- if (this.standAloneAnnotationIsPresent(declaration)) {
- this.removeStandAloneAnnotation(declaration);
- return;
- }
- }
- this.removeNestedAnnotation(declaration);
- if (this.nestedElementCanBeConvertedToStandAlone(declaration)) {
- this.convertLastElementAnnotationToStandAloneAnnotation(declaration);
- }
- }
-
- public ASTNode getAstNode(ModifiedDeclaration declaration) {
- // if the annotation is missing, delegate to the nested annotation adapter
- Annotation annotation = this.getAnnotation(declaration);
- return (annotation != null) ? annotation : this.nestedAnnotationAdapter.getAstNode(declaration);
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.getAnnotationName());
- }
-
-
- // ********** IndexedDeclarationAnnotationAdapter implementation **********
-
- public int getIndex() {
- return this.nestedAnnotationAdapter.getIndex();
- }
-
- public void moveAnnotation(int newIndex, ModifiedDeclaration declaration) {
- int oldIndex = this.getIndex();
- if (newIndex == oldIndex) {
- return;
- }
-
- Annotation standAloneAnnotation = this.getStandAloneAnnotation(declaration);
- if (standAloneAnnotation == null) {
- this.moveNestedAnnotation(newIndex, declaration);
- if (this.nestedElementCanBeConvertedToStandAlone(declaration)) {
- this.convertLastElementAnnotationToStandAloneAnnotation(declaration);
- }
- } else {
- if ((oldIndex == 0) && (newIndex == 1)) {
- // this is one of two situations where we transition from standalone to container
- this.moveStandAloneAnnotationToContainerAnnotation(standAloneAnnotation, declaration);
- this.moveNestedAnnotation(newIndex, declaration);
- } else if (newIndex == 0) {
- // we are moving a 'null' entry on top of the standalone, so remove it
- this.removeStandAloneAnnotation(declaration);
- } else {
- throw new IllegalStateException("old index = " + oldIndex + "; new index = " + newIndex); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- }
-
-
- // ********** internal methods **********
-
- /**
- * build the appropriate new annotation,
- * which may require moving the 0th annotation from "stand-alone" to "nested"
- */
- private Annotation newAnnotation(AnnotationFactory annotationFactory, ModifiedDeclaration declaration) {
- if (this.getIndex() == 0) {
- return this.newZeroAnnotation(annotationFactory, declaration);
- }
- if (this.zeroNestedAnnotationIsPresent(declaration)) {
- // manipulate the container annotation - ignore the stand-alone annotation(?)
- // @Outer(foo=@Inner("zero")) => @Outer(foo={@Inner("zero"), @Inner})
- // or
- // @Outer(foo={@Inner("zero"), @Inner("one")}) => @Outer(foo={@Inner("zero"), @Inner})
- return annotationFactory.newAnnotation(this.nestedAnnotationAdapter, declaration);
- }
-
- // this is one of two situations where we transition from standalone to container
- this.moveStandAloneAnnotationToContainerAnnotation(declaration);
- // once the stand-alone annotation is moved to index=0, build the new annotation at index=1
- return annotationFactory.newAnnotation(this.nestedAnnotationAdapter, declaration);
- }
-
- /**
- * the index is 0 - build the appropriate new annotation,
- * which may be either "stand-alone" or "nested"
- */
- private Annotation newZeroAnnotation(AnnotationFactory annotationFactory, ModifiedDeclaration declaration) {
- if (this.standAloneAnnotationIsPresent(declaration)) {
- // replace the stand-alone annotation - ignore the container annotation(?)
- // @Inner(text="lorem ipsum") => @Inner
- return annotationFactory.newAnnotation(this.standAloneAnnotationAdapter, declaration);
- }
- if (this.containerAnnotationIsPresent(declaration)) {
- // manipulate the container annotation
- // @Outer(foo=@Inner(text="lorem ipsum")) => @Outer(foo=@Inner)
- return annotationFactory.newAnnotation(this.nestedAnnotationAdapter, declaration);
- }
- // neither annotation is present - add a new stand-alone annotation
- return annotationFactory.newAnnotation(this.standAloneAnnotationAdapter, declaration);
- }
-
- /**
- * move the stand-alone annotation to the container annotation at index=0
- */
- private void moveStandAloneAnnotationToContainerAnnotation(ModifiedDeclaration declaration) {
- Annotation standAloneAnnotation = this.getStandAloneAnnotation(declaration);
- if (standAloneAnnotation == null) {
- throw new IllegalStateException("the stand-alone annotation is missing"); //$NON-NLS-1$
- }
- this.moveStandAloneAnnotationToContainerAnnotation(standAloneAnnotation, declaration);
- }
-
- /**
- * move the specified, non-null, stand-alone annotation to
- * the container annotation at index=0
- */
- private void moveStandAloneAnnotationToContainerAnnotation(Annotation standAloneAnnotation, ModifiedDeclaration declaration) {
- if (standAloneAnnotation.isMarkerAnnotation()) {
- this.zeroNestedAnnotationAdapter.newMarkerAnnotation(declaration);
- } else if (standAloneAnnotation.isSingleMemberAnnotation()) {
- Expression vv = ((SingleMemberAnnotation) standAloneAnnotation).getValue();
- vv = (Expression) ASTNode.copySubtree(vv.getAST(), vv);
- this.zeroNestedAnnotationAdapter.newSingleMemberAnnotation(declaration).setValue(vv);
- } else if (standAloneAnnotation.isNormalAnnotation()) {
- NormalAnnotation newNA = this.zeroNestedAnnotationAdapter.newNormalAnnotation(declaration);
- List<MemberValuePair> values = this.values(newNA);
- for (MemberValuePair pair : this.values((NormalAnnotation) standAloneAnnotation)) {
- values.add((MemberValuePair) ASTNode.copySubtree(pair.getAST(), pair));
- }
- } else {
- throw new IllegalStateException("unknown annotation type: " + standAloneAnnotation); //$NON-NLS-1$
- }
- this.removeStandAloneAnnotation(declaration);
- }
-
- /**
- * return whether the "nested" annotation container has been reduced to
- * a single element (and the array initializer is converted to just
- * the single remaining element) and can be further converted to the
- * "stand-alone" annotation:
- * <pre>
- * &#64;Outer(foo={&#64;Inner("zero"), &#64;Inner("one")}) =>
- * &#64;Outer(foo=&#64;Inner("zero")) =>
- * &#64;Inner("zero")
- * </pre>
- */
- private boolean nestedElementCanBeConvertedToStandAlone(ModifiedDeclaration declaration) {
- Annotation containerAnnotation = this.getContainerAnnotation(declaration);
- if (containerAnnotation == null) {
- return false;
- }
- if (containerAnnotation.isMarkerAnnotation()) {
- return false;
- }
- if (containerAnnotation.isSingleMemberAnnotation()) {
- if (this.getElementName().equals(VALUE)) {
- return (((SingleMemberAnnotation) containerAnnotation).getValue().getNodeType() != ASTNode.ARRAY_INITIALIZER)
- && (this.zeroNestedAnnotationAdapter.getAnnotation(declaration) != null);
- }
- return false;
- }
- if (containerAnnotation.isNormalAnnotation()) {
- NormalAnnotation na = (NormalAnnotation) containerAnnotation;
- if (na.values().size() == 0) {
- return false; // there are no elements present
- }
- if (na.values().size() != 1) {
- return false; // there are other elements present - leave them all alone
- }
- MemberValuePair pair = (MemberValuePair) na.values().get(0);
- if (this.getElementName().equals(pair.getName().getFullyQualifiedName())) {
- return (pair.getValue().getNodeType() != ASTNode.ARRAY_INITIALIZER)
- && (this.zeroNestedAnnotationAdapter.getAnnotation(declaration) != null);
- }
- return false;
- }
- throw new IllegalStateException("unknown annotation type: " + containerAnnotation); //$NON-NLS-1$
- }
-
- /**
- * move the annotation in the container annotation at index=0
- * to the stand-alone annotation
- */
- private void convertLastElementAnnotationToStandAloneAnnotation(ModifiedDeclaration declaration) {
- Annotation last = this.zeroNestedAnnotationAdapter.getAnnotation(declaration);
- if (last == null) {
- throw new IllegalStateException("the last nested annotation is missing"); //$NON-NLS-1$
- } else if (last.isMarkerAnnotation()) {
- this.newStandAloneMarkerAnnotation(declaration);
- } else if (last.isSingleMemberAnnotation()) {
- Expression vv = ((SingleMemberAnnotation) last).getValue();
- vv = (Expression) ASTNode.copySubtree(vv.getAST(), vv);
- this.newStandAloneSingleMemberAnnotation(declaration).setValue(vv);
- } else if (last.isNormalAnnotation()) {
- NormalAnnotation newNA = this.newStandAloneNormalAnnotation(declaration);
- List<MemberValuePair> values = this.values(newNA);
- for (MemberValuePair pair : this.values((NormalAnnotation) last)) {
- values.add((MemberValuePair) ASTNode.copySubtree(pair.getAST(), pair));
- }
- } else {
- throw new IllegalStateException("unknown annotation type: " + last); //$NON-NLS-1$
- }
- this.zeroNestedAnnotationAdapter.removeAnnotation(declaration);
- }
-
- private boolean standAloneAnnotationIsPresent(ModifiedDeclaration declaration) {
- return this.getStandAloneAnnotation(declaration) != null;
- }
-
- private Annotation getStandAloneAnnotation(ModifiedDeclaration declaration) {
- return this.standAloneAnnotationAdapter.getAnnotation(declaration);
- }
-
- private MarkerAnnotation newStandAloneMarkerAnnotation(ModifiedDeclaration declaration) {
- return this.standAloneAnnotationAdapter.newMarkerAnnotation(declaration);
- }
-
- private SingleMemberAnnotation newStandAloneSingleMemberAnnotation(ModifiedDeclaration declaration) {
- return this.standAloneAnnotationAdapter.newSingleMemberAnnotation(declaration);
- }
-
- private NormalAnnotation newStandAloneNormalAnnotation(ModifiedDeclaration declaration) {
- return this.standAloneAnnotationAdapter.newNormalAnnotation(declaration);
- }
-
- private void removeStandAloneAnnotation(ModifiedDeclaration declaration) {
- this.standAloneAnnotationAdapter.removeAnnotation(declaration);
- }
-
- private Annotation getNestedAnnotation(ModifiedDeclaration declaration) {
- return this.nestedAnnotationAdapter.getAnnotation(declaration);
- }
-
- private void moveNestedAnnotation(int newIndex, ModifiedDeclaration declaration) {
- this.nestedAnnotationAdapter.moveAnnotation(newIndex, declaration);
- }
-
- private void removeNestedAnnotation(ModifiedDeclaration declaration) {
- this.nestedAnnotationAdapter.removeAnnotation(declaration);
- }
-
- private boolean containerAnnotationIsPresent(ModifiedDeclaration declaration) {
- return this.getContainerAnnotation(declaration) != null;
- }
-
- private Annotation getContainerAnnotation(ModifiedDeclaration declaration) {
- return this.nestedAnnotationAdapter.getOuterAnnotationAdapter().getAnnotation(declaration);
- }
-
- private boolean zeroNestedAnnotationIsPresent(ModifiedDeclaration declaration) {
- return this.getZeroNestedAnnotation(declaration) != null;
- }
-
- private Annotation getZeroNestedAnnotation(ModifiedDeclaration declaration) {
- return this.zeroNestedAnnotationAdapter.getAnnotation(declaration);
- }
-
- private String getAnnotationName() {
- return this.nestedAnnotationAdapter.getAnnotationName();
- }
-
- private String getElementName() {
- return this.nestedAnnotationAdapter.getElementName();
- }
-
- @SuppressWarnings("unchecked")
- protected List<MemberValuePair> values(NormalAnnotation na) {
- return na.values();
- }
-
-
- // ********** annotation factories **********
-
- /**
- * define interface that allows us to "re-use" the nasty code in
- * #newAnnotation(AnnotationFactory, ModifiedDeclaration)
- */
- private interface AnnotationFactory {
- Annotation newAnnotation(DeclarationAnnotationAdapter adapter, ModifiedDeclaration declaration);
- }
-
- private static final AnnotationFactory MARKER_ANNOTATION_FACTORY = new AnnotationFactory() {
- public Annotation newAnnotation(DeclarationAnnotationAdapter adapter, ModifiedDeclaration declaration) {
- return adapter.newMarkerAnnotation(declaration);
- }
- @Override
- public String toString() {
- return "MarkerAnnotationFactory"; //$NON-NLS-1$
- }
- };
-
- private static final AnnotationFactory SINGLE_MEMBER_ANNOTATION_FACTORY = new AnnotationFactory() {
- public Annotation newAnnotation(DeclarationAnnotationAdapter adapter, ModifiedDeclaration declaration) {
- return adapter.newSingleMemberAnnotation(declaration);
- }
- @Override
- public String toString() {
- return "SingleMemberAnnotationFactory"; //$NON-NLS-1$
- }
- };
-
- private static final AnnotationFactory NORMAL_ANNOTATION_FACTORY = new AnnotationFactory() {
- public Annotation newAnnotation(DeclarationAnnotationAdapter adapter, ModifiedDeclaration declaration) {
- return adapter.newNormalAnnotation(declaration);
- }
- @Override
- public String toString() {
- return "NormalAnnotationFactory"; //$NON-NLS-1$
- }
- };
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/ConversionDeclarationAnnotationElementAdapter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/ConversionDeclarationAnnotationElementAdapter.java
deleted file mode 100644
index 8a70c2230c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/ConversionDeclarationAnnotationElementAdapter.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
-import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- * Wrap a declaration annotation element adapter that deals with AST
- * expressions, converting them to/from various other objects.
- * T is the type of the object to be passed to and returned by the adapter.
- */
-public class ConversionDeclarationAnnotationElementAdapter<T>
- implements DeclarationAnnotationElementAdapter<T>
-{
- /**
- * The wrapped adapter that returns and takes AST expressions.
- */
- private final DeclarationAnnotationElementAdapter<Expression> adapter;
-
- /**
- * The converter that converts AST expressions to other objects
- * (e.g. Strings).
- */
- private final ExpressionConverter<T> converter;
-
-
- // ********** constructors **********
-
- /**
- * The default element name is "value"; the default behavior is to
- * remove the annotation when the last element is removed.
- */
- public ConversionDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, ExpressionConverter<T> converter) {
- this(new ExpressionDeclarationAnnotationElementAdapter<Expression>(annotationAdapter), converter);
- }
-
- /**
- * The default behavior is to remove the annotation when the last
- * element is removed.
- */
- public ConversionDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<T> converter) {
- this(new ExpressionDeclarationAnnotationElementAdapter<Expression>(annotationAdapter, elementName), converter);
- }
-
- public ConversionDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, boolean removeAnnotationWhenEmpty, ExpressionConverter<T> converter) {
- this(new ExpressionDeclarationAnnotationElementAdapter<Expression>(annotationAdapter, elementName, removeAnnotationWhenEmpty), converter);
- }
-
- public ConversionDeclarationAnnotationElementAdapter(DeclarationAnnotationElementAdapter<Expression> adapter, ExpressionConverter<T> converter) {
- super();
- this.adapter = adapter;
- this.converter = converter;
- }
-
-
- // ********** DeclarationAnnotationElementAdapter implementation **********
-
- public T getValue(ModifiedDeclaration declaration) {
- Expression expression = this.adapter.getValue(declaration);
- return this.converter.convert(expression);
- }
-
- public void setValue(T value, ModifiedDeclaration declaration) {
- Expression expression;
- try {
- expression = this.converter.convert(value, declaration.getAst());
- } catch (IllegalArgumentException ex) {
- // if there is a problem converting the 'value' to an Expression we get this exception
- return; // don't set the value if it is "illegal"
- }
- this.adapter.setValue(expression, declaration);
- }
-
- public Expression getExpression(ModifiedDeclaration declaration) {
- return this.adapter.getExpression(declaration);
- }
-
- public ASTNode getAstNode(ModifiedDeclaration declaration) {
- return this.adapter.getAstNode(declaration);
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.adapter);
- }
-
-
- // ********** factory static methods **********
-
- /**
- * The default element name is "value"; the default behavior is to
- * remove the annotation when the last element is removed;
- * the default expression converter expects string constant expressions.
- */
- public static ConversionDeclarationAnnotationElementAdapter<String> forStrings(DeclarationAnnotationAdapter annotationAdapter) {
- return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, StringExpressionConverter.instance());
- }
-
- /**
- * The default behavior is to remove the annotation when the last
- * element is removed; the default expression converter expects
- * string constant expressions.
- */
- public static ConversionDeclarationAnnotationElementAdapter<String> forStrings(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, StringExpressionConverter.instance());
- }
-
- /**
- * The default expression converter expects string constant expressions.
- */
- public static ConversionDeclarationAnnotationElementAdapter<String> forStrings(DeclarationAnnotationAdapter annotationAdapter, String elementName, boolean removeAnnotationWhenEmpty) {
- return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, removeAnnotationWhenEmpty, StringExpressionConverter.instance());
- }
-
- /**
- * The default element name is "value"; the default behavior is to
- * remove the annotation when the last element is removed;
- * the default expression converter expects number constant expressions.
- */
- public static ConversionDeclarationAnnotationElementAdapter<Integer> forNumbers(DeclarationAnnotationAdapter annotationAdapter) {
- return new ConversionDeclarationAnnotationElementAdapter<Integer>(annotationAdapter, NumberIntegerExpressionConverter.instance());
- }
-
- /**
- * The default behavior is to remove the annotation when the last
- * element is removed; the default expression converter expects
- * number constant expressions.
- */
- public static ConversionDeclarationAnnotationElementAdapter<Integer> forNumbers(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return new ConversionDeclarationAnnotationElementAdapter<Integer>(annotationAdapter, elementName, NumberIntegerExpressionConverter.instance());
- }
-
- /**
- * The default expression converter expects number constant expressions.
- */
- public static ConversionDeclarationAnnotationElementAdapter<Integer> forNumbers(DeclarationAnnotationAdapter annotationAdapter, String elementName, boolean removeAnnotationWhenEmpty) {
- return new ConversionDeclarationAnnotationElementAdapter<Integer>(annotationAdapter, elementName, removeAnnotationWhenEmpty, NumberIntegerExpressionConverter.instance());
- }
-
- /**
- * The default element name is "value"; the default behavior is to
- * remove the annotation when the last element is removed;
- * the default expression converter expects boolean constant expressions.
- */
- public static ConversionDeclarationAnnotationElementAdapter<Boolean> forBooleans(DeclarationAnnotationAdapter annotationAdapter) {
- return new ConversionDeclarationAnnotationElementAdapter<Boolean>(annotationAdapter, BooleanExpressionConverter.instance());
- }
-
- /**
- * The default behavior is to remove the annotation when the last
- * element is removed; the default expression converter expects
- * boolean constant expressions.
- */
- public static ConversionDeclarationAnnotationElementAdapter<Boolean> forBooleans(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return new ConversionDeclarationAnnotationElementAdapter<Boolean>(annotationAdapter, elementName, BooleanExpressionConverter.instance());
- }
-
- /**
- * The default expression converter expects boolean constant expressions.
- */
- public static ConversionDeclarationAnnotationElementAdapter<Boolean> forBooleans(DeclarationAnnotationAdapter annotationAdapter, String elementName, boolean removeAnnotationWhenEmpty) {
- return new ConversionDeclarationAnnotationElementAdapter<Boolean>(annotationAdapter, elementName, removeAnnotationWhenEmpty, BooleanExpressionConverter.instance());
- }
-
- /**
- * The default element name is "value"; the default behavior is to
- * remove the annotation when the last element is removed;
- * the default expression converter expects character constant expressions.
- */
- public static ConversionDeclarationAnnotationElementAdapter<String> forCharacters(DeclarationAnnotationAdapter annotationAdapter) {
- return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, CharacterStringExpressionConverter.instance());
- }
-
- /**
- * The default behavior is to remove the annotation when the last
- * element is removed; the default expression converter expects
- * character constant expressions.
- */
- public static ConversionDeclarationAnnotationElementAdapter<String> forCharacters(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, CharacterStringExpressionConverter.instance());
- }
-
- /**
- * The default expression converter expects character constant expressions.
- */
- public static ConversionDeclarationAnnotationElementAdapter<String> forCharacters(DeclarationAnnotationAdapter annotationAdapter, String elementName, boolean removeAnnotationWhenEmpty) {
- return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, removeAnnotationWhenEmpty, CharacterStringExpressionConverter.instance());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/DefaultAnnotationEditFormatter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/DefaultAnnotationEditFormatter.java
deleted file mode 100644
index 0f6cfd917d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/DefaultAnnotationEditFormatter.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jpt.core.utility.jdt.AnnotationEditFormatter;
-import org.eclipse.text.edits.InsertEdit;
-import org.eclipse.text.edits.MalformedTreeException;
-import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.text.edits.TextEdit;
-
-/**
- * This implementation will clean up some of the nasty Eclipse annotation
- * formatting (or lack thereof); e.g. arrays of annotations.
- */
-public final class DefaultAnnotationEditFormatter
- implements AnnotationEditFormatter
-{
- private static final DefaultAnnotationEditFormatter INSTANCE = new DefaultAnnotationEditFormatter();
-
- /**
- * Return the singleton.
- */
- public static DefaultAnnotationEditFormatter instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private DefaultAnnotationEditFormatter() {
- super();
- }
-
- /**
- * TODO
- */
- public void format(IDocument doc, TextEdit editTree) throws MalformedTreeException, BadLocationException {
- TextEdit[] edits = editTree.getChildren();
- int len = edits.length;
- if (len == 0) {
- return;
- }
-
- MultiTextEdit extraEdits = new MultiTextEdit();
- for (int i = 0; i < len; i++) {
- TextEdit edit1 = edits[i];
- if ( ! (edit1 instanceof InsertEdit)) {
- continue; // if the edit is not an insert, skip to the next edit
- }
- InsertEdit insert1 = (InsertEdit) edit1;
- int j = i + 1;
- if (j < len) {
- TextEdit edit2 = edits[j];
- if (edit2 instanceof InsertEdit) {
- InsertEdit insert2 = (InsertEdit) edit2;
- String text1 = insert1.getText();
- String text2 = insert2.getText();
- int offset1 = insert1.getOffset();
- int offset2 = insert2.getOffset();
- if (this.stringIsAnnotation(text1) && text2.equals(" ")) {
- // an annotation was inserted before something on the same line;
- // replace the trailing space with a newline and appropriate indent
- extraEdits.addChild(new ReplaceEdit(offset2, 1, this.buildCR(doc, offset2)));
- i++; // jump the index past 'edit2'
- continue; // go to the next edit
- }
- int comma1Length = this.commaLength(text1);
- if ((comma1Length != 0) && this.stringIsAnnotation(text2)) {
- // an annotation was inserted in an array initializer on the
- // same line as the previous array element;
- // replace the preceding space with a newline and appropriate indent
- extraEdits.addChild(new ReplaceEdit(offset1 + comma1Length, text1.length() - comma1Length, this.buildCR(doc, offset1)));
- i++; // jump the index past 'edit2'
- continue; // go to the next edit
- }
- }
- }
- this.formatArrayInitializer(doc, insert1, extraEdits);
- }
- extraEdits.apply(doc, TextEdit.NONE);
- }
-
- /**
- * If the insert edit is inserting an annotation containing an array of annotations as
- * its value then format them nicely.
- */
- private void formatArrayInitializer(IDocument doc, InsertEdit insertEdit, MultiTextEdit extraEdits) throws BadLocationException {
- String s = insertEdit.getText();
- if ( ! this.stringIsAnnotation(s)) {
- return;
- }
- int len = s.length();
- int pos = 1; // skip '@'
- while (pos < len) {
- char c = s.charAt(pos);
- pos++; // bump to just past first '('
- if (c == '(') {
- break;
- }
- }
- if (pos == len) {
- return; // reached end of string
- }
- while (pos < len) {
- char c = s.charAt(pos);
- pos++; // bump to just past first '{'
- if (c == '{') {
- break;
- }
- if (c != ' ') {
- return;
- }
- }
- if (pos == len) {
- return; // reached end of string
- }
- // now look for '@' not inside parentheses and put in
- // line delimeter and indent string before each
- int offset = insertEdit.getOffset();
- String indent = null;
- int parenDepth = 0;
- while (pos < len) {
- switch (s.charAt(pos)) {
- case '(' :
- parenDepth++;
- break;
- case ')' :
- parenDepth--;
- break;
- case '@' :
- if (parenDepth == 0) {
- if (indent == null) {
- indent = this.buildCR(doc, offset, "\t"); // TODO use tab preference?
- }
- extraEdits.addChild(new InsertEdit(offset + pos, indent));
- }
- break;
- case '}' :
- if (parenDepth == 0) {
- extraEdits.addChild(new InsertEdit(offset + pos, this.buildCR(doc, offset)));
- }
- break;
- }
- pos++;
- }
- }
-
- /**
- * Build a string containing a line delimeter and indenting characters
- * matching the indent level of the line containing the character offset
- * (i.e. the new line's indent matches the current line).
- */
- private String buildCR(IDocument doc, int offset) throws BadLocationException {
- return this.buildCR(doc, offset, "");
- }
-
- private String buildCR(IDocument doc, int offset, String suffix) throws BadLocationException {
- int line = doc.getLineOfOffset(offset);
- StringBuilder sb = new StringBuilder();
- sb.append(doc.getLineDelimiter(line)); // use same CR as current line
-
- int o = doc.getLineOffset(line); // match the whitespace of the current line
- char c = doc.getChar(o++);
- while ((c == ' ') || (c == '\t')) {
- sb.append(c);
- c = doc.getChar(o++);
- }
- sb.append(suffix);
- return sb.toString();
- }
-
- /**
- * Return whether the specified string is an annotation.
- */
- private boolean stringIsAnnotation(String string) {
- return (string.length() > 1) && string.charAt(0) == '@';
- }
-
- /**
- * If the specified string is a single comma, possibly surrounded by
- * spaces, return the length of the substring containing the
- * initial spaces and the comma.
- */
- private int commaLength(String string) {
- boolean comma = false;
- int len = string.length();
- int result = 0;
- for (int i = 0; i < len; i++) {
- switch (string.charAt(i)) {
- case ' ' :
- if ( ! comma) {
- result++; // space preceding comma
- }
- break;
- case ',' :
- if (comma) {
- return 0; // second comma!
- }
- comma = true;
- result++;
- break;
- default:
- return 0; // non-comma, non-space char
- }
- }
- return result;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/EnumArrayDeclarationAnnotationElementAdapter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/EnumArrayDeclarationAnnotationElementAdapter.java
deleted file mode 100644
index 31ffe65292..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/EnumArrayDeclarationAnnotationElementAdapter.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.ArrayInitializer;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
-import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
-
-/**
- * Wrap a declaration annotation element adapter and simply
- * add an import for the enums when necessary.
- */
-public class EnumArrayDeclarationAnnotationElementAdapter
- implements DeclarationAnnotationElementAdapter<String[]>
-{
- /**
- * The wrapped adapter that returns and takes name strings (enums).
- */
- private final ConversionDeclarationAnnotationElementAdapter<String[]> adapter;
-
- private static final String[] EMPTY_STRING_ARRAY = new String[0];
-
-
- // ********** constructors **********
-
- /**
- * The default element name is "value"; the default behavior is to
- * remove the annotation when the last element is removed.
- */
- public EnumArrayDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter) {
- this(annotationAdapter, VALUE);
- }
-
- /**
- * The default behavior is to remove the annotation when the last
- * element is removed and remove the array initializer if it is empty.
- */
- public EnumArrayDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- this(annotationAdapter, elementName, true);
- }
-
- /**
- * The default behavior is to remove the array initializer if it is empty.
- */
- public EnumArrayDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, boolean removeAnnotationWhenEmpty) {
- this(annotationAdapter, elementName, removeAnnotationWhenEmpty, true);
- }
-
- public EnumArrayDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, boolean removeAnnotationWhenEmpty, boolean removeArrayInitializerWhenEmpty) {
- this(new ConversionDeclarationAnnotationElementAdapter<String[]>(annotationAdapter, elementName, removeAnnotationWhenEmpty, buildExpressionConverter(removeArrayInitializerWhenEmpty)));
- }
-
- private static ExpressionConverter<String[]> buildExpressionConverter(boolean removeArrayInitializerWhenEmpty) {
- return new AnnotationStringArrayExpressionConverter(NameStringExpressionConverter.instance(), removeArrayInitializerWhenEmpty);
- }
-
- protected EnumArrayDeclarationAnnotationElementAdapter(ConversionDeclarationAnnotationElementAdapter<String[]> adapter) {
- super();
- this.adapter = adapter;
- }
-
-
- // ********** DeclarationAnnotationElementAdapter implementation **********
-
- public String[] getValue(ModifiedDeclaration declaration) {
- // ignore the adapter's getValue() - we want the expression
- return this.resolve(this.adapter.getExpression(declaration), declaration);
- }
-
- public void setValue(String[] value, ModifiedDeclaration declaration) {
- this.adapter.setValue(this.convertToSourceCodeNames(value, declaration), declaration);
- }
-
- public Expression getExpression(ModifiedDeclaration declaration) {
- return this.adapter.getExpression(declaration);
- }
-
- public ASTNode getAstNode(ModifiedDeclaration declaration) {
- return this.adapter.getAstNode(declaration);
- }
-
-
- // ********** internal methods **********
-
- /**
- * resolve the enums, which can be
- * null
- * or
- * {FOO, BAR, BAZ}
- * or
- * FOO
- */
- protected String[] resolve(Expression expression, ModifiedDeclaration declaration) {
- if (expression == null) {
- return EMPTY_STRING_ARRAY;
- } else if (expression.getNodeType() == ASTNode.ARRAY_INITIALIZER) {
- return this.resolveArray((ArrayInitializer) expression, declaration);
- } else {
- return this.resolveSingleElement(expression, declaration);
- }
- }
-
- protected String[] resolveArray(ArrayInitializer ai, @SuppressWarnings("unused") ModifiedDeclaration declaration) {
- List<Expression> expressions = this.expressions(ai);
- int len = expressions.size();
- String[] enums = new String[len];
- for (int i = len; i-- > 0; ) {
- enums[i] = this.resolveEnum(expressions.get(i));
- }
- return enums;
- }
-
- protected String[] resolveSingleElement(Expression enumExpression, @SuppressWarnings("unused") ModifiedDeclaration declaration) {
- return new String[] {this.resolveEnum(enumExpression)};
- }
-
- protected String resolveEnum(Expression expression) {
- return JDTTools.resolveEnum(expression);
- }
-
- // minimize scope of suppressd warnings
- @SuppressWarnings("unchecked")
- private List<Expression> expressions(ArrayInitializer arrayInitializer) {
- return arrayInitializer.expressions();
- }
-
- /**
- * convert the fully-qualified enums to names that can be inserted in source code
- * NB: imports may be added as a side-effect :-(
- */
- protected String[] convertToSourceCodeNames(String[] enums, ModifiedDeclaration declaration) {
- if (enums == null) {
- return null;
- }
- int len = enums.length;
- String[] sourceCodeNames = new String[len];
- for (int i = 0; i < len; i++) {
- sourceCodeNames[i] = this.convertToSourceCodeName(enums[i], declaration);
- }
- return sourceCodeNames;
- }
-
- protected String convertToSourceCodeName(String enum_, ModifiedDeclaration declaration) {
- return EnumDeclarationAnnotationElementAdapter.convertToSourceCodeName(enum_, declaration);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/EnumDeclarationAnnotationElementAdapter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/EnumDeclarationAnnotationElementAdapter.java
deleted file mode 100644
index 4fe7f9c115..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/EnumDeclarationAnnotationElementAdapter.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
-
-/**
- * Wrap a declaration annotation element adapter and simply
- * add an import for the enum when necessary.
- */
-public class EnumDeclarationAnnotationElementAdapter
- implements DeclarationAnnotationElementAdapter<String>
-{
- /**
- * The wrapped adapter that returns and takes name strings (enums).
- */
- private final ConversionDeclarationAnnotationElementAdapter<String> adapter;
-
-
- // ********** constructors **********
-
- /**
- * The default element name is "value"; the default behavior is to
- * remove the annotation when the last element is removed.
- */
- public EnumDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter) {
- this(annotationAdapter, VALUE);
- }
-
- /**
- * The default behavior is to remove the annotation when the last
- * element is removed.
- */
- public EnumDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- this(annotationAdapter, elementName, true);
- }
-
- public EnumDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, boolean removeAnnotationWhenEmpty) {
- this(new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, removeAnnotationWhenEmpty, NameStringExpressionConverter.instance()));
- }
-
- protected EnumDeclarationAnnotationElementAdapter(ConversionDeclarationAnnotationElementAdapter<String> adapter) {
- super();
- this.adapter = adapter;
- }
-
-
- // ********** DeclarationAnnotationElementAdapter implementation **********
-
- public String getValue(ModifiedDeclaration declaration) {
- return this.resolve(this.adapter.getExpression(declaration));
- }
-
- public void setValue(String value, ModifiedDeclaration declaration) {
- this.adapter.setValue(convertToSourceCodeName(value, declaration), declaration);
- }
-
- public Expression getExpression(ModifiedDeclaration declaration) {
- return this.adapter.getExpression(declaration);
- }
-
- public ASTNode getAstNode(ModifiedDeclaration declaration) {
- return this.adapter.getAstNode(declaration);
- }
-
-
- // ********** internal methods **********
-
- /**
- * resolve the enum
- */
- protected String resolve(Expression expression) {
- return JDTTools.resolveEnum(expression);
- }
-
- /**
- * convert the fully-qualified enum constant to a static import and the constant's short name, e.g.
- * static import javax.persistence.FetchType.EAGER;
- * return "EAGER"
- * if that doesn't work, convert to a normal import and the constant's partially-qualified name, e.g.
- * import javax.persistence.FetchType;
- * return "FetchType.EAGER"
- * if that doesn't work, simply return the constant's fully-qualified name, e.g.
- * return "javax.persistence.FetchType.EAGER"
- * NB: an import may be added as a side-effect :-(
- */
- protected static String convertToSourceCodeName(String enumConstantName, ModifiedDeclaration declaration) {
- return (enumConstantName == null) ? null : convertToSourceCodeName_(enumConstantName, declaration);
- }
-
- /**
- * pre-condition: enum constant name is non-null;
- * convert it to its short version if we can add a static import etc.
- */
- protected static String convertToSourceCodeName_(String enumConstantName, ModifiedDeclaration declaration) {
- if (declaration.addStaticImport(enumConstantName)) {
- return convertToShortName(enumConstantName);
- }
- if (declaration.addImport(convertToTypeName(enumConstantName))) {
- return convertToPartiallyQualifiedName(enumConstantName);
- }
- return enumConstantName;
- }
-
- protected static String convertToShortName(String name) {
- return name.substring(name.lastIndexOf('.') + 1);
- }
-
- protected static String convertToTypeName(String name) {
- return name.substring(0, name.lastIndexOf('.'));
- }
-
- protected static String convertToPartiallyQualifiedName(String name) {
- return name.substring(name.lastIndexOf('.', name.lastIndexOf('.') - 1) + 1);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/ExpressionDeclarationAnnotationElementAdapter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/ExpressionDeclarationAnnotationElementAdapter.java
deleted file mode 100644
index b96a7de027..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/ExpressionDeclarationAnnotationElementAdapter.java
+++ /dev/null
@@ -1,362 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jdt.core.dom.MarkerAnnotation;
-import org.eclipse.jdt.core.dom.MemberValuePair;
-import org.eclipse.jdt.core.dom.NormalAnnotation;
-import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- * Most obvious implementation of the interface.
- * Assume the element's value is an Expression.
- */
-public class ExpressionDeclarationAnnotationElementAdapter<E extends Expression>
- implements DeclarationAnnotationElementAdapter<E>
-{
- /**
- * Adapter used to manipulate the element's annotation.
- */
- private final DeclarationAnnotationAdapter annotationAdapter;
-
- /**
- * The name of the relevant annotation element.
- */
- private final String elementName;
-
- /**
- * Flag to indicate whether the element's annotation is to be
- * completely removed if, when the element itself is removed,
- * the annotation has no remaining elements.
- */
- private final boolean removeAnnotationWhenEmpty;
-
-
- // ********** constructors **********
-
- /**
- * The default element name is "value"; the default behavior is to
- * remove the annotation when the last element is removed.
- */
- public ExpressionDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter) {
- this(annotationAdapter, VALUE);
- }
-
- /**
- * The default element name is "value".
- */
- public ExpressionDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, boolean removeAnnotationWhenEmpty) {
- this(annotationAdapter, VALUE, removeAnnotationWhenEmpty);
- }
-
- /**
- * The default behavior is to remove the annotation when the last
- * element is removed.
- */
- public ExpressionDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- this(annotationAdapter, elementName, true);
- }
-
- public ExpressionDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, boolean removeAnnotationWhenEmpty) {
- super();
- this.annotationAdapter = annotationAdapter;
- this.elementName = elementName;
- this.removeAnnotationWhenEmpty = removeAnnotationWhenEmpty;
- }
-
-
- // ********** DeclarationAnnotationElementAdapter implementation **********
-
- public E getValue(ModifiedDeclaration declaration) {
- // return the expression unmodified
- return this.getExpression(declaration);
- }
-
- public void setValue(E value, ModifiedDeclaration declaration) {
- this.setValue(value, this.annotationAdapter.getAnnotation(declaration), declaration);
- }
-
- public E getExpression(ModifiedDeclaration declaration) {
- return this.expression(this.annotationAdapter.getAnnotation(declaration));
- }
-
- public ASTNode getAstNode(ModifiedDeclaration declaration) {
- Expression exp = this.getExpression(declaration);
- return (exp != null) ? exp : this.annotationAdapter.getAstNode(declaration);
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.elementName);
- }
-
-
- // ********** expression **********
-
- /**
- * Return the expression value of the *first* annotation element
- * with the adapter's element name.
- * Return null if the annotation has no such element.
- * (An element name of "value" will return the value of a single
- * member annotation.)
- */
- protected E expression(Annotation annotation) {
- if (annotation == null) {
- return this.expressionNoAnnotation();
- }
- if (annotation.isMarkerAnnotation()) {
- return this.expressionMarkerAnnotation((MarkerAnnotation) annotation);
- }
- if (annotation.isSingleMemberAnnotation()) {
- return this.expressionSingleMemberAnnotation((SingleMemberAnnotation) annotation);
- }
- if (annotation.isNormalAnnotation()) {
- return this.expressionNormalAnnotation((NormalAnnotation) annotation);
- }
- throw new IllegalArgumentException("unknown annotation type: " + annotation); //$NON-NLS-1$
- }
-
- protected E expressionNoAnnotation() {
- return null;
- }
-
- /**
- * Return the expression value of the *first* annotation element
- * with the adapter's element name.
- * Return null if the annotation has no such element.
- */
- protected E expressionMarkerAnnotation(@SuppressWarnings("unused") MarkerAnnotation annotation) {
- return null;
- }
-
- /**
- * Return the expression value of the *first* annotation element
- * with the adapter's element name.
- * Return null if the annotation has no such element.
- */
- protected E expressionSingleMemberAnnotation(SingleMemberAnnotation annotation) {
- return this.downcast(this.elementName.equals(VALUE) ? annotation.getValue() : null);
- }
-
- @SuppressWarnings("unchecked")
- private E downcast(Expression e) {
- return (E) e;
- }
-
- /**
- * Return the expression value of the *first* annotation element
- * with the adapter's element name.
- * Return null if the annotation has no such element.
- */
- protected E expressionNormalAnnotation(NormalAnnotation annotation) {
- MemberValuePair pair = this.memberValuePair(annotation);
- return this.downcast((pair == null) ? null : pair.getValue());
- }
-
-
- // ********** set value **********
-
- /**
- * set non-null, non-empty value
- */
- protected void setValue(Expression value, Annotation annotation, ModifiedDeclaration declaration) {
- if (value == null) {
- this.removeElement(annotation, declaration);
- }
- else if (annotation == null) {
- this.setValueNoAnnotation(value, declaration);
- }
- else if (annotation.isMarkerAnnotation()) {
- this.setValueMarkerAnnotation(value, (MarkerAnnotation) annotation, declaration);
- }
- else if (annotation.isSingleMemberAnnotation()) {
- this.setValueSingleMemberAnnotation(value, (SingleMemberAnnotation) annotation, declaration);
- }
- else if (annotation.isNormalAnnotation()) {
- this.setValueNormalAnnotation(value, (NormalAnnotation) annotation, declaration);
- }
- else {
- throw new IllegalArgumentException("unknown annotation type: " + annotation); //$NON-NLS-1$
- }
- }
-
- /**
- * add non-null, non-empty value
- */
- protected void setValueNoAnnotation(Expression value, ModifiedDeclaration declaration) {
- if (this.elementName.equals(VALUE)) {
- // @Foo("xxx")
- this.annotationAdapter.newSingleMemberAnnotation(declaration).setValue(value);
- } else {
- // @Foo(bar="xxx")
- this.addValue(value, this.annotationAdapter.newNormalAnnotation(declaration));
- }
- }
-
- protected void addValue(Expression value, NormalAnnotation annotation) {
- this.addValue(value, annotation, this.elementName);
- }
-
- protected void addValue(Expression value, NormalAnnotation annotation, String annotationElementName) {
- AST ast = annotation.getAST();
- MemberValuePair pair = ast.newMemberValuePair();
- pair.setName(ast.newSimpleName(annotationElementName));
- pair.setValue(value);
- List<MemberValuePair> values = this.values(annotation);
- values.add(pair);
- }
-
- protected void setValueMarkerAnnotation(Expression value, @SuppressWarnings("unused") MarkerAnnotation annotation, ModifiedDeclaration declaration) {
- // @Foo => @Foo("xxx")
- // or
- // @Foo => @Foo(bar="xxx")
- this.setValueNoAnnotation(value, declaration);
- }
-
- protected void setValueSingleMemberAnnotation(Expression value, SingleMemberAnnotation annotation, ModifiedDeclaration declaration) {
- if (this.elementName.equals(VALUE)) {
- // @Foo("yyy") => @Foo("xxx")
- annotation.setValue(value);
- } else {
- // @Foo("yyy") => @Foo(value="yyy", bar="xxx")
- Expression vv = annotation.getValue();
- vv = (Expression) ASTNode.copySubtree(vv.getAST(), vv);
- NormalAnnotation normalAnnotation = this.annotationAdapter.newNormalAnnotation(declaration);
- this.addValue(vv, normalAnnotation, VALUE);
- this.addValue(value, normalAnnotation);
- }
- }
-
- protected void setValueNormalAnnotation(Expression value, NormalAnnotation annotation, @SuppressWarnings("unused") ModifiedDeclaration declaration) {
- MemberValuePair pair = this.memberValuePair(annotation);
- if (pair == null) {
- this.addValue(value, annotation);
- } else {
- pair.setValue(value);
- }
- }
-
-
- // ********** remove element **********
-
- protected void removeElement(Annotation annotation, ModifiedDeclaration declaration) {
- if (annotation == null) {
- this.removeElementNoAnnotation(declaration);
- }
- else if (annotation.isMarkerAnnotation()) {
- this.removeElementMarkerAnnotation((MarkerAnnotation) annotation, declaration);
- }
- else if (annotation.isSingleMemberAnnotation()) {
- this.removeElementSingleMemberAnnotation((SingleMemberAnnotation) annotation, declaration);
- }
- else if (annotation.isNormalAnnotation()) {
- this.removeElementNormalAnnotation((NormalAnnotation) annotation, declaration);
- }
- else {
- throw new IllegalArgumentException("unknown annotation type: " + annotation); //$NON-NLS-1$
- }
- }
-
- protected void removeElementNoAnnotation(@SuppressWarnings("unused") ModifiedDeclaration declaration) {
- // the element is already gone (?)
- }
-
- protected void removeElementMarkerAnnotation(@SuppressWarnings("unused") MarkerAnnotation annotation, @SuppressWarnings("unused") ModifiedDeclaration declaration) {
- // the element is already gone (?)
- }
-
- protected void removeElementSingleMemberAnnotation(@SuppressWarnings("unused") SingleMemberAnnotation annotation, ModifiedDeclaration declaration) {
- if (this.elementName.equals(VALUE)) {
- if (this.removeAnnotationWhenEmpty) {
- // @Foo("xxx") =>
- this.annotationAdapter.removeAnnotation(declaration);
- } else {
- // @Foo("xxx") => @Foo
- this.annotationAdapter.newMarkerAnnotation(declaration);
- }
- } else {
- // the [non-'value'] element is already gone (?)
- }
- }
-
- protected void removeElementNormalAnnotation(NormalAnnotation annotation, ModifiedDeclaration declaration) {
- List<MemberValuePair> values = this.values(annotation);
- if ((values.size() == 1) && values.get(0).getName().getFullyQualifiedName().equals(this.elementName)) {
- if (this.removeAnnotationWhenEmpty) {
- // @Foo(bar="xxx") =>
- this.annotationAdapter.removeAnnotation(declaration);
- } else {
- // @Foo(bar="xxx") => @Foo
- this.annotationAdapter.newMarkerAnnotation(declaration);
- }
- } else {
- this.removeElement(annotation);
- if (values.size() == 1) {
- MemberValuePair pair = values.get(0);
- if (pair.getName().getFullyQualifiedName().equals(VALUE)) {
- // @Foo(bar="xxx", value="yyy") => @Foo("yyy")
- Expression vv = pair.getValue();
- vv = (Expression) ASTNode.copySubtree(vv.getAST(), vv);
- this.annotationAdapter.newSingleMemberAnnotation(declaration).setValue(vv);
- } else {
- // @Foo(bar="xxx", baz="yyy") => @Foo(baz="yyy")
- }
- } else {
- // @Foo(bar="xxx", baz="yyy", joo="xxx") => @Foo(baz="yyy", joo="xxx")
- }
- }
- }
-
- /**
- * Remove the *first* member value pair from the specified annotation element
- * with the adapter's element name.
- */
- protected void removeElement(NormalAnnotation annotation) {
- for (Iterator<MemberValuePair> stream = this.values(annotation).iterator(); stream.hasNext(); ) {
- MemberValuePair pair = stream.next();
- if (pair.getName().getFullyQualifiedName().equals(this.elementName)) {
- stream.remove();
- }
- }
- }
-
-
- // ********** convenience methods **********
-
- /**
- * Return the *first* member value pair for the specified annotation element
- * with the adapter's element name.
- * Return null if the annotation has no such element.
- */
- protected MemberValuePair memberValuePair(NormalAnnotation annotation) {
- for (MemberValuePair pair : this.values(annotation)) {
- if (pair.getName().getFullyQualifiedName().equals(this.elementName)) {
- return pair;
- }
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- protected List<MemberValuePair> values(NormalAnnotation na) {
- return na.values();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/GenericVisitor.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/GenericVisitor.java
deleted file mode 100644
index 284d615e26..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/GenericVisitor.java
+++ /dev/null
@@ -1,791 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.ASTVisitor;
-import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration;
-import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration;
-import org.eclipse.jdt.core.dom.AnonymousClassDeclaration;
-import org.eclipse.jdt.core.dom.ArrayAccess;
-import org.eclipse.jdt.core.dom.ArrayCreation;
-import org.eclipse.jdt.core.dom.ArrayInitializer;
-import org.eclipse.jdt.core.dom.ArrayType;
-import org.eclipse.jdt.core.dom.AssertStatement;
-import org.eclipse.jdt.core.dom.Assignment;
-import org.eclipse.jdt.core.dom.Block;
-import org.eclipse.jdt.core.dom.BlockComment;
-import org.eclipse.jdt.core.dom.BooleanLiteral;
-import org.eclipse.jdt.core.dom.BreakStatement;
-import org.eclipse.jdt.core.dom.CastExpression;
-import org.eclipse.jdt.core.dom.CatchClause;
-import org.eclipse.jdt.core.dom.CharacterLiteral;
-import org.eclipse.jdt.core.dom.ClassInstanceCreation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.ConditionalExpression;
-import org.eclipse.jdt.core.dom.ConstructorInvocation;
-import org.eclipse.jdt.core.dom.ContinueStatement;
-import org.eclipse.jdt.core.dom.DoStatement;
-import org.eclipse.jdt.core.dom.EmptyStatement;
-import org.eclipse.jdt.core.dom.EnhancedForStatement;
-import org.eclipse.jdt.core.dom.EnumConstantDeclaration;
-import org.eclipse.jdt.core.dom.EnumDeclaration;
-import org.eclipse.jdt.core.dom.ExpressionStatement;
-import org.eclipse.jdt.core.dom.FieldAccess;
-import org.eclipse.jdt.core.dom.FieldDeclaration;
-import org.eclipse.jdt.core.dom.ForStatement;
-import org.eclipse.jdt.core.dom.IfStatement;
-import org.eclipse.jdt.core.dom.ImportDeclaration;
-import org.eclipse.jdt.core.dom.InfixExpression;
-import org.eclipse.jdt.core.dom.Initializer;
-import org.eclipse.jdt.core.dom.InstanceofExpression;
-import org.eclipse.jdt.core.dom.Javadoc;
-import org.eclipse.jdt.core.dom.LabeledStatement;
-import org.eclipse.jdt.core.dom.LineComment;
-import org.eclipse.jdt.core.dom.MarkerAnnotation;
-import org.eclipse.jdt.core.dom.MemberRef;
-import org.eclipse.jdt.core.dom.MemberValuePair;
-import org.eclipse.jdt.core.dom.MethodDeclaration;
-import org.eclipse.jdt.core.dom.MethodInvocation;
-import org.eclipse.jdt.core.dom.MethodRef;
-import org.eclipse.jdt.core.dom.MethodRefParameter;
-import org.eclipse.jdt.core.dom.Modifier;
-import org.eclipse.jdt.core.dom.NormalAnnotation;
-import org.eclipse.jdt.core.dom.NullLiteral;
-import org.eclipse.jdt.core.dom.NumberLiteral;
-import org.eclipse.jdt.core.dom.PackageDeclaration;
-import org.eclipse.jdt.core.dom.ParameterizedType;
-import org.eclipse.jdt.core.dom.ParenthesizedExpression;
-import org.eclipse.jdt.core.dom.PostfixExpression;
-import org.eclipse.jdt.core.dom.PrefixExpression;
-import org.eclipse.jdt.core.dom.PrimitiveType;
-import org.eclipse.jdt.core.dom.QualifiedName;
-import org.eclipse.jdt.core.dom.QualifiedType;
-import org.eclipse.jdt.core.dom.ReturnStatement;
-import org.eclipse.jdt.core.dom.SimpleName;
-import org.eclipse.jdt.core.dom.SimpleType;
-import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
-import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.jdt.core.dom.StringLiteral;
-import org.eclipse.jdt.core.dom.SuperConstructorInvocation;
-import org.eclipse.jdt.core.dom.SuperFieldAccess;
-import org.eclipse.jdt.core.dom.SuperMethodInvocation;
-import org.eclipse.jdt.core.dom.SwitchCase;
-import org.eclipse.jdt.core.dom.SwitchStatement;
-import org.eclipse.jdt.core.dom.SynchronizedStatement;
-import org.eclipse.jdt.core.dom.TagElement;
-import org.eclipse.jdt.core.dom.TextElement;
-import org.eclipse.jdt.core.dom.ThisExpression;
-import org.eclipse.jdt.core.dom.ThrowStatement;
-import org.eclipse.jdt.core.dom.TryStatement;
-import org.eclipse.jdt.core.dom.TypeDeclaration;
-import org.eclipse.jdt.core.dom.TypeDeclarationStatement;
-import org.eclipse.jdt.core.dom.TypeLiteral;
-import org.eclipse.jdt.core.dom.TypeParameter;
-import org.eclipse.jdt.core.dom.VariableDeclarationExpression;
-import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
-import org.eclipse.jdt.core.dom.WhileStatement;
-import org.eclipse.jdt.core.dom.WildcardType;
-
-/**
- * copied from org.eclipse.jdt.internal.corext.dom.GenericVisitor
- */
-public class GenericVisitor extends ASTVisitor {
-
- public GenericVisitor() {
- super();
- }
-
- public GenericVisitor(boolean visitJavadocTags) {
- super(visitJavadocTags);
- }
-
- // ********** hooks for subclasses **********
-
- protected boolean visit_(@SuppressWarnings("unused") ASTNode node) {
- return true;
- }
-
- protected void endVisit_(@SuppressWarnings("unused") ASTNode node) {
- // do nothing
- }
-
- // ********** overrides **********
-
- @Override
- public boolean visit(AnonymousClassDeclaration node) {
- return visit_(node);
- }
- @Override
- public boolean visit(ArrayAccess node) {
- return visit_(node);
- }
- @Override
- public boolean visit(ArrayCreation node) {
- return visit_(node);
- }
- @Override
- public boolean visit(ArrayInitializer node) {
- return visit_(node);
- }
- @Override
- public boolean visit(ArrayType node) {
- return visit_(node);
- }
- @Override
- public boolean visit(AssertStatement node) {
- return visit_(node);
- }
- @Override
- public boolean visit(Assignment node) {
- return visit_(node);
- }
- @Override
- public boolean visit(Block node) {
- return visit_(node);
- }
- @Override
- public boolean visit(BooleanLiteral node) {
- return visit_(node);
- }
- @Override
- public boolean visit(BreakStatement node) {
- return visit_(node);
- }
- @Override
- public boolean visit(CastExpression node) {
- return visit_(node);
- }
- @Override
- public boolean visit(CatchClause node) {
- return visit_(node);
- }
- @Override
- public boolean visit(CharacterLiteral node) {
- return visit_(node);
- }
- @Override
- public boolean visit(ClassInstanceCreation node) {
- return visit_(node);
- }
- @Override
- public boolean visit(CompilationUnit node) {
- return visit_(node);
- }
- @Override
- public boolean visit(ConditionalExpression node) {
- return visit_(node);
- }
- @Override
- public boolean visit(ConstructorInvocation node) {
- return visit_(node);
- }
- @Override
- public boolean visit(ContinueStatement node) {
- return visit_(node);
- }
- @Override
- public boolean visit(DoStatement node) {
- return visit_(node);
- }
- @Override
- public boolean visit(EmptyStatement node) {
- return visit_(node);
- }
- @Override
- public boolean visit(ExpressionStatement node) {
- return visit_(node);
- }
- @Override
- public boolean visit(FieldAccess node) {
- return visit_(node);
- }
- @Override
- public boolean visit(FieldDeclaration node) {
- return visit_(node);
- }
- @Override
- public boolean visit(ForStatement node) {
- return visit_(node);
- }
- @Override
- public boolean visit(IfStatement node) {
- return visit_(node);
- }
- @Override
- public boolean visit(ImportDeclaration node) {
- return visit_(node);
- }
- @Override
- public boolean visit(InfixExpression node) {
- return visit_(node);
- }
- @Override
- public boolean visit(InstanceofExpression node) {
- return visit_(node);
- }
- @Override
- public boolean visit(Initializer node) {
- return visit_(node);
- }
- @Override
- public boolean visit(Javadoc node) {
- return (super.visit(node)) ? visit_(node) : false;
- }
- @Override
- public boolean visit(LabeledStatement node) {
- return visit_(node);
- }
- @Override
- public boolean visit(MethodDeclaration node) {
- return visit_(node);
- }
- @Override
- public boolean visit(MethodInvocation node) {
- return visit_(node);
- }
- @Override
- public boolean visit(NullLiteral node) {
- return visit_(node);
- }
- @Override
- public boolean visit(NumberLiteral node) {
- return visit_(node);
- }
- @Override
- public boolean visit(PackageDeclaration node) {
- return visit_(node);
- }
- @Override
- public boolean visit(ParenthesizedExpression node) {
- return visit_(node);
- }
- @Override
- public boolean visit(PostfixExpression node) {
- return visit_(node);
- }
- @Override
- public boolean visit(PrefixExpression node) {
- return visit_(node);
- }
- @Override
- public boolean visit(PrimitiveType node) {
- return visit_(node);
- }
- @Override
- public boolean visit(QualifiedName node) {
- return visit_(node);
- }
- @Override
- public boolean visit(ReturnStatement node) {
- return visit_(node);
- }
- @Override
- public boolean visit(SimpleName node) {
- return visit_(node);
- }
- @Override
- public boolean visit(SimpleType node) {
- return visit_(node);
- }
- @Override
- public boolean visit(StringLiteral node) {
- return visit_(node);
- }
- @Override
- public boolean visit(SuperConstructorInvocation node) {
- return visit_(node);
- }
- @Override
- public boolean visit(SuperFieldAccess node) {
- return visit_(node);
- }
- @Override
- public boolean visit(SuperMethodInvocation node) {
- return visit_(node);
- }
- @Override
- public boolean visit(SwitchCase node) {
- return visit_(node);
- }
- @Override
- public boolean visit(SwitchStatement node) {
- return visit_(node);
- }
- @Override
- public boolean visit(SynchronizedStatement node) {
- return visit_(node);
- }
- @Override
- public boolean visit(ThisExpression node) {
- return visit_(node);
- }
- @Override
- public boolean visit(ThrowStatement node) {
- return visit_(node);
- }
- @Override
- public boolean visit(TryStatement node) {
- return visit_(node);
- }
- @Override
- public boolean visit(TypeDeclaration node) {
- return visit_(node);
- }
- @Override
- public boolean visit(TypeDeclarationStatement node) {
- return visit_(node);
- }
- @Override
- public boolean visit(TypeLiteral node) {
- return visit_(node);
- }
- @Override
- public boolean visit(SingleVariableDeclaration node) {
- return visit_(node);
- }
- @Override
- public boolean visit(VariableDeclarationExpression node) {
- return visit_(node);
- }
- @Override
- public boolean visit(VariableDeclarationStatement node) {
- return visit_(node);
- }
- @Override
- public boolean visit(VariableDeclarationFragment node) {
- return visit_(node);
- }
- @Override
- public boolean visit(WhileStatement node) {
- return visit_(node);
- }
- @Override
- public boolean visit(AnnotationTypeDeclaration node) {
- return visit_(node);
- }
- @Override
- public boolean visit(AnnotationTypeMemberDeclaration node) {
- return visit_(node);
- }
- @Override
- public boolean visit(BlockComment node) {
- return visit_(node);
- }
- @Override
- public boolean visit(EnhancedForStatement node) {
- return visit_(node);
- }
- @Override
- public boolean visit(EnumConstantDeclaration node) {
- return visit_(node);
- }
- @Override
- public boolean visit(EnumDeclaration node) {
- return visit_(node);
- }
- @Override
- public boolean visit(LineComment node) {
- return visit_(node);
- }
- @Override
- public boolean visit(MarkerAnnotation node) {
- return visit_(node);
- }
- @Override
- public boolean visit(MemberRef node) {
- return visit_(node);
- }
- @Override
- public boolean visit(MemberValuePair node) {
- return visit_(node);
- }
- @Override
- public boolean visit(MethodRef node) {
- return visit_(node);
- }
- @Override
- public boolean visit(MethodRefParameter node) {
- return visit_(node);
- }
- @Override
- public boolean visit(Modifier node) {
- return visit_(node);
- }
- @Override
- public boolean visit(NormalAnnotation node) {
- return visit_(node);
- }
- @Override
- public boolean visit(ParameterizedType node) {
- return visit_(node);
- }
- @Override
- public boolean visit(QualifiedType node) {
- return visit_(node);
- }
- @Override
- public boolean visit(SingleMemberAnnotation node) {
- return visit_(node);
- }
- @Override
- public boolean visit(TagElement node) {
- return visit_(node);
- }
- @Override
- public boolean visit(TextElement node) {
- return visit_(node);
- }
- @Override
- public boolean visit(TypeParameter node) {
- return visit_(node);
- }
- @Override
- public boolean visit(WildcardType node) {
- return visit_(node);
- }
-
- @Override
- public void endVisit(AnonymousClassDeclaration node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(ArrayAccess node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(ArrayCreation node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(ArrayInitializer node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(ArrayType node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(AssertStatement node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(Assignment node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(Block node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(BooleanLiteral node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(BreakStatement node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(CastExpression node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(CatchClause node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(CharacterLiteral node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(ClassInstanceCreation node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(CompilationUnit node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(ConditionalExpression node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(ConstructorInvocation node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(ContinueStatement node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(DoStatement node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(EmptyStatement node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(ExpressionStatement node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(FieldAccess node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(FieldDeclaration node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(ForStatement node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(IfStatement node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(ImportDeclaration node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(InfixExpression node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(InstanceofExpression node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(Initializer node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(Javadoc node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(LabeledStatement node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(MethodDeclaration node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(MethodInvocation node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(NullLiteral node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(NumberLiteral node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(PackageDeclaration node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(ParenthesizedExpression node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(PostfixExpression node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(PrefixExpression node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(PrimitiveType node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(QualifiedName node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(ReturnStatement node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(SimpleName node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(SimpleType node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(StringLiteral node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(SuperConstructorInvocation node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(SuperFieldAccess node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(SuperMethodInvocation node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(SwitchCase node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(SwitchStatement node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(SynchronizedStatement node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(ThisExpression node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(ThrowStatement node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(TryStatement node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(TypeDeclaration node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(TypeDeclarationStatement node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(TypeLiteral node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(SingleVariableDeclaration node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(VariableDeclarationExpression node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(VariableDeclarationStatement node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(VariableDeclarationFragment node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(WhileStatement node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(AnnotationTypeDeclaration node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(AnnotationTypeMemberDeclaration node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(BlockComment node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(EnhancedForStatement node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(EnumConstantDeclaration node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(EnumDeclaration node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(LineComment node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(MarkerAnnotation node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(MemberRef node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(MemberValuePair node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(MethodRef node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(MethodRefParameter node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(Modifier node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(NormalAnnotation node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(ParameterizedType node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(QualifiedType node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(SingleMemberAnnotation node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(TagElement node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(TextElement node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(TypeParameter node) {
- endVisit_(node);
- }
- @Override
- public void endVisit(WildcardType node) {
- endVisit_(node);
- }
-
-}
-
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTAttribute.java
deleted file mode 100644
index 86551588da..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTAttribute.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.TypeDeclaration;
-import org.eclipse.jpt.core.utility.jdt.AnnotationEditFormatter;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.Type;
-import org.eclipse.jpt.utility.CommandExecutor;
-
-/**
- * Combine behavior common to JDTFieldAttribute and JDTMethodAttribute.
- * Not so sure this is useful....
- */
-public abstract class JDTAttribute
- extends JDTMember
- implements Attribute
-{
-
- // ********** constructors **********
-
- protected JDTAttribute(
- Type declaringType,
- String name,
- int occurrence,
- ICompilationUnit compilationUnit,
- CommandExecutor modifySharedDocumentCommandExecutor) {
- super(declaringType, name, occurrence, compilationUnit, modifySharedDocumentCommandExecutor);
- }
-
- protected JDTAttribute(
- Type declaringType,
- String name,
- int occurrence,
- ICompilationUnit compilationUnit,
- CommandExecutor modifySharedDocumentCommandExecutor,
- AnnotationEditFormatter annotationEditFormatter) {
- super(declaringType, name, occurrence, compilationUnit, modifySharedDocumentCommandExecutor, annotationEditFormatter);
- }
-
-
- // ********** Member/Attribute implementation **********
-
- public boolean isField() {
- return false;
- }
-
-
- // ********** internal **********
-
- protected TypeDeclaration getDeclaringTypeDeclaration(CompilationUnit astRoot) {
- // assume the declaring type is not an enum or annotation
- // since they do not have field or method declarations
- return this.getDeclaringType().getBodyDeclaration(astRoot);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTFieldAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTFieldAttribute.java
deleted file mode 100644
index 1c18f297cb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTFieldAttribute.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import java.util.List;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.FieldDeclaration;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jdt.core.dom.IVariableBinding;
-import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationEditFormatter;
-import org.eclipse.jpt.core.utility.jdt.FieldAttribute;
-import org.eclipse.jpt.core.utility.jdt.Type;
-import org.eclipse.jpt.utility.CommandExecutor;
-
-/**
- * Adapt and extend a JDT field.
- * Attribute based on a Java field, e.g.
- * private int foo;
- */
-public class JDTFieldAttribute
- extends JDTAttribute
- implements FieldAttribute
-{
-
- // ********** constructors **********
-
- public JDTFieldAttribute(
- Type declaringType,
- String name,
- int occurrence,
- ICompilationUnit compilationUnit,
- CommandExecutor modifySharedDocumentCommandExecutor) {
- this(declaringType, name, occurrence, compilationUnit, modifySharedDocumentCommandExecutor, DefaultAnnotationEditFormatter.instance());
- }
-
- public JDTFieldAttribute(
- Type declaringType,
- String name,
- int occurrence,
- ICompilationUnit compilationUnit,
- CommandExecutor modifySharedDocumentCommandExecutor,
- AnnotationEditFormatter annotationEditFormatter) {
- super(declaringType, name, occurrence, compilationUnit, modifySharedDocumentCommandExecutor, annotationEditFormatter);
- }
-
- /**
- * constructor for testing
- */
- public JDTFieldAttribute(Type declaringType, String name, int occurrence, ICompilationUnit compilationUnit) {
- this(declaringType, name, occurrence, compilationUnit, CommandExecutor.Default.instance(), DefaultAnnotationEditFormatter.instance());
- }
-
-
- // ********** Member/Attribute/FieldAttribute implementation **********
-
- public IVariableBinding getBinding(CompilationUnit astRoot) {
- return this.getFragment(astRoot).resolveBinding();
- }
-
- public FieldDeclaration getBodyDeclaration(CompilationUnit astRoot) {
- return this.getSelectedDeclaration(astRoot, FIELD_DECLARATION_SELECTOR);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return new ASTNodeTextRange(this.getFragment(astRoot).getName());
- }
-
- public String getAttributeName() {
- return this.getName_();
- }
-
- public ITypeBinding getTypeBinding(CompilationUnit astRoot) {
- return this.getBodyDeclaration(astRoot).getType().resolveBinding();
- }
-
- @Override
- public boolean isField() {
- return true;
- }
-
- public boolean isPersistable(CompilationUnit astRoot) {
- IVariableBinding binding = this.getBinding(astRoot);
- return (binding == null) ? false : JPTTools.fieldIsPersistable(new JPTToolsAdapter(binding));
- }
-
-
- // ********** internal **********
-
- protected VariableDeclarationFragment getFragment(CompilationUnit astRoot) {
- return this.getSelectedDeclaration(astRoot, VARIABLE_DECLARATION_FRAGMENT_SELECTOR);
- }
-
- /**
- * return either a FieldDeclaration or a VariableDeclarationFragment,
- * depending on the specified selector;
- *
- * handle multiple fields declared in a single statement:
- * private int foo, bar;
- */
- protected <T extends ASTNode> T getSelectedDeclaration(CompilationUnit astRoot, Selector<T> selector) {
- String name = this.getName_();
- int occurrence = this.getOccurrence();
- int count = 0;
- for (FieldDeclaration fieldDeclaration : this.getDeclaringTypeFieldDeclarations(astRoot)) {
- for (VariableDeclarationFragment fragment : fragments(fieldDeclaration)) {
- if (fragment.getName().getFullyQualifiedName().equals(name)) {
- count++;
- if (count == occurrence) {
- return selector.select(fieldDeclaration, fragment);
- }
- }
- }
- }
- // return null if the field is no longer in the source code;
- // this can happen when the context model has not yet
- // been synchronized with the resource model but is still
- // asking for an ASTNode (e.g. during a selection event)
- return null;
- }
-
- protected FieldDeclaration[] getDeclaringTypeFieldDeclarations(CompilationUnit astRoot) {
- return this.getDeclaringTypeDeclaration(astRoot).getFields();
- }
-
- // minimize scope of suppressed warnings
- @SuppressWarnings("unchecked")
- protected static List<VariableDeclarationFragment> fragments(FieldDeclaration fd) {
- return fd.fragments();
- }
-
-
- // ********** Selector **********
-
- // I'm not quite sure this interface is worth the resulting obfuscation,
- // but, then, I kept changing both methods, so... ~bjv
- protected interface Selector<T extends ASTNode> {
- T select(FieldDeclaration fieldDeclaration, VariableDeclarationFragment variableDeclarationFragment);
- String getDescription();
- }
-
- protected static final Selector<FieldDeclaration> FIELD_DECLARATION_SELECTOR =
- new Selector<FieldDeclaration>() {
- public FieldDeclaration select(FieldDeclaration fieldDeclaration, VariableDeclarationFragment variableDeclarationFragment) {
- return fieldDeclaration;
- }
- public String getDescription() {
- return "field declaration"; //$NON-NLS-1$
- }
- @Override
- public String toString() {
- return "FIELD_DECLARATION_SELECTOR"; //$NON-NLS-1$
- }
- };
-
- protected static final Selector<VariableDeclarationFragment> VARIABLE_DECLARATION_FRAGMENT_SELECTOR =
- new Selector<VariableDeclarationFragment>() {
- public VariableDeclarationFragment select(FieldDeclaration fieldDeclaration, VariableDeclarationFragment variableDeclarationFragment) {
- return variableDeclarationFragment;
- }
- public String getDescription() {
- return "variable declaration fragment"; //$NON-NLS-1$
- }
- @Override
- public String toString() {
- return "VARIABLE_DECLARATION_FRAGMENT_SELECTOR"; //$NON-NLS-1$
- }
- };
-
-
- // ********** JPTTools adapter **********
-
- /**
- * JPTTools needs an adapter so it can work with either an IField
- * or an IVariableBinding etc.
- */
- protected static class JPTToolsAdapter implements JPTTools.FieldAdapter {
- private final IVariableBinding fieldBinding;
-
- protected JPTToolsAdapter(IVariableBinding fieldBinding) {
- super();
- if (fieldBinding == null) {
- throw new NullPointerException();
- }
- this.fieldBinding = fieldBinding;
- }
-
- public int getModifiers() {
- return this.fieldBinding.getModifiers();
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTMember.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTMember.java
deleted file mode 100644
index b0ecf61004..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTMember.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.core.filebuffers.FileBuffers;
-import org.eclipse.core.filebuffers.ITextFileBuffer;
-import org.eclipse.core.filebuffers.LocationKind;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jpt.core.utility.jdt.AnnotationEditFormatter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
-import org.eclipse.jpt.core.utility.jdt.Type;
-import org.eclipse.jpt.utility.Command;
-import org.eclipse.jpt.utility.CommandExecutor;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.text.edits.MalformedTreeException;
-import org.eclipse.text.edits.TextEdit;
-
-/**
- * Adapt and extend a JDT member with simplified annotation handling.
- */
-public abstract class JDTMember
- implements Member
-{
- /** this will be null for the primary type */
- private final Type declaringType;
-
- /** the member's name (duh) */
- private final String name;
-
- /**
- * members can occur more than once in non-compiling source;
- * count starts at 1; the primary type will have occurrence 1
- */
- private final int occurrence;
-
- /**
- * the compilation unit (file) containing the member;
- * used for building an AST when we modify the member
- */
- private final ICompilationUnit compilationUnit;
-
- /**
- * this allows clients to provide a way to modify the compilation unit
- * (file) when it is open in an editor and should be modified on the UI
- * thread
- */
- private final CommandExecutor modifySharedDocumentCommandExecutor;
-
- /** this will format the member's annotations a bit */
- private final AnnotationEditFormatter annotationEditFormatter;
-
-
- // ********** constructors **********
-
- protected JDTMember(
- Type declaringType,
- String name,
- int occurrence,
- ICompilationUnit compilationUnit,
- CommandExecutor modifySharedDocumentCommandExecutor) {
- this(declaringType, name, occurrence, compilationUnit, modifySharedDocumentCommandExecutor, DefaultAnnotationEditFormatter.instance());
- }
-
- protected JDTMember(
- Type declaringType,
- String name,
- int occurrence,
- ICompilationUnit compilationUnit,
- CommandExecutor modifySharedDocumentCommandExecutor,
- AnnotationEditFormatter annotationEditFormatter) {
- super();
- this.declaringType = declaringType;
- this.name = name;
- this.occurrence = occurrence;
- this.compilationUnit = compilationUnit;
- this.modifySharedDocumentCommandExecutor = modifySharedDocumentCommandExecutor;
- this.annotationEditFormatter = annotationEditFormatter;
- }
-
-
- // ********** Member implementation **********
-
- public ModifiedDeclaration getModifiedDeclaration(CompilationUnit astRoot) {
- return new JDTModifiedDeclaration(this.getBodyDeclaration(astRoot));
- }
-
- public ModifiedDeclaration getModifiedDeclaration() {
- return this.getModifiedDeclaration(this.buildASTRoot());
- }
-
- public boolean matches(String memberName, int occur) {
- return memberName.equals(this.name) && (occur == this.occurrence);
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.name);
- }
-
-
- // ********** internal **********
-
- protected String getName_() {
- return this.name;
- }
-
- protected int getOccurrence() {
- return this.occurrence;
- }
-
- /**
- * this will return null for a top-level type
- */
- protected Type getDeclaringType() {
- return this.declaringType;
- }
-
-
- // ********** editing **********
-
- /**
- * Edit the member with the specified editor.
- * The editor will be invoked once the member's compilation unit
- * is in an editable state.
- */
- public void edit(Editor editor) {
- try {
- this.edit_(editor);
- } catch (JavaModelException ex) {
- throw new RuntimeException(ex);
- } catch (BadLocationException ex) {
- throw new RuntimeException(ex);
- }
- }
-
- /**
- * NB: Be careful changing this method.
- * Things to look out for:
- * - when editing via the JavaEditor there is no need to create a working copy
- * - when editing without an editor or via a simple text editor, a "working copy" must be created.
- * (at least as far as I can tell ~kfm)
- * - sharedDocument is only ever false in tests (headless mode). In the UI, even if the file
- * is not open in an editor, sharedDocument is still true (buffer is not null)
- * - if a working copy is created, then we must discard it
- */
- protected void edit_(Editor editor) throws JavaModelException, BadLocationException {
- boolean createWorkingCopy = ! this.compilationUnit.isWorkingCopy();
- if (createWorkingCopy) {
- this.compilationUnit.becomeWorkingCopy(null);
- }
-
- ITextFileBuffer buffer = FileBuffers.getTextFileBufferManager().getTextFileBuffer(this.compilationUnit.getResource().getFullPath(), LocationKind.NORMALIZE);
- boolean sharedDocument = (buffer != null); // documents are typically shared when they are already open in an editor
- IDocument doc = sharedDocument ?
- buffer.getDocument()
- :
- new Document(this.compilationUnit.getBuffer().getContents());
-
- try {
- CompilationUnit astRoot = this.buildASTRoot();
- astRoot.recordModifications();
-
- editor.edit(this.getModifiedDeclaration(astRoot));
-
- TextEdit edits = astRoot.rewrite(doc, this.compilationUnit.getJavaProject().getOptions(true));
- if (sharedDocument) {
- this.modifySharedDocumentCommandExecutor.execute(new ModifySharedDocumentCommand(edits, doc));
- } else {
- this.applyEdits(edits, doc);
- }
- }
- finally {
- if (createWorkingCopy) {
- //discardWorkingCopy must be called every time becomeWorkingCopy is called.
- this.compilationUnit.getBuffer().setContents(doc.get());
- this.compilationUnit.commitWorkingCopy(true, null); // true="force"
- this.compilationUnit.discardWorkingCopy();
- }
- }
- }
-
- /**
- * apply the specified edits to the specified document,
- * reformatting the document if necessary
- */
- protected void applyEdits(TextEdit edits, IDocument doc) throws MalformedTreeException, BadLocationException {
- edits.apply(doc, TextEdit.UPDATE_REGIONS);
- this.annotationEditFormatter.format(doc, edits);
- }
-
- protected CompilationUnit buildASTRoot() {
- return JDTTools.buildASTRoot(this.compilationUnit);
- }
-
-
- // ********** modify shared document command class **********
-
- /**
- * simple command that calls back to the member to apply the edits
- * in the same way as if the document were not shared
- */
- protected class ModifySharedDocumentCommand implements Command {
- private final TextEdit edits;
- private final IDocument doc;
-
- protected ModifySharedDocumentCommand(TextEdit edits, IDocument doc) {
- super();
- this.edits = edits;
- this.doc = doc;
- }
-
- public void execute() {
- try {
- JDTMember.this.applyEdits(this.edits, this.doc);
- } catch (MalformedTreeException ex) {
- throw new RuntimeException(ex);
- } catch (BadLocationException ex) {
- throw new RuntimeException(ex);
- }
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTMethodAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTMethodAttribute.java
deleted file mode 100644
index b233a2a803..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTMethodAttribute.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.IMethodBinding;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jdt.core.dom.MethodDeclaration;
-import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationEditFormatter;
-import org.eclipse.jpt.core.utility.jdt.MethodAttribute;
-import org.eclipse.jpt.core.utility.jdt.Type;
-import org.eclipse.jpt.utility.CommandExecutor;
-import org.eclipse.jpt.utility.JavaType;
-import org.eclipse.jpt.utility.MethodSignature;
-import org.eclipse.jpt.utility.internal.NameTools;
-import org.eclipse.jpt.utility.internal.SimpleMethodSignature;
-
-/**
- * Adapt and extend a JDT method.
- * Attribute based on a Java property, e.g.
- * private int getFoo() {
- * return foo;
- * }
- * private void setFoo(int foo) {
- * this.foo = foo;
- * }
- */
-public class JDTMethodAttribute
- extends JDTAttribute
- implements MethodAttribute
-{
- /** we need the parameter types to build the method signature */
- private final JavaType[] parameterTypes;
-
-
- // ********** constructors **********
-
- public static JDTMethodAttribute newInstance(
- Type declaringType,
- MethodSignature signature,
- int occurrence,
- ICompilationUnit compilationUnit,
- CommandExecutor modifySharedDocumentCommandExecutor) {
- return newInstance(declaringType, signature, occurrence, compilationUnit, modifySharedDocumentCommandExecutor, DefaultAnnotationEditFormatter.instance());
- }
-
- public static JDTMethodAttribute newInstance(
- Type declaringType,
- MethodSignature signature,
- int occurrence,
- ICompilationUnit compilationUnit,
- CommandExecutor modifySharedDocumentCommandExecutor,
- AnnotationEditFormatter annotationEditFormatter) {
- return new JDTMethodAttribute(declaringType, signature, occurrence, compilationUnit, modifySharedDocumentCommandExecutor, annotationEditFormatter);
- }
-
- public JDTMethodAttribute(
- Type declaringType,
- MethodSignature methodSignature,
- int occurrence,
- ICompilationUnit compilationUnit,
- CommandExecutor modifySharedDocumentCommandExecutor) {
- this(declaringType, methodSignature, occurrence, compilationUnit, modifySharedDocumentCommandExecutor, DefaultAnnotationEditFormatter.instance());
- }
-
- public JDTMethodAttribute(
- Type declaringType,
- MethodSignature methodSignature,
- int occurrence,
- ICompilationUnit compilationUnit,
- CommandExecutor modifySharedDocumentCommandExecutor,
- AnnotationEditFormatter annotationEditFormatter) {
- super(declaringType, methodSignature.getName(), occurrence, compilationUnit, modifySharedDocumentCommandExecutor, annotationEditFormatter);
- this.parameterTypes = methodSignature.getParameterTypes();
- }
-
- /**
- * constructor for testing
- */
- public JDTMethodAttribute(Type declaringType, String name, String[] parameterTypeNames, int occurrence, ICompilationUnit compilationUnit) {
- this(declaringType, new SimpleMethodSignature(name, parameterTypeNames), occurrence, compilationUnit, CommandExecutor.Default.instance(), DefaultAnnotationEditFormatter.instance());
- }
-
-
- // ********** Member/Attribute/MethodAttribute implementation **********
-
- public IMethodBinding getBinding(CompilationUnit astRoot) {
- return this.getBodyDeclaration(astRoot).resolveBinding();
- }
-
- public MethodDeclaration getBodyDeclaration(CompilationUnit astRoot) {
- int count = 0;
- for (MethodDeclaration methodDeclaration : this.getDeclaringTypeMethodDeclarations(astRoot)) {
- if (this.matches(methodDeclaration)) {
- count++;
- if (count == this.getOccurrence()) {
- return methodDeclaration;
- }
- }
- }
- // return null if the method is no longer in the source code;
- // this can happen when the context model has not yet
- // been synchronized with the resource model but is still
- // asking for an ASTNode (e.g. during a selection event)
- return null;
- }
-
- public boolean matches(MethodSignature signature, int occurrence) {
- return this.matches(signature) && (occurrence == this.getOccurrence());
- }
-
- protected boolean matches(MethodSignature signature) {
- return signature.getName().equals(this.getName_())
- && Arrays.equals(this.parameterTypes, signature.getParameterTypes());
- }
-
- protected boolean matches(MethodDeclaration methodDeclaration) {
- return this.matches(JDTTools.buildMethodSignature(methodDeclaration));
- }
-
- // minimize scope of suppressed warnings
- @SuppressWarnings("unchecked")
- protected static List<SingleVariableDeclaration> parameters(MethodDeclaration methodDeclaration) {
- return methodDeclaration.parameters();
- }
-
- @Override
- public boolean matches(String memberName, int occurrence) {
- throw new UnsupportedOperationException("Use #matches(MethodSignature, int)."); //$NON-NLS-1$
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return new ASTNodeTextRange(this.getBodyDeclaration(astRoot).getName());
- }
-
- /**
- * return "foo" for a method named "getFoo" or "isFoo"
- */
- public String getAttributeName() {
- return NameTools.convertGetterMethodNameToPropertyName(this.getName_());
- }
-
- public ITypeBinding getTypeBinding(CompilationUnit astRoot) {
- IMethodBinding methodBinding = getBodyDeclaration(astRoot).resolveBinding();
- return (methodBinding == null) ? null : methodBinding.getReturnType();
- }
-
- public boolean isPersistable(CompilationUnit astRoot) {
- IMethodBinding binding = this.getBinding(astRoot);
- return (binding == null) ? false : JPTTools.methodIsPersistablePropertyGetter(new JPTToolsAdapter(binding));
- }
-
-
- // ********** internal **********
-
- protected MethodDeclaration[] getDeclaringTypeMethodDeclarations(CompilationUnit astRoot) {
- return this.getDeclaringTypeDeclaration(astRoot).getMethods();
- }
-
-
- // ********** JPTTools adapter **********
-
- /**
- * JPTTools needs an adapter so it can work with either an IMethod
- * or an IMethodBinding etc.
- */
- protected static class SimpleJPTToolsAdapter
- implements JPTTools.SimpleMethodAdapter
- {
- protected final IMethodBinding methodBinding;
-
- protected SimpleJPTToolsAdapter(IMethodBinding methodBinding) {
- super();
- if (methodBinding == null) {
- throw new NullPointerException();
- }
- this.methodBinding = methodBinding;
- }
-
- public int getModifiers() {
- return this.methodBinding.getModifiers();
- }
-
- public String getReturnTypeErasureName() {
- ITypeBinding returnType = this.methodBinding.getReturnType();
- return (returnType == null) ? null : returnType.getTypeDeclaration().getErasure().getQualifiedName();
- }
-
- public boolean isConstructor() {
- return this.methodBinding.isConstructor();
- }
-
- }
-
- protected static class JPTToolsAdapter
- extends SimpleJPTToolsAdapter
- implements JPTTools.MethodAdapter
- {
- protected JPTToolsAdapter(IMethodBinding methodBinding) {
- super(methodBinding);
- }
-
- public String getName() {
- return this.methodBinding.getName();
- }
-
- public int getParametersLength() {
- return this.methodBinding.getParameterTypes().length;
- }
-
- public JPTTools.SimpleMethodAdapter getSibling(String name) {
- ITypeBinding typeBinding = this.methodBinding.getDeclaringClass();
- if (typeBinding == null) {
- return null;
- }
- for (IMethodBinding sibling : typeBinding.getDeclaredMethods()) {
- if ((sibling.getParameterTypes().length == 0)
- && sibling.getName().equals(name)) {
- return new SimpleJPTToolsAdapter(sibling);
- }
- }
- return null;
- }
-
- public JPTTools.SimpleMethodAdapter getSibling(String name, String parameterTypeErasureName) {
- ITypeBinding typeBinding = this.methodBinding.getDeclaringClass();
- if (typeBinding == null) {
- return null;
- }
- for (IMethodBinding sibling : typeBinding.getDeclaredMethods()) {
- ITypeBinding[] siblingParmTypes = sibling.getParameterTypes();
- if ((siblingParmTypes.length == 1)
- && sibling.getName().equals(name)
- && siblingParmTypes[0].getTypeDeclaration().getErasure().getQualifiedName().equals(parameterTypeErasureName)) {
- return new SimpleJPTToolsAdapter(sibling);
- }
- }
- return null;
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTModifiedDeclaration.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTModifiedDeclaration.java
deleted file mode 100644
index 2f6f82dab1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTModifiedDeclaration.java
+++ /dev/null
@@ -1,532 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.BodyDeclaration;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.IExtendedModifier;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jdt.core.dom.ImportDeclaration;
-import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.jdt.core.dom.VariableDeclarationExpression;
-import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
-import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-/**
- * Wrap any of the AST nodes that have modifiers (specifically, annotations);
- * i.e. BodyDeclaration, SingleVariableDeclaration, VariableDeclarationExpression,
- * and VariableDeclarationStatement.
- */
-public class JDTModifiedDeclaration
- implements ModifiedDeclaration
-{
- private final Adapter adapter;
-
-
- // ********** constructors **********
-
- public JDTModifiedDeclaration(Adapter adapter) {
- super();
- this.adapter = adapter;
- }
-
- public JDTModifiedDeclaration(BodyDeclaration declaration) {
- this(new BodyDeclarationAdapter(declaration));
- }
-
- public JDTModifiedDeclaration(SingleVariableDeclaration declaration) {
- this(new SingleVariableDeclarationAdapter(declaration));
- }
-
- public JDTModifiedDeclaration(VariableDeclarationExpression declaration) {
- this(new VariableDeclarationExpressionAdapter(declaration));
- }
-
- public JDTModifiedDeclaration(VariableDeclarationStatement declaration) {
- this(new VariableDeclarationStatementAdapter(declaration));
- }
-
-
- // ********** annotations **********
-
- public Annotation getAnnotationNamed(String annotationName) {
- for (Iterator<Annotation> stream = this.annotations(); stream.hasNext(); ) {
- Annotation annotation = stream.next();
- if (this.annotationIsNamed(annotation, annotationName)) {
- return annotation;
- }
- }
- return null;
- }
-
- public void removeAnnotationNamed(String annotationName) {
- for (Iterator<IExtendedModifier> stream = this.getModifiers().iterator(); stream.hasNext(); ) {
- IExtendedModifier modifier = stream.next();
- if (modifier.isAnnotation()) {
- if (this.annotationIsNamed((Annotation) modifier, annotationName)) {
- stream.remove();
- break;
- }
- }
- }
- }
-
- public void replaceAnnotationNamed(String oldAnnotationName, Annotation newAnnotation) {
- List<IExtendedModifier> modifiers = this.getModifiers();
- for (ListIterator<IExtendedModifier> stream = modifiers.listIterator(); stream.hasNext(); ) {
- IExtendedModifier modifier = stream.next();
- if (modifier.isAnnotation()) {
- if (this.annotationIsNamed((Annotation) modifier, oldAnnotationName)) {
- stream.set(newAnnotation);
- return;
- }
- }
- }
- this.addAnnotation(newAnnotation);
- }
-
- /**
- * Add the specified annotation to the declaration.
- * By convention annotations precede the "standard" (JLS2) modifiers;
- * though, technically, they can be interspersed.
- */
- protected void addAnnotation(Annotation annotation) {
- List<IExtendedModifier> modifiers = this.getModifiers();
- for (ListIterator<IExtendedModifier> stream = modifiers.listIterator(); stream.hasNext(); ) {
- if (stream.next().isModifier()) {
- stream.previous(); // put the annotation *before* the first "standard" (JLS2) modifier
- stream.add(annotation);
- return;
- }
- }
- modifiers.add(annotation); // just tack it on to the end
- }
-
- /**
- * Return the declaration's annotations.
- */
- protected Iterator<Annotation> annotations() {
- return new FilteringIterator<IExtendedModifier, Annotation>(this.getModifiers().iterator()) {
- @Override
- protected boolean accept(IExtendedModifier next) {
- return next.isAnnotation();
- }
- };
- }
-
-
- // ********** add import **********
-
- public boolean addImport(String className) {
- if (className.indexOf('.') == -1) {
- return true; // the class is in the default package - no need for import
- }
- return this.addImport(className, false);
- }
-
- public boolean addStaticImport(String enumConstantName) {
- int index1 = enumConstantName.indexOf('.');
- if (index1 == -1) {
- throw new IllegalArgumentException(enumConstantName); // shouldn't happen?
- }
- int index2 = enumConstantName.indexOf('.', index1 + 1);
- if (index2 == -1) {
- return true; // the enum is in the default package - no need for import
- }
- return this.addImport(enumConstantName, true);
- }
-
- public boolean addImport(String importName, boolean staticImport) {
- Boolean include = this.importsInclude(importName, staticImport);
- if (include != null) {
- return include.booleanValue();
- }
-
- ImportDeclaration importDeclaration = this.getAst().newImportDeclaration();
- importDeclaration.setName(this.getAst().newName(importName));
- importDeclaration.setStatic(staticImport);
- this.getImports().add(importDeclaration);
- return true;
- }
-
- /**
- * Just a bit hacky:
- * Return Boolean.TRUE if the import is already present.
- * Return Boolean.FALSE if a colliding import is already present.
- * Return null if a new import may be added.
- * This hackery allows us to loop through the imports only once
- * (and compose our methods).
- * Pre-condition: 'importName' is not in the "default" package (i.e. it *is* qualified)
- */
- protected Boolean importsInclude(String importName, boolean staticImport) {
- int period = importName.lastIndexOf('.'); // should not be -1
- String importNameQualifier = importName.substring(0, period);
- String shortImportName = importName.substring(period + 1);
- return this.importsInclude(importName, importNameQualifier, shortImportName, staticImport);
- }
-
- /**
- * pre-calculate the qualifier and short name
- */
- protected Boolean importsInclude(String importName, String importNameQualifier, String shortImportName, boolean staticImport) {
- for (ImportDeclaration importDeclaration : this.getImports()) {
- if (importDeclaration.isStatic() == staticImport) {
- Boolean match = this.importMatches(importDeclaration, importName, importNameQualifier, shortImportName);
- if (match != null) {
- return match;
- }
- }
- }
- return null;
- }
-
- /**
- * we should be able to rely on the JDT model here, since we are looking
- * at objects that should not be changing underneath us...
- */
- protected Boolean importMatches(ImportDeclaration importDeclaration, String importName, String importNameQualifier, String shortImportName) {
- // examples:
- // 'importName' is "java.util.Date"
- // or
- // 'importName' is "java.lang.annotation.ElementType.TYPE"
- String idn = importDeclaration.getName().getFullyQualifiedName();
- if (importName.equals(idn)) {
- // import java.util.Date; => "Date" will resolve to "java.util.Date"
- // import static java.lang.annotation.ElementType.TYPE; => "TYPE" will resolve to "java.lang.annotation.ElementType.TYPE"
- return Boolean.TRUE;
- }
-
- String shortIDN = idn.substring(idn.lastIndexOf('.') + 1);
- if (shortImportName.equals(shortIDN)) {
- // import java.sql.Date; => ambiguous resolution of "Date"
- // import static org.foo.Bar.TYPE; => ambiguous resolution of "TYPE"
- return Boolean.FALSE;
- }
-
- if (importDeclaration.isOnDemand()) {
- if (importNameQualifier.equals(idn)) {
- // import java.util.*; => "Date" will resolve to "java.util.Date"
- // import static java.lang.annotation.ElementType.*; => "TYPE" will resolve to "java.lang.annotation.ElementType.TYPE"
- return Boolean.TRUE;
- }
- if (importDeclaration.isStatic()) {
- if (this.enumResolves(idn, shortImportName)) {
- // import static org.foo.Bar.*; => ambiguous resolution of "TYPE"
- return Boolean.FALSE;
- }
- } else {
- if (this.typeResolves(idn + '.' + shortImportName)) {
- // import java.sql.*; => ambiguous resolution of "Date"
- return Boolean.FALSE;
- }
- }
- }
- // no matches - OK to add explicit import
- return null;
- }
-
- protected boolean enumResolves(String enumTypeName, String enumConstantName) {
- try {
- return this.enumResolves_(enumTypeName, enumConstantName);
- } catch (JavaModelException ex) {
- throw new RuntimeException(ex);
- }
- }
-
- protected boolean enumResolves_(String enumTypeName, String enumConstantName) throws JavaModelException {
- IType jdtType = this.findType_(enumTypeName);
- if (jdtType == null) {
- return false;
- }
- if ( ! jdtType.isEnum()) {
- return false;
- }
- for (IField jdtField : jdtType.getFields()) {
- if (jdtField.isEnumConstant() && jdtField.getElementName().equals(enumConstantName)) {
- return true;
- }
- }
- return false;
- }
-
- protected boolean typeResolves(String name) {
- return this.findType(name) != null;
- }
-
- protected IType findType(String name) {
- try {
- return this.findType_(name);
- } catch (JavaModelException ex) {
- throw new RuntimeException(ex);
- }
- }
-
- protected IType findType_(String name) throws JavaModelException {
- return this.getCompilationUnit().getJavaElement().getJavaProject().findType(name);
- }
-
- protected List<ImportDeclaration> getImports() {
- return this.imports(this.getCompilationUnit());
- }
-
- // minimize scope of suppressed warnings
- @SuppressWarnings("unchecked")
- protected List<ImportDeclaration> imports(CompilationUnit astRoot) {
- return astRoot.imports();
- }
-
-
- // ********** annotation name resolution **********
-
- public boolean annotationIsNamed(Annotation annotation, String name) {
- return this.getQualifiedName(annotation).equals(name);
- }
-
- /**
- * Simply return the annotation's unqualified name if we can't "resolve" it.
- */
- protected String getQualifiedName(Annotation annotation) {
- ITypeBinding typeBinding = annotation.resolveTypeBinding();
- if (typeBinding != null) {
- String resolvedName = typeBinding.getQualifiedName();
- if (resolvedName != null) {
- return resolvedName;
- }
- }
- // hack(?): check for a matching import because when moving a stand-alone
- // annotation to its container in CombinationIndexedDeclarationAnnotationAdapter
- // the container's import is added but then it won't "resolve" upon
- // subsequent lookups (because the parser hasn't had time to run?)... :-(
- return this.convertToFullClassName(annotation.getTypeName().getFullyQualifiedName());
- }
-
- /**
- * If necessary, use the declaration's imports to calculate a guess as to
- * the specified name's fully-qualified form.
- * Simply return the unqualified name if we can't "resolve" it.
- */
- protected String convertToFullClassName(String name) {
- // check for fully-qualified name
- return (name.lastIndexOf('.') != -1) ? name : this.resolveAgainstImports(name, false);
- }
-
- /**
- * If necessary, use the declaration's imports to calculate a guess as to
- * the specified name's fully-qualified form.
- * Simply return the unqualified name if we can't "resolve" it.
- */
- protected String convertToFullEnumConstantName(String name) {
- int index1 = name.indexOf('.');
- if (index1 == -1) {
- // short name, e.g. "TYPE"
- // true = look for static import of enum constant
- return this.resolveAgainstImports(name, true);
- }
-
- int index2 = name.indexOf('.', index1 + 1);
- if (index2 == -1) {
- // partially-qualified name, e.g. "ElementType.TYPE"
- // false = look regular import of enum class, not static import of enum constant
- return this.resolveAgainstImports(name, false);
- }
-
- // fully-qualified name, e.g. "java.lang.annotation.ElementType.TYPE"
- return name;
- }
-
- /**
- * Attempt to resolve the specified "short" name against the declaration's
- * imports. Return the name unchanged if we can't resolve it (perhaps it is
- * in the "default" package).
- */
- protected String resolveAgainstImports(String shortName, boolean static_) {
- for (ImportDeclaration importDeclaration : this.getImports()) {
- if (importDeclaration.isStatic() == static_) {
- String resolvedName = this.resolveAgainstImport(importDeclaration, shortName);
- if (resolvedName != null) {
- return resolvedName;
- }
- }
- }
- return shortName; // "default" package or unknown
- }
-
- /**
- * Attempt to resolve the specified "short" name against the specified
- * import. Return the resolved name if the import resolves it; otherwise
- * return null.
- */
- protected String resolveAgainstImport(ImportDeclaration importDeclaration, String shortName) {
- String idn = importDeclaration.getName().getFullyQualifiedName();
- if (importDeclaration.isOnDemand()) {
- String candidate = idn + '.' + shortName;
- if (importDeclaration.isStatic()) {
- if (this.enumResolves(idn, shortName)) {
- return candidate;
- }
- } else {
- if (this.typeResolves(candidate)) {
- return candidate;
- }
- }
- // no match
- return null;
- }
-
- // explicit import - see whether its end matches 'shortName'
- int period = idn.length() - shortName.length() - 1;
- if (period < 1) {
- // something must precede period
- return null;
- }
- if ((idn.charAt(period) == '.') && idn.endsWith(shortName)) {
- return idn; // probable exact match
- }
- return null;
- }
-
-
- // ********** miscellaneous methods **********
-
- public ASTNode getDeclaration() {
- return this.adapter.getDeclaration();
- }
-
- /**
- * Return the declaration's list of modifiers.
- * Element type: org.eclipse.jdt.core.dom.IExtendedModifier
- */
- protected List<IExtendedModifier> getModifiers() {
- return this.adapter.getModifiers();
- }
-
- public AST getAst() {
- return this.getDeclaration().getAST();
- }
-
- protected CompilationUnit getCompilationUnit() {
- return (CompilationUnit) this.getDeclaration().getRoot();
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.adapter.toString());
- }
-
-
- // ********** declaration adapter interface and implementations **********
-
- /**
- * Define common protocol among the various "declarations".
- */
- public interface Adapter {
-
- /**
- * Return the adapted "declaration".
- */
- ASTNode getDeclaration();
-
- /**
- * Return the "declaration"'s list of modifiers.
- * Element type: org.eclipse.jdt.core.dom.IExtendedModifier
- */
- List<IExtendedModifier> getModifiers();
-
- }
-
- public static class BodyDeclarationAdapter implements Adapter {
- private final BodyDeclaration declaration;
- public BodyDeclarationAdapter(BodyDeclaration declaration) {
- super();
- this.declaration = declaration;
- }
- public ASTNode getDeclaration() {
- return this.declaration;
- }
- @SuppressWarnings("unchecked")
- public List<IExtendedModifier> getModifiers() {
- return this.declaration.modifiers();
- }
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.declaration.toString());
- }
- }
-
- public static class SingleVariableDeclarationAdapter implements Adapter {
- private final SingleVariableDeclaration declaration;
- public SingleVariableDeclarationAdapter(SingleVariableDeclaration declaration) {
- super();
- this.declaration = declaration;
- }
- public ASTNode getDeclaration() {
- return this.declaration;
- }
- @SuppressWarnings("unchecked")
- public List<IExtendedModifier> getModifiers() {
- return this.declaration.modifiers();
- }
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.declaration.toString());
- }
- }
-
- public static class VariableDeclarationExpressionAdapter implements Adapter {
- private final VariableDeclarationExpression declaration;
- public VariableDeclarationExpressionAdapter(VariableDeclarationExpression declaration) {
- super();
- this.declaration = declaration;
- }
- public ASTNode getDeclaration() {
- return this.declaration;
- }
- @SuppressWarnings("unchecked")
- public List<IExtendedModifier> getModifiers() {
- return this.declaration.modifiers();
- }
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.declaration.toString());
- }
- }
-
- public static class VariableDeclarationStatementAdapter implements Adapter {
- private final VariableDeclarationStatement declaration;
- public VariableDeclarationStatementAdapter(VariableDeclarationStatement declaration) {
- super();
- this.declaration = declaration;
- }
- public ASTNode getDeclaration() {
- return this.declaration;
- }
- @SuppressWarnings("unchecked")
- public List<IExtendedModifier> getModifiers() {
- return this.declaration.modifiers();
- }
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.declaration.toString());
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTTools.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTTools.java
deleted file mode 100644
index a7f93390f9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTTools.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import java.util.HashSet;
-import java.util.List;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.ASTParser;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jdt.core.dom.IAnnotationBinding;
-import org.eclipse.jdt.core.dom.IBinding;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jdt.core.dom.IVariableBinding;
-import org.eclipse.jdt.core.dom.MethodDeclaration;
-import org.eclipse.jdt.core.dom.Name;
-import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.jdt.core.dom.TypeLiteral;
-import org.eclipse.jpt.utility.JavaType;
-import org.eclipse.jpt.utility.MethodSignature;
-import org.eclipse.jpt.utility.internal.SimpleJavaType;
-import org.eclipse.jpt.utility.internal.SimpleMethodSignature;
-
-/**
- * Convenience methods for dealing with JDT objects.
- */
-public class JDTTools {
-
- /**
- * Build an AST for the specified compilation unit with its bindings
- * resolved (and the resultant performance hit).
- */
- public static CompilationUnit buildASTRoot(ICompilationUnit compilationUnit) {
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setSource(compilationUnit);
-// TODO
-// parser.setFocalPosition(0);
- parser.setResolveBindings(true);
- parser.setBindingsRecovery(true); // see bugs 196200, 222735
- return (CompilationUnit) parser.createAST(null);
- }
-
-
- // ********** JDT DOM **********
-
- public static String resolveEnum(Expression expression) {
- if (expression == null) {
- return null;
- }
- switch (expression.getNodeType()) {
- case ASTNode.QUALIFIED_NAME:
- case ASTNode.SIMPLE_NAME:
- return resolveEnum((Name) expression);
- default:
- return null;
- }
- }
-
- public static String resolveEnum(Name enumExpression) {
- IBinding binding = enumExpression.resolveBinding();
- if (binding == null) {
- return null; // TODO figure out why this is null sometimes
- }
- if (binding.getKind() != IBinding.VARIABLE) {
- return null;
- }
- IVariableBinding variableBinding = (IVariableBinding) binding;
- return variableBinding.getType().getQualifiedName() + '.' + variableBinding.getName();
- }
-
- /**
- * Return the fully-qualified name of the specified node's annotation
- * class.
- */
- public static String resolveAnnotation(Annotation node) {
- IAnnotationBinding annotationBinding = node.resolveAnnotationBinding();
- if (annotationBinding == null) {
- return null;
- }
- ITypeBinding annotationTypeBinding = annotationBinding.getAnnotationType();
- return (annotationTypeBinding == null) ? null : annotationTypeBinding.getQualifiedName();
- }
-
- /**
- * If the specified expression is a type literal, return the type's fully-
- * qualified name. Return null otherwise.
- */
- public static String resolveFullyQualifiedName(Expression expression) {
- ITypeBinding resolvedTypeBinding = resolveTypeBinding(expression);
- return (resolvedTypeBinding == null) ? null : resolvedTypeBinding.getQualifiedName();
- }
-
- /**
- * If the specified expression is a type literal, return the corresponding
- * type binding.
- */
- public static ITypeBinding resolveTypeBinding(Expression expression) {
- if (expression.getNodeType() == ASTNode.TYPE_LITERAL) {
- return ((TypeLiteral) expression).getType().resolveBinding();
- }
- return null;
- }
-
- public static MethodSignature buildMethodSignature(MethodDeclaration methodDeclaration) {
- return new SimpleMethodSignature(
- methodDeclaration.getName().getFullyQualifiedName(),
- buildParameterTypes(methodDeclaration)
- );
- }
-
- public static JavaType[] buildParameterTypes(MethodDeclaration methodDeclaration) {
- List<SingleVariableDeclaration> parameters = parameters(methodDeclaration);
- int len = parameters.size();
- JavaType[] parameterTypes = new JavaType[len];
- for (int i = 0; i < len; i++) {
- ITypeBinding type = parameters.get(i).getType().resolveBinding();
- parameterTypes[i] = new SimpleJavaType(type.getQualifiedName(), type.getDimensions());
- }
- return parameterTypes;
- }
-
- // minimize scope of suppressed warnings
- @SuppressWarnings("unchecked")
- private static List<SingleVariableDeclaration> parameters(MethodDeclaration methodDeclaration) {
- return methodDeclaration.parameters();
- }
-
- /**
- * Return whether the specified expression is a type literal and the type binding
- * corresponding to the specified type name exists in the type
- * literal's inheritance hierarchy (superclasses and interfaces).
- * Return null otherwise.
- */
- public static boolean typeIsSubTypeOf(Expression expression, String searchTypeName) {
- return findTypeInHierarchy(expression, searchTypeName) != null;
- }
-
- /**
- * If the specified expression is a type literal, return the type binding
- * corresponding to the specified type name if it exists in the type
- * literal's inheritance hierarchy (superclasses and interfaces).
- * Return null otherwise.
- */
- public static ITypeBinding findTypeInHierarchy(Expression expression, String searchTypeName) {
- ITypeBinding typeBinding = resolveTypeBinding(expression);
- return (typeBinding == null) ? null : findTypeInHierarchy(typeBinding, searchTypeName);
- }
-
- /**
- * Return whether a type binding with the specified type name exists in
- * the specified type binding's inheritance hierarchy (superclasses
- * and interfaces).
- */
- public static boolean typeIsSubTypeOf(ITypeBinding typeBinding, String searchTypeName) {
- return findTypeInHierarchy(typeBinding, searchTypeName) != null;
- }
-
- /**
- * Return the type binding corresponding to the specified type name if it
- * exists in the specified type binding's inheritance hierarchy (superclasses
- * and interfaces). Return null otherwise.
- */
- public static ITypeBinding findTypeInHierarchy(ITypeBinding typeBinding, String searchTypeName) {
- return findTypeInHierarchy(typeBinding, searchTypeName, new HashSet<String>());
- }
-
- private static ITypeBinding findTypeInHierarchy(ITypeBinding typeBinding, String searchTypeName, HashSet<String> visited) {
- String typeName = typeBinding.getQualifiedName();
- if (visited.contains(typeName)) {
- return null;
- }
- if (typeName.equals(searchTypeName)) {
- return typeBinding;
- }
- visited.add(typeName);
-
- ITypeBinding[] interfaceBindings = typeBinding.getInterfaces();
- for (ITypeBinding interfaceBinding : interfaceBindings) { // recurse up interfaces
- ITypeBinding result = findTypeInHierarchy(interfaceBinding, searchTypeName, visited);
- if (result != null) {
- return result;
- }
- }
-
- ITypeBinding superBinding = typeBinding.getSuperclass();
- if (superBinding != null) { // recurse up superclasses
- ITypeBinding result = findTypeInHierarchy(superBinding, searchTypeName, visited);
- if (result != null) {
- return result;
- }
- }
-
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTType.java
deleted file mode 100644
index 26de333d42..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTType.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import java.util.List;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.FieldDeclaration;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jdt.core.dom.MethodDeclaration;
-import org.eclipse.jdt.core.dom.TypeDeclaration;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationEditFormatter;
-import org.eclipse.jpt.core.utility.jdt.Type;
-import org.eclipse.jpt.utility.CommandExecutor;
-
-/**
- * Adapt and extend a JDT type.
- */
-public class JDTType
- extends JDTMember
- implements Type
-{
-
- /**
- * constructor for the compilation unit's primary type
- */
- public JDTType(
- TypeDeclaration typeDeclaration, // exclude annotations and enums
- ICompilationUnit compilationUnit,
- CommandExecutor modifySharedDocumentCommandExecutor) {
- this(typeDeclaration, compilationUnit, modifySharedDocumentCommandExecutor, DefaultAnnotationEditFormatter.instance());
- }
-
- /**
- * constructor for the compilation unit's primary type
- */
- public JDTType(
- TypeDeclaration typeDeclaration, // exclude annotations and enums
- ICompilationUnit compilationUnit,
- CommandExecutor modifySharedDocumentCommandExecutor,
- AnnotationEditFormatter annotationEditFormatter) {
- this(null, typeDeclaration, 1, compilationUnit, modifySharedDocumentCommandExecutor, annotationEditFormatter);
- }
-
- /**
- * constructor for nested types
- */
- public JDTType(
- Type declaringType,
- TypeDeclaration typeDeclaration, // exclude annotations and enums
- int occurrence,
- ICompilationUnit compilationUnit,
- CommandExecutor modifySharedDocumentCommandExecutor) {
- this(declaringType, typeDeclaration, occurrence, compilationUnit, modifySharedDocumentCommandExecutor, DefaultAnnotationEditFormatter.instance());
- }
-
- /**
- * constructor for nested types
- */
- public JDTType(
- Type declaringType,
- TypeDeclaration typeDeclaration, // exclude annotations and enums
- int occurrence,
- ICompilationUnit compilationUnit,
- CommandExecutor modifySharedDocumentCommandExecutor,
- AnnotationEditFormatter annotationEditFormatter) {
- super(declaringType, typeDeclaration.getName().getFullyQualifiedName(), occurrence, compilationUnit, modifySharedDocumentCommandExecutor, annotationEditFormatter);
- }
-
- /**
- * constructor for testing
- */
- public JDTType(Type declaringType, String name, int occurrence, ICompilationUnit compilationUnit) {
- super(declaringType, name, occurrence, compilationUnit, CommandExecutor.Default.instance(), DefaultAnnotationEditFormatter.instance());
- }
-
-
- // ********** Member/Type implementation **********
-
- public ITypeBinding getBinding(CompilationUnit astRoot) {
- TypeDeclaration td = this.getBodyDeclaration(astRoot);
- return (td == null) ? null : td.resolveBinding();
- }
-
- /**
- * find the type's body declaration in the specified AST
- */
- public TypeDeclaration getBodyDeclaration(CompilationUnit astRoot) {
- Type declaringType = this.getDeclaringType();
- return (declaringType == null) ?
- this.getTopLevelTypeDeclaration(astRoot)
- :
- this.getNestedTypeDeclaration(declaringType.getBodyDeclaration(astRoot));
- }
-
- public boolean isPersistable(CompilationUnit astRoot) {
- ITypeBinding binding = this.getBinding(astRoot);
- return (binding == null) ? false : JPTTools.typeIsPersistable(new JPTToolsAdapter(binding));
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return new ASTNodeTextRange(this.getBodyDeclaration(astRoot).getName());
- }
-
- public TypeDeclaration[] getTypes(CompilationUnit astRoot) {
- return this.getBodyDeclaration(astRoot).getTypes();
- }
-
- public FieldDeclaration[] getFields(CompilationUnit astRoot) {
- return this.getBodyDeclaration(astRoot).getFields();
- }
-
- public MethodDeclaration[] getMethods(CompilationUnit astRoot) {
- return this.getBodyDeclaration(astRoot).getMethods();
- }
-
-
- // ********** internal **********
-
- /**
- * return the first top-level type in the specified AST with a matching name
- */
- protected TypeDeclaration getTopLevelTypeDeclaration(CompilationUnit astRoot) {
- return this.getTypeDeclaration(types(astRoot));
- }
-
- protected TypeDeclaration getTypeDeclaration(List<AbstractTypeDeclaration> typeDeclarations) {
- return this.getTypeDeclaration(typeDeclarations.toArray(new AbstractTypeDeclaration[typeDeclarations.size()]));
- }
-
- /**
- * return the nested type with a matching name and occurrence
- */
- protected TypeDeclaration getNestedTypeDeclaration(TypeDeclaration declaringTypeDeclaration) {
- return this.getTypeDeclaration(declaringTypeDeclaration.getTypes());
- }
-
- /**
- * return the type declaration corresponding to the type from the specified
- * set of type declarations (match name and occurrence)
- */
- protected TypeDeclaration getTypeDeclaration(AbstractTypeDeclaration[] typeDeclarations) {
- String name = this.getName_();
- int occurrence = this.getOccurrence();
- int count = 0;
- for (AbstractTypeDeclaration typeDeclaration : typeDeclarations) {
- if (typeDeclaration.getName().getFullyQualifiedName().equals(name)) {
- count++;
- if (count == occurrence) {
- return (typeDeclaration.getNodeType() == ASTNode.TYPE_DECLARATION) ? (TypeDeclaration) typeDeclaration : null;
- }
- }
- }
- // return null if the type is no longer in the source code;
- // this can happen when the context model has not yet
- // been synchronized with the resource model but is still
- // asking for an ASTNode (e.g. during a selection event)
- return null;
- }
-
- /**
- * we only instantiate a single top-level, non-enum, non-annotation
- * type per compilation unit (i.e. a class or interface); and, since
- * enums and annotations can only be top-level types (i.e. they cannot
- * be nested within another type) we will always have TypeDeclarations
- * in the CompilationUnit
- */
- // minimize scope of suppressed warnings
- @SuppressWarnings("unchecked")
- protected static List<AbstractTypeDeclaration> types(CompilationUnit astRoot) {
- return astRoot.types();
- }
-
-
- // ********** JPT tools adapter **********
-
- protected static class JPTToolsAdapter implements JPTTools.TypeAdapter {
- private final ITypeBinding typeBinding;
- protected JPTToolsAdapter(ITypeBinding typeBinding) {
- super();
- if (typeBinding == null) {
- throw new NullPointerException();
- }
- this.typeBinding = typeBinding;
- }
-
- public int getModifiers() {
- return this.typeBinding.getModifiers();
- }
-
- public boolean isAnnotation() {
- return this.typeBinding.isAnnotation();
- }
-
- public boolean isAnonymous() {
- return this.typeBinding.isAnonymous();
- }
-
- public boolean isArray() {
- return this.typeBinding.isArray();
- }
-
- public boolean isEnum() {
- return this.typeBinding.isEnum();
- }
-
- public boolean isInterface() {
- return this.typeBinding.isInterface();
- }
-
- public boolean isLocal() {
- return this.typeBinding.isLocal();
- }
-
- public boolean isMember() {
- return this.typeBinding.isMember();
- }
-
- public boolean isPrimitive() {
- return this.typeBinding.isPrimitive();
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JPTTools.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JPTTools.java
deleted file mode 100644
index 4ab0e88d3d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JPTTools.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import java.lang.reflect.Modifier;
-import java.util.Iterator;
-import org.eclipse.jpt.core.resource.java.AccessType;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-
-/**
- * Convenience methods for JPA-related queries concerning JDT objects.
- */
-public class JPTTools {
-
- // ********** type **********
-
- /**
- * Return whether the specified type can be "persisted", i.e. marked as
- * Entity, MappedSuperclass, Embeddable
- */
- // TODO check for no-arg constructor (or should that just be validation?)
- // TODO move other checks to validation (e.g. 'final', 'static')?
- public static boolean typeIsPersistable(TypeAdapter typeAdapter) {
- if (typeAdapter.isInterface()) {
- return false;
- }
- if (typeAdapter.isAnnotation()) {
- return false;
- }
- if (typeAdapter.isEnum()) {
- return false;
- }
- if (typeAdapter.isLocal()) {
- return false;
- }
- if (typeAdapter.isAnonymous()) {
- return false;
- }
- if (typeAdapter.isPrimitive()) {
- return false; // should never get here(?)
- }
- if (typeAdapter.isArray()) {
- return false; // should never get here(?)
- }
- int modifiers = typeAdapter.getModifiers();
- if (Modifier.isFinal(modifiers)) {
- return false;
- }
- if (typeAdapter.isMember()) {
- if ( ! Modifier.isStatic(modifiers)) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Queries needed to calculate whether a type is "persistable".
- * Adapted to ITypeBinding and IType.
- */
- public interface TypeAdapter {
- int getModifiers();
- boolean isAnnotation();
- boolean isAnonymous();
- boolean isArray();
- boolean isEnum();
- boolean isInterface();
- boolean isLocal();
- boolean isMember();
- boolean isPrimitive();
- }
-
-
- // ********** field **********
-
- /**
- * Return whether the specified field may be "persisted".
- * According to the spec, "All non-transient instance variables that are not
- * annotated with the Transient annotation are persistent."
- */
- public static boolean fieldIsPersistable(FieldAdapter fieldAdapter) {
- int modifiers = fieldAdapter.getModifiers();
- if (Modifier.isStatic(modifiers)) {
- return false;
- }
- if (Modifier.isTransient(modifiers)) {
- return false;
- }
- return true;
- }
-
- /**
- * Queries needed to calculate whether a field is "persistable".
- * Adapted to IVariableBinding and IField.
- */
- public interface FieldAdapter {
- /**
- * Return the field's modifiers. We use these to check whether the
- * field is static or transient.
- */
- int getModifiers();
- }
-
-
- // ********** method **********
-
- /**
- * Return whether the specified method is a "getter" method that
- * represents a property that may be "persisted".
- */
- public static boolean methodIsPersistablePropertyGetter(MethodAdapter methodAdapter) {
- if (methodHasInvalidModifiers(methodAdapter)) {
- return false;
- }
- if (methodAdapter.isConstructor()) {
- return false;
- }
-
- String returnTypeName = methodAdapter.getReturnTypeErasureName();
- if (returnTypeName == null) {
- return false; // DOM method bindings can have a null name
- }
- if (returnTypeName.equals("void")) { //$NON-NLS-1$
- return false;
- }
- if (methodHasParameters(methodAdapter)) {
- return false;
- }
-
- String name = methodAdapter.getName();
- int beginIndex = 0;
- boolean booleanGetter = false;
- if (name.startsWith("is")) { //$NON-NLS-1$
- if (returnTypeName.equals("boolean")) { //$NON-NLS-1$
- beginIndex = 2;
- } else {
- return false;
- }
- } else if (name.startsWith("get")) { //$NON-NLS-1$
- beginIndex = 3;
- if (returnTypeName.equals("boolean")) { //$NON-NLS-1$
- booleanGetter = true;
- }
- } else {
- return false;
- }
-
- String capitalizedAttributeName = name.substring(beginIndex);
- // 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(methodAdapter, capitalizedAttributeName)) {
- return false; // since the type also defines #isProperty(), ignore #getProperty()
- }
- return methodHasValidSiblingSetMethod(methodAdapter, capitalizedAttributeName, returnTypeName);
- }
-
- /**
- * Return whether the method's modifiers prevent it
- * from being a getter or setter for a "persistent" property.
- */
- private static boolean methodHasInvalidModifiers(SimpleMethodAdapter methodAdapter) {
- int modifiers = methodAdapter.getModifiers();
- if (Modifier.isStatic(modifiers)) {
- return true;
- }
- if (Modifier.isFinal(modifiers)) {
- return true;
- }
- if ( ! (Modifier.isPublic(modifiers) || Modifier.isProtected(modifiers))) {
- return true;
- }
- return false;
- }
-
- private static boolean methodHasParameters(MethodAdapter methodAdapter) {
- return methodAdapter.getParametersLength() != 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(MethodAdapter methodAdapter, String capitalizedAttributeName) {
- SimpleMethodAdapter isMethodAdapter = methodAdapter.getSibling("is" + capitalizedAttributeName); //$NON-NLS-1$
- return methodIsValidSibling(isMethodAdapter, "boolean"); //$NON-NLS-1$
- }
-
- /**
- * Return whether the method has a sibling "set" method
- * and that method is valid for a "persistable" property.
- */
- private static boolean methodHasValidSiblingSetMethod(MethodAdapter methodAdapter, String capitalizedAttributeName, String parameterTypeErasureName) {
- SimpleMethodAdapter setMethodAdapter = methodAdapter.getSibling("set" + capitalizedAttributeName, parameterTypeErasureName); //$NON-NLS-1$
- return methodIsValidSibling(setMethodAdapter, "void"); //$NON-NLS-1$
- }
-
- /**
- * Return whether the specified method is a valid sibling with the
- * specified return type.
- */
- private static boolean methodIsValidSibling(SimpleMethodAdapter methodAdapter, String returnTypeName) {
- if (methodAdapter == null) {
- return false;
- }
- if (methodHasInvalidModifiers(methodAdapter)) {
- return false;
- }
- if (methodAdapter.isConstructor()) {
- return false;
- }
- String rtName = methodAdapter.getReturnTypeErasureName();
- if (rtName == null) {
- return false; // DOM method bindings can have a null name
- }
- return rtName.equals(returnTypeName);
- }
-
- /**
- * Queries needed to calculate whether a method is "persistable".
- * Adapted to IMethodBinding and IMethod.
- */
- public interface SimpleMethodAdapter {
- /**
- * Return the method's modifiers.
- * We use these to check whether the method is static, final, etc.
- */
- int getModifiers();
-
- /**
- * Return the name of the method's return type erasure.
- * We use this to check for
- * - boolean getters
- * - void return types
- * - matching getters and setters
- */
- String getReturnTypeErasureName();
-
- /**
- * Return whether the method is a constructor.
- */
- boolean isConstructor();
- }
-
- /**
- * Queries needed to calculate whether a method is "persistable".
- * Adapted to IMethodBinding and IMethod.
- */
- public interface MethodAdapter extends SimpleMethodAdapter {
- /**
- * Return the method's name.
- * We use this to determine
- * - whether the method is a "getter"
- * - the property name implied by the getter's name
- */
- String getName();
-
- /**
- * Return the number of paramters declared by the method.
- * We use this to determine whether the method is a "getter".
- */
- int getParametersLength();
-
- /**
- * Return the method's "sibling" with the specified name and no parameters.
- * We use this to find an "is" boolean getter that would take precedence
- * over a "get" boolean getter.
- */
- SimpleMethodAdapter getSibling(String name);
-
- /**
- * Return the method's "sibling" with the specified name and single parameter.
- * We use this to find a matching "setter" for a possible "getter".
- */
- SimpleMethodAdapter getSibling(String name, String parameterTypeErasureName);
- }
-
-
- // ********** Access type **********
-
- /**
- * Return the AccessType currently implied by the Java source code
- * or class file:
- * - if only Fields are annotated => FIELD
- * - if only Properties are annotated => PROPERTY
- * - if both Fields and Properties are annotated => FIELD
- * - if nothing is annotated
- * - and fields exist => FIELD
- * - and properties exist, but no fields exist => PROPERTY
- * - and neither fields nor properties exist => null at this level (FIELD in the context model)
- */
- public static AccessType buildAccess(JavaResourcePersistentType jrpType) {
- boolean hasPersistableFields = false;
- for (Iterator<JavaResourcePersistentAttribute> stream = jrpType.persistableFields(); stream.hasNext(); ) {
- hasPersistableFields = true;
- if (stream.next().isAnnotated()) {
- // any field is annotated => FIELD
- return AccessType.FIELD;
- }
- }
-
- boolean hasPersistableProperties = false;
- for (Iterator<JavaResourcePersistentAttribute> stream = jrpType.persistableProperties(); stream.hasNext(); ) {
- hasPersistableProperties = true;
- if (stream.next().isAnnotated()) {
- // none of the fields are annotated and a getter is annotated => PROPERTY
- return AccessType.PROPERTY;
- }
- }
-
- if (hasPersistableProperties && ! hasPersistableFields) {
- return AccessType.PROPERTY;
- }
-
- // if no annotations exist, access is null at the resource model level
- return null;
- }
-
-
- // ********** suppressed constructor **********
-
- /**
- * Suppress default constructor, ensuring non-instantiability.
- */
- private JPTTools() {
- super();
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/MemberAnnotationAdapter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/MemberAnnotationAdapter.java
deleted file mode 100644
index 5b92fa57d8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/MemberAnnotationAdapter.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * Adapt a member and a declaration annotation adapter.
- */
-public class MemberAnnotationAdapter extends AbstractAnnotationAdapter {
-
-
- // ********** constructor **********
-
- public MemberAnnotationAdapter(Member member, DeclarationAnnotationAdapter daa) {
- super(member, daa);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/MemberAnnotationElementAdapter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/MemberAnnotationElementAdapter.java
deleted file mode 100644
index 89f854f2e5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/MemberAnnotationElementAdapter.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
-import org.eclipse.jpt.utility.internal.StringTools;
-
- /**
- * Adapt a member and a declaration annotation element adapter.
- */
-public class MemberAnnotationElementAdapter<T>
- implements AnnotationElementAdapter<T>
-{
- private final Member member;
- private final DeclarationAnnotationElementAdapter<T> daea;
-
-
- // ********** constructor **********
-
- public MemberAnnotationElementAdapter(Member member, DeclarationAnnotationElementAdapter<T> daea) {
- super();
- this.member = member;
- this.daea = daea;
- }
-
-
- // ********** AnnotationElementAdapter implementation **********
-
- public T getValue() {
- return this.daea.getValue(this.member.getModifiedDeclaration());
- }
-
- public T getValue(CompilationUnit astRoot) {
- return this.daea.getValue(this.member.getModifiedDeclaration(astRoot));
- }
-
- public void setValue(T value) {
- this.edit(this.buildSetValueEditor(value));
- }
-
- public Expression getExpression(CompilationUnit astRoot) {
- return this.daea.getExpression(this.member.getModifiedDeclaration(astRoot));
- }
-
- public ASTNode getAstNode(CompilationUnit astRoot) {
- return this.daea.getAstNode(this.member.getModifiedDeclaration(astRoot));
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.daea);
- }
-
-
- // ********** internal methods **********
-
- protected void edit(Member.Editor editor) {
- this.member.edit(editor);
- }
-
- protected Member.Editor buildSetValueEditor(T value) {
- return new SetValueEditor<T>(value, this.daea);
- }
-
-
- // ********** member classes **********
-
- protected static class SetValueEditor<T> implements Member.Editor {
- private final DeclarationAnnotationElementAdapter<T> daea;
- private final T value;
-
- SetValueEditor(T value, DeclarationAnnotationElementAdapter<T> daea) {
- super();
- this.value = value;
- this.daea = daea;
- }
- public void edit(ModifiedDeclaration declaration) {
- this.daea.setValue(this.value, declaration);
- }
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this);
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/MemberIndexedAnnotationAdapter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/MemberIndexedAnnotationAdapter.java
deleted file mode 100644
index aceeb48616..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/MemberIndexedAnnotationAdapter.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- * Adapt a member and an indexed declaration annotation adapter.
- */
-public class MemberIndexedAnnotationAdapter
- extends AbstractAnnotationAdapter
- implements IndexedAnnotationAdapter
-{
- private final IndexedDeclarationAnnotationAdapter idaa;
-
-
- // ********** constructor **********
-
- public MemberIndexedAnnotationAdapter(Member member, IndexedDeclarationAnnotationAdapter idaa) {
- super(member, idaa);
- this.idaa = idaa;
- }
-
-
- // ********** IndexedAnnotationAdapter implementation **********
-
- public int getIndex() {
- return this.idaa.getIndex();
- }
-
- public void moveAnnotation(int newIndex) {
- this.edit(this.buildMoveAnnotationEditor(newIndex));
- }
-
-
- // ********** factory methods **********
-
- protected Member.Editor buildMoveAnnotationEditor(int newIndex) {
- return new MoveAnnotationEditor(this.idaa, newIndex);
- }
-
-
- // ********** member classes **********
-
- protected static class MoveAnnotationEditor implements Member.Editor {
- private final IndexedDeclarationAnnotationAdapter idaa;
- private int index;
-
- MoveAnnotationEditor(IndexedDeclarationAnnotationAdapter idaa, int index) {
- super();
- this.idaa = idaa;
- this.index = index;
- }
- public void edit(ModifiedDeclaration declaration) {
- this.idaa.moveAnnotation(this.index, declaration);
- }
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this);
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NameStringExpressionConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NameStringExpressionConverter.java
deleted file mode 100644
index 56fd65a386..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NameStringExpressionConverter.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jdt.core.dom.Name;
-import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
-
-/**
- * Convert a name to/from a string representation of a name/identifier
- * (e.g. "com.xxx.Foo.VALUE1" or "value").
- */
-public final class NameStringExpressionConverter
- extends AbstractExpressionConverter<String>
-{
- private static final ExpressionConverter<String> INSTANCE = new NameStringExpressionConverter();
-
- /**
- * Return the singleton.
- */
- public static ExpressionConverter<String> instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private NameStringExpressionConverter() {
- super();
- }
-
- @Override
- protected Name convertObject(String string, AST ast) {
- return ast.newName(string);
- }
-
- @Override
- protected String convertExpression(Expression expression) {
- switch (expression.getNodeType()) {
- case ASTNode.QUALIFIED_NAME:
- case ASTNode.SIMPLE_NAME:
- return ((Name) expression).getFullyQualifiedName();
- default:
- return null;
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NestedDeclarationAnnotationAdapter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NestedDeclarationAnnotationAdapter.java
deleted file mode 100644
index 2b991a7c2e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NestedDeclarationAnnotationAdapter.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jdt.core.dom.MemberValuePair;
-import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
-
-/**
- * Manipulate an annotation that is embedded as an element within
- * another annotation, e.g.
- * <pre>
- * &#64;Outer(foo=&#64;Inner)
- * private int id;
- * outerAnnotationAdapter = AnnotationAdapter<&#64;Outer>
- * elementName = "foo"
- * annotationName = "Inner"
- * </pre>
- */
-public class NestedDeclarationAnnotationAdapter extends AbstractNestedDeclarationAnnotationAdapter {
-
-
- // ********** constructors **********
-
- /**
- * default element name is "value";
- * default behavior is to remove the outer annotation when it is empty
- */
- public NestedDeclarationAnnotationAdapter(DeclarationAnnotationAdapter outerAnnotationAdapter, String annotationName) {
- super(outerAnnotationAdapter, annotationName);
- }
-
- /**
- * default behavior is to remove the outer annotation when it is empty
- */
- public NestedDeclarationAnnotationAdapter(DeclarationAnnotationAdapter outerAnnotationAdapter, String elementName, String annotationName) {
- super(outerAnnotationAdapter, elementName, annotationName);
- }
-
- public NestedDeclarationAnnotationAdapter(DeclarationAnnotationAdapter outerAnnotationAdapter, String elementName, String annotationName, boolean removeOuterAnnotationWhenEmpty) {
- super(outerAnnotationAdapter, elementName, annotationName, removeOuterAnnotationWhenEmpty);
- }
-
-
- // ********** AbstractNestedDeclarationAnnotationAdapter implementation **********
-
- @Override
- protected Annotation getAnnotation(Expression value) {
- return this.annotationValue(value);
- }
-
- @Override
- protected Expression buildNewInnerExpression(Annotation inner) {
- return inner;
- }
-
- /**
- * the annotation is the expression itself, so the annotation cannot be
- * "removed" from itself - return 'false'
- */
- @Override
- protected boolean removeAnnotation(ModifiedDeclaration declaration, Annotation outer, Expression value) {
- return false;
- }
-
- /**
- * <pre>
- * &#64;Outer("lorem ipsum") => &#64;Outer(&#64;Inner)
- * </pre>
- */
- @Override
- protected void modifyAnnotationValue(SingleMemberAnnotation outer, Annotation inner) {
- // replace(?) the current element value
- outer.setValue(inner);
- }
-
- /**
- * Simply set the pair's value.
- */
- @Override
- protected void modifyMemberValuePair(MemberValuePair pair, Annotation inner) {
- pair.setValue(inner);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NestedIndexedDeclarationAnnotationAdapter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NestedIndexedDeclarationAnnotationAdapter.java
deleted file mode 100644
index 8f39485e0e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NestedIndexedDeclarationAnnotationAdapter.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.ArrayInitializer;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jdt.core.dom.MemberValuePair;
-import org.eclipse.jdt.core.dom.NormalAnnotation;
-import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
-
-/**
- * Manipulate an annotation that is embedded in an element array within
- * another annotation, e.g.
- * <pre>
- * &#64;Outer(foo={&#64;Inner("zero"), &#64;Inner("one"), &#64;Inner("two")})
- * private int id;
- * outerAnnotationAdapter = AnnotationAdapter<&#64;Outer>
- * elementName = "foo"
- * index = 0-2
- * annotationName = "Inner"
- * </pre>
- */
-public class NestedIndexedDeclarationAnnotationAdapter
- extends AbstractNestedDeclarationAnnotationAdapter
- implements IndexedDeclarationAnnotationAdapter
-{
- private int index;
-
-
- // ********** constructors **********
-
- /**
- * default element name is "value";
- * default behavior is to remove the outer annotation when it is empty
- */
- public NestedIndexedDeclarationAnnotationAdapter(DeclarationAnnotationAdapter annotationAdapter, int index, String annotationName) {
- super(annotationAdapter, annotationName);
- this.index = index;
- }
-
- /**
- * default behavior is to remove the outer annotation when it is empty
- */
- public NestedIndexedDeclarationAnnotationAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, int index, String annotationName) {
- super(annotationAdapter, elementName, annotationName);
- this.index = index;
- }
-
- public NestedIndexedDeclarationAnnotationAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, int index, String annotationName, boolean removeOuterAnnotationWhenEmpty) {
- super(annotationAdapter, elementName, annotationName, removeOuterAnnotationWhenEmpty);
- this.index = index;
- }
-
-
- // ********** AbstractNestedDeclarationAnnotationAdapter implementation **********
-
- @Override
- protected Annotation getAnnotation(Expression value) {
- if (value.getNodeType() == ASTNode.ARRAY_INITIALIZER) {
- return this.annotation((ArrayInitializer) value);
- }
- return (this.index == 0) ? this.annotationValue(value) : null;
- }
-
- @Override
- protected Expression buildNewInnerExpression(Annotation inner) {
- return (this.index == 0) ? inner : (Expression) this.buildNewInnerArrayInitializer(inner);
- }
-
- @Override
- protected boolean removeAnnotation(ModifiedDeclaration declaration, Annotation outer, Expression value) {
- if (value.getNodeType() == ASTNode.ARRAY_INITIALIZER) {
- this.removeAnnotation(declaration, outer, (ArrayInitializer) value);
- return true;
- }
- // if our index is greater than zero, but we don't have an array,
- // then the annotation must already be gone
- return (this.index != 0);
- }
-
- /**
- * <pre>
- * &#64;Outer({&#64;Inner(0), &#64;Inner(1)}) => &#64;Outer({&#64;Inner(0), &#64;Inner(1), &#64;Inner(2)})
- * or
- * &#64;Outer("lorem ipsum") => &#64;Outer(&#64;Inner(0))
- * or
- * &#64;Outer(&#64;Inner(0)) => &#64;Outer({&#64;Inner(0), &#64;Inner(1)})
- * </pre>
- */
- @Override
- protected void modifyAnnotationValue(SingleMemberAnnotation outer, Annotation inner) {
- this.modifyExpression(outer, SINGLE_MEMBER_ANNOTATION_EXPRESSION_PROVIDER, inner);
- }
-
- /**
- * <pre>
- * &#64;Outer(text="lorem ipsum") => &#64;Outer(text="lorem ipsum", foo=&#64;Inner(0))
- * or
- * &#64;Outer(foo={&#64;Inner(0), &#64;Inner(1)}) => &#64;Outer(foo={&#64;Inner(0), &#64;Inner(1), &#64;Inner(2)})
- * or
- * &#64;Outer(foo="lorem ipsum") => &#64;Outer(foo=&#64;Inner(0))
- * or
- * &#64;Outer(foo=&#64;NotInner) => &#64;Outer(foo=&#64;Inner(0))
- * or
- * &#64;Outer(foo=&#64;Inner(0)) => &#64;Outer(foo={&#64;Inner(0), &#64;Inner(1)})
- * </pre>
- */
- @Override
- protected void modifyMemberValuePair(MemberValuePair pair, Annotation inner) {
- this.modifyExpression(pair, MEMBER_VALUE_PAIR_EXPRESSION_PROVIDER, inner);
- }
-
-
- // ********** IndexedDeclarationAnnotationAdapter implementation **********
-
- public int getIndex() {
- return this.index;
- }
-
- /**
- * Move the annotation to the specified index, leaving its original
- * position cleared out.
- */
- public void moveAnnotation(int newIndex, ModifiedDeclaration declaration) {
- int oldIndex = this.index;
- if (newIndex == oldIndex) {
- return;
- }
-
- Annotation original = this.getAnnotation(declaration);
- if (original == null) {
- this.index = newIndex;
- this.removeAnnotation(declaration); // clear out the new location (?)
- } else {
- Annotation copy = (Annotation) ASTNode.copySubtree(original.getAST(), original);
- this.index = newIndex;
- this.addAnnotation(declaration, copy); // install the copy in the new location
- this.index = oldIndex;
- this.removeAnnotation(declaration); // go back and clear out the original location (AFTER the move)
- this.index = newIndex;
- }
- }
-
-
- // ********** internal methods **********
-
- /**
- * Return the adapter's annotation from the specified array initializer.
- */
- private Annotation annotation(ArrayInitializer value) {
- List<Expression> expressions = this.expressions(value);
- return (this.index >= expressions.size()) ? null : this.annotationValue(expressions.get(this.index));
- }
-
- /**
- * Build a new array initializer to hold the specified annotation,
- * padding it with 'null' literals as necessary
- */
- private ArrayInitializer buildNewInnerArrayInitializer(Annotation inner) {
- ArrayInitializer ai = inner.getAST().newArrayInitializer();
- this.addInnerToExpressions(inner, this.expressions(ai));
- return ai;
- }
-
- /**
- * Add the specified annotation to the specified array initializer,
- * padding it with 'null' literals as necessary
- */
- private void addInnerToExpressions(Annotation inner, List<Expression> expressions) {
- if (expressions.size() > this.index) {
- throw new IllegalStateException("expressions size is greater than index - size: " + expressions.size() + " - index: " + this.index); //$NON-NLS-1$ //$NON-NLS-2$
- }
- while (expressions.size() < this.index) {
- expressions.add(inner.getAST().newNullLiteral());
- }
- expressions.add(inner);
- }
-
- /**
- * Remove the adapter's annotation from the specified array initializer.
- */
- private void removeAnnotation(ModifiedDeclaration declaration, Annotation outer, ArrayInitializer value) {
- List<Expression> expressions = this.expressions(value);
- if (this.index >= expressions.size()) {
- return; // avoid IndexOutOfBoundsException(?)
- }
- Annotation inner = this.annotationValue(expressions.get(this.index));
- if (inner == null) {
- return;
- }
- if ( ! this.nameMatches(declaration, inner)) {
- return;
- }
- if (this.index == (expressions.size() - 1)) {
- expressions.remove(this.index);
- } else {
- expressions.set(this.index, value.getAST().newNullLiteral());
- }
- this.trimExpressions(declaration, outer, expressions);
- }
-
- /**
- * Strip all the null literals off the end of the specified list of expressions
- * and normalize the specified outer annotation.
- */
- private void trimExpressions(ModifiedDeclaration declaration, Annotation outer, List<Expression> expressions) {
- // start at the end of the list
- for (int i = expressions.size(); i-- > 0; ) {
- if (expressions.get(i).getNodeType() == ASTNode.NULL_LITERAL) {
- expressions.remove(i);
- } else {
- break; // stop with the first non-null literal encountered
- }
- }
- switch (expressions.size()) {
- case 0:
- this.removeElementAndNormalize(declaration, outer);
- break;
- case 1:
- this.convertArrayToLastRemainingExpression(outer, expressions.get(0));
- break;
- default:
- break;
- }
- }
-
- /**
- * When there is only a single element in an array initializer, convert the
- * expression to be just the single element; e.g.
- * <pre>
- * &#64;Foo(xxx={"abc"}) => &#64;Foo(xxx="abc")
- * or
- * &#64;Foo({"abc"}) => &#64;Foo("abc")
- * </pre>
- */
- private void convertArrayToLastRemainingExpression(Annotation outer, Expression lastValue) {
- lastValue = (Expression) ASTNode.copySubtree(lastValue.getAST(), lastValue);
- if (outer.isNormalAnnotation()) {
- this.memberValuePair((NormalAnnotation) outer).setValue(lastValue);
- } else if (outer.isSingleMemberAnnotation()) {
- ((SingleMemberAnnotation) outer).setValue(lastValue);
- } else {
- throw new IllegalArgumentException("unexpected annotation type: " + outer); //$NON-NLS-1$
- }
- }
-
- /**
- * Manipulate the specified expression appropriately.
- * If it is an array initializer, add the specified annotation to it.
- * If it is not, replace the expression or convert it into an array
- * initializer.
- */
- private void modifyExpression(ASTNode node, ExpressionProvider expProvider, Annotation inner) {
- Expression value = expProvider.getExpression(node);
- if (value.getNodeType() == ASTNode.ARRAY_INITIALIZER) {
- // ignore the other entries in the array initializer(?) - they may not be matching Annotations...
- List<Expression> expressions = this.expressions((ArrayInitializer) value);
- if (this.index >= expressions.size()) {
- this.addInnerToExpressions(inner, expressions);
- } else {
- expressions.set(this.index, inner);
- }
- } else {
- if (this.index == 0) {
- // replace whatever was there before
- expProvider.setExpression(node, inner);
- } else {
- // convert to an array
- ArrayInitializer ai = inner.getAST().newArrayInitializer();
- List<Expression> expressions = this.expressions(ai);
- expressions.add((Expression) ASTNode.copySubtree(value.getAST(), value));
- this.addInnerToExpressions(inner, expressions);
- expProvider.setExpression(node, ai);
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- protected List<Expression> expressions(ArrayInitializer ai) {
- return ai.expressions();
- }
-
-
- // ********** expression providers **********
-
- /**
- * define interface that allows us to "re-use" the code in
- * #modifyExpression(ASTNode, ExpressionProvider, Annotation)
- */
- private interface ExpressionProvider {
- Expression getExpression(ASTNode node);
- void setExpression(ASTNode node, Expression expression);
- }
-
- private static final ExpressionProvider MEMBER_VALUE_PAIR_EXPRESSION_PROVIDER = new ExpressionProvider() {
- public Expression getExpression(ASTNode node) {
- return ((MemberValuePair) node).getValue();
- }
- public void setExpression(ASTNode node, Expression expression) {
- ((MemberValuePair) node).setValue(expression);
- }
- @Override
- public String toString() {
- return "MemberValuePairExpressionProvider"; //$NON-NLS-1$
- }
- };
-
- private static final ExpressionProvider SINGLE_MEMBER_ANNOTATION_EXPRESSION_PROVIDER = new ExpressionProvider() {
- public Expression getExpression(ASTNode node) {
- return ((SingleMemberAnnotation) node).getValue();
- }
- public void setExpression(ASTNode node, Expression expression) {
- ((SingleMemberAnnotation) node).setValue(expression);
- }
- @Override
- public String toString() {
- return "SingleMemberAnnotationExpressionProvider"; //$NON-NLS-1$
- }
- };
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NullAnnotationEditFormatter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NullAnnotationEditFormatter.java
deleted file mode 100644
index 3c632f36c3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NullAnnotationEditFormatter.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jpt.core.utility.jdt.AnnotationEditFormatter;
-import org.eclipse.text.edits.MalformedTreeException;
-import org.eclipse.text.edits.TextEdit;
-
-public final class NullAnnotationEditFormatter
- implements AnnotationEditFormatter
-{
-
- private static final NullAnnotationEditFormatter INSTANCE = new NullAnnotationEditFormatter();
-
- /**
- * Return the singleton.
- */
- public static AnnotationEditFormatter instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private NullAnnotationEditFormatter() {
- super();
- }
-
- public void format(IDocument doc, TextEdit editTree) throws MalformedTreeException, BadLocationException {
- // no formatting
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NullDeclarationAnnotationAdapter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NullDeclarationAnnotationAdapter.java
deleted file mode 100644
index d81448ce1b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NullDeclarationAnnotationAdapter.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.MarkerAnnotation;
-import org.eclipse.jdt.core.dom.NormalAnnotation;
-import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
-import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
-
-/**
- * Behaviorless implementation.
- */
-public final class NullDeclarationAnnotationAdapter
- implements IndexedDeclarationAnnotationAdapter
-{
-
- // singleton
- private static final NullDeclarationAnnotationAdapter INSTANCE = new NullDeclarationAnnotationAdapter();
-
- /**
- * Return the singleton.
- */
- public static IndexedDeclarationAnnotationAdapter instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private NullDeclarationAnnotationAdapter() {
- super();
- }
-
-
- // ********** DeclarationAnnotationAdapter implementation **********
-
- public Annotation getAnnotation(ModifiedDeclaration declaration) {
- return null;
- }
-
- public MarkerAnnotation newMarkerAnnotation(ModifiedDeclaration declaration) {
- return null;
- }
-
- public SingleMemberAnnotation newSingleMemberAnnotation(ModifiedDeclaration declaration) {
- return null;
- }
-
- public NormalAnnotation newNormalAnnotation(ModifiedDeclaration declaration) {
- return null;
- }
-
- public void removeAnnotation(ModifiedDeclaration declaration) {
- // do nothing
- }
-
- public ASTNode getAstNode(ModifiedDeclaration declaration) {
- return declaration.getDeclaration();
- }
-
-
- // ********** IndexedDeclarationAnnotationAdapter implementation **********
-
- public int getIndex() {
- return -1;
- }
-
- public void moveAnnotation(int newIndex, ModifiedDeclaration declaration) {
- // do nothing
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NullDeclarationAnnotationElementAdapter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NullDeclarationAnnotationElementAdapter.java
deleted file mode 100644
index c53a69546a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NullDeclarationAnnotationElementAdapter.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
-
-/**
- * Behaviorless implementation.
- */
-public class NullDeclarationAnnotationElementAdapter<T>
- implements DeclarationAnnotationElementAdapter<T>
-{
-
- // singleton
- @SuppressWarnings("unchecked")
- private static final DeclarationAnnotationElementAdapter INSTANCE
- = new NullDeclarationAnnotationElementAdapter();
-
- /**
- * Return the singleton.
- */
- @SuppressWarnings("unchecked")
- public static <S> DeclarationAnnotationElementAdapter<S> instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private NullDeclarationAnnotationElementAdapter() {
- super();
- }
-
- public T getValue(ModifiedDeclaration declaration) {
- return null;
- }
-
- public void setValue(T value, ModifiedDeclaration declaration) {
- // do nothing
- }
-
- public ASTNode getAstNode(ModifiedDeclaration declaration) {
- return declaration.getDeclaration();
- }
-
- public Expression getExpression(ModifiedDeclaration declaration) {
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NullExpressionConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NullExpressionConverter.java
deleted file mode 100644
index 803b983910..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NullExpressionConverter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- * No conversion.
- */
-public final class NullExpressionConverter
- implements ExpressionConverter<Expression>
-{
-
- // singleton
- private static final ExpressionConverter<Expression> INSTANCE = new NullExpressionConverter();
-
- /**
- * Return the singleton.
- */
- public static ExpressionConverter<Expression> instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private NullExpressionConverter() {
- super();
- }
-
- public Expression convert(Expression expression, AST ast) {
- return expression;
- }
-
- public Expression convert(Expression expression) {
- return expression;
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NumberIntegerExpressionConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NumberIntegerExpressionConverter.java
deleted file mode 100644
index 526e1fe4aa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/NumberIntegerExpressionConverter.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jdt.core.dom.NumberLiteral;
-import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
-
-/**
- * Convert a number literal to/from an Integer
- * (e.g. 5).
- */
-public final class NumberIntegerExpressionConverter
- extends AbstractExpressionConverter<Integer>
-{
- private static final ExpressionConverter<Integer> INSTANCE = new NumberIntegerExpressionConverter();
-
- /**
- * Return the singleton.
- */
- public static ExpressionConverter<Integer> instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private NumberIntegerExpressionConverter() {
- super();
- }
-
- @Override
- protected NumberLiteral convertObject(Integer integer, AST ast) {
- return ast.newNumberLiteral(integer.toString());
- }
-
- @Override
- protected Integer convertExpression(Expression expression) {
- Object value = expression.resolveConstantExpressionValue();
- return (value instanceof Integer) ? ((Integer) value) : null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/PrimitiveTypeStringExpressionConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/PrimitiveTypeStringExpressionConverter.java
deleted file mode 100644
index 3f9990680f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/PrimitiveTypeStringExpressionConverter.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jdt.core.dom.PrimitiveType;
-import org.eclipse.jdt.core.dom.TypeLiteral;
-import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
-
-/**
- * Convert a type literal to/from a string representation of a primitive type
- * (e.g. "int").
- */
-public final class PrimitiveTypeStringExpressionConverter
- extends AbstractExpressionConverter<String>
-{
- private static final ExpressionConverter<String> INSTANCE = new PrimitiveTypeStringExpressionConverter();
-
- /**
- * Return the singleton.
- */
- public static ExpressionConverter<String> instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private PrimitiveTypeStringExpressionConverter() {
- super();
- }
-
- @Override
- protected TypeLiteral convertObject(String string, AST ast) {
- org.eclipse.jdt.core.dom.Type type = ast.newPrimitiveType(PrimitiveType.toCode(string));
- TypeLiteral typeLiteral = ast.newTypeLiteral();
- typeLiteral.setType(type);
- return typeLiteral;
- }
-
- @Override
- protected String convertExpression(Expression expression) {
- if (expression.getNodeType() == ASTNode.TYPE_LITERAL) {
- org.eclipse.jdt.core.dom.Type type = ((TypeLiteral) expression).getType();
- if (type.getNodeType() == ASTNode.PRIMITIVE_TYPE) {
- return ((PrimitiveType) type).getPrimitiveTypeCode().toString();
- }
- }
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/ShortCircuitAnnotationElementAdapter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/ShortCircuitAnnotationElementAdapter.java
deleted file mode 100644
index c0a1dca304..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/ShortCircuitAnnotationElementAdapter.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- * Wrap another annotation element adapter and short-circuit the
- * #setValue method if the value has not changed.
- */
-public class ShortCircuitAnnotationElementAdapter<T>
- implements AnnotationElementAdapter<T>
-{
- /** the wrapped adapter */
- private final AnnotationElementAdapter<T> adapter;
-
-
- // ********** constructor **********
-
- public ShortCircuitAnnotationElementAdapter(Member member, DeclarationAnnotationElementAdapter<T> daea) {
- this(new MemberAnnotationElementAdapter<T>(member, daea));
- }
-
- public ShortCircuitAnnotationElementAdapter(AnnotationElementAdapter<T> adapter) {
- super();
- this.adapter = adapter;
- }
-
-
- // ********** AnnotationElementAdapter implementation **********
-
- public T getValue() {
- return this.adapter.getValue();
- }
-
- public T getValue(CompilationUnit astRoot) {
- return this.adapter.getValue(astRoot);
- }
-
- public void setValue(T value) {
- this.setValue(this.adapter.getValue(), value);
- }
-
- public Expression getExpression(CompilationUnit astRoot) {
- return this.adapter.getExpression(astRoot);
- }
-
- public ASTNode getAstNode(CompilationUnit astRoot) {
- return this.adapter.getAstNode(astRoot);
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.adapter);
- }
-
-
- // ********** internal methods **********
-
- /**
- * set the adapter's value to the specified new value if it
- * is different from the specified old value
- */
- protected void setValue(T oldValue, T newValue) {
- if (oldValue == null) {
- if (newValue == null) { // null => null
- // do nothing
- } else { // null => object
- this.adapter.setValue(newValue);
- }
- } else {
- if (newValue == null) { // object => null
- this.adapter.setValue(null);
- } else { // object => object
- if (this.valuesAreEqual(oldValue, newValue)) {
- // do nothing
- } else {
- this.adapter.setValue(newValue);
- }
- }
- }
- }
-
- /**
- * both values are non-null when this method is called
- */
- protected boolean valuesAreEqual(T oldValue, T newValue) {
- return newValue.equals(oldValue);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/ShortCircuitArrayAnnotationElementAdapter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/ShortCircuitArrayAnnotationElementAdapter.java
deleted file mode 100644
index 01952fe059..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/ShortCircuitArrayAnnotationElementAdapter.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import java.util.Arrays;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-
-/**
- * Wrap another annotation element adapter and short-circuit the
- * #setValue method if the value has not changed. Overrides #valuesAreEqual()
- * to check equality on arrays
- */
-public class ShortCircuitArrayAnnotationElementAdapter<T>
- extends ShortCircuitAnnotationElementAdapter<T[]>
-{
- // ********** constructor **********
-
- public ShortCircuitArrayAnnotationElementAdapter(Member member, DeclarationAnnotationElementAdapter<T[]> daea) {
- super(member, daea);
- }
-
- public ShortCircuitArrayAnnotationElementAdapter(AnnotationElementAdapter<T[]> adapter) {
- super(adapter);
- }
-
-
- // ********** AnnotationElementAdapter implementation **********
-
- @Override
- protected boolean valuesAreEqual(T[] oldValue, T[] newValue) {
- return Arrays.equals(newValue, oldValue);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/SimpleDeclarationAnnotationAdapter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/SimpleDeclarationAnnotationAdapter.java
deleted file mode 100644
index 16a657437b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/SimpleDeclarationAnnotationAdapter.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration;
-
-/**
- * Manipulate an annotation with a specific name, e.g.
- * <pre>
- * &#64;Foo
- * private int id;
- * </pre>
- *
- * NB:
- * If the declaration contains more than one annotation with the same
- * name, the adapter will correspond to the first annotation with the specified
- * name. (Also note that the compiler will not allow a declaration to be
- * modified by multiple annotations with the same name, i.e. of the same type;
- * so if there *are* multiple annotations of the same type, there are bigger
- * problems to worry about than which annotation the adapter manipulates.)
- */
-public class SimpleDeclarationAnnotationAdapter extends AbstractDeclarationAnnotationAdapter {
-
-
- // ********** constructors **********
-
- public SimpleDeclarationAnnotationAdapter(String annotationName) {
- super(annotationName);
- }
-
-
- // ********** DeclarationAnnotationAdapter implementation **********
-
- public Annotation getAnnotation(ModifiedDeclaration declaration) {
- return declaration.getAnnotationNamed(this.getAnnotationName());
- }
-
- public void removeAnnotation(ModifiedDeclaration declaration) {
- declaration.removeAnnotationNamed(this.getAnnotationName());
- }
-
- @Override
- protected void addAnnotation(ModifiedDeclaration declaration, Annotation annotation) {
- declaration.replaceAnnotationNamed(this.getAnnotationName(), annotation);
- }
-
- public ASTNode getAstNode(ModifiedDeclaration declaration) {
- // if the annotation is missing, return the declaration
- Annotation annotation = this.getAnnotation(declaration);
- return (annotation != null) ? annotation : declaration.getDeclaration();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/SimpleTypeStringExpressionConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/SimpleTypeStringExpressionConverter.java
deleted file mode 100644
index f622562554..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/SimpleTypeStringExpressionConverter.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jdt.core.dom.Name;
-import org.eclipse.jdt.core.dom.SimpleType;
-import org.eclipse.jdt.core.dom.TypeLiteral;
-import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
-
-/**
- * Convert a type literal to/from a string representation of a simple type
- * (e.g. "java.lang.Object").
- */
-public final class SimpleTypeStringExpressionConverter
- extends AbstractExpressionConverter<String>
-{
- private static final ExpressionConverter<String> INSTANCE = new SimpleTypeStringExpressionConverter();
-
- /**
- * Return the singleton.
- */
- public static ExpressionConverter<String> instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private SimpleTypeStringExpressionConverter() {
- super();
- }
-
- @Override
- protected TypeLiteral convertObject(String string, AST ast) {
- Name name = ast.newName(string);
- org.eclipse.jdt.core.dom.Type type = ast.newSimpleType(name);
- TypeLiteral typeLiteral = ast.newTypeLiteral();
- typeLiteral.setType(type);
- return typeLiteral;
- }
-
- @Override
- protected String convertExpression(Expression expression) {
- if (expression.getNodeType() == ASTNode.TYPE_LITERAL) {
- org.eclipse.jdt.core.dom.Type type = ((TypeLiteral) expression).getType();
- if (type.getNodeType() == ASTNode.SIMPLE_TYPE) {
- return ((SimpleType) type).getName().getFullyQualifiedName();
- }
- }
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/StringArrayExpressionConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/StringArrayExpressionConverter.java
deleted file mode 100644
index 35751f6e52..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/StringArrayExpressionConverter.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.ArrayInitializer;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
-
-/**
- * Convert an array initializer to/from an array of strings (e.g. {"text0", "text1"}).
- *
- * Do NOT use this class for converting array initializers in annotation elements.
- * Java5 has a bit of syntactic sugar that allows a single-element array
- * initializer to not have curly braces. This converter will return null if it encounters
- * anything other than an array initializer.
- *
- * Invalid entries in the array initializer will result in null elements in the
- * resulting string array. This allows clients to manipulate elements at
- * the appropriate index.
- */
-public class StringArrayExpressionConverter
- extends AbstractExpressionConverter<String[]>
-{
- private final ExpressionConverter<String> elementConverter;
- private final boolean removeArrayInitializerWhenEmpty;
-
- private static final String[] EMPTY_STRING_ARRAY = new String[0];
-
-
- /**
- * The default behavior is to remove the array initializer if it is empty.
- */
- public StringArrayExpressionConverter(ExpressionConverter<String> elementConverter) {
- this(elementConverter, true);
- }
-
- public StringArrayExpressionConverter(ExpressionConverter<String> elementConverter, boolean removeArrayInitializerWhenEmpty) {
- super();
- this.elementConverter = elementConverter;
- this.removeArrayInitializerWhenEmpty = removeArrayInitializerWhenEmpty;
- }
-
- @Override
- /*
- * this method is 'public' so it can be called by
- * AnnotationStringArrayExpressionConverter
- */
- public ArrayInitializer convertObject(String[] strings, AST ast) {
- if ((strings.length == 0) && this.removeArrayInitializerWhenEmpty) {
- return null;
- }
- ArrayInitializer arrayInitializer = ast.newArrayInitializer();
- List<Expression> expressions = this.expressions(arrayInitializer);
- for (String string : strings) {
- expressions.add(this.elementConverter.convert(string, ast));
- }
- return arrayInitializer;
- }
-
- @SuppressWarnings("unchecked")
- private List<Expression> expressions(ArrayInitializer arrayInitializer) {
- return arrayInitializer.expressions();
- }
-
- /*
- * this method is 'public' so it can be called by
- * AnnotationStringArrayExpressionConverter
- */
- @Override
- public String[] convertNull() {
- return EMPTY_STRING_ARRAY;
- }
-
- @Override
- protected String[] convertExpression(Expression expression) {
- return (expression.getNodeType() == ASTNode.ARRAY_INITIALIZER) ?
- this.convertArrayInitializer((ArrayInitializer) expression)
- :
- EMPTY_STRING_ARRAY;
- }
-
- /*
- * this method is 'public' so it can be called by
- * AnnotationStringArrayExpressionConverter
- */
- public String[] convertArrayInitializer(ArrayInitializer arrayInitializer) {
- List<Expression> expressions = this.downcastExpressions(arrayInitializer);
- int len = expressions.size();
- String[] strings = new String[len];
- for (int i = len; i-- > 0; ) {
- strings[i] = this.elementConverter.convert(expressions.get(i));
- }
- return strings;
- }
-
- @SuppressWarnings("unchecked")
- private List<Expression> downcastExpressions(ArrayInitializer arrayInitializer) {
- return arrayInitializer.expressions();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/StringExpressionConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/StringExpressionConverter.java
deleted file mode 100644
index b5fee1e52d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/StringExpressionConverter.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jdt.core.dom.StringLiteral;
-import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
-
-/**
- * Convert a string literal to/from a string (e.g. "text").
- */
-public final class StringExpressionConverter
- extends AbstractExpressionConverter<String>
-{
- private static final ExpressionConverter<String> INSTANCE = new StringExpressionConverter();
-
- /**
- * Return the singleton.
- */
- public static ExpressionConverter<String> instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private StringExpressionConverter() {
- super();
- }
-
- @Override
- protected StringLiteral convertObject(String string, AST ast) {
- StringLiteral stringLiteral = ast.newStringLiteral();
- stringLiteral.setLiteralValue(string);
- return stringLiteral;
- }
-
- @Override
- protected String convertExpression(Expression expression) {
- Object value = expression.resolveConstantExpressionValue();
- return (value instanceof String) ? (String) value : null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/TypeStringExpressionConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/TypeStringExpressionConverter.java
deleted file mode 100644
index 4ca6248449..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/TypeStringExpressionConverter.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.jdt;
-
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jdt.core.dom.PrimitiveType;
-import org.eclipse.jdt.core.dom.TypeLiteral;
-import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
-
-/**
- * Convert a type literal to/from a string representation of a
- * simple type (e.g. "java.lang.Object") or primitive type (e.g. "int").
- */
-public final class TypeStringExpressionConverter
- extends AbstractExpressionConverter<String>
-{
- private static final ExpressionConverter<String> INSTANCE = new TypeStringExpressionConverter();
-
- /**
- * Return the singleton.
- */
- public static ExpressionConverter<String> instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private TypeStringExpressionConverter() {
- super();
- }
-
- @Override
- protected TypeLiteral convertObject(String string, AST ast) {
- if (PrimitiveType.toCode(string) != null) {
- return (TypeLiteral) PrimitiveTypeStringExpressionConverter.instance().convert(string, ast);
- }
- return (TypeLiteral) SimpleTypeStringExpressionConverter.instance().convert(string, ast);
- }
-
- @Override
- protected String convertExpression(Expression expression) {
- String name = SimpleTypeStringExpressionConverter.instance().convert(expression);
- return name != null ? name : PrimitiveTypeStringExpressionConverter.instance().convert(expression);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/translators/BooleanTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/translators/BooleanTranslator.java
deleted file mode 100644
index 46ebb2e816..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/translators/BooleanTranslator.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.translators;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class BooleanTranslator
- extends Translator
-{
- public BooleanTranslator(String domPathAndNames, EStructuralFeature structuralFeature) {
- super(domPathAndNames, structuralFeature, BOOLEAN_FEATURE | BOOLEAN_LOWERCASE);
- }
-
- public BooleanTranslator(String domPathAndNames, EStructuralFeature structuralFeature, int style) {
- super(domPathAndNames, structuralFeature, BOOLEAN_FEATURE | BOOLEAN_LOWERCASE | style);
- }
-
- @Override
- public Object convertStringToValue(String string, EObject owner) {
- return Boolean.valueOf(string);
- }
-
- @Override
- public String convertValueToString(Object value, EObject owner) {
- return ((Boolean) value).toString();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/translators/EmptyTagBooleanTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/translators/EmptyTagBooleanTranslator.java
deleted file mode 100644
index 8ee27fe218..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/translators/EmptyTagBooleanTranslator.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.translators;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-/**
- * This translator is to be used for empty xml tags that correspond
- * to a boolean attribute in the emf model.
- * cascade-persist is an example from the orm.xsd:
- *
- * <persistence-unit-defaults>
- * <cascade-persist/>
- * </persistence-unit-defaults> ==> cascadePersist == true
- *
- * vs.
- *
- * <persistence-unit-defaults>
- * </persistence-unit-defaults> ==> cascadePersist == false
- *
- */
-public class EmptyTagBooleanTranslator
- extends Translator
-{
- public EmptyTagBooleanTranslator(String domPathAndNames, EStructuralFeature structuralFeature) {
- super(domPathAndNames, structuralFeature, EMPTY_TAG | BOOLEAN_FEATURE);
- }
-
- public EmptyTagBooleanTranslator(String domPathAndNames, EStructuralFeature structuralFeature, int style) {
- super(domPathAndNames, structuralFeature, style | EMPTY_TAG | BOOLEAN_FEATURE);
- }
-
- @Override
- public Object getMOFValue(EObject mofObject) {
- // I am overriding this method. This is so the tag will be removed when
- // the value is false.
- // I'm not sure if this is a bug in the ecore or maybe in the translators,
- // but I really don't think that we should have to depend on the boolean
- // being "unset" to remove the tag.
- Boolean value = (Boolean) super.getMOFValue(mofObject);
- return (value == null) ? null : value.booleanValue() ? value : null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/translators/EnumeratedValueTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/translators/EnumeratedValueTranslator.java
deleted file mode 100644
index e0f3551e07..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/translators/EnumeratedValueTranslator.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.translators;
-
-import java.util.Iterator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public abstract class EnumeratedValueTranslator
- extends Translator
-{
- public EnumeratedValueTranslator(String domPathAndNames, EStructuralFeature structuralFeature) {
- super(domPathAndNames, structuralFeature);
- }
-
- public EnumeratedValueTranslator(String domPathAndNames, EStructuralFeature structuralFeature, int style) {
- super(domPathAndNames, structuralFeature, style);
- }
-
-
- protected abstract Iterator enumeratedObjectValues();
-
- @Override
- public Object convertStringToValue(String string, EObject owner) {
- for (Object each : CollectionTools.iterable(enumeratedObjectValues())) {
- if (each.toString().equals(string)) {
- return each;
- }
- }
- return null;
- }
-
- @Override
- public String convertValueToString(Object value, EObject owner) {
- return value.toString();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/translators/SimpleRootTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/translators/SimpleRootTranslator.java
deleted file mode 100644
index 6f01afb5e6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/translators/SimpleRootTranslator.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.translators;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.wst.common.internal.emf.resource.RootTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-/**
- * Root translator that contains a list of child translators and no special
- * behavior.
- */
-public class SimpleRootTranslator
- extends RootTranslator
-{
- protected Translator[] children;
-
- public SimpleRootTranslator(String domPathAndNames, EClass eClass) {
- super(domPathAndNames, eClass);
- }
-
- public SimpleRootTranslator(String domPathAndNames, EClass eClass, Translator[] children) {
- super(domPathAndNames, eClass);
- this.children = children;
- }
-
- /**
- * Widen method access to 'public'.
- */
- @Override
- public Translator[] getChildren() {
- return this.children;
- }
-
- protected Translator[] getChildren_() {
- return (this.children == null) ? EMPTY_TRANSLATOR_ARRAY : this.children;
- }
- protected static final Translator[] EMPTY_TRANSLATOR_ARRAY = new Translator[0];
-
- /**
- * Set the translator's children.
- * Return the translator.
- */
- public void setChildren(Translator[] children) {
- this.children = children;
- }
-
- /**
- * Add the specified translator to the translator's list of children.
- * Return the translator for method chaining.
- */
- public SimpleRootTranslator addChild(Translator translator) {
- this.children = ArrayTools.add(this.getChildren_(), translator);
- return this;
- }
-
- /**
- * Add the specified translators to the translator's list of children.
- * Return the translator for method chaining.
- */
- public SimpleRootTranslator addChildren(Translator[] translators) {
- this.children = ArrayTools.addAll(this.getChildren_(), translators);
- return this;
- }
-
- /**
- * Remove the specified translator from the translator's list of children.
- * Return the translator for method chaining.
- */
- public SimpleRootTranslator removeChild(Translator translator) {
- this.children = ArrayTools.remove(this.children, translator);
- return this;
- }
-
- /**
- * Remove the specified translators from the translator's list of children.
- * Return the translator for method chaining.
- */
- public SimpleRootTranslator removeChildren(Translator[] translators) {
- this.children = ArrayTools.removeAll(this.children, (Object[]) translators);
- return this;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/translators/SimpleTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/translators/SimpleTranslator.java
deleted file mode 100644
index 9b465cfe9c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/translators/SimpleTranslator.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.utility.translators;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-import org.eclipse.wst.common.internal.emf.resource.TranslatorPath;
-
-/**
- * Translator that contains a list of child translators and no special
- * behavior.
- */
-public class SimpleTranslator
- extends Translator
-{
- protected Translator[] children;
-
-
- // ********** constructors **********
-
- public SimpleTranslator(String domPathAndNames, EClass eClass) {
- super(domPathAndNames, eClass);
- }
-
- public SimpleTranslator(String domPathAndNames, EStructuralFeature eStructuralFeature) {
- super(domPathAndNames, eStructuralFeature);
- }
-
- public SimpleTranslator(String domPathAndNames, EStructuralFeature eStructuralFeature, Translator[] children) {
- super(domPathAndNames, eStructuralFeature);
- this.children = children;
- }
-
- public SimpleTranslator(String domPathAndNames, EStructuralFeature eStructuralFeature, EClass eClass) {
- super(domPathAndNames, eStructuralFeature, eClass);
- }
-
- public SimpleTranslator(String domPathAndNames, EStructuralFeature eStructuralFeature, EClass eClass, Translator[] children) {
- super(domPathAndNames, eStructuralFeature, eClass);
- this.children = children;
- }
-
- public SimpleTranslator(String domPathAndNames, EStructuralFeature eStructuralFeature, TranslatorPath translatorPath) {
- super(domPathAndNames, eStructuralFeature, translatorPath);
- }
-
- public SimpleTranslator(String domPathAndNames, EStructuralFeature eStructuralFeature, TranslatorPath[] translatorPaths) {
- super(domPathAndNames, eStructuralFeature, translatorPaths);
- }
-
- public SimpleTranslator(String domPathAndNames, EStructuralFeature eStructuralFeature, int style) {
- super(domPathAndNames, eStructuralFeature, style);
- }
-
- public SimpleTranslator(String domPathAndNames, EStructuralFeature aFeature, int style, EClass eClass, Translator[] children) {
- this(domPathAndNames, aFeature, style);
- setEMFClass(eClass);
- this.children = children;
- }
-
- public SimpleTranslator(String domPathAndNames, EStructuralFeature eStructuralFeature, int style, Translator[] children) {
- super(domPathAndNames, eStructuralFeature, style);
- this.children = children;
- }
-
-
- // ********** children **********
-
- /**
- * Widen method access to 'public'.
- */
- @Override
- public Translator[] getChildren() {
- return this.children;
- }
-
- protected Translator[] getChildren_() {
- return (this.children == null) ? EMPTY_TRANSLATOR_ARRAY : this.children;
- }
- protected static final Translator[] EMPTY_TRANSLATOR_ARRAY = new Translator[0];
-
- /**
- * Set the translator's children.
- * Return the translator.
- */
- public void setChildren(Translator[] children) {
- this.children = children;
- }
-
- /**
- * Add the specified translator to the translator's list of children.
- * Return the translator for method chaining.
- */
- public SimpleTranslator addChild(Translator translator) {
- this.children = ArrayTools.add(this.getChildren_(), translator);
- return this;
- }
-
- /**
- * Add the specified translators to the translator's list of children.
- * Return the translator for method chaining.
- */
- public SimpleTranslator addChildren(Translator[] translators) {
- this.children = ArrayTools.addAll(this.getChildren_(), translators);
- return this;
- }
-
- /**
- * Remove the specified translator from the translator's list of children.
- * Return the translator for method chaining.
- */
- public SimpleTranslator removeChild(Translator translator) {
- this.children = ArrayTools.remove(this.children, translator);
- return this;
- }
-
- /**
- * Remove the specified translators from the translator's list of children.
- * Return the translator for method chaining.
- */
- public SimpleTranslator removeChildren(Translator[] translators) {
- this.children = ArrayTools.removeAll(this.children, (Object[]) translators);
- return this;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/DefaultJpaValidationMessages.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/DefaultJpaValidationMessages.java
deleted file mode 100644
index 2136e52e5e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/DefaultJpaValidationMessages.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.validation;
-
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.utility.TextRange;
-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);
- if (textRange == null) {
- //log an exception and then continue without setting location information
- //At least the user will still get the validation message and will
- //be able to see other validation messages with valid textRanges
- JptCorePlugin.log(new IllegalArgumentException("Null text range for message ID: " + messageId)); //$NON-NLS-1$
- }
- else {
- message.setLineNo(textRange.getLineNumber());
- message.setOffset(textRange.getOffset());
- message.setLength(textRange.getLength());
- }
- return message;
- }
-
-
- private DefaultJpaValidationMessages() {
- super();
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaHelper.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaHelper.java
deleted file mode 100644
index 7789238c30..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaHelper.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.validation;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jpt.core.JpaNode;
-
-public class JpaHelper extends org.eclipse.wst.validation.internal.operations.WorkbenchContext {
-
- @Override
- public IResource getResource(Object obj) {
- return ((JpaNode) obj).getResource();
- }
-
- /*
- * This is used when no line number is set. We generally use line numbers.
- * Therefore, when this is called, we will use the default location, i.e.
- * null.
- */
- @Override
- public String getLocation(Object object) {
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationMessages.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationMessages.java
deleted file mode 100644
index d9da784469..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationMessages.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.validation;
-
-@SuppressWarnings("nls")
-public interface JpaValidationMessages {
-
- public static final String BUNDLE_NAME = "jpa_validation";
-
- public static final String PROJECT_NO_CONNECTION = "PROJECT_NO_CONNECTION";
- public static final String PROJECT_INVALID_CONNECTION = "PROJECT_INVALID_CONNECTION";
- public static final String PROJECT_INACTIVE_CONNECTION = "PROJECT_INACTIVE_CONNECTION";
- public static final String PROJECT_NO_PERSISTENCE_XML = "PROJECT_NO_PERSISTENCE_XML";
- public static final String PROJECT_MULTIPLE_PERSISTENCE_XML = "PROJECT_MULTIPLE_PERSISTENCE_XML";
- public static final String XML_VERSION_NOT_LATEST = "XML_VERSION_NOT_LATEST";
- public static final String PERSISTENCE_XML_INVALID_CONTENT = "PERSISTENCE_XML_INVALID_CONTENT";
- public static final String PERSISTENCE_NO_PERSISTENCE_UNIT = "PERSISTENCE_NO_PERSISTENCE_UNIT";
- public static final String PERSISTENCE_MULTIPLE_PERSISTENCE_UNITS = "PERSISTENCE_MULTIPLE_PERSISTENCE_UNITS";
- public static final String PERSISTENCE_UNIT_UNSPECIFIED_MAPPING_FILE = "PERSISTENCE_UNIT_UNSPECIFIED_MAPPING_FILE";
- public static final String PERSISTENCE_UNIT_UNSUPPORTED_MAPPING_FILE_CONTENT = "PERSISTENCE_UNIT_UNSUPPORTED_MAPPING_FILE_CONTENT";
- public static final String PERSISTENCE_UNIT_NONEXISTENT_MAPPING_FILE = "PERSISTENCE_UNIT_NONEXISTENT_MAPPING_FILE";
- public static final String PERSISTENCE_UNIT_INVALID_MAPPING_FILE = "PERSISTENCE_UNIT_INVALID_MAPPING_FILE";
- public static final String PERSISTENCE_UNIT_DUPLICATE_MAPPING_FILE = "PERSISTENCE_UNIT_DUPLICATE_MAPPING_FILE";
- public static final String PERSISTENCE_UNIT_UNSPECIFIED_CLASS = "PERSISTENCE_UNIT_UNSPECIFIED_CLASS";
- public static final String PERSISTENCE_UNIT_NONEXISTENT_CLASS = "PERSISTENCE_UNIT_NONEXISTENT_CLASS";
- public static final String PERSISTENCE_UNIT_INVALID_CLASS = "PERSISTENCE_UNIT_INVALID_CLASS";
- public static final String PERSISTENCE_UNIT_DUPLICATE_CLASS = "PERSISTENCE_UNIT_DUPLICATE_CLASS";
- public static final String PERSISTENCE_UNIT_REDUNDANT_CLASS = "PERSISTENCE_UNIT_REDUNDANT_CLASS";
- public static final String PERSISTENCE_UNIT_DUPLICATE_JAR_FILE = "PERSISTENCE_UNIT_DUPLICATE_JAR_FILE";
- public static final String PERSISTENCE_UNIT_UNSPECIFIED_JAR_FILE = "PERSISTENCE_UNIT_UNSPECIFIED_JAR_FILE";
- public static final String PERSISTENCE_UNIT_JAR_FILE_DEPLOYMENT_PATH_WARNING = "PERSISTENCE_UNIT_JAR_FILE_DEPLOYMENT_PATH_WARNING";
- public static final String PERSISTENCE_UNIT_NONEXISTENT_JAR_FILE = "PERSISTENCE_UNIT_NONEXISTENT_JAR_FILE";
- public static final String GENERATOR_DUPLICATE_NAME = "GENERATOR_DUPLICATE_NAME";
- public static final String QUERY_DUPLICATE_NAME = "QUERY_DUPLICATE_NAME";
- public static final String MAPPING_FILE_EXTRANEOUS_PERSISTENCE_UNIT_DEFAULTS = "MAPPING_FILE_EXTRANEOUS_PERSISTENCE_UNIT_DEFAULTS";
- public static final String PERSISTENT_TYPE_MAPPED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT = "PERSISTENT_TYPE_MAPPED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT";
- public static final String PERSISTENT_TYPE_ANNOTATED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT = "PERSISTENT_TYPE_ANNOTATED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT";
- public static final String PERSISTENT_TYPE_UNSPECIFIED_CLASS = "PERSISTENT_TYPE_UNSPECIFIED_CLASS";
- public static final String PERSISTENT_TYPE_UNRESOLVED_CLASS = "PERSISTENT_TYPE_UNRESOLVED_CLASS";
- public static final String ENTITY_NO_ID = "ENTITY_NO_ID";
- public static final String ENTITY_SINGLE_TABLE_DESCENDANT_DEFINES_TABLE = "ENTITY_SINGLE_TABLE_DESCENDANT_DEFINES_TABLE";
- public static final String ENTITY_ABSTRACT_TABLE_PER_CLASS_DEFINES_TABLE = "ENTITY_ABSTRACT_TABLE_PER_CLASS_DEFINES_TABLE";
- public static final String ENTITY_ABSTRACT_DISCRIMINATOR_VALUE_DEFINED = "ENTITY_ABSTRACT_DISCRIMINATOR_VALUE_DEFINED";
- public static final String ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_VALUE_DEFINED = "ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_VALUE_DEFINED";
- public static final String ENTITY_NON_ROOT_DISCRIMINATOR_COLUMN_DEFINED = "ENTITY_NON_ROOT_DISCRIMINATOR_COLUMN_DEFINED";
- public static final String ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_COLUMN_DEFINED = "ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_COLUMN_DEFINED";
- public static final String PERSISTENT_ATTRIBUTE_UNSPECIFIED_NAME = "PERSISTENT_ATTRIBUTE_UNSPECIFIED_NAME";
- public static final String PERSISTENT_ATTRIBUTE_UNRESOLVED_NAME = "PERSISTENT_ATTRIBUTE_UNRESOLVED_NAME";
- public static final String PERSISTENT_ATTRIBUTE_INHERITED_ATTRIBUTES_NOT_SUPPORTED = "PERSISTENT_ATTRIBUTE_INHERITED_ATTRIBUTES_NOT_SUPPORTED";
- public static final String PERSISTENT_ATTRIBUTE_FINAL_FIELD = "PERSISTENT_ATTRIBUTE_FINAL_FIELD";
- public static final String PERSISTENT_ATTRIBUTE_PUBLIC_FIELD = "PERSISTENT_ATTRIBUTE_PUBLIC_FIELD";
- public static final String PERSISTENT_ATTRIBUTE_INVALID_MAPPING = "PERSISTENT_ATTRIBUTE_INVALID_MAPPING";
- public static final String MAPPING_UNRESOLVED_MAPPED_BY = "MAPPING_UNRESOLVED_MAPPED_BY";
- public static final String MAPPING_INVALID_MAPPED_BY = "MAPPING_INVALID_MAPPED_BY";
- public static final String MAPPING_MAPPED_BY_WITH_JOIN_TABLE = "MAPPING_MAPPED_BY_WITH_JOIN_TABLE";
- public static final String MAPPING_MAPPED_BY_ON_BOTH_SIDES = "MAPPING_MAPPED_BY_ON_BOTH_SIDES";
- public static final String ID_MAPPING_UNRESOLVED_GENERATOR_NAME = "ID_MAPPING_UNRESOLVED_GENERATOR_NAME";
- public static final String TABLE_UNRESOLVED_CATALOG = "TABLE_UNRESOLVED_CATALOG";
- public static final String TABLE_UNRESOLVED_SCHEMA = "TABLE_UNRESOLVED_SCHEMA";
- public static final String TABLE_UNRESOLVED_NAME = "TABLE_UNRESOLVED_NAME";
- public static final String SECONDARY_TABLE_UNRESOLVED_CATALOG = "SECONDARY_TABLE_UNRESOLVED_CATALOG";
- public static final String SECONDARY_TABLE_UNRESOLVED_SCHEMA = "SECONDARY_TABLE_UNRESOLVED_SCHEMA";
- public static final String SECONDARY_TABLE_UNRESOLVED_NAME = "SECONDARY_TABLE_UNRESOLVED_NAME";
- public static final String JOIN_TABLE_UNRESOLVED_CATALOG = "JOIN_TABLE_UNRESOLVED_CATALOG";
- public static final String JOIN_TABLE_UNRESOLVED_SCHEMA = "JOIN_TABLE_UNRESOLVED_SCHEMA";
- public static final String VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_CATALOG = "VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_CATALOG";
- public static final String VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_SCHEMA = "VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_SCHEMA";
- public static final String JOIN_TABLE_UNRESOLVED_NAME = "JOIN_TABLE_UNRESOLVED_NAME";
- public static final String VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_NAME";
- public static final String COLUMN_UNRESOLVED_TABLE = "COLUMN_UNRESOLVED_TABLE";
- public static final String VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_TABLE = "VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_TABLE";
- public static final String VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_TABLE = "VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_TABLE";
- public static final String COLUMN_UNRESOLVED_NAME = "COLUMN_UNRESOLVED_NAME";
- public static final String VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME";
- public static final String VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME";
- public static final String JOIN_COLUMN_UNRESOLVED_TABLE = "JOIN_COLUMN_UNRESOLVED_TABLE";
- public static final String VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_TABLE = "VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_TABLE";
- public static final String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_TABLE = "VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_TABLE";
- public static final String JOIN_COLUMN_UNRESOLVED_NAME = "JOIN_COLUMN_UNRESOLVED_NAME";
- public static final String JOIN_COLUMN_UNRESOLVED_NAME_MULTIPLE_JOIN_COLUMNS = "JOIN_COLUMN_UNRESOLVED_NAME_MULTIPLE_JOIN_COLUMNS";
- public static final String VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_NAME";
- public static final String VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_NAME_MULTIPLE_JOIN_COLUMNS = "VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_NAME_MULTIPLE_JOIN_COLUMNS";
- public static final String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME";
- public static final String JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME = "JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME";
- public static final String JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME_MULTIPLE_JOIN_COLUMNS = "JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME_MULTIPLE_JOIN_COLUMNS";
- public static final String VIRTUAL_ATTRIBUTE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME";
- public static final String VIRTUAL_ATTRIBUTE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME_MULTIPLE_JOIN_COLUMNS = "VIRTUAL_ATTRIBUTE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME_MULTIPLE_JOIN_COLUMNS";
- public static final String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME";
- public static final String GENERATED_VALUE_UNRESOLVED_GENERATOR = "GENERATED_VALUE_UNRESOLVED_GENERATOR";
- public static final String PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME = "PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME";
- public static final String PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME = "PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME";
- public static final String NO_JPA_PROJECT = "NO_JPA_PROJECT";
- public static final String TARGET_ENTITY_NOT_DEFINED = "TARGET_ENTITY_NOT_DEFINED";
- public static final String VIRTUAL_ATTRIBUTE_TARGET_ENTITY_NOT_DEFINED = "VIRTUAL_ATTRIBUTE_TARGET_ENTITY_NOT_DEFINED";
- public static final String TARGET_ENTITY_IS_NOT_AN_ENTITY = "TARGET_ENTITY_IS_NOT_AN_ENTITY";
- public static final String VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY = "VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY";
- public static final String DISCRIMINATOR_COLUMN_UNRESOLVED_NAME = "DISCRIMINATOR_COLUMN_UNRESOLVED_NAME";
- public static final String ENTITY_TABLE_PER_CLASS_NOT_SUPPORTED_ON_PLATFORM = "ENTITY_TABLE_PER_CLASS_NOT_SUPPORTED_ON_PLATFORM";
- public static final String ENTITY_TABLE_PER_CLASS_NOT_PORTABLE_ON_PLATFORM = "ENTITY_TABLE_PER_CLASS_NOT_PORTABLE_ON_PLATFORM";
-
- //JPA 2.0 validation messages
- public static final String ORDER_COLUMN_AND_ORDER_BY_BOTH_SPECIFIED = "ORDER_COLUMN_AND_ORDER_BY_BOTH_SPECIFIED";
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationPreferences.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationPreferences.java
deleted file mode 100644
index 3e94a40cba..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationPreferences.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.IResourcePart;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.osgi.service.prefs.BackingStoreException;
-
-//TODO: Probably want to merge the behavior in this class into JptCorePlugin
-public class JpaValidationPreferences {
-
- public static String HIGH_SEVERITY = "error";
- public static String NORMAL_SEVERITY = "warning";
- public static String LOW_SEVERITY = "info";
- public static String IGNORE = "ignore";
-
- static int NO_SEVERITY_PREFERENCE = -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(HIGH_SEVERITY)){
- return IMessage.HIGH_SEVERITY;
- } else if (problemPreference.equals(NORMAL_SEVERITY)){
- return IMessage.NORMAL_SEVERITY;
- } else if (problemPreference.equals(LOW_SEVERITY)){
- 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){
- return false;
- }else if(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){
- IEclipsePreferences projectPreferences = JptCorePlugin.getProjectPreferences(project);
- return projectPreferences.get(messageId, null);
- }
-
- public static void setProjectLevelProblemPreference(IProject project, String messageId, String problemPreference) {
- IEclipsePreferences projectPreferences = JptCorePlugin.getProjectPreferences(project);
- if (problemPreference==null){
- projectPreferences.remove(messageId);
- }
- else {
- projectPreferences.put(messageId, problemPreference);
- }
- flush(projectPreferences);
- }
-
- /**
- * Returns the String value of the problem preference from the workspace preferences
- */
- public static String getWorkspaceLevelProblemPreference(String messageId){
- IEclipsePreferences workspacePreferences = JptCorePlugin.getWorkspacePreferences();
- return workspacePreferences.get(messageId, null);
- }
-
- public static void setWorkspaceLevelProblemPreference(String messageId, String problemPreference) {
- IEclipsePreferences workspacePreferences = JptCorePlugin.getWorkspacePreferences();
- if (problemPreference==null){
- workspacePreferences.remove(messageId);
- }
- else {
- workspacePreferences.put(messageId, problemPreference);
- }
- flush(workspacePreferences);
- }
-
-
- private static void flush(IEclipsePreferences prefs) {
- try {
- prefs.flush();
- } catch(BackingStoreException ex) {
- JptCorePlugin.log(ex);
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidator.java
deleted file mode 100644
index 72248499b2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidator.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.validation;
-
-import java.util.Iterator;
-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.core.IResourcePart;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.utility.internal.iterators.SingleElementIterator;
-import org.eclipse.wst.validation.AbstractValidator;
-import org.eclipse.wst.validation.ValidationResult;
-import org.eclipse.wst.validation.ValidationState;
-import org.eclipse.wst.validation.ValidatorMessage;
-import org.eclipse.wst.validation.internal.ValConstants;
-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();
- try {
- clearMarkers(project);
- }
- catch (CoreException ce) {
- JptCorePlugin.log(ce);
- }
- result.setSuspendValidation(project);
- validate(reporter, project);
- return result;
- }
-
-
- // **************** internal conv. *****************************************
-
- private void clearMarkers(IProject project) throws CoreException {
- IMarker[] markers = project.findMarkers(ValConstants.ProblemMarker, true, IResource.DEPTH_INFINITE);
- String valId = JptCorePlugin.VALIDATOR_ID;
- for (IMarker marker : markers) {
- String id = marker.getAttribute(ValidatorMessage.ValidationId, null);
- if (valId.equals(id)) marker.delete();
- }
- }
-
- private void validate(IReporter reporter, IProject project) {
- reporter.removeAllMessages(this);
-
- for (Iterator<IMessage> stream = this.validationMessages(reporter, project); stream.hasNext(); ) {
- IMessage message = stream.next();
- // 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 Iterator<IMessage> validationMessages(IReporter reporter, IProject project) {
- JpaProject jpaProject = JptCorePlugin.getJpaProject(project);
- if (jpaProject != null) {
- return jpaProject.validationMessages(reporter);
- }
- return new SingleElementIterator<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