258533 - [JPA 2.0] Orphan-Removal support
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
new file mode 100644
index 0000000..3ac4081
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryOneToMany1_0Annotation.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+* Copyright (c) 2009 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.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
new file mode 100644
index 0000000..3a4c879
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryOneToOne1_0Annotation.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+* Copyright (c) 2009 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.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/source/SourceOneToMany1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceOneToMany1_0Annotation.java
new file mode 100644
index 0000000..320a036
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceOneToMany1_0Annotation.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+* Copyright (c) 2009 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.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
new file mode 100644
index 0000000..6fe6535
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceOneToOne1_0Annotation.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+* Copyright (c) 2009 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.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/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java
index 55b6d88..882fd4f 100644
--- 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
@@ -10,6 +10,7 @@
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;
@@ -17,6 +18,8 @@
import org.eclipse.jpt.core.internal.jpa2.resource.java.AssociationOverrides2_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.OneToMany2_0AnnotationDefinition;
+import org.eclipse.jpt.core.internal.jpa2.resource.java.OneToOne2_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;
@@ -45,8 +48,6 @@
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;
@@ -144,8 +145,8 @@
definitions.add(ManyToOneAnnotationDefinition.instance());
definitions.add(MapsId2_0AnnotationDefinition.instance());
definitions.add(MapKeyAnnotationDefinition.instance());
- definitions.add(OneToManyAnnotationDefinition.instance());
- definitions.add(OneToOneAnnotationDefinition.instance());
+ definitions.add(OneToMany2_0AnnotationDefinition.instance());
+ definitions.add(OneToOne2_0AnnotationDefinition.instance());
definitions.add(OrderByAnnotationDefinition.instance());
definitions.add(PrimaryKeyJoinColumnAnnotationDefinition.instance());
definitions.add(PrimaryKeyJoinColumnsAnnotationDefinition.instance());
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
new file mode 100644
index 0000000..01dd7b5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/OneToMany2_0AnnotationDefinition.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+* Copyright (c) 2009 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.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.internal.resource.java.NullOneToManyAnnotation;
+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;
+
+/**
+ * OneToMany2_0AnnotationDefinition
+ */
+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 NullOneToManyAnnotation((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
new file mode 100644
index 0000000..11a4fd6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/OneToOne2_0AnnotationDefinition.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+* Copyright (c) 2009 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* 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.internal.resource.java.NullOneToOneAnnotation;
+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;
+
+/**
+ * OneToOne2_0AnnotationDefinition
+ */
+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 NullOneToOneAnnotation((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/binary/BinaryOneToMany2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryOneToMany2_0Annotation.java
new file mode 100644
index 0000000..7760598
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryOneToMany2_0Annotation.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+* Copyright (c) 2009 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.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
new file mode 100644
index 0000000..47150a3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryOneToOne2_0Annotation.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+* Copyright (c) 2009 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.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/source/SourceOneToMany2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOneToMany2_0Annotation.java
new file mode 100644
index 0000000..57c4902
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOneToMany2_0Annotation.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+* Copyright (c) 2009 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* 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
new file mode 100644
index 0000000..11ce5d7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOneToOne2_0Annotation.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+* Copyright (c) 2009 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* 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/resource/java/NullOneToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullOneToOneAnnotation.java
index ce6374c..5a951e9 100644
--- 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
@@ -21,7 +21,7 @@
extends NullOwnableRelationshipMappingAnnotation
implements OneToOneAnnotation
{
- protected NullOneToOneAnnotation(JavaResourcePersistentAttribute parent) {
+ public NullOneToOneAnnotation(JavaResourcePersistentAttribute parent) {
super(parent);
}
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
index 29c3efe..27e2e32 100644
--- 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
@@ -10,8 +10,8 @@
package org.eclipse.jpt.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryOneToManyAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceOneToManyAnnotation;
+import org.eclipse.jpt.core.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;
@@ -44,7 +44,7 @@
}
public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new SourceOneToManyAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
+ return new SourceOneToMany1_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
}
public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
@@ -52,7 +52,7 @@
}
public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryOneToManyAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryOneToMany1_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
}
public String getAnnotationName() {
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
index 93ecc8e..cc3726a 100644
--- 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
@@ -10,8 +10,8 @@
package org.eclipse.jpt.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryOneToOneAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceOneToOneAnnotation;
+import org.eclipse.jpt.core.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;
@@ -44,7 +44,7 @@
}
public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new SourceOneToOneAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
+ return new SourceOneToOne1_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
}
public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
@@ -52,7 +52,7 @@
}
public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
- return new BinaryOneToOneAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryOneToOne1_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
}
public String getAnnotationName() {
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
index fcd1c05..6f0e01d 100644
--- 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
@@ -19,7 +19,7 @@
/**
* javax.persistence.OneToMany
*/
-public final class BinaryOneToManyAnnotation
+public abstract class BinaryOneToManyAnnotation
extends BinaryRelationshipMappingAnnotation
implements OneToManyAnnotation
{
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
index a36c7bf..e0571d6 100644
--- 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
@@ -19,7 +19,7 @@
/**
* javax.persistence.OneToOne
*/
-public final class BinaryOneToOneAnnotation
+public abstract class BinaryOneToOneAnnotation
extends BinaryRelationshipMappingAnnotation
implements OneToOneAnnotation
{
@@ -110,7 +110,7 @@
}
private Boolean buildOptional() {
- return (Boolean) this.getJdtMemberValue(JPA.MANY_TO_ONE__OPTIONAL);
+ return (Boolean) this.getJdtMemberValue(JPA.ONE_TO_ONE__OPTIONAL);
}
public TextRange getOptionalTextRange(CompilationUnit astRoot) {
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
index 388c22f..8e379f9 100644
--- 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
@@ -24,11 +24,11 @@
/**
* javax.persistence.OneToMany
*/
-public final class SourceOneToManyAnnotation
+public abstract class SourceOneToManyAnnotation
extends SourceRelationshipMappingAnnotation
implements OneToManyAnnotation
{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+ protected static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
private static final DeclarationAnnotationElementAdapter<String> TARGET_ENTITY_ADAPTER = buildTargetEntityAdapter();
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
index 0beac3a..cf1d474 100644
--- 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
@@ -25,7 +25,7 @@
/**
* javax.persistence.OneToOne
*/
-public final class SourceOneToOneAnnotation
+public abstract class SourceOneToOneAnnotation
extends SourceRelationshipMappingAnnotation
implements OneToOneAnnotation
{
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
index 5cdc49f..db7f070 100644
--- 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
@@ -68,11 +68,11 @@
this.cascadeAdapter = new ShortCircuitArrayAnnotationElementAdapter<String>(attribute, this.cascadeDeclarationAdapter);
}
- AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) {
+ protected AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) {
return new ShortCircuitAnnotationElementAdapter<String>(this.member, daea);
}
- AnnotationElementAdapter<Boolean> buildBooleanAnnotationElementAdapter(DeclarationAnnotationElementAdapter<Boolean> daea) {
+ protected AnnotationElementAdapter<Boolean> buildBooleanAnnotationElementAdapter(DeclarationAnnotationElementAdapter<Boolean> daea) {
return new ShortCircuitAnnotationElementAdapter<Boolean>(this.member, daea);
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/JPA2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/JPA2_0.java
index 3420d17..fe9a80a 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/JPA2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/JPA2_0.java
@@ -19,8 +19,8 @@
* will almost certainly be broken (repeatedly) as the API evolves.
*/
@SuppressWarnings("nls")
-public interface JPA2_0 {
-
+public interface JPA2_0
+{
// JPA package
String PACKAGE = "javax.persistence";
String PACKAGE_ = PACKAGE + '.';
@@ -40,6 +40,10 @@
String SEQUENCE_GENERATOR__CATALOG = "catalog";
String SEQUENCE_GENERATOR__SCHEMA = "schema";
+ String ONE_TO_MANY__ORPHAN_REMOVAL = "orphanRemoval";
+
+ String ONE_TO_ONE__ORPHAN_REMOVAL = "orphanRemoval";
+
String ELEMENT_COLLECTION = PACKAGE_ + "ElementCollection";
String ELEMENT_COLLECTION__FETCH = "fetch";
String ELEMENT_COLLECTION__TARGET_CLASS = "targetClass";
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/OneToMany2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/OneToMany2_0Annotation.java
new file mode 100644
index 0000000..7b3c7e6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/OneToMany2_0Annotation.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+* Copyright (c) 2009 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.core.jpa2.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
+import org.eclipse.jpt.core.utility.TextRange;
+
+/**
+ * OneToMany2_0Annotation
+ */
+public interface OneToMany2_0Annotation
+ extends OneToManyAnnotation
+{
+ // ********** orphan removal **********
+ /**
+ * Corresponds to the orphanRemoval element of the OneToMany annotation.
+ * Returns null if the orphanRemoval element does not exist in java.
+ */
+ Boolean getOrphanRemoval();
+
+ /**
+ * Corresponds to the orphanRemoval element of the OneToMany annotation.
+ * Set to null to remove the orphanRemoval element.
+ */
+ void setOrphanRemoval(Boolean orphanRemoval);
+ String ORPHAN_REMOVAL_PROPERTY = "orphanRemoval"; //$NON-NLS-1$
+
+ /**
+ * Return the {@link TextRange} for the orphanRemoval element. If the orphanRemoval element
+ * does not exist return the {@link TextRange} for the OneToMany annotation.
+ */
+ TextRange getOrphanRemovalTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/OneToOne2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/OneToOne2_0Annotation.java
new file mode 100644
index 0000000..70a0ac5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/OneToOne2_0Annotation.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+* Copyright (c) 2009 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.core.jpa2.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
+import org.eclipse.jpt.core.utility.TextRange;
+
+/**
+ * OneToOne2_0Annotation
+ */
+public interface OneToOne2_0Annotation
+ extends OneToOneAnnotation
+{
+ // ********** orphan removal **********
+ /**
+ * Corresponds to the orphanRemoval element of the OneToMany annotation.
+ * Returns null if the orphanRemoval element does not exist in java.
+ */
+ Boolean getOrphanRemoval();
+
+ /**
+ * Corresponds to the orphanRemoval element of the OneToMany annotation.
+ * Set to null to remove the orphanRemoval element.
+ */
+ void setOrphanRemoval(Boolean orphanRemoval);
+ String ORPHAN_REMOVAL_PROPERTY = "orphanRemoval"; //$NON-NLS-1$
+
+ /**
+ * Return the {@link TextRange} for the orphanRemoval element. If the orphanRemoval element
+ * does not exist return the {@link TextRange} for the OneToMany annotation.
+ */
+ TextRange getOrphanRemovalTextRange(CompilationUnit astRoot);
+
+}