diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java')
154 files changed, 1019 insertions, 4091 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractAnnotationResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractAnnotationResource.java index 34ee901217..d4b6c1fdc9 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractAnnotationResource.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractAnnotationResource.java @@ -10,11 +10,13 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; public abstract class AbstractAnnotationResource<E extends Member> extends AbstractMemberResource<E> implements Annotation @@ -23,13 +25,13 @@ public abstract class AbstractAnnotationResource<E extends Member> extends Abstr private final AnnotationAdapter annotationAdapter; - protected AbstractAnnotationResource(JavaResource parent, E member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { + protected AbstractAnnotationResource(JavaResourceNode parent, E member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { super(parent, member); this.daa = daa; this.annotationAdapter = annotationAdapter; } - protected AbstractAnnotationResource(JavaResource parent, E member, DeclarationAnnotationAdapter daa) { + protected AbstractAnnotationResource(JavaResourceNode parent, E member, DeclarationAnnotationAdapter daa) { this(parent, member, daa, new MemberAnnotationAdapter(member, daa)); } @@ -54,7 +56,7 @@ public abstract class AbstractAnnotationResource<E extends Member> extends Abstr getAnnotationAdapter().newMarkerAnnotation(); } - public ITextRange textRange(CompilationUnit astRoot) { + public TextRange textRange(CompilationUnit astRoot) { return getMember().annotationTextRange(this.daa, astRoot); } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractColumn.java deleted file mode 100644 index 11770dfe3c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractColumn.java +++ /dev/null @@ -1,121 +0,0 @@ - /******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - - -public interface AbstractColumn extends NamedColumn -{ - - /** - * Corresponds to the unique element of the *Column annotation. - * Returns null if the unique valuePair does not exist in the annotation - */ - Boolean getUnique(); - - /** - * Corresponds to the unique element of the *Column annotation. - * Set to null to remove the unique valuePair from the annotation - */ - void setUnique(Boolean unique); - String UNIQUE_PROPERTY = "uniqueProperty"; - - /** - * Corresponds to the nullable element of the *Column annotation. - * Returns null if the nullable valuePair does not exist in the annotation - */ - Boolean getNullable(); - - /** - * Corresponds to the nullable element of the *Column annotation. - * Set to null to remove the nullable valuePair from the annotation - */ - void setNullable(Boolean nullable); - String NULLABLE_PROPERTY = "nullableProperty"; - - /** - * Corresponds to the insertable element of the *Column annotation. - * Returns null if the insertable valuePair does not exist in the annotation - */ - Boolean getInsertable(); - - /** - * Corresponds to the insertable element of the *Column annotation. - * Set to null to remove the insertable valuePair from the annotation - */ - void setInsertable(Boolean insertable); - String INSERTABLE_PROPERTY = "insertableProperty"; - - /** - * Corresponds to the updatable element of the *Column annotation. - * Returns null if the updatable valuePair does not exist in the annotation - */ - Boolean getUpdatable(); - - /** - * Corresponds to the updatable element of the *Column annotation. - * Set to null to remove the updatable valuePair from the annotation - */ - void setUpdatable(Boolean updatable); - String UPDATABLE_PROPERTY = "updatableProperty"; - - /** - * Corresponds to the table element of the *Column annotation. - * Returns null if the table valuePair does not exist in the annotation - */ - String getTable(); - - /** - * Corresponds to the table element of the *Column annotation. - * Set to null to remove the table valuePair from the annotation - */ - void setTable(String table); - String TABLE_PROPERTY = "tableProperty"; - - - /** - * Return the ITextRange for the unique element. If the unique element - * does not exist return the ITextRange for the *Column annotation. - */ - ITextRange uniqueTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the nullable element. If the nullable element - * does not exist return the ITextRange for the *Column annotation. - */ - ITextRange nullableTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the insertable element. If the insertable element - * does not exist return the ITextRange for the *Column annotation. - */ - ITextRange insertableTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the updatable element. If the updatable element - * does not exist return the ITextRange for the *Column annotation. - */ - ITextRange updatableTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the table element. If the table element - * does not exist return the ITextRange for the *Column annotation. - */ - ITextRange tableTextRange(CompilationUnit astRoot); - - /** - * Return whether the specified postition touches the table element. - * Return false if the table element does not exist. - */ - boolean tableTouches(int pos, CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractColumnImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractColumnImpl.java index ffbf8f9373..95dd653eab 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractColumnImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractColumnImpl.java @@ -10,15 +10,18 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.AbstractColumnAnnotation; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.NestableAnnotation; -public abstract class AbstractColumnImpl extends AbstractNamedColumn implements AbstractColumn +public abstract class AbstractColumnImpl extends AbstractNamedColumn implements AbstractColumnAnnotation { // hold this so we can get the 'table' text range private final DeclarationAnnotationElementAdapter<String> tableDeclarationAdapter; @@ -52,11 +55,11 @@ public abstract class AbstractColumnImpl extends AbstractNamedColumn implements private Boolean updatable; - public AbstractColumnImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa) { + public AbstractColumnImpl(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) { this(parent, member, daa, new MemberAnnotationAdapter(member, daa)); } - public AbstractColumnImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { + public AbstractColumnImpl(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { super(parent, member, daa, annotationAdapter); this.tableDeclarationAdapter = this.buildStringElementAdapter(this.tableElementName()); this.tableAdapter = this.buildShortCircuitElementAdapter(this.tableDeclarationAdapter); @@ -93,7 +96,7 @@ public abstract class AbstractColumnImpl extends AbstractNamedColumn implements @Override public void initializeFrom(NestableAnnotation oldAnnotation) { super.initializeFrom(oldAnnotation); - AbstractColumn oldColumn = (AbstractColumn) oldAnnotation; + AbstractColumnAnnotation oldColumn = (AbstractColumnAnnotation) oldAnnotation; setTable(oldColumn.getTable()); setUnique(oldColumn.getUnique()); setNullable(oldColumn.getNullable()); @@ -157,23 +160,23 @@ public abstract class AbstractColumnImpl extends AbstractNamedColumn implements firePropertyChanged(UPDATABLE_PROPERTY, oldUpdatable, newUpdatable); } - public ITextRange nullableTextRange(CompilationUnit astRoot) { + public TextRange nullableTextRange(CompilationUnit astRoot) { return this.elementTextRange(this.nullableDeclarationAdapter, astRoot); } - public ITextRange insertableTextRange(CompilationUnit astRoot) { + public TextRange insertableTextRange(CompilationUnit astRoot) { return this.elementTextRange(this.insertableDeclarationAdapter, astRoot); } - public ITextRange uniqueTextRange(CompilationUnit astRoot) { + public TextRange uniqueTextRange(CompilationUnit astRoot) { return this.elementTextRange(this.uniqueDeclarationAdapter, astRoot); } - public ITextRange updatableTextRange(CompilationUnit astRoot) { + public TextRange updatableTextRange(CompilationUnit astRoot) { return this.elementTextRange(this.updatableDeclarationAdapter, astRoot); } - public ITextRange tableTextRange(CompilationUnit astRoot) { + public TextRange tableTextRange(CompilationUnit astRoot) { return this.elementTextRange(this.tableDeclarationAdapter, astRoot); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractJavaPersistentResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractJavaPersistentResource.java index b038145114..1bb8b7e4da 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractJavaPersistentResource.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractJavaPersistentResource.java @@ -19,16 +19,21 @@ 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.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; import org.eclipse.jpt.core.internal.jdtutility.Member; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.ContainerAnnotation; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.NestableAnnotation; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.CloneIterator; import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator; import org.eclipse.jpt.utility.internal.iterators.SingleElementListIterator; public abstract class AbstractJavaPersistentResource<E extends Member> extends AbstractMemberResource<E> - implements JavaPersistentResource + implements JavaResourcePersistentMember { /** * stores all annotations(non-mapping) except duplicates, java compiler has an error for duplicates @@ -42,7 +47,7 @@ public abstract class AbstractJavaPersistentResource<E extends Member> extends A private boolean persistable; - public AbstractJavaPersistentResource(JavaResource parent, E member){ + public AbstractJavaPersistentResource(JavaResourceNode parent, E member){ super(parent, member); this.annotations = new ArrayList<Annotation>(); this.mappingAnnotations = new ArrayList<Annotation>(); @@ -128,7 +133,7 @@ public abstract class AbstractJavaPersistentResource<E extends Member> extends A return null; } - public JavaResource nonNullAnnotation(String annotationName) { + public JavaResourceNode nonNullAnnotation(String annotationName) { Annotation annotation = annotation(annotationName); if (annotation == null) { return buildNullAnnotation(annotationName); @@ -146,7 +151,7 @@ public abstract class AbstractJavaPersistentResource<E extends Member> extends A return null; } - public JavaResource nonNullMappingAnnotation(String annotationName) { + public JavaResourceNode nonNullMappingAnnotation(String annotationName) { Annotation annotation = mappingAnnotation(annotationName); if (annotation == null) { return buildNullMappingAnnotation(annotationName); @@ -498,15 +503,15 @@ public abstract class AbstractJavaPersistentResource<E extends Member> extends A } - public ITextRange fullTextRange(CompilationUnit astRoot) { + public TextRange fullTextRange(CompilationUnit astRoot) { return this.getMember().textRange(astRoot); } - public ITextRange textRange(CompilationUnit astRoot) { + public TextRange textRange(CompilationUnit astRoot) { return this.fullTextRange(astRoot); } - public ITextRange nameTextRange(CompilationUnit astRoot) { + public TextRange nameTextRange(CompilationUnit astRoot) { return this.getMember().nameTextRange(astRoot); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractMemberResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractMemberResource.java index 7eebdbae71..dedc0e8430 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractMemberResource.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractMemberResource.java @@ -11,16 +11,17 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; public abstract class AbstractMemberResource<E extends Member> extends AbstractResource { private final E member; - protected AbstractMemberResource(JavaResource parent, E member) { + protected AbstractMemberResource(JavaResourceNode parent, E member) { super(parent); this.member = member; } @@ -30,7 +31,7 @@ public abstract class AbstractMemberResource<E extends Member> extends AbstractR return this.member; } - protected ITextRange elementTextRange(DeclarationAnnotationElementAdapter<?> elementAdapter, CompilationUnit astRoot) { + protected TextRange elementTextRange(DeclarationAnnotationElementAdapter<?> elementAdapter, CompilationUnit astRoot) { return this.elementTextRange(this.member.annotationElementTextRange(elementAdapter, astRoot), astRoot); } @@ -39,7 +40,7 @@ public abstract class AbstractMemberResource<E extends Member> extends AbstractR * return the Java object's text range instead (which is usually the * annotation's text range). */ - protected ITextRange elementTextRange(ITextRange elementTextRange, CompilationUnit astRoot) { + protected TextRange elementTextRange(TextRange elementTextRange, CompilationUnit astRoot) { return (elementTextRange != null) ? elementTextRange : this.textRange(astRoot); } @@ -55,7 +56,7 @@ public abstract class AbstractMemberResource<E extends Member> extends AbstractR * Convenience method. Return whether element's text range is not * null (meaning the element exists) and the specified position touches it. */ - protected boolean elementTouches(ITextRange elementTextRange, int pos) { + protected boolean elementTouches(TextRange elementTextRange, int pos) { return (elementTextRange != null) && elementTextRange.touches(pos); } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractNamedColumn.java index c51023c023..aea450deb1 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractNamedColumn.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractNamedColumn.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.BooleanExpressionConverter; @@ -20,8 +20,11 @@ import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdap import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.NumberIntegerExpressionConverter; import org.eclipse.jpt.core.internal.jdtutility.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; -public abstract class AbstractNamedColumn extends AbstractAnnotationResource<Member> implements NamedColumn +public abstract class AbstractNamedColumn extends AbstractAnnotationResource<Member> implements NamedColumnAnnotation { // hold this so we can get the 'name' text range private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter; @@ -36,7 +39,7 @@ public abstract class AbstractNamedColumn extends AbstractAnnotationResource<Mem private String name; private String columnDefinition; - public AbstractNamedColumn(JavaResource parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { + public AbstractNamedColumn(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { super(parent, member, daa, annotationAdapter); this.nameDeclarationAdapter = this.buildStringElementAdapter(this.nameElementName()); this.nameAdapter = this.buildShortCircuitElementAdapter(this.nameDeclarationAdapter); @@ -81,7 +84,7 @@ public abstract class AbstractNamedColumn extends AbstractAnnotationResource<Mem } public void initializeFrom(NestableAnnotation oldAnnotation) { - NamedColumn oldColumn = (NamedColumn) oldAnnotation; + NamedColumnAnnotation oldColumn = (NamedColumnAnnotation) oldAnnotation; setName(oldColumn.getName()); setColumnDefinition(oldColumn.getColumnDefinition()); } @@ -109,11 +112,11 @@ public abstract class AbstractNamedColumn extends AbstractAnnotationResource<Mem firePropertyChanged(COLUMN_DEFINITION_PROPERTY, oldColumnDefinition, newColumnDefinition); } - public ITextRange nameTextRange(CompilationUnit astRoot) { + public TextRange nameTextRange(CompilationUnit astRoot) { return this.elementTextRange(this.nameDeclarationAdapter, astRoot); } - public ITextRange columnDefinitionTextRange(CompilationUnit astRoot) { + public TextRange columnDefinitionTextRange(CompilationUnit astRoot) { return this.elementTextRange(this.columnDefinitionDeclarationAdapter, astRoot); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractNamedQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractNamedQuery.java index 7f38a83ed6..783e8fa66f 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractNamedQuery.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractNamedQuery.java @@ -14,7 +14,7 @@ import java.util.List; import java.util.ListIterator; import org.eclipse.jdt.core.dom.Annotation; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter; @@ -23,11 +23,18 @@ import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdap import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Type; +import org.eclipse.jpt.core.resource.java.ContainerAnnotation; +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.NestableQueryHint; +import org.eclipse.jpt.core.resource.java.QueryAnnotation; +import org.eclipse.jpt.core.resource.java.QueryHintAnnotation; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; public abstract class AbstractNamedQuery extends AbstractAnnotationResource<Type> - implements Query + implements QueryAnnotation { // hold this so we can get the 'name' text range private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter; @@ -46,7 +53,7 @@ public abstract class AbstractNamedQuery extends AbstractAnnotationResource<Type private final List<NestableQueryHint> hints; private final HintsContainerAnnotation hintsContainerAnnotation; - protected AbstractNamedQuery(JavaResource parent, Type type,DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { + protected AbstractNamedQuery(JavaResourceNode parent, Type type,DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { super(parent, type, daa, annotationAdapter); this.nameDeclarationAdapter = nameAdapter(daa); this.queryDeclarationAdapter = queryAdapter(daa); @@ -102,8 +109,8 @@ public abstract class AbstractNamedQuery extends AbstractAnnotationResource<Type firePropertyChanged(QUERY_PROPERTY, oldQuery, newQuery); } - public ListIterator<QueryHint> hints() { - return new CloneListIterator<QueryHint>(this.hints); + public ListIterator<QueryHintAnnotation> hints() { + return new CloneListIterator<QueryHintAnnotation>(this.hints); } public int hintsSize() { @@ -114,13 +121,13 @@ public abstract class AbstractNamedQuery extends AbstractAnnotationResource<Type return this.hints.get(index); } - public int indexOfHint(QueryHint queryHint) { + public int indexOfHint(QueryHintAnnotation queryHint) { return this.hints.indexOf(queryHint); } public NestableQueryHint addHint(int index) { NestableQueryHint queryHint = (NestableQueryHint) ContainerAnnotationTools.addNestedAnnotation(index, this.hintsContainerAnnotation); - fireItemAdded(Query.HINTS_LIST, index, queryHint); + fireItemAdded(QueryAnnotation.HINTS_LIST, index, queryHint); return queryHint; } @@ -142,18 +149,18 @@ public abstract class AbstractNamedQuery extends AbstractAnnotationResource<Type public void moveHint(int targetIndex, int sourceIndex) { moveHintInternal(targetIndex, sourceIndex); ContainerAnnotationTools.synchAnnotationsAfterMove(targetIndex, sourceIndex, this.hintsContainerAnnotation); - fireItemMoved(Query.HINTS_LIST, targetIndex, sourceIndex); + fireItemMoved(QueryAnnotation.HINTS_LIST, targetIndex, sourceIndex); } protected void moveHintInternal(int targetIndex, int sourceIndex) { CollectionTools.move(this.hints, targetIndex, sourceIndex); } - public ITextRange nameTextRange(CompilationUnit astRoot) { + public TextRange nameTextRange(CompilationUnit astRoot) { return this.elementTextRange(this.nameDeclarationAdapter, astRoot); } - public ITextRange queryTextRange(CompilationUnit astRoot) { + public TextRange queryTextRange(CompilationUnit astRoot) { return this.elementTextRange(this.queryDeclarationAdapter, astRoot); } @@ -190,7 +197,7 @@ public abstract class AbstractNamedQuery extends AbstractAnnotationResource<Type AbstractNamedQuery oldNamedQuery = (AbstractNamedQuery) oldAnnotation; setName(oldNamedQuery.getName()); setQuery(oldNamedQuery.getQuery()); - for (QueryHint queryHint : CollectionTools.iterable(oldNamedQuery.hints())) { + for (QueryHintAnnotation queryHint : CollectionTools.iterable(oldNamedQuery.hints())) { NestableQueryHint newQueryHint = addHint(oldNamedQuery.indexOfHint(queryHint)); newQueryHint.initializeFrom((NestableQueryHint) queryHint); } @@ -284,7 +291,7 @@ public abstract class AbstractNamedQuery extends AbstractAnnotationResource<Type AbstractNamedQuery.this.updateFromJava(astRoot); } - public ITextRange textRange(CompilationUnit astRoot) { + public TextRange textRange(CompilationUnit astRoot) { return AbstractNamedQuery.this.textRange(astRoot); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractRelationshipMappingAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractRelationshipMappingAnnotation.java index 277816a4f3..72e72099ac 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractRelationshipMappingAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractRelationshipMappingAnnotation.java @@ -11,7 +11,7 @@ package org.eclipse.jpt.core.internal.resource.java; import java.util.List; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Attribute; import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter; @@ -24,10 +24,14 @@ import org.eclipse.jpt.core.internal.jdtutility.JDTTools; import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitArrayAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.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.utility.internal.CollectionTools; -public abstract class AbstractRelationshipMappingAnnotation extends AbstractAnnotationResource<Attribute> implements RelationshipMapping +public abstract class AbstractRelationshipMappingAnnotation extends AbstractAnnotationResource<Attribute> implements RelationshipMappingAnnotation { // hold this so we can get the 'targetEntity' text range private final DeclarationAnnotationElementAdapter<String> targetEntityDeclarationAdapter; @@ -52,7 +56,7 @@ public abstract class AbstractRelationshipMappingAnnotation extends AbstractAnno private CascadeType[] cascadeTypes; - public AbstractRelationshipMappingAnnotation(JavaPersistentAttributeResource parent, Attribute attribute, DeclarationAnnotationAdapter daa) { + public AbstractRelationshipMappingAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute, DeclarationAnnotationAdapter daa) { super(parent, attribute, daa); this.targetEntityDeclarationAdapter = targetEntityAdapter(); this.targetEntityAdapter = buildAnnotationElementAdapter(this.targetEntityDeclarationAdapter); @@ -212,15 +216,15 @@ public abstract class AbstractRelationshipMappingAnnotation extends AbstractAnno } } - public ITextRange targetEntityTextRange(CompilationUnit astRoot) { + public TextRange targetEntityTextRange(CompilationUnit astRoot) { return elementTextRange(this.targetEntityDeclarationAdapter, astRoot); } - public ITextRange fetchTextRange(CompilationUnit astRoot) { + public TextRange fetchTextRange(CompilationUnit astRoot) { return elementTextRange(this.fetchDeclarationAdapter, astRoot); } - public ITextRange cascadeTextRange(CompilationUnit astRoot) { + public TextRange cascadeTextRange(CompilationUnit astRoot) { return elementTextRange(this.cascadeDeclarationAdapter, astRoot); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractResource.java index bb1cfbab61..d876f0761c 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractResource.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractResource.java @@ -10,16 +10,17 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.IJpaAnnotationProvider; +import org.eclipse.jpt.core.JpaAnnotationProvider; import org.eclipse.jpt.core.internal.jdtutility.AnnotationEditFormatter; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; import org.eclipse.jpt.utility.internal.CommandExecutorProvider; import org.eclipse.jpt.utility.internal.node.AbstractNode; import org.eclipse.jpt.utility.internal.node.Node; public abstract class AbstractResource extends AbstractNode - implements JavaResource + implements JavaResourceNode { - protected AbstractResource(JavaResource parent) { + protected AbstractResource(JavaResourceNode parent) { super(parent); } @@ -27,8 +28,8 @@ public abstract class AbstractResource extends AbstractNode // **************** overrides ********************************************** @Override - public JavaResource parent() { - return (JavaResource) super.parent(); + public JavaResourceNode parent() { + return (JavaResourceNode) super.parent(); } @Override @@ -39,7 +40,7 @@ public abstract class AbstractResource extends AbstractNode // **************** JavaResource implementation **************************** - public IJpaAnnotationProvider annotationProvider() { + public JpaAnnotationProvider annotationProvider() { return root().annotationProvider(); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractTableResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractTableResource.java index f824448582..97abb42c05 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractTableResource.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractTableResource.java @@ -14,17 +14,23 @@ import java.util.List; import java.util.ListIterator; import org.eclipse.jdt.core.dom.Annotation; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter; +import org.eclipse.jpt.core.resource.java.ContainerAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.NestableUniqueConstraint; +import org.eclipse.jpt.core.resource.java.TableAnnotation; +import org.eclipse.jpt.core.resource.java.UniqueConstraint; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; -public abstract class AbstractTableResource extends AbstractAnnotationResource<Member> implements Table +public abstract class AbstractTableResource extends AbstractAnnotationResource<Member> implements TableAnnotation { // hold this so we can get the 'name' text range private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter; @@ -51,7 +57,7 @@ public abstract class AbstractTableResource extends AbstractAnnotationResource<M private final UniqueConstraintsContainerAnnotation uniqueConstraintsContainerAnnotation; - protected AbstractTableResource(JavaResource parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { + protected AbstractTableResource(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { super(parent, member, daa, annotationAdapter); this.nameDeclarationAdapter = this.nameAdapter(daa); this.schemaDeclarationAdapter = this.schemaAdapter(daa); @@ -141,7 +147,7 @@ public abstract class AbstractTableResource extends AbstractAnnotationResource<M public NestableUniqueConstraint addUniqueConstraint(int index) { NestableUniqueConstraint uniqueConstraint = (NestableUniqueConstraint) ContainerAnnotationTools.addNestedAnnotation(index, this.uniqueConstraintsContainerAnnotation); - fireItemAdded(Table.UNIQUE_CONSTRAINTS_LIST, index, uniqueConstraint); + fireItemAdded(TableAnnotation.UNIQUE_CONSTRAINTS_LIST, index, uniqueConstraint); return uniqueConstraint; } @@ -163,7 +169,7 @@ public abstract class AbstractTableResource extends AbstractAnnotationResource<M public void moveUniqueConstraint(int targetIndex, int sourceIndex) { moveUniqueConstraintInternal(targetIndex, sourceIndex); ContainerAnnotationTools.synchAnnotationsAfterMove(targetIndex, sourceIndex, this.uniqueConstraintsContainerAnnotation); - fireItemMoved(Table.UNIQUE_CONSTRAINTS_LIST, targetIndex, sourceIndex); + fireItemMoved(TableAnnotation.UNIQUE_CONSTRAINTS_LIST, targetIndex, sourceIndex); } protected void moveUniqueConstraintInternal(int targetIndex, int sourceIndex) { @@ -172,15 +178,15 @@ public abstract class AbstractTableResource extends AbstractAnnotationResource<M protected abstract NestableUniqueConstraint createUniqueConstraint(int index); - public ITextRange nameTextRange(CompilationUnit astRoot) { + public TextRange nameTextRange(CompilationUnit astRoot) { return elementTextRange(this.nameDeclarationAdapter, astRoot); } - public ITextRange schemaTextRange(CompilationUnit astRoot) { + public TextRange schemaTextRange(CompilationUnit astRoot) { return elementTextRange(this.schemaDeclarationAdapter, astRoot); } - public ITextRange catalogTextRange(CompilationUnit astRoot) { + public TextRange catalogTextRange(CompilationUnit astRoot) { return elementTextRange(this.catalogDeclarationAdapter, astRoot); } @@ -312,7 +318,7 @@ public abstract class AbstractTableResource extends AbstractAnnotationResource<M AbstractTableResource.this.updateFromJava(astRoot); } - public ITextRange textRange(CompilationUnit astRoot) { + public TextRange textRange(CompilationUnit astRoot) { return AbstractTableResource.this.textRange(astRoot); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AccessType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AccessType.java deleted file mode 100644 index 0ce01c1820..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AccessType.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - - -public enum AccessType { - - PROPERTY, - FIELD; - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Annotation.java deleted file mode 100644 index 627404890f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Annotation.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; - -public interface Annotation extends JavaResource -{ - /** - * Return the fully qualified annotation name. - * @see JPA - */ - String getAnnotationName(); - - org.eclipse.jdt.core.dom.Annotation jdtAnnotation(CompilationUnit astRoot); - - /** - * Removing the underyling Java annotation - */ - void removeAnnotation(); - - /** - * Create and add Java annotation - */ - void newAnnotation(); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AnnotationDefinition.java deleted file mode 100644 index 37fbc7c1f8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AnnotationDefinition.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jpt.core.internal.jdtutility.Member; -import org.eclipse.jpt.core.internal.platform.base.BaseJpaPlatform; - -/** - * Used for building new Annotations. - * These should be used to define non-mapping annotations. If you - * want to provide new AnnotationDefinitions you will need - * to create a new JpaPlatform by extending BaseJpaPlatform. - * - * @see MappingAnnotation - * @see BaseJpaPlatform - */ -public interface AnnotationDefinition -{ - /** - * Return the fully qualified annotation name - */ - String getAnnotationName(); - - /** - * Build and return an Annotation given the Member - */ - Annotation buildAnnotation(JavaPersistentResource parent, Member member); - - Annotation buildNullAnnotation(JavaPersistentResource parent, Member member); -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverride.java deleted file mode 100644 index 0bb5487ecb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverride.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import java.util.ListIterator; - -/** - * Corresponds to the javax.persistence.AssociationOverride annotation - */ -public interface AssociationOverride extends OverrideResource -{ - String ANNOTATION_NAME = JPA.ASSOCIATION_OVERRIDE; - - - /** - * Corresponds to the joinColumns element of the AssociationOverride annotation. - * Returns an empty iterator if the joinColumns element does not exist in java. - */ - ListIterator<JoinColumn> joinColumns(); - - JoinColumn joinColumnAt(int index); - - int indexOfJoinColumn(JoinColumn joinColumn); - - int joinColumnsSize(); - - JoinColumn addJoinColumn(int index); - - void removeJoinColumn(int index); - - void moveJoinColumn(int targetIndex, int sourceIndex); - - String JOIN_COLUMNS_LIST = "joinColumnsList"; -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrideImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrideImpl.java index 794eeabfbb..d28771199a 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrideImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrideImpl.java @@ -13,7 +13,7 @@ import java.util.ArrayList; import java.util.List; import java.util.ListIterator; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter; @@ -23,6 +23,17 @@ import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +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.ContainerAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +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.NestableAssociationOverride; +import org.eclipse.jpt.core.resource.java.NestableJoinColumn; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; @@ -36,7 +47,7 @@ public class AssociationOverrideImpl private final JoinColumnsContainerAnnotation joinColumnsContainerAnnotation; - protected AssociationOverrideImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { + protected AssociationOverrideImpl(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { super(parent, member, daa, annotationAdapter); this.joinColumns = new ArrayList<NestableJoinColumn>(); this.joinColumnsContainerAnnotation = new JoinColumnsContainerAnnotation(); @@ -49,14 +60,14 @@ public class AssociationOverrideImpl } public String getAnnotationName() { - return AssociationOverride.ANNOTATION_NAME; + return AssociationOverrideAnnotation.ANNOTATION_NAME; } @Override public void initializeFrom(NestableAnnotation oldAnnotation) { super.initializeFrom(oldAnnotation); - AssociationOverride oldAssociationOverride = (AssociationOverride) oldAnnotation; - for (JoinColumn joinColumn : CollectionTools.iterable(oldAssociationOverride.joinColumns())) { + AssociationOverrideAnnotation oldAssociationOverride = (AssociationOverrideAnnotation) oldAnnotation; + for (JoinColumnAnnotation joinColumn : CollectionTools.iterable(oldAssociationOverride.joinColumns())) { NestableJoinColumn newJoinColumn = addJoinColumn(oldAssociationOverride.indexOfJoinColumn(joinColumn)); newJoinColumn.initializeFrom((NestableAnnotation) joinColumn); } @@ -65,8 +76,8 @@ public class AssociationOverrideImpl // ************* Association implementation ******************* - public ListIterator<JoinColumn> joinColumns() { - return new CloneListIterator<JoinColumn>(this.joinColumns); + public ListIterator<JoinColumnAnnotation> joinColumns() { + return new CloneListIterator<JoinColumnAnnotation>(this.joinColumns); } public int joinColumnsSize() { @@ -77,18 +88,18 @@ public class AssociationOverrideImpl return this.joinColumns.get(index); } - public int indexOfJoinColumn(JoinColumn joinColumn) { + public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) { return this.joinColumns.indexOf(joinColumn); } public NestableJoinColumn addJoinColumn(int index) { NestableJoinColumn joinColumn = (NestableJoinColumn) ContainerAnnotationTools.addNestedAnnotation(index, this.joinColumnsContainerAnnotation); - fireItemAdded(AssociationOverride.JOIN_COLUMNS_LIST, index, joinColumn); + fireItemAdded(AssociationOverrideAnnotation.JOIN_COLUMNS_LIST, index, joinColumn); return joinColumn; } private void addJoinColumn(int index, NestableJoinColumn joinColumn) { - addItemToList(index, joinColumn, this.joinColumns, AssociationOverride.JOIN_COLUMNS_LIST); + addItemToList(index, joinColumn, this.joinColumns, AssociationOverrideAnnotation.JOIN_COLUMNS_LIST); } public void removeJoinColumn(int index) { @@ -99,13 +110,13 @@ public class AssociationOverrideImpl } private void removeJoinColumn(NestableJoinColumn joinColumn) { - removeItemFromList(joinColumn, this.joinColumns, AssociationOverride.JOIN_COLUMNS_LIST); + removeItemFromList(joinColumn, this.joinColumns, AssociationOverrideAnnotation.JOIN_COLUMNS_LIST); } public void moveJoinColumn(int targetIndex, int sourceIndex) { moveJoinColumnInternal(targetIndex, sourceIndex); ContainerAnnotationTools.synchAnnotationsAfterMove(targetIndex, sourceIndex, this.joinColumnsContainerAnnotation); - fireItemMoved(AssociationOverride.JOIN_COLUMNS_LIST, targetIndex, sourceIndex); + fireItemMoved(AssociationOverrideAnnotation.JOIN_COLUMNS_LIST, targetIndex, sourceIndex); } protected void moveJoinColumnInternal(int targetIndex, int sourceIndex) { @@ -128,11 +139,11 @@ public class AssociationOverrideImpl // ********** static methods ********** - static AssociationOverrideImpl createAssociationOverride(JavaResource parent, Member member) { + static AssociationOverrideImpl createAssociationOverride(JavaResourceNode parent, Member member) { return new AssociationOverrideImpl(parent, member, DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER)); } - static AssociationOverrideImpl createNestedAssociationOverride(JavaResource parent, Member member, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) { + static AssociationOverrideImpl createNestedAssociationOverride(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) { IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter); IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(member, idaa); return new AssociationOverrideImpl(parent, member, idaa, annotationAdapter); @@ -230,7 +241,7 @@ public class AssociationOverrideImpl AssociationOverrideImpl.this.updateFromJava(astRoot); } - public ITextRange textRange(CompilationUnit astRoot) { + public TextRange textRange(CompilationUnit astRoot) { return AssociationOverrideImpl.this.textRange(astRoot); } @@ -259,16 +270,16 @@ public class AssociationOverrideImpl super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return AssociationOverrideImpl.createAssociationOverride(parent, member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } public String getAnnotationName() { - return AssociationOverride.ANNOTATION_NAME; + return AssociationOverrideAnnotation.ANNOTATION_NAME; } } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrides.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrides.java deleted file mode 100644 index 117958ddf5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrides.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - - -public interface AssociationOverrides extends ContainerAnnotation<NestableAssociationOverride> -{ - String ANNOTATION_NAME = JPA.ASSOCIATION_OVERRIDES; - - String ASSOCIATION_OVERRIDES_LIST = "associationOveridesList"; -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverridesImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverridesImpl.java index b64986b18a..721bc69823 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverridesImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverridesImpl.java @@ -17,6 +17,12 @@ import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation; +import org.eclipse.jpt.core.resource.java.AssociationOverrides; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.NestableAssociationOverride; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; @@ -26,7 +32,7 @@ public class AssociationOverridesImpl extends AbstractAnnotationResource<Member> protected final List<NestableAssociationOverride> associationOverrides; - protected AssociationOverridesImpl(JavaResource parent, Member member) { + protected AssociationOverridesImpl(JavaResourceNode parent, Member member) { super(parent, member, DECLARATION_ANNOTATION_ADAPTER); this.associationOverrides = new ArrayList<NestableAssociationOverride>(); } @@ -40,7 +46,7 @@ public class AssociationOverridesImpl extends AbstractAnnotationResource<Member> } public String getNestableAnnotationName() { - return AssociationOverride.ANNOTATION_NAME; + return AssociationOverrideAnnotation.ANNOTATION_NAME; } public ListIterator<NestableAssociationOverride> nestedAnnotations() { @@ -131,11 +137,11 @@ public class AssociationOverridesImpl extends AbstractAnnotationResource<Member> super(); } - public AssociationOverrides buildAnnotation(JavaPersistentResource parent, Member member) { + public AssociationOverrides buildAnnotation(JavaResourcePersistentMember parent, Member member) { return new AssociationOverridesImpl(parent, member); } - public AssociationOverrides buildNullAnnotation(JavaPersistentResource parent, Member member) { + public AssociationOverrides buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverride.java deleted file mode 100644 index 87075273ec..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverride.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - - -/** - * Corresponds to the javax.persistence.AttributeOverride annotation - */ -public interface AttributeOverride extends OverrideResource -{ - String ANNOTATION_NAME = JPA.ATTRIBUTE_OVERRIDE; - - /** - * Corresponds to the column element of the AttributeOverride annotation. - * Returns null if the column element does not exist in java. - */ - Column getColumn(); - - /** - * Add the column element to the AttributeOverride annotation. - */ - Column addColumn(); - - /** - * Remove the column element from the AttributeOverride annotation. - */ - void removeColumn(); - - Column getNonNullColumn(); - - String COLUMN_PROPERTY = "columnProperty"; - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrideImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrideImpl.java index 7a10ffcf88..cde699d023 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrideImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrideImpl.java @@ -19,6 +19,15 @@ import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +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.ColumnAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.NestableAnnotation; +import org.eclipse.jpt.core.resource.java.NestableAttributeOverride; public class AttributeOverrideImpl extends OverrideImpl @@ -31,7 +40,7 @@ public class AttributeOverrideImpl private ColumnImpl column; - protected AttributeOverrideImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { + protected AttributeOverrideImpl(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { super(parent, member, daa, annotationAdapter); this.columnAdapter = new MemberAnnotationAdapter(getMember(), ColumnImpl.buildAttributeOverrideAnnotationAdapter(getDeclarationAnnotationAdapter())); } @@ -46,30 +55,30 @@ public class AttributeOverrideImpl } public String getAnnotationName() { - return AttributeOverride.ANNOTATION_NAME; + return AttributeOverrideAnnotation.ANNOTATION_NAME; } @Override public void initializeFrom(NestableAnnotation oldAnnotation) { super.initializeFrom(oldAnnotation); - AttributeOverride oldAttributeOverride = (AttributeOverride) oldAnnotation; + AttributeOverrideAnnotation oldAttributeOverride = (AttributeOverrideAnnotation) oldAnnotation; if (oldAttributeOverride.getColumn() != null) { - Column column = addColumn(); + ColumnAnnotation column = addColumn(); ((NestableAnnotation) column).initializeFrom((NestableAnnotation) oldAttributeOverride.getColumn()); } } //************ AttriubteOverride implementation **************** - public Column getNonNullColumn() { + public ColumnAnnotation getNonNullColumn() { return (getColumn() != null) ? getColumn() : new NullAttributeOverrideColumn(this); } - public Column getColumn() { + public ColumnAnnotation getColumn() { return this.column; } - public Column addColumn() { + public ColumnAnnotation addColumn() { ColumnImpl column = ColumnImpl.createAttributeOverrideColumn(this, getMember(), getDeclarationAnnotationAdapter()); column.newAnnotation(); setColumn(column); @@ -84,7 +93,7 @@ public class AttributeOverrideImpl protected void setColumn(ColumnImpl newColumn) { ColumnImpl oldColumn = this.column; this.column = newColumn; - firePropertyChanged(AttributeOverride.COLUMN_PROPERTY, oldColumn, newColumn); + firePropertyChanged(AttributeOverrideAnnotation.COLUMN_PROPERTY, oldColumn, newColumn); } @Override @@ -106,11 +115,11 @@ public class AttributeOverrideImpl } // ********** static methods ********** - static AttributeOverrideImpl createAttributeOverride(JavaResource parent, Member member) { + static AttributeOverrideImpl createAttributeOverride(JavaResourceNode parent, Member member) { return new AttributeOverrideImpl(parent, member, DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER)); } - static AttributeOverrideImpl createNestedAttributeOverride(JavaResource parent, Member member, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) { + static AttributeOverrideImpl createNestedAttributeOverride(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) { IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter); IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(member, idaa); return new AttributeOverrideImpl(parent, member, idaa, annotationAdapter); @@ -139,16 +148,16 @@ public class AttributeOverrideImpl super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return AttributeOverrideImpl.createAttributeOverride(parent, member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } public String getAnnotationName() { - return AttributeOverride.ANNOTATION_NAME; + return AttributeOverrideAnnotation.ANNOTATION_NAME; } } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrides.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrides.java deleted file mode 100644 index d39825b3e7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrides.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - - -public interface AttributeOverrides extends ContainerAnnotation<NestableAttributeOverride> -{ - String ANNOTATION_NAME = JPA.ATTRIBUTE_OVERRIDES; - - String ATTRIBUTE_OVERRIDES_LIST = "attributeOverridesList"; -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverridesImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverridesImpl.java index edffdea856..3cd17c2b0f 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverridesImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverridesImpl.java @@ -17,6 +17,12 @@ import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation; +import org.eclipse.jpt.core.resource.java.AttributeOverrides; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.NestableAttributeOverride; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; @@ -26,7 +32,7 @@ public class AttributeOverridesImpl extends AbstractAnnotationResource<Member> i private final List<NestableAttributeOverride> attributesOverrides; - protected AttributeOverridesImpl(JavaResource parent, Member member) { + protected AttributeOverridesImpl(JavaResourceNode parent, Member member) { super(parent, member, DECLARATION_ANNOTATION_ADAPTER); this.attributesOverrides = new ArrayList<NestableAttributeOverride>(); } @@ -40,7 +46,7 @@ public class AttributeOverridesImpl extends AbstractAnnotationResource<Member> i } public String getNestableAnnotationName() { - return AttributeOverride.ANNOTATION_NAME; + return AttributeOverrideAnnotation.ANNOTATION_NAME; } public ListIterator<NestableAttributeOverride> nestedAnnotations() { @@ -132,11 +138,11 @@ public class AttributeOverridesImpl extends AbstractAnnotationResource<Member> i super(); } - public AttributeOverrides buildAnnotation(JavaPersistentResource parent, Member member) { + public AttributeOverrides buildAnnotation(JavaResourcePersistentMember parent, Member member) { return new AttributeOverridesImpl(parent, member); } - public AttributeOverrides buildNullAnnotation(JavaPersistentResource parent, Member member) { + public AttributeOverrides buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Basic.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Basic.java deleted file mode 100644 index 7ca3722186..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Basic.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - - -public interface Basic extends JavaResource -{ - - String ANNOTATION_NAME = JPA.BASIC; - - /** - * Corresponds to the fetch element of the Basic annotation. - * Returns null if the fetch element does not exist in java. - */ - FetchType getFetch(); - - /** - * Corresponds to the fetch element of the Basic annotation. - * Set to null to remove the fetch element. - */ - void setFetch(FetchType fetch); - String FETCH_PROPERTY = "fetchProperty"; - - /** - * Corresponds to the optional element of the Basic annotation. - * Returns null if the optional element does not exist in java. - */ - Boolean getOptional(); - - /** - * Corresponds to the optional element of the Basic annotation. - * Set to null to remove the optional element. - */ - void setOptional(Boolean optional); - String OPTIONAL_PROPERTY = "optionalProperty"; - - /** - * Return the ITextRange for the fetch element. If the fetch element - * does not exist return the ITextRange for the Basic annotation. - */ - ITextRange fetchTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the optional element. If the optional element - * does not exist return the ITextRange for the Basic annotation. - */ - ITextRange optionalTextRange(CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/BasicImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/BasicImpl.java index e20e0af69a..a52582de67 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/BasicImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/BasicImpl.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Attribute; import org.eclipse.jpt.core.internal.jdtutility.BooleanExpressionConverter; @@ -21,6 +21,13 @@ import org.eclipse.jpt.core.internal.jdtutility.EnumDeclarationAnnotationElement import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.Basic; +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.resource.java.JavaResourcePersistentMember; public class BasicImpl extends AbstractAnnotationResource<Attribute> implements Basic @@ -39,7 +46,7 @@ public class BasicImpl extends AbstractAnnotationResource<Attribute> implements private FetchType fetch; - protected BasicImpl(JavaPersistentAttributeResource parent, Attribute attribute) { + protected BasicImpl(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); @@ -77,11 +84,11 @@ public class BasicImpl extends AbstractAnnotationResource<Attribute> implements firePropertyChanged(FETCH_PROPERTY, oldFetch, newFetch); } - public ITextRange fetchTextRange(CompilationUnit astRoot) { + public TextRange fetchTextRange(CompilationUnit astRoot) { return this.elementTextRange(FETCH_ADAPTER, astRoot); } - public ITextRange optionalTextRange(CompilationUnit astRoot) { + public TextRange optionalTextRange(CompilationUnit astRoot) { return this.elementTextRange(OPTIONAL_ADAPTER, astRoot); } @@ -126,11 +133,11 @@ public class BasicImpl extends AbstractAnnotationResource<Attribute> implements super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { - return new BasicImpl((JavaPersistentAttributeResource) parent, (Attribute) member); + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { + return new BasicImpl((JavaResourcePersistentAttribute) parent, (Attribute) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return new NullBasic(parent); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/CascadeType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/CascadeType.java deleted file mode 100644 index ce100d7cc9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/CascadeType.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - - -public enum CascadeType { - - ALL(JPA.CASCADE_TYPE__ALL), - PERSIST(JPA.CASCADE_TYPE__PERSIST), - MERGE(JPA.CASCADE_TYPE__MERGE), - REMOVE(JPA.CASCADE_TYPE__REMOVE), - REFRESH(JPA.CASCADE_TYPE__REFRESH); - - private String javaAnnotationValue; - - CascadeType(String javaAnnotationValue) { - this.javaAnnotationValue = javaAnnotationValue; - } - - public String getJavaAnnotationValue() { - return this.javaAnnotationValue; - } - - public static CascadeType[] fromJavaAnnotationValue(String[] javaAnnotationValues) { - if (javaAnnotationValues == null) { - return new CascadeType[0]; - } - CascadeType[] cascadeTypes = new CascadeType[javaAnnotationValues.length]; - for (int i = 0; i < javaAnnotationValues.length; i++) { - String javaAnnotationValue = javaAnnotationValues[i]; - if (javaAnnotationValue != null) { - cascadeTypes[i] = cascadeType(javaAnnotationValue); - } - } - return cascadeTypes; - } - - private static CascadeType cascadeType(String javaAnnotationValue) { - if (javaAnnotationValue.equals(ALL.getJavaAnnotationValue())) { - return ALL; - } - else if (javaAnnotationValue.equals(PERSIST.getJavaAnnotationValue())) { - return PERSIST; - } - else if (javaAnnotationValue.equals(MERGE.getJavaAnnotationValue())) { - return MERGE; - } - else if (javaAnnotationValue.equals(REMOVE.getJavaAnnotationValue())) { - return REMOVE; - } - else if (javaAnnotationValue.equals(REFRESH.getJavaAnnotationValue())) { - return REFRESH; - } - throw new IllegalArgumentException("Unknown cascade type: " + javaAnnotationValue); - } - - public static String[] toJavaAnnotationValue(CascadeType[] cascadeTypes) { - String[] javaAnnotationValues = new String[cascadeTypes.length]; - for (int i = 0; i < cascadeTypes.length; i++) { - CascadeType cascadeType = cascadeTypes[i]; - javaAnnotationValues[i] = cascadeType.javaAnnotationValue; - } - return javaAnnotationValues; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Column.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Column.java deleted file mode 100644 index 0885748875..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Column.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - - -public interface Column extends AbstractColumn -{ - String ANNOTATION_NAME = JPA.COLUMN; - - /** - * Corresponds to the length element of the javax.persistence.Column annotation. - * Returns null if the length valuePair does not exist in the annotation - */ - Integer getLength(); - - /** - * Corresponds to the length element of the javax.persistence.Column annotation. - * Set to null to remove the length valuePair from the annotation - */ - void setLength(Integer length); - String LENGTH_PROPERTY = "lengthProperty"; - - /** - * Corresponds to the precision element of the javax.persistence.Column annotation. - * Returns null if the precision valuePair does not exist in the annotation - */ - Integer getPrecision(); - - /** - * Corresponds to the precision element of the javax.persistence.Column annotation. - * Set to null to remove the precision valuePair from the annotation - */ - void setPrecision(Integer precision); - String PRECISION_PROPERTY = "precisionProperty"; - - /** - * Corresponds to the scale element of the javax.persistence.Column annotation. - * Returns null if the scale valuePair does not exist in the annotation - */ - Integer getScale(); - - /** - * Corresponds to the scale element of the javax.persistence.Column annotation. - * Set to null to remove the scale valuePair from the annotation - */ - void setScale(Integer scale); - String SCALE_PROPERTY = "scaleProperty"; - - /** - * Return the ITextRange for the length element. If length element - * does not exist return the ITextRange for the Column annotation. - */ - ITextRange lengthTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the precision element. If precision element - * does not exist return the ITextRange for the Column annotation. - */ - ITextRange precisionTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the scale element. If scale element - * does not exist return the ITextRange for the Column annotation. - */ - ITextRange scaleTextRange(CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ColumnImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ColumnImpl.java index c5f3d65a7a..dc541b4ce4 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ColumnImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ColumnImpl.java @@ -10,15 +10,22 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.NestedDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; - -public class ColumnImpl extends AbstractColumnImpl implements Column, NestableAnnotation +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.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.NestableAnnotation; + +public class ColumnImpl extends AbstractColumnImpl implements ColumnAnnotation, NestableAnnotation { // 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); @@ -44,7 +51,7 @@ public class ColumnImpl extends AbstractColumnImpl implements Column, NestableAn private Integer scale; - protected ColumnImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa) { + protected ColumnImpl(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) { super(parent, member, daa); this.lengthDeclarationAdapter = this.buildIntegerElementAdapter(JPA.COLUMN__LENGTH); this.lengthAdapter = this.buildShortCircuitIntegerElementAdapter(this.lengthDeclarationAdapter); @@ -109,7 +116,7 @@ public class ColumnImpl extends AbstractColumnImpl implements Column, NestableAn @Override public void initializeFrom(NestableAnnotation oldAnnotation) { super.initializeFrom(oldAnnotation); - Column oldColumn = (Column) oldAnnotation; + ColumnAnnotation oldColumn = (ColumnAnnotation) oldAnnotation; setLength(oldColumn.getLength()); setPrecision(oldColumn.getPrecision()); setScale(oldColumn.getScale()); @@ -149,15 +156,15 @@ public class ColumnImpl extends AbstractColumnImpl implements Column, NestableAn firePropertyChanged(SCALE_PROPERTY, oldScale, newScale); } - public ITextRange lengthTextRange(CompilationUnit astRoot) { + public TextRange lengthTextRange(CompilationUnit astRoot) { return this.elementTextRange(this.lengthDeclarationAdapter, astRoot); } - public ITextRange precisionTextRange(CompilationUnit astRoot) { + public TextRange precisionTextRange(CompilationUnit astRoot) { return this.elementTextRange(this.precisionDeclarationAdapter, astRoot); } - public ITextRange scaleTextRange(CompilationUnit astRoot) { + public TextRange scaleTextRange(CompilationUnit astRoot) { return this.elementTextRange(this.scaleDeclarationAdapter, astRoot); } @@ -183,7 +190,7 @@ public class ColumnImpl extends AbstractColumnImpl implements Column, NestableAn // ********** static methods ********** - static ColumnImpl createAttributeOverrideColumn(JavaResource parent, Member member, DeclarationAnnotationAdapter attributeOverrideAnnotationAdapter) { + static ColumnImpl createAttributeOverrideColumn(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter attributeOverrideAnnotationAdapter) { return new ColumnImpl(parent, member, buildAttributeOverrideAnnotationAdapter(attributeOverrideAnnotationAdapter)); } @@ -211,11 +218,11 @@ public class ColumnImpl extends AbstractColumnImpl implements Column, NestableAn super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return new ColumnImpl(parent, member, ColumnImpl.MAPPING_DECLARATION_ANNOTATION_ADAPTER); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return new NullColumn(parent); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ContainerAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ContainerAnnotation.java deleted file mode 100644 index 0a6aad284f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ContainerAnnotation.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import java.util.ListIterator; - -public interface ContainerAnnotation<T extends NestableAnnotation> extends Annotation -{ - /** - * Return the fully qualified nestable annotation name. - */ - String getNestableAnnotationName(); - - /** - * Return the element name of the nestable annotation when - * it is nested withing the container annotatio as a member value pai - */ - String getElementName(); - - ListIterator<T> nestedAnnotations(); - - int nestedAnnotationsSize(); - - T nestedAnnotationAt(int index); - - T nestedAnnotationFor(org.eclipse.jdt.core.dom.Annotation jdtAnnotation); - - int indexOf(T nestedAnnotation); - - T add(int index); - - /** - * Add directly to the List without firing change notification. - */ - T addInternal(int index); - - void remove(T nestedAnnotation); - - void remove(int index); - - /** - * Move in the List without firing change notification. - */ - void moveInternal(int targetIndex, int sourceIndex); - - void move(int targetIndex, int sourceIndex); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ContainerAnnotationTools.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ContainerAnnotationTools.java index 3334876cc4..5085ef8dcd 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ContainerAnnotationTools.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ContainerAnnotationTools.java @@ -17,6 +17,9 @@ 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.internal.jdtutility.JDTTools; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.ContainerAnnotation; +import org.eclipse.jpt.core.resource.java.NestableAnnotation; import org.eclipse.jpt.utility.internal.CollectionTools; public class ContainerAnnotationTools diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumn.java deleted file mode 100644 index 493a2472b0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumn.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -/** - * Corresponds to the javax.persistence.DiscriminatorColumn annotation - */ -public interface DiscriminatorColumn extends NamedColumn -{ - String ANNOTATION_NAME = JPA.DISCRIMINATOR_COLUMN; - - /** - * Corresponds to the discriminatorType element of the javax.persistence.DiscriminatorColumn annotation. - * Returns null if the discriminatorType valuePair does not exist in the annotation - */ - DiscriminatorType getDiscriminatorType(); - - /** - * Corresponds to the discriminatorType element of the javax.persistence.OrderBy annotation. - * Set the discriminatorType to null to remove the discriminatorType valuePair - */ - void setDiscriminatorType(DiscriminatorType discriminatorType); - String DISCRIMINATOR_TYPE_PROPERTY = "discriminatorTypeProperty"; - - /** - * Corresponds to the length element of the javax.persistence.DiscriminatorColumn annotation. - * Returns null if the length valuePair does not exist in the annotation - */ - Integer getLength(); - - /** - * Corresponds to the length element of the javax.persistence.OrderBy annotation. - * Set the length to null to remove the length valuePair - */ - void setLength(Integer length); - String LENGTH_PROPERTY = "lengthProperty"; - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumnImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumnImpl.java index e333818c6e..b006ba2103 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumnImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumnImpl.java @@ -18,8 +18,16 @@ import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +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.DiscriminatorType; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.NestableAnnotation; -public class DiscriminatorColumnImpl extends AbstractNamedColumn implements DiscriminatorColumn +public class DiscriminatorColumnImpl extends AbstractNamedColumn implements DiscriminatorColumnAnnotation { public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); @@ -36,7 +44,7 @@ public class DiscriminatorColumnImpl extends AbstractNamedColumn implements Disc private Integer length; - protected DiscriminatorColumnImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa) { + protected DiscriminatorColumnImpl(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) { super(parent, member, daa, new MemberAnnotationAdapter(member, daa)); this.discriminatorTypeAdapter = new ShortCircuitAnnotationElementAdapter<String>(member, DISCRIMINATOR_TYPE_ADAPTER); this.lengthDeclarationAdapter = this.buildIntegerElementAdapter(JPA.DISCRIMINATOR_COLUMN__LENGTH); @@ -72,7 +80,7 @@ public class DiscriminatorColumnImpl extends AbstractNamedColumn implements Disc @Override public void initializeFrom(NestableAnnotation oldAnnotation) { super.initializeFrom(oldAnnotation); - DiscriminatorColumn oldColumn = (DiscriminatorColumn) oldAnnotation; + DiscriminatorColumnAnnotation oldColumn = (DiscriminatorColumnAnnotation) oldAnnotation; setLength(oldColumn.getLength()); setDiscriminatorType(oldColumn.getDiscriminatorType()); } @@ -139,11 +147,11 @@ public class DiscriminatorColumnImpl extends AbstractNamedColumn implements Disc super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return new DiscriminatorColumnImpl(parent, member, DiscriminatorColumnImpl.DECLARATION_ANNOTATION_ADAPTER); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return new NullDiscriminatorColumn(parent); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorType.java deleted file mode 100644 index a59d492490..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorType.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - - -public enum DiscriminatorType { - - STRING, - CHAR, - INTEGER; - - - public static DiscriminatorType fromJavaAnnotationValue(Object javaAnnotationValue) { - if (javaAnnotationValue == null) { - return null; - } - if (javaAnnotationValue.equals(JPA.DISCRIMINATOR_TYPE__STRING)) { - return STRING; - } - if (javaAnnotationValue.equals(JPA.DISCRIMINATOR_TYPE__CHAR)) { - return CHAR; - } - if (javaAnnotationValue.equals(JPA.DISCRIMINATOR_TYPE__INTEGER)) { - return INTEGER; - } - return null; - } - - public static String toJavaAnnotationValue(DiscriminatorType discriminatorType) { - if (discriminatorType == null) { - return null; - } - switch (discriminatorType) { - case STRING : - return JPA.DISCRIMINATOR_TYPE__STRING; - case CHAR : - return JPA.DISCRIMINATOR_TYPE__CHAR; - case INTEGER : - return JPA.DISCRIMINATOR_TYPE__INTEGER; - default : - throw new IllegalArgumentException("unknown discriminator type: " + discriminatorType); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValue.java deleted file mode 100644 index 2e82140dfe..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValue.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - -/** - * Corresponds to the javax.persistence.OrderBy annotation - */ -public interface DiscriminatorValue extends JavaResource -{ - String ANNOTATION_NAME = JPA.DISCRIMINATOR_VALUE; - - /** - * Corresponds to the value element of the javax.persistence.OrderBy annotation. - * Returns null if the value valuePair does not exist in the annotation - */ - String getValue(); - - /** - * Corresponds to the value element of the javax.persistence.OrderBy annotation. - * Setting the value to null will not remove the OrderBy annotation - */ - void setValue(String value); - String VALUE_PROPERTY = "valueProperty"; - - /** - * Return the ITextRange for the value element. If value element - * does not exist return the ITextRange for the DisriminatorValue annotation. - */ - ITextRange valueTextRange(CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValueImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValueImpl.java index f17a5c7c44..329b4948d8 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValueImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValueImpl.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; @@ -19,6 +19,12 @@ import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Type; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.DiscriminatorValue; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; public class DiscriminatorValueImpl extends AbstractAnnotationResource<Type> implements DiscriminatorValue { @@ -30,7 +36,7 @@ public class DiscriminatorValueImpl extends AbstractAnnotationResource<Type> imp private String value; - protected DiscriminatorValueImpl(JavaResource parent, Type type) { + protected DiscriminatorValueImpl(JavaResourceNode parent, Type type) { super(parent, type, DECLARATION_ANNOTATION_ADAPTER); this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(type, VALUE_ADAPTER); } @@ -54,7 +60,7 @@ public class DiscriminatorValueImpl extends AbstractAnnotationResource<Type> imp firePropertyChanged(VALUE_PROPERTY, oldValue, newValue); } - public ITextRange valueTextRange(CompilationUnit astRoot) { + public TextRange valueTextRange(CompilationUnit astRoot) { return this.elementTextRange(VALUE_ADAPTER, astRoot); } @@ -91,11 +97,11 @@ public class DiscriminatorValueImpl extends AbstractAnnotationResource<Type> imp super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return new DiscriminatorValueImpl(parent, (Type) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return new NullDiscriminatorValue(parent); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Embeddable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Embeddable.java deleted file mode 100644 index b78326bda5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Embeddable.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -/** - * Corresponds to the javax.persistence.Embeddable annotation - */ -public interface Embeddable extends JavaResource -{ - String ANNOTATION_NAME = JPA.EMBEDDABLE; - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddableImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddableImpl.java index 7cca1de655..730d9555b3 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddableImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddableImpl.java @@ -14,13 +14,18 @@ import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Type; +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; -public class EmbeddableImpl extends AbstractAnnotationResource<Type> implements Embeddable +public class EmbeddableImpl extends AbstractAnnotationResource<Type> implements EmbeddableAnnotation { public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - protected EmbeddableImpl(JavaPersistentTypeResource parent, Type type) { + protected EmbeddableImpl(JavaResourcePersistentType parent, Type type) { super(parent, type, DECLARATION_ANNOTATION_ADAPTER); } @@ -56,11 +61,11 @@ public class EmbeddableImpl extends AbstractAnnotationResource<Type> implements super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { - return new EmbeddableImpl((JavaPersistentTypeResource) parent, (Type) member); + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { + return new EmbeddableImpl((JavaResourcePersistentType) parent, (Type) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Embedded.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Embedded.java deleted file mode 100644 index d2dd8fd9a6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Embedded.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - - -public interface Embedded extends JavaResource -{ - String ANNOTATION_NAME = JPA.EMBEDDED; - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedId.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedId.java deleted file mode 100644 index b97543553c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedId.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - - -public interface EmbeddedId extends JavaResource -{ - String ANNOTATION_NAME = JPA.EMBEDDED_ID; - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedIdImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedIdImpl.java index b5db28d0ef..91e618ca67 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedIdImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedIdImpl.java @@ -14,12 +14,17 @@ import org.eclipse.jpt.core.internal.jdtutility.Attribute; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.EmbeddedId; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; public class EmbeddedIdImpl extends AbstractAnnotationResource<Attribute> implements EmbeddedId { private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - protected EmbeddedIdImpl(JavaPersistentAttributeResource parent, Attribute attribute) { + protected EmbeddedIdImpl(JavaResourcePersistentAttribute parent, Attribute attribute) { super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); } @@ -55,11 +60,11 @@ public class EmbeddedIdImpl extends AbstractAnnotationResource<Attribute> implem super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { - return new EmbeddedIdImpl((JavaPersistentAttributeResource) parent, (Attribute) member); + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { + return new EmbeddedIdImpl((JavaResourcePersistentAttribute) parent, (Attribute) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedImpl.java index ed5652c654..8806a0d883 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedImpl.java @@ -14,13 +14,18 @@ import org.eclipse.jpt.core.internal.jdtutility.Attribute; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.Embedded; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; public class EmbeddedImpl extends AbstractAnnotationResource<Attribute> implements Embedded { private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - protected EmbeddedImpl(JavaPersistentAttributeResource parent, Attribute attribute) { + protected EmbeddedImpl(JavaResourcePersistentAttribute parent, Attribute attribute) { super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); } @@ -55,11 +60,11 @@ public class EmbeddedImpl extends AbstractAnnotationResource<Attribute> implemen super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { - return new EmbeddedImpl((JavaPersistentAttributeResource) parent, (Attribute) member); + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { + return new EmbeddedImpl((JavaResourcePersistentAttribute) parent, (Attribute) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return new NullEmbedded(parent); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Entity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Entity.java deleted file mode 100644 index 3d2420014f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Entity.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - -/** - * Corresponds to the javax.persistence.Entity annotation - */ -public interface Entity extends JavaResource -{ - String ANNOTATION_NAME = JPA.ENTITY; - - /** - * Corresponds to the name element of the Entity annotation. - * Returns null if the name element does not exist in java. - */ - String getName(); - - /** - * Corresponds to the name element of the Entity annotation. - * Set to null to remove the name element. - */ - void setName(String name); - - String NAME_PROPERTY = "nameProperty"; - - /** - * Return the ITextRange for the name element. If the name element - * does not exist return the ITextRange for the Entity annotation. - */ - ITextRange nameTextRange(CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EntityImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EntityImpl.java index 42734c94bc..1f7d5725b1 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EntityImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EntityImpl.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; @@ -19,9 +19,15 @@ import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Type; +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.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -public class EntityImpl extends AbstractAnnotationResource<Type> implements Entity +public class EntityImpl extends AbstractAnnotationResource<Type> implements EntityAnnotation { private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); @@ -31,7 +37,7 @@ public class EntityImpl extends AbstractAnnotationResource<Type> implements Enti private String name; - protected EntityImpl(JavaPersistentTypeResource parent, Type type) { + protected EntityImpl(JavaResourcePersistentType parent, Type type) { super(parent, type, DECLARATION_ANNOTATION_ADAPTER); this.nameAdapter = new ShortCircuitAnnotationElementAdapter<String>(getMember(), NAME_ADAPTER); } @@ -42,7 +48,7 @@ public class EntityImpl extends AbstractAnnotationResource<Type> implements Enti //*********** Annotation implementation **************** public String getAnnotationName() { - return Entity.ANNOTATION_NAME; + return EntityAnnotation.ANNOTATION_NAME; } //*********** Entity implementation **************** @@ -54,10 +60,10 @@ public class EntityImpl extends AbstractAnnotationResource<Type> implements Enti String oldName = this.name; this.name = newName; this.nameAdapter.setValue(newName); - firePropertyChanged(Entity.NAME_PROPERTY, oldName, newName); + firePropertyChanged(EntityAnnotation.NAME_PROPERTY, oldName, newName); } - public ITextRange nameTextRange(CompilationUnit astRoot) { + public TextRange nameTextRange(CompilationUnit astRoot) { return this.elementTextRange(NAME_ADAPTER, astRoot); } @@ -95,17 +101,17 @@ public class EntityImpl extends AbstractAnnotationResource<Type> implements Enti super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { - return new EntityImpl((JavaPersistentTypeResource) parent, (Type) member); + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { + return new EntityImpl((JavaResourcePersistentType) parent, (Type) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } public String getAnnotationName() { - return Entity.ANNOTATION_NAME; + return EntityAnnotation.ANNOTATION_NAME; } } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumType.java deleted file mode 100644 index 6670795056..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumType.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - - -public enum EnumType { - - ORDINAL, - STRING; - - - public static EnumType fromJavaAnnotationValue(Object javaAnnotationValue) { - if (javaAnnotationValue == null) { - return null; - } - if (javaAnnotationValue.equals(JPA.ENUM_TYPE__ORDINAL)) { - return ORDINAL; - } - if (javaAnnotationValue.equals(JPA.ENUM_TYPE__STRING)) { - return STRING; - } - return null; - } - - public static String toJavaAnnotationValue(EnumType enumType) { - if (enumType == null) { - return null; - } - switch (enumType) { - case ORDINAL : - return JPA.ENUM_TYPE__ORDINAL; - case STRING : - return JPA.ENUM_TYPE__STRING; - default : - throw new IllegalArgumentException("unknown enum type: " + enumType); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Enumerated.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Enumerated.java deleted file mode 100644 index 010c7bd3c2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Enumerated.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - -/** - * Corresponds to the javax.persistence.Enumerated annotation - */ -public interface Enumerated extends JavaResource -{ - String ANNOTATION_NAME = JPA.ENUMERATED; - - /** - * Corresponds to the value element of the Enumerated annotation. - * Returns null if the value element does not exist in java. - */ - EnumType getValue(); - - /** - * Corresponds to the value element of the Enumerated annotation. - * Set to null to remove the value element. - */ - void setValue(EnumType value); - String VALUE_PROPERTY = "valueProperty"; - - /** - * Return the ITextRange for the value element. If the value element - * does not exist return the ITextRange for the Enumerated annotation. - */ - ITextRange valueTextRange(CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumeratedImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumeratedImpl.java index b232e5b769..7777ada03d 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumeratedImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumeratedImpl.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Attribute; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; @@ -19,6 +19,13 @@ import org.eclipse.jpt.core.internal.jdtutility.EnumDeclarationAnnotationElement import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.EnumType; +import org.eclipse.jpt.core.resource.java.Enumerated; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; public class EnumeratedImpl extends AbstractAnnotationResource<Attribute> implements Enumerated { @@ -30,7 +37,7 @@ public class EnumeratedImpl extends AbstractAnnotationResource<Attribute> implem private EnumType value; - protected EnumeratedImpl(JavaResource parent, Attribute attribute) { + protected EnumeratedImpl(JavaResourceNode parent, Attribute attribute) { super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, VALUE_ADAPTER); } @@ -54,7 +61,7 @@ public class EnumeratedImpl extends AbstractAnnotationResource<Attribute> implem firePropertyChanged(VALUE_PROPERTY, oldValue, newValue); } - public ITextRange valueTextRange(CompilationUnit astRoot) { + public TextRange valueTextRange(CompilationUnit astRoot) { return this.elementTextRange(VALUE_ADAPTER, astRoot); } @@ -90,11 +97,11 @@ public class EnumeratedImpl extends AbstractAnnotationResource<Attribute> implem super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return new EnumeratedImpl(parent, (Attribute) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return new NullEnumerated(parent); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/FetchType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/FetchType.java deleted file mode 100644 index 4768e64a88..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/FetchType.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - - -public enum FetchType { - - EAGER, - LAZY; - - - public static FetchType fromJavaAnnotationValue(Object javaAnnotationValue) { - if (javaAnnotationValue == null) { - return null; - } - if (javaAnnotationValue.equals(JPA.FETCH_TYPE__EAGER)) { - return EAGER; - } - if (javaAnnotationValue.equals(JPA.FETCH_TYPE__LAZY)) { - return LAZY; - } - return null; - } - - public static String toJavaAnnotationValue(FetchType fetchType) { - if (fetchType == null) { - return null; - } - switch (fetchType) { - case EAGER : - return JPA.FETCH_TYPE__EAGER; - case LAZY : - return JPA.FETCH_TYPE__LAZY; - default : - throw new IllegalArgumentException("unknown fetch type: " + fetchType); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValue.java deleted file mode 100644 index 57e0cb2752..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValue.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - -/** - * Corresponds to the javax.persistence.GeneratedValue annotation - */ -public interface GeneratedValue extends JavaResource -{ - String ANNOTATION_NAME = JPA.GENERATED_VALUE; - - /** - * Corresponds to the strategy element of the GeneratedValue annotation. - * Returns null if the strategy element does not exist in java. - */ - GenerationType getStrategy(); - - /** - * Corresponds to the strategy element of the GeneratedValue annotation. - * Set to null to remove the strategy element. - */ - void setStrategy(GenerationType strategy); - String STRATEGY_PROPERTY = "strategyProperty"; - - /** - * Corresponds to the generator element of the GeneratedValue annotation. - * Returns null if the generator element does not exist in java. - */ - String getGenerator(); - - /** - * Corresponds to the generator element of the GeneratedValue annotation. - * Set to null to remove the generator element. - */ - void setGenerator(String generator); - String GENERATOR_PROPERTY = "generatorProperty"; - - - /** - * Return the ITextRange for the generator element. If the generator element - * does not exist return the ITextRange for the Enumerated annotation. - */ - ITextRange generatorTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the strategy element. If the strategy element - * does not exist return the ITextRange for the Enumerated annotation. - */ - ITextRange strategyTextRange(CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValueImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValueImpl.java index ddf961c8fc..f00f26ad0c 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValueImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValueImpl.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; @@ -19,8 +19,15 @@ import org.eclipse.jpt.core.internal.jdtutility.EnumDeclarationAnnotationElement import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; - -public class GeneratedValueImpl extends AbstractAnnotationResource<Member> implements GeneratedValue +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.GenerationType; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; + +public class GeneratedValueImpl extends AbstractAnnotationResource<Member> implements GeneratedValueAnnotation { private final AnnotationElementAdapter<String> strategyAdapter; @@ -37,7 +44,7 @@ public class GeneratedValueImpl extends AbstractAnnotationResource<Member> imple private String generator; - protected GeneratedValueImpl(JavaResource parent, Member member) { + protected GeneratedValueImpl(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); @@ -74,11 +81,11 @@ public class GeneratedValueImpl extends AbstractAnnotationResource<Member> imple firePropertyChanged(GENERATOR_PROPERTY, oldGenerator, newGenerator); } - public ITextRange strategyTextRange(CompilationUnit astRoot) { + public TextRange strategyTextRange(CompilationUnit astRoot) { return this.elementTextRange(STRATEGY_ADAPTER, astRoot); } - public ITextRange generatorTextRange(CompilationUnit astRoot) { + public TextRange generatorTextRange(CompilationUnit astRoot) { return this.elementTextRange(GENERATOR_ADAPTER, astRoot); } @@ -124,11 +131,11 @@ public class GeneratedValueImpl extends AbstractAnnotationResource<Member> imple super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return new GeneratedValueImpl(parent, member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GenerationType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GenerationType.java deleted file mode 100644 index 6e5d7b7244..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GenerationType.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - - -public enum GenerationType { - - TABLE, - SEQUENCE, - IDENTITY, - AUTO; - - - public static GenerationType fromJavaAnnotationValue(Object javaAnnotationValue) { - if (javaAnnotationValue == null) { - return null; - } - if (javaAnnotationValue.equals(JPA.GENERATION_TYPE__TABLE)) { - return TABLE; - } - if (javaAnnotationValue.equals(JPA.GENERATION_TYPE__SEQUENCE)) { - return SEQUENCE; - } - if (javaAnnotationValue.equals(JPA.GENERATION_TYPE__IDENTITY)) { - return IDENTITY; - } - if (javaAnnotationValue.equals(JPA.GENERATION_TYPE__AUTO)) { - return AUTO; - } - return null; - } - - public static String toJavaAnnotationValue(GenerationType generationType) { - if (generationType == null) { - return null; - } - switch (generationType) { - case TABLE : - return JPA.GENERATION_TYPE__TABLE; - case SEQUENCE : - return JPA.GENERATION_TYPE__SEQUENCE; - case IDENTITY : - return JPA.GENERATION_TYPE__IDENTITY; - case AUTO : - return JPA.GENERATION_TYPE__AUTO; - default : - throw new IllegalArgumentException("unknown generation type: " + generationType); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Generator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Generator.java deleted file mode 100644 index 1da98e781d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Generator.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - - -public interface Generator extends JavaResource -{ - /** - * Corresponds to the name element of the TableGenerator or SequenceGenerator annotation. - * Returns null if the name element does not exist in java. If no other memberValuePairs exist - * the *Generator annotation will be removed as well. - */ - String getName(); - - /** - * Corresponds to the name element of the TableGenerator or SequenceGenerator annotation. - * Set to null to remove the name element. If no other memberValuePairs exist - * the *Generator annotation will be removed as well. - */ - void setName(String name); - String NAME_PROPERTY = "nameProperty"; - - /** - * Corresponds to the initialValue element of the TableGenerator or SequenceGenerator annotation. - * Returns null if the initialValue element does not exist in java. If no other memberValuePairs exist - * the *Generator annotation will be removed as well. - */ - Integer getInitialValue(); - - /** - * Corresponds to the initialValue element of the TableGenerator or SequenceGenerator annotation. - * Set to null to remove the initialValue element. If no other memberValuePairs exist - * the *Generator annotation will be removed as well. - */ - void setInitialValue(Integer initialValue); - String INITIAL_VALUE_PROPERTY = "initialValueProperty"; - - /** - * Corresponds to the allocationSize element of the TableGenerator or SequenceGenerator annotation. - * Returns null if the allocationSize element does not exist in java. If no other memberValuePairs exist - * the *Generator annotation will be removed as well. - */ - Integer getAllocationSize(); - - /** - * Corresponds to the allocationSize element of the TableGenerator or SequenceGenerator annotation. - * Set to null to remove the allocationSize element. If no other memberValuePairs exist - * the *Generator annotation will be removed as well. - */ - void setAllocationSize(Integer allocationSize); - String ALLOCATION_SIZE_PROPERTY = "allocationSizeProperty"; - - /** - * Return the ITextRange for the name element. If the name element - * does not exist return the ITextRange for the *Generator annotation. - */ - ITextRange nameTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the initialValue element. If the initialValue element - * does not exist return the ITextRange for the *Generator annotation. - */ - ITextRange initialValueTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the allocationSize element. If the allocationSize element - * does not exist return the ITextRange for the *Generator annotation. - */ - ITextRange allocationSizeTextRange(CompilationUnit astRoot); - - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratorImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratorImpl.java index e8221904ef..d6fbf5c6af 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratorImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratorImpl.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; @@ -18,8 +18,10 @@ import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdap import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.NumberIntegerExpressionConverter; import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter; +import org.eclipse.jpt.core.resource.java.GeneratorAnnotation; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; -public abstract class GeneratorImpl extends AbstractAnnotationResource<Member> implements Generator +public abstract class GeneratorImpl extends AbstractAnnotationResource<Member> implements GeneratorAnnotation { // hold this so we can get the 'name' text range private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter; @@ -42,7 +44,7 @@ public abstract class GeneratorImpl extends AbstractAnnotationResource<Member> i private Integer allocationSize; - public GeneratorImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa) { + public GeneratorImpl(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) { super(parent, member, daa); this.nameDeclarationAdapter = this.nameAdapter(); this.nameAdapter = this.buildAdapter(this.nameDeclarationAdapter); @@ -110,15 +112,15 @@ public abstract class GeneratorImpl extends AbstractAnnotationResource<Member> i firePropertyChanged(NAME_PROPERTY, oldName, newName); } - public ITextRange nameTextRange(CompilationUnit astRoot) { + public TextRange nameTextRange(CompilationUnit astRoot) { return this.elementTextRange(this.nameDeclarationAdapter, astRoot); } - public ITextRange initialValueTextRange(CompilationUnit astRoot) { + public TextRange initialValueTextRange(CompilationUnit astRoot) { return this.elementTextRange(this.initialValueDeclarationAdapter, astRoot); } - public ITextRange allocationSizeTextRange(CompilationUnit astRoot) { + public TextRange allocationSizeTextRange(CompilationUnit astRoot) { return this.elementTextRange(this.allocationSizeDeclarationAdapter, astRoot); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Id.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Id.java deleted file mode 100644 index af2fe66442..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Id.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - - -public interface Id extends JavaResource -{ - String ANNOTATION_NAME = JPA.ID; - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdClass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdClass.java deleted file mode 100644 index 58b4eeafda..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdClass.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - -/** - * This interface corresponds to the javax.persistence.IdClass annotation - */ -public interface IdClass extends JavaResource -{ - final String ANNOTATION_NAME = JPA.ID_CLASS; - - /** - * Corresponds to the value element of the IdClass annotation. - * Returns null if the value element does not exist in java. - * Returns the portion of the value preceding the .class. - * <p> - * @IdClass(value=Employee.class) - * </p> - * will return "Employee" - **/ - String getValue(); - - /** - * Corresponds to the value element of the IdClass annotation. - * Set to null to remove the value element. This will also remove the IdClass - * annotation itself. - */ - void setValue(String value); - String VALUE_PROPERTY = "valueProperty"; - - /** - * Returns the qualified value name as it is resolved in the AST - * <p> - * @IdClass(Employee.class) - * </p> - * will return "model.Employee" if there is an import for model.Employee - * @return - */ - String getFullyQualifiedClass(); - String FULLY_QUALIFIED_CLASS_PROPERTY = "fullyQualifiedClassProperty"; - - /** - * Return the ITextRange for the value element. If the value element - * does not exist return the ITextRange for the IdClass annotation. - */ - ITextRange valueTextRange(CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdClassImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdClassImpl.java index 8b56fe0369..ce0105ac98 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdClassImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdClassImpl.java @@ -1,7 +1,7 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; @@ -12,6 +12,12 @@ import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAda import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.SimpleTypeStringExpressionConverter; import org.eclipse.jpt.core.internal.jdtutility.Type; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.IdClass; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; public class IdClassImpl extends AbstractAnnotationResource<Type> implements IdClass { @@ -25,7 +31,7 @@ public class IdClassImpl extends AbstractAnnotationResource<Type> implements IdC private String fullyQualifiedValue; - public IdClassImpl(JavaResource parent, Type type) { + public IdClassImpl(JavaResourceNode parent, Type type) { super(parent, type, DECLARATION_ANNOTATION_ADAPTER); this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(type, VALUE_ADAPTER); } @@ -60,7 +66,7 @@ public class IdClassImpl extends AbstractAnnotationResource<Type> implements IdC firePropertyChanged(IdClass.FULLY_QUALIFIED_CLASS_PROPERTY, oldQualifiedClass, newQualifiedClass); } - public ITextRange valueTextRange(CompilationUnit astRoot) { + public TextRange valueTextRange(CompilationUnit astRoot) { return this.elementTextRange(VALUE_ADAPTER, astRoot); } @@ -105,11 +111,11 @@ public class IdClassImpl extends AbstractAnnotationResource<Type> implements IdC super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return new IdClassImpl(parent, (Type) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdImpl.java index 021d21b565..3ee833ae4c 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdImpl.java @@ -14,13 +14,18 @@ import org.eclipse.jpt.core.internal.jdtutility.Attribute; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.Id; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; public class IdImpl extends AbstractAnnotationResource<Attribute> implements Id { private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - protected IdImpl(JavaPersistentAttributeResource parent, Attribute attribute) { + protected IdImpl(JavaResourcePersistentAttribute parent, Attribute attribute) { super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); } @@ -55,11 +60,11 @@ public class IdImpl extends AbstractAnnotationResource<Attribute> implements Id super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { - return new IdImpl((JavaPersistentAttributeResource) parent, (Attribute) member); + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { + return new IdImpl((JavaResourcePersistentAttribute) parent, (Attribute) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Inheritance.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Inheritance.java deleted file mode 100644 index cc04587a4c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Inheritance.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - -/** - * Corresponds to the javax.persistence.Inheritance annotation - */ -public interface Inheritance extends JavaResource -{ - String ANNOTATION_NAME = JPA.INHERITANCE; - - InheritanceType getStrategy(); - - void setStrategy(InheritanceType strategy); - String STRATEGY_PROPERTY = "strategyProperty"; - - /** - * Return the ITextRange for the strategy element. If the strategy element - * does not exist return the ITextRange for the Inheritance annotation. - */ - ITextRange strategyTextRange(CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceImpl.java index 23d1e78761..00a9effa88 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceImpl.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter; @@ -19,6 +19,13 @@ import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Type; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.Inheritance; +import org.eclipse.jpt.core.resource.java.InheritanceType; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; public class InheritanceImpl extends AbstractAnnotationResource<Type> implements Inheritance { @@ -29,7 +36,7 @@ public class InheritanceImpl extends AbstractAnnotationResource<Type> implements private InheritanceType strategy; - protected InheritanceImpl(JavaResource parent, Type type) { + protected InheritanceImpl(JavaResourceNode parent, Type type) { super(parent, type, DECLARATION_ANNOTATION_ADAPTER); this.strategyAdapter = new ShortCircuitAnnotationElementAdapter<String>(type, STRATEGY_ADAPTER); } @@ -53,7 +60,7 @@ public class InheritanceImpl extends AbstractAnnotationResource<Type> implements firePropertyChanged(STRATEGY_PROPERTY, oldStrategy, newStrategy); } - public ITextRange strategyTextRange(CompilationUnit astRoot) { + public TextRange strategyTextRange(CompilationUnit astRoot) { return this.elementTextRange(STRATEGY_ADAPTER, astRoot); } @@ -89,11 +96,11 @@ public class InheritanceImpl extends AbstractAnnotationResource<Type> implements super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return new InheritanceImpl(parent, (Type) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return new NullInheritance(parent); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceType.java deleted file mode 100644 index 65cada71e9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceType.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - - -public enum InheritanceType { - - SINGLE_TABLE, - JOINED, - TABLE_PER_CLASS; - - - public static InheritanceType fromJavaAnnotationValue(Object javaAnnotationValue) { - if (javaAnnotationValue == null) { - return null; - } - if (javaAnnotationValue.equals(JPA.INHERITANCE_TYPE__SINGLE_TABLE)) { - return SINGLE_TABLE; - } - if (javaAnnotationValue.equals(JPA.INHERITANCE_TYPE__JOINED)) { - return JOINED; - } - if (javaAnnotationValue.equals(JPA.INHERITANCE_TYPE__TABLE_PER_CLASS)) { - return TABLE_PER_CLASS; - } - return null; - } - - public static String toJavaAnnotationValue(InheritanceType inheritanceType) { - if (inheritanceType == null) { - return null; - } - switch (inheritanceType) { - case SINGLE_TABLE : - return JPA.INHERITANCE_TYPE__SINGLE_TABLE; - case JOINED : - return JPA.INHERITANCE_TYPE__JOINED; - case TABLE_PER_CLASS : - return JPA.INHERITANCE_TYPE__TABLE_PER_CLASS; - default : - throw new IllegalArgumentException("unknown inheritance type: " + inheritanceType); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JPA.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JPA.java deleted file mode 100644 index 810960b68b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JPA.java +++ /dev/null @@ -1,294 +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.resource.java; - - -/** - * JPA Java-related stuff (annotations etc.) - */ -public interface JPA { - - // JPA package - String PACKAGE = "javax.persistence"; - String PACKAGE_ = PACKAGE + "."; - - - // ********** API ********** - - // JPA annotations - String ASSOCIATION_OVERRIDE = PACKAGE_ + "AssociationOverride"; - String ASSOCIATION_OVERRIDE__NAME = "name"; - String ASSOCIATION_OVERRIDE__JOIN_COLUMNS = "joinColumns"; - String ASSOCIATION_OVERRIDES = PACKAGE_ + "AssociationOverrides"; - String ASSOCIATION_OVERRIDES__VALUE = "value"; - String ATTRIBUTE_OVERRIDE = PACKAGE_ + "AttributeOverride"; - String ATTRIBUTE_OVERRIDE__NAME = "name"; - String ATTRIBUTE_OVERRIDE__COLUMN = "column"; - String ATTRIBUTE_OVERRIDES = PACKAGE_ + "AttributeOverrides"; - String ATTRIBUTE_OVERRIDES__VALUE = "value"; - String BASIC = PACKAGE_ + "Basic"; - String BASIC__FETCH = "fetch"; - String BASIC__OPTIONAL = "optional"; - String COLUMN = PACKAGE_ + "Column"; - String COLUMN__NAME = "name"; - String COLUMN__UNIQUE = "unique"; - String COLUMN__NULLABLE = "nullable"; - String COLUMN__INSERTABLE = "insertable"; - String COLUMN__UPDATABLE = "updatable"; - String COLUMN__COLUMN_DEFINITION = "columnDefinition"; - String COLUMN__TABLE = "table"; - String COLUMN__LENGTH = "length"; - String COLUMN__PRECISION = "precision"; - String COLUMN__SCALE = "scale"; - String COLUMN_RESULT = PACKAGE_ + "ColumnResult"; - String COLUMN_RESULT__NAME = "name"; - String DISCRIMINATOR_COLUMN = PACKAGE_ + "DiscriminatorColumn"; - String DISCRIMINATOR_COLUMN__NAME = "name"; - String DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE = "discriminatorType"; - String DISCRIMINATOR_COLUMN__COLUMN_DEFINITION = "columnDefinition"; - String DISCRIMINATOR_COLUMN__LENGTH = "length"; - String DISCRIMINATOR_VALUE = PACKAGE_ + "DiscriminatorValue"; - String DISCRIMINATOR_VALUE__VALUE = "value"; - String EMBEDDABLE = PACKAGE_ + "Embeddable"; - String EMBEDDED = PACKAGE_ + "Embedded"; - String EMBEDDED_ID = PACKAGE_ + "EmbeddedId"; - String ENTITY = PACKAGE_ + "Entity"; - String ENTITY__NAME = "name"; - String ENTITY_LISTENERS = PACKAGE_ + "EntityListeners"; - String ENTITY_LISTENERS__VALUE = "value"; - String ENTITY_RESULT = PACKAGE_ + "EntityResult"; - String ENTITY_RESULT__ENTITY_CLASS = "entityClass"; - String ENTITY_RESULT__FIELDS = "fields"; - String ENTITY_RESULT__DISCRIMINATOR_COLUMN = "discriminatorColumn"; - String ENUMERATED = PACKAGE_ + "Enumerated"; - String ENUMERATED__VALUE = "value"; - String EXCLUDE_DEFAULT_LISTENERS = PACKAGE_ + "ExcludeDefaultListeners"; - String EXCLUDE_SUPERCLASS_LISTENERS = PACKAGE_ + "ExcludeSuperclassListeners"; - String FIELD_RESULT = PACKAGE_ + "FieldResult"; - String FIELD_RESULT__NAME = "name"; - String FIELD_RESULT__COLUMN = "column"; - String FLUSH_MODE = PACKAGE_ + "FlushMode"; - String FLUSH_MODE__VALUE = "value"; - String GENERATED_VALUE = PACKAGE_ + "GeneratedValue"; - String GENERATED_VALUE__STRATEGY = "strategy"; - String GENERATED_VALUE__GENERATOR = "generator"; - String ID = PACKAGE_ + "Id"; - String ID_CLASS = PACKAGE_ + "IdClass"; - String ID_CLASS__VALUE = "value"; - String INHERITANCE = PACKAGE_ + "Inheritance"; - String INHERITANCE__STRATEGY = "strategy"; - String JOIN_COLUMN = PACKAGE_ + "JoinColumn"; - String JOIN_COLUMN__NAME = "name"; - String JOIN_COLUMN__REFERENCED_COLUMN_NAME = "referencedColumnName"; - String JOIN_COLUMN__UNIQUE = "unique"; - String JOIN_COLUMN__NULLABLE = "nullable"; - String JOIN_COLUMN__INSERTABLE = "insertable"; - String JOIN_COLUMN__UPDATABLE = "updatable"; - String JOIN_COLUMN__COLUMN_DEFINITION = "columnDefinition"; - String JOIN_COLUMN__TABLE = "table"; - String JOIN_COLUMNS = PACKAGE_ + "JoinColumns"; - String JOIN_COLUMNS__VALUE = "value"; - String JOIN_TABLE = PACKAGE_ + "JoinTable"; - String JOIN_TABLE__NAME = "name"; - String JOIN_TABLE__CATALOG = "catalog"; - String JOIN_TABLE__SCHEMA = "schema"; - String JOIN_TABLE__JOIN_COLUMNS = "joinColumns"; - String JOIN_TABLE__INVERSE_JOIN_COLUMNS = "inverseJoinColumns"; - String JOIN_TABLE__UNIQUE_CONSTRAINTS = "uniqueConstraints"; - String LOB = PACKAGE_ + "Lob"; - String MANY_TO_MANY = PACKAGE_ + "ManyToMany"; - String MANY_TO_MANY__TARGET_ENTITY = "targetEntity"; - String MANY_TO_MANY__CASCADE = "cascade"; - String MANY_TO_MANY__FETCH = "fetch"; - String MANY_TO_MANY__MAPPED_BY = "mappedBy"; - String MANY_TO_ONE = PACKAGE_ + "ManyToOne"; - String MANY_TO_ONE__TARGET_ENTITY = "targetEntity"; - String MANY_TO_ONE__CASCADE = "cascade"; - String MANY_TO_ONE__FETCH = "fetch"; - String MANY_TO_ONE__OPTIONAL = "optional"; - String MAP_KEY = PACKAGE_ + "MapKey"; - String MAP_KEY__NAME = "name"; - String MAPPED_SUPERCLASS = PACKAGE_ + "MappedSuperclass"; - String NAMED_NATIVE_QUERIES = PACKAGE_ + "NamedNativeQueries"; - String NAMED_NATIVE_QUERIES__VALUE = "value"; - String NAMED_NATIVE_QUERY = PACKAGE_ + "NamedNativeQuery"; - String NAMED_NATIVE_QUERY__NAME = "name"; - String NAMED_NATIVE_QUERY__QUERY = "query"; - String NAMED_NATIVE_QUERY__HINTS = "hints"; - String NAMED_NATIVE_QUERY__RESULT_CLASS = "resultClass"; - String NAMED_NATIVE_QUERY__RESULT_SET_MAPPING = "resultSetMapping"; - String NAMED_QUERIES = PACKAGE_ + "NamedQueries"; - String NAMED_QUERIES__VALUE = "value"; - String NAMED_QUERY = PACKAGE_ + "NamedQuery"; - String NAMED_QUERY__NAME = "name"; - String NAMED_QUERY__QUERY = "query"; - String NAMED_QUERY__HINTS = "hints"; - String ONE_TO_MANY = PACKAGE_ + "OneToMany"; - String ONE_TO_MANY__TARGET_ENTITY = "targetEntity"; - String ONE_TO_MANY__CASCADE = "cascade"; - String ONE_TO_MANY__FETCH = "fetch"; - String ONE_TO_MANY__MAPPED_BY = "mappedBy"; - String ONE_TO_ONE = PACKAGE_ + "OneToOne"; - String ONE_TO_ONE__TARGET_ENTITY = "targetEntity"; - String ONE_TO_ONE__CASCADE = "cascade"; - String ONE_TO_ONE__FETCH = "fetch"; - String ONE_TO_ONE__OPTIONAL = "optional"; - String ONE_TO_ONE__MAPPED_BY = "mappedBy"; - String ORDER_BY = PACKAGE_ + "OrderBy"; - String ORDER_BY__VALUE = "value"; - String PERSISTENCE_CONTEXT = PACKAGE_ + "PersistenceContext"; - String PERSISTENCE_CONTEXT__NAME = "name"; - String PERSISTENCE_CONTEXT__UNIT_NAME = "unitName"; - String PERSISTENCE_CONTEXT__TYPE = "type"; - String PERSISTENCE_CONTEXTS = PACKAGE_ + "PersistenceContexts"; - String PERSISTENCE_CONTEXTS__VALUE = "value"; - String PERSISTENCE_UNIT = PACKAGE_ + "XmlPersistenceUnit"; - String PERSISTENCE_UNIT__NAME = "name"; - String PERSISTENCE_UNIT__UNIT_NAME = "unitName"; - String PERSISTENCE_UNITS = PACKAGE_ + "PersistenceUnits"; - String PERSISTENCE_UNITS__VALUE = "value"; - String POST_LOAD = PACKAGE_ + "PostLoad"; - String POST_PERSIST = PACKAGE_ + "PostPersist"; - String POST_REMOVE = PACKAGE_ + "PostRemove"; - String POST_UPDATE = PACKAGE_ + "PostUpdate"; - String PRE_PERSIST = PACKAGE_ + "PrePersist"; - String PRE_REMOVE = PACKAGE_ + "PreRemove"; - String PRE_UPDATE = PACKAGE_ + "PreUpdate"; - String PRIMARY_KEY_JOIN_COLUMN = PACKAGE_ + "PrimaryKeyJoinColumn"; - String PRIMARY_KEY_JOIN_COLUMN__NAME = "name"; - String PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME = "referencedColumnName"; - String PRIMARY_KEY_JOIN_COLUMN__COLUMN_DEFINITION = "columnDefinition"; - String PRIMARY_KEY_JOIN_COLUMNS = PACKAGE_ + "PrimaryKeyJoinColumns"; - String PRIMARY_KEY_JOIN_COLUMNS__VALUE = "value"; - String QUERY_HINT = PACKAGE_ + "QueryHint"; - String QUERY_HINT__NAME = "name"; - String QUERY_HINT__VALUE = "value"; - String SECONDARY_TABLE = PACKAGE_ + "SecondaryTable"; - String SECONDARY_TABLE__NAME = "name"; - String SECONDARY_TABLE__CATALOG = "catalog"; - String SECONDARY_TABLE__SCHEMA = "schema"; - String SECONDARY_TABLE__PK_JOIN_COLUMNS = "pkJoinColumns"; - String SECONDARY_TABLE__UNIQUE_CONSTRAINTS = "uniqueConstraints"; - String SECONDARY_TABLES = PACKAGE_ + "SecondaryTables"; - String SECONDARY_TABLES__VALUE = "value"; - String SEQUENCE_GENERATOR = PACKAGE_ + "SequenceGenerator"; - String SEQUENCE_GENERATOR__NAME = "name"; - String SEQUENCE_GENERATOR__SEQUENCE_NAME = "sequenceName"; - String SEQUENCE_GENERATOR__INITIAL_VALUE = "initialValue"; - String SEQUENCE_GENERATOR__ALLOCATION_SIZE = "allocationSize"; - String SQL_RESULT_SET_MAPPING = PACKAGE_ + "SqlResultSetMapping"; - String SQL_RESULT_SET_MAPPING__NAME = "name"; - String SQL_RESULT_SET_MAPPING__ENTITIES = "entities"; - String SQL_RESULT_SET_MAPPING__COLUMNS = "columns"; - String TABLE = PACKAGE_ + "Table"; - String TABLE__NAME = "name"; - String TABLE__CATALOG = "catalog"; - String TABLE__SCHEMA = "schema"; - String TABLE__UNIQUE_CONSTRAINTS = "uniqueConstraints"; - String TABLE_GENERATOR = PACKAGE_ + "TableGenerator"; - String TABLE_GENERATOR__NAME = "name"; - String TABLE_GENERATOR__TABLE = "table"; - String TABLE_GENERATOR__CATALOG = "catalog"; - String TABLE_GENERATOR__SCHEMA = "schema"; - String TABLE_GENERATOR__PK_COLUMN_NAME = "pkColumnName"; - String TABLE_GENERATOR__VALUE_COLUMN_NAME = "valueColumnName"; - String TABLE_GENERATOR__PK_COLUMN_VALUE = "pkColumnValue"; - String TABLE_GENERATOR__INITIAL_VALUE = "initialValue"; - String TABLE_GENERATOR__ALLOCATION_SIZE = "allocationSize"; - String TABLE_GENERATOR__UNIQUE_CONSTRAINTS = "uniqueConstraints"; - String TEMPORAL = PACKAGE_ + "Temporal"; - String TEMPORAL__VALUE = "value"; - String TRANSIENT = PACKAGE_ + "Transient"; - String UNIQUE_CONSTRAINT = PACKAGE_ + "UniqueConstraint"; - String UNIQUE_CONSTRAINT__COLUMN_NAMES = "columnNames"; - String VERSION = PACKAGE_ + "Version"; - - // JPA enums - String GENERATION_TYPE = PACKAGE_ + "GenerationType"; - String GENERATION_TYPE_ = GENERATION_TYPE + "."; - String GENERATION_TYPE__AUTO = GENERATION_TYPE_ + "AUTO"; - String GENERATION_TYPE__IDENTITY = GENERATION_TYPE_ + "IDENTITY"; - String GENERATION_TYPE__SEQUENCE = GENERATION_TYPE_ + "SEQUENCE"; - String GENERATION_TYPE__TABLE = GENERATION_TYPE_ + "TABLE"; - - String CASCADE_TYPE = PACKAGE_ + "CascadeType"; - String CASCADE_TYPE_ = CASCADE_TYPE + "."; - String CASCADE_TYPE__ALL = CASCADE_TYPE_ + "ALL"; - String CASCADE_TYPE__MERGE = CASCADE_TYPE_ + "MERGE"; - String CASCADE_TYPE__PERSIST = CASCADE_TYPE_ + "PERSIST"; - String CASCADE_TYPE__REFRESH = CASCADE_TYPE_ + "REFRESH"; - String CASCADE_TYPE__REMOVE = CASCADE_TYPE_ + "REMOVE"; - - String DISCRIMINATOR_TYPE = PACKAGE_ + "DiscriminatorType"; - String DISCRIMINATOR_TYPE_ = DISCRIMINATOR_TYPE + "."; - String DISCRIMINATOR_TYPE__CHAR = DISCRIMINATOR_TYPE_ + "CHAR"; - String DISCRIMINATOR_TYPE__INTEGER = DISCRIMINATOR_TYPE_ + "INTEGER"; - String DISCRIMINATOR_TYPE__STRING = DISCRIMINATOR_TYPE_ + "STRING"; - - String ENUM_TYPE = PACKAGE_ + "EnumType"; - String ENUM_TYPE_ = ENUM_TYPE + "."; - String ENUM_TYPE__ORDINAL = ENUM_TYPE_ + "ORDINAL"; - String ENUM_TYPE__STRING = ENUM_TYPE_ + "STRING"; - - String FETCH_TYPE = PACKAGE_ + "FetchType"; - String FETCH_TYPE_ = FETCH_TYPE + "."; - String FETCH_TYPE__EAGER = FETCH_TYPE_ + "EAGER"; - String FETCH_TYPE__LAZY = FETCH_TYPE_ + "LAZY"; - - String FLUSH_MODE_TYPE = PACKAGE_ + "FlushModeType"; - String FLUSH_MODE_TYPE_ = FLUSH_MODE_TYPE + "."; - String FLUSH_MODE_TYPE__AUTO = FLUSH_MODE_TYPE_ + "AUTO"; - String FLUSH_MODE_TYPE__COMMIT = FLUSH_MODE_TYPE_ + "COMMIT"; - - String INHERITANCE_TYPE = PACKAGE_ + "InheritanceType"; - String INHERITANCE_TYPE_ = INHERITANCE_TYPE + "."; - String INHERITANCE_TYPE__JOINED = INHERITANCE_TYPE_ + "JOINED"; - String INHERITANCE_TYPE__SINGLE_TABLE = INHERITANCE_TYPE_ + "SINGLE_TABLE"; - String INHERITANCE_TYPE__TABLE_PER_CLASS = INHERITANCE_TYPE_ + "TABLE_PER_CLASS"; - - String PERSISTENCE_CONTEXT_TYPE = PACKAGE_ + "PersistenceContextType"; - String PERSISTENCE_CONTEXT_TYPE_ = PERSISTENCE_CONTEXT_TYPE + "."; - String PERSISTENCE_CONTEXT_TYPE__EXTENDED = PERSISTENCE_CONTEXT_TYPE_ + "EXTENDED"; - String PERSISTENCE_CONTEXT_TYPE__TRANSACTION = PERSISTENCE_CONTEXT_TYPE_ + "TRANSACTION"; - - String TEMPORAL_TYPE = PACKAGE_ + "TemporalType"; - String TEMPORAL_TYPE_ = TEMPORAL_TYPE + "."; - String TEMPORAL_TYPE__DATE = TEMPORAL_TYPE_ + "DATE"; - String TEMPORAL_TYPE__TIME = TEMPORAL_TYPE_ + "TIME"; - String TEMPORAL_TYPE__TIMESTAMP = TEMPORAL_TYPE_ + "TIMESTAMP"; - - // JPA interfaces - String ENTITY_MANAGER = PACKAGE_ + "EntityManager"; - String ENTITY_MANAGER_FACTORY = PACKAGE_ + "EntityManagerFactory"; - String ENTITY_TRANSACTION = PACKAGE_ + "EntityTransaction"; - String INSTRUMENTABLE_CLASS_LOADER = PACKAGE_ + "InstrumentableClassLoader"; - String QUERY = PACKAGE_ + "Query"; - - // JPA classes - String PERSISTENCE = PACKAGE_ + "XmlPersistence"; - - // JPA exceptions - String NON_UNIQUE_RESULT_EXCEPTION = PACKAGE_ + "NonUniqueResultException"; - String OBJECT_NOT_FOUND_EXCEPTION = PACKAGE_ + "ObjectNotFoundException"; - String PERSISTENCE_EXCEPTION = PACKAGE_ + "PersistenceException"; - - - // ********** SPI ********** - - // JPA SPI package - String SPI_PACKAGE = PACKAGE_ + "spi"; - String SPI_PACKAGE_ = SPI_PACKAGE + "."; - - // JPA SPI interfaces - String ENTITY_MANAGER_FACTORY_PROVIDER = SPI_PACKAGE_ + "EntityManagerFactoryProvider"; - String PERSISTENCE_INFO = SPI_PACKAGE_ + "PersistenceInfo"; - String PERSISTENCE_PROVIDER = SPI_PACKAGE_ + "PersistenceProvider"; - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentAttributeResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentAttributeResource.java deleted file mode 100644 index e26c71f2ad..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentAttributeResource.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jpt.core.internal.jdtutility.Member; - - -//TODO how do we handle: -// @Basic -// private String foo, bar; - -public interface JavaPersistentAttributeResource extends JavaPersistentResource -{ - String getName(); - - Member getMember(); - - boolean isForField(); - - boolean isForProperty(); - - boolean typeIsBasic(); - String TYPE_IS_BASIC_PROPERTY = "typeIsBasicProperty"; - - /** - * Return true if the attribute type is a container: - * java.util.Collection - * java.util.Set - * java.util.List - * java.util.Map - * @return - */ - boolean typeIsContainer(); - String TYPE_IS_CONTAINER_PROPERTY = "typeIsContainerProperty"; - - /** - * Returns the resolved qualfied type name for the attribute - */ - String getQualifiedTypeName(); - String QUALIFIED_TYPE_NAME_PROPERTY = "qualfiedTypeNameProperty"; - - /** - * Returns the resolved qualfied type name for the attribute - * if it as valid as a target entity type. i.e. not an array. - * see typeIsContainer() to be used with this - */ - String getQualifiedReferenceEntityTypeName(); - String QUALIFIED_REFERENCE_ENTITY_TYPE_NAME_PROPERTY = "qualfiedReferenceEntityTypeNameProperty"; - - /** - * Returns the fully qualified type parameter for use as a target entity - */ - String getQualifiedReferenceEntityElementTypeName(); - String QUALIFIED_REFERENCE_ENTITY_ELEMENT_TYPE_NAME_PROPERTY = "qualfiedReferenceEntityElementTypeNameProperty"; - - /** - * Return true if this attribute has any mapping or non-mapping annotations - * (of course only persistence related annotations) - */ - boolean hasAnyAnnotation(); -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentAttributeResourceImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentAttributeResourceImpl.java index c26964129e..c6c2b278c5 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentAttributeResourceImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentAttributeResourceImpl.java @@ -19,11 +19,15 @@ import org.eclipse.jdt.core.dom.ITypeBinding; import org.eclipse.jdt.core.dom.IVariableBinding; import org.eclipse.jpt.core.internal.jdtutility.Attribute; import org.eclipse.jpt.core.internal.jdtutility.JPTTools; +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.core.resource.java.NestableAnnotation; import org.eclipse.jpt.utility.internal.CollectionTools; public class JavaPersistentAttributeResourceImpl extends AbstractJavaPersistentResource<Attribute> - implements JavaPersistentAttributeResource + implements JavaResourcePersistentAttribute { private boolean typeIsBasic; @@ -36,7 +40,7 @@ public class JavaPersistentAttributeResourceImpl private String qualifiedReferenceEntityElementTypeName; - public JavaPersistentAttributeResourceImpl(JavaPersistentTypeResource parent, Attribute attribute){ + public JavaPersistentAttributeResourceImpl(JavaResourcePersistentType parent, Attribute attribute){ super(parent, attribute); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentResource.java deleted file mode 100644 index 75a9476141..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentResource.java +++ /dev/null @@ -1,161 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import java.util.Iterator; -import java.util.ListIterator; -import org.eclipse.jdt.core.IMember; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; -import org.eclipse.jpt.core.internal.platform.base.BaseJpaPlatform; - -public interface JavaPersistentResource extends JavaResource -{ - - /** - * Return all <code>JavaResource</code>s that correspond to type - * mapping annotations specified in the source code. In JPA these could be - * Entity, MappedSuperclass, Embeddable. - * <p>Does not return duplicate annotations as this error is handled by the java compiler. - */ - <T extends JavaResource> Iterator<T> mappingAnnotations(); - - String MAPPING_ANNOTATIONS_COLLECTION = "mappingAnnotationsCollection"; - - int mappingAnnotationsSize(); - /** - * Return the <code>JavaResource</code> specified on this JavaPersistentResource - * In the case of multiples the first one will be returned as defined by the order of - * {@link BaseJpaPlatform#typeMappingAnnotationDefinitions()} or - * {@link BaseJpaPlatform#attributeMappingAnnotationDefinitions()} - * @return - */ - JavaResource mappingAnnotation(); - - /** - * Returns the <code>JavaResource</code> with this fully qualifed annotation name. - * In JPA the valid annotations are "javax.persistence.Embedddable", "javax.persistence.Entity", - * and "javax.persistence.MappedSuperclass" - * Return the first if there are duplicates in the source code - * @param annotationName - fully qualified annotation name - * @return - */ - //TODO not sure we need this API, first 2 seem sufficient - JavaResource mappingAnnotation(String annotationName); - - /** - * Use this to change the type mapping annotation. This will only remove - * other mapping annotations in case there were multiple before. It - * will not remove any non-mapping annotations - * @param annotationName - fully qualified annotation name - */ - void setMappingAnnotation(String annotationName); - - /** - * Return all <code>JavaResource</code>s that correspond to annotations in the source code. - * Does not return duplicate annotations as this error is handled by the java compiler. - * No <code>MappingAnnotation</code>s should be included. - * @see #mappingAnnotations() - */ - <T extends JavaResource> Iterator<T> annotations(); - - String ANNOTATIONS_COLLECTION = "annotationsCollection"; - - int annotationsSize(); - - //TODO tie the singular and plural annotations together somehow in the resource model so we can give - //a validation error for the case of both being specified - /** - * Given a nestable and container annotation name return the specified <code>JavaResource</code>s. - * If both the nestable and container annotations are specified on the Type, then only - * return the nestable annotations specified within the container annotation. This is - * only going to return JavaResources that match the nestableAnnotationName - */ - <T extends JavaResource> ListIterator<T> annotations(String nestableAnnotationName, String containerAnnotationName); - - - /** - * Returns the <code>JavaResource</code> with this fully qualifed annotation name. - * Return the first if there are duplicates in the source code. - * @param annotationName - * @return - */ - JavaResource annotation(String annotationName); - - /** - * Returns the <code>JavaResource</code> with this fully qualifed annotation name. - * Return the first if there are duplicates in the source code. Will not return null, - * but a null Object instead if no annotation with this name exists in the java source. - * @param annotationName - * @return - */ - JavaResource nonNullAnnotation(String annotationName); - - /** - * Returns the <code>JavaResource</code> with this fully qualifed annotation name. - * Return the first if there are duplicates in the source code. Will not return null, - * but a null Object instead if no annotation with this name exists in the java source. - * @param annotationName - * @return - */ - JavaResource nonNullMappingAnnotation(String annotationName); - - /** - * Add an annotation for the given fully qualified annotation name - */ - JavaResource addAnnotation(String annotationName); - - void removeAnnotation(String annotationName); - - /** - * Add a new NestableAnnotation named nestableAnnotationName. Create a new container annotation - * if necessary and add the nestable annotation to it. If both nestable and container already - * exist then add to the container annotation leaving the existing nestable annotaion alone. - * If only nestable exists, then create the new container annotation and move the nestable to it - * also adding the new one. If neither exists, create a new nestable annotation. - * @return the new JavaResource with the name nestableAnnotationName - */ - JavaResource addAnnotation(int index, String nestableAnnotationName, String containerAnnotationName); - - void removeAnnotation(int index, String nestableAnnotationName, String containerAnnotationName); - - /** - * Move nestableAnnotation found in the containerAnnotation from the specified source - * index to the specified target index. - */ - void move(int targetIndex, int sourceIndex, String containerAnnotationName); - - /** - * Return whether the underlying JDT member is persistable according to the JPA spec - * @return - */ - boolean isPersistable(); - String PERSISTABLE_PROPERTY = "persistableProperty"; - - /** - * Return whether the underlying JDT member is currently annotated as being persistent - * (equivalent to "is mapped") - */ - boolean isPersisted(); - - /** - * Return true if this JavaPersistentResource represents the underlying JDT IMeber - * @param member - * @return - */ - boolean isFor(IMember member); - - - /** - * return the text range for the name of the persistent resource - */ - ITextRange nameTextRange(CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentTypeResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentTypeResource.java deleted file mode 100644 index f9ab8d317c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentTypeResource.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import java.util.Iterator; - -import org.eclipse.jpt.core.internal.jdtutility.Member; - -public interface JavaPersistentTypeResource extends JavaPersistentResource -{ - /** - * Return only the persistable nestedTypes - */ - Iterator<JavaPersistentTypeResource> nestedTypes(); - String NESTED_TYPES_COLLECTION = "nestedTypesCollection"; - - /** - * Return only the persistable attributes, those that respond true to - * {@link JavaPersistentAttributeResource#isPersistable()} - * This returns fields and properties - * @return - */ - Iterator<JavaPersistentAttributeResource> attributes(); - String ATTRIBUTES_COLLECTION = "attributesCollection"; - - /** - * Return only the persistable fields, those that respond true to - * {@link JavaPersistentAttributeResource#isPersistable()} - * This returns filters out all properties and only returns fields - * @return - */ - Iterator<JavaPersistentAttributeResource> fields(); - - /** - * Return only the persistable fields, those that respond true to - * {@link JavaPersistentAttributeResource#isPersistable()} - * This returns filters out all fields and only returns properties - * @return - */ - Iterator<JavaPersistentAttributeResource> properties(); - - JavaPersistentTypeResource javaPersistentTypeResource(String fullyQualifiedTypeName); - - /** - * Return the fully qualified type name - */ - String getQualifiedName(); - String QUALIFIED_NAME_PROPERTY = "qualifiedNameProperty"; - - /** - * Return the fully unqualified type name - */ - String getName(); - String NAME_PROPERTY = "nameProperty"; - - String getSuperClassQualifiedName(); - String SUPER_CLASS_QUALIFIED_NAME_PROPERTY = "superClassQualifiedNameProperty"; - - AccessType getAccess(); - String ACCESS_PROPERTY = "accessProperty"; - - boolean isAbstract(); - String ABSTRACT_PROPERTY = "abstractProperty"; - - Member getMember(); - - /** - * Return whether any attributes in this persistentType have - * JPA annotations on them. - */ - boolean hasAnyAttributeAnnotations(); -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentTypeResourceImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentTypeResourceImpl.java index 8c886f2c07..e7dfb171a1 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentTypeResourceImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentTypeResourceImpl.java @@ -26,19 +26,25 @@ import org.eclipse.jpt.core.internal.jdtutility.FieldAttribute; import org.eclipse.jpt.core.internal.jdtutility.JPTTools; import org.eclipse.jpt.core.internal.jdtutility.MethodAttribute; import org.eclipse.jpt.core.internal.jdtutility.Type; +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.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.NestableAnnotation; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.CommandExecutorProvider; import org.eclipse.jpt.utility.internal.iterators.CloneIterator; import org.eclipse.jpt.utility.internal.iterators.FilteringIterator; -public class JavaPersistentTypeResourceImpl extends AbstractJavaPersistentResource<Type> implements JavaPersistentTypeResource +public class JavaPersistentTypeResourceImpl extends AbstractJavaPersistentResource<Type> implements JavaResourcePersistentType { /** * store all member types including those that aren't persistable so we can include validation errors. */ - private final Collection<JavaPersistentTypeResource> nestedTypes; + private final Collection<JavaResourcePersistentType> nestedTypes; - private final Collection<JavaPersistentAttributeResource> attributes; + private final Collection<JavaResourcePersistentAttribute> attributes; private AccessType accessType; @@ -50,10 +56,10 @@ public class JavaPersistentTypeResourceImpl extends AbstractJavaPersistentResour private boolean isAbstract; - public JavaPersistentTypeResourceImpl(JavaResource parent, Type type){ + public JavaPersistentTypeResourceImpl(JavaResourceNode parent, Type type){ super(parent, type); - this.nestedTypes = new ArrayList<JavaPersistentTypeResource>(); - this.attributes = new ArrayList<JavaPersistentAttributeResource>(); + this.nestedTypes = new ArrayList<JavaResourcePersistentType>(); + this.attributes = new ArrayList<JavaResourcePersistentAttribute>(); } @Override @@ -149,11 +155,11 @@ public class JavaPersistentTypeResourceImpl extends AbstractJavaPersistentResour // ******** JavaPersistentTypeResource implementation ******** - public JavaPersistentTypeResource javaPersistentTypeResource(String fullyQualifiedTypeName) { + public JavaResourcePersistentType javaPersistentTypeResource(String fullyQualifiedTypeName) { if (getQualifiedName().equals(fullyQualifiedTypeName)) { return this; } - for (JavaPersistentTypeResource jptr : CollectionTools.iterable(nestedTypes())) { + for (JavaResourcePersistentType jptr : CollectionTools.iterable(nestedTypes())) { if (jptr.getQualifiedName().equals(fullyQualifiedTypeName)) { return jptr; } @@ -161,19 +167,19 @@ public class JavaPersistentTypeResourceImpl extends AbstractJavaPersistentResour return null; } - public Iterator<JavaPersistentTypeResource> nestedTypes() { + public Iterator<JavaResourcePersistentType> nestedTypes() { //TODO since we are filtering how do we handle the case where a type becomes persistable? //what kind of change notificiation for that case? - return new FilteringIterator<JavaPersistentTypeResource, JavaPersistentTypeResource>(new CloneIterator<JavaPersistentTypeResource>(this.nestedTypes)) { + return new FilteringIterator<JavaResourcePersistentType, JavaResourcePersistentType>(new CloneIterator<JavaResourcePersistentType>(this.nestedTypes)) { @Override - protected boolean accept(JavaPersistentTypeResource o) { + protected boolean accept(JavaResourcePersistentType o) { return o.isPersistable(); } }; } - protected JavaPersistentTypeResource nestedTypeFor(IType type) { - for (JavaPersistentTypeResource nestedType : this.nestedTypes) { + protected JavaResourcePersistentType nestedTypeFor(IType type) { + for (JavaResourcePersistentType nestedType : this.nestedTypes) { if (nestedType.isFor(type)) { return nestedType; } @@ -181,26 +187,26 @@ public class JavaPersistentTypeResourceImpl extends AbstractJavaPersistentResour return null; } - protected JavaPersistentTypeResource addNestedType(IType nestedType, CompilationUnit astRoot) { - JavaPersistentTypeResource persistentType = createJavaPersistentType(nestedType, astRoot); + protected JavaResourcePersistentType addNestedType(IType nestedType, CompilationUnit astRoot) { + JavaResourcePersistentType persistentType = createJavaPersistentType(nestedType, astRoot); addNestedType(persistentType); return persistentType; } - protected void addNestedType(JavaPersistentTypeResource nestedType) { + protected void addNestedType(JavaResourcePersistentType nestedType) { addItemToCollection(nestedType, this.nestedTypes, NESTED_TYPES_COLLECTION); } - protected void removeNestedType(JavaPersistentTypeResource nestedType) { + protected void removeNestedType(JavaResourcePersistentType nestedType) { removeItemFromCollection(nestedType, this.nestedTypes, NESTED_TYPES_COLLECTION); } - protected JavaPersistentTypeResource createJavaPersistentType(IType nestedType, CompilationUnit astRoot) { + protected JavaResourcePersistentType createJavaPersistentType(IType nestedType, CompilationUnit astRoot) { return createJavaPersistentType(this, nestedType, modifySharedDocumentCommandExecutorProvider(), annotationEditFormatter(), astRoot); } - public static JavaPersistentTypeResource createJavaPersistentType( - JavaResource parent, + public static JavaResourcePersistentType createJavaPersistentType( + JavaResourceNode parent, IType nestedType, CommandExecutorProvider modifySharedDocumentCommandExecutorProvider, AnnotationEditFormatter annotationEditFormatter, @@ -212,46 +218,46 @@ public class JavaPersistentTypeResourceImpl extends AbstractJavaPersistentResour return javaPersistentType; } - public Iterator<JavaPersistentAttributeResource> attributes() { + public Iterator<JavaResourcePersistentAttribute> attributes() { //TODO since we are filtering how do we handle the case where an attribute becomes persistable? //what kind of change notificiation for that case? - return new FilteringIterator<JavaPersistentAttributeResource, JavaPersistentAttributeResource>(new CloneIterator<JavaPersistentAttributeResource>(this.attributes)) { + return new FilteringIterator<JavaResourcePersistentAttribute, JavaResourcePersistentAttribute>(new CloneIterator<JavaResourcePersistentAttribute>(this.attributes)) { @Override - protected boolean accept(JavaPersistentAttributeResource o) { + protected boolean accept(JavaResourcePersistentAttribute o) { return o.isPersistable(); } }; } - public Iterator<JavaPersistentAttributeResource> fields() { - return new FilteringIterator<JavaPersistentAttributeResource, JavaPersistentAttributeResource>(attributes()) { + public Iterator<JavaResourcePersistentAttribute> fields() { + return new FilteringIterator<JavaResourcePersistentAttribute, JavaResourcePersistentAttribute>(attributes()) { @Override - protected boolean accept(JavaPersistentAttributeResource o) { + protected boolean accept(JavaResourcePersistentAttribute o) { return o.isForField(); } }; } - public Iterator<JavaPersistentAttributeResource> properties() { - return new FilteringIterator<JavaPersistentAttributeResource, JavaPersistentAttributeResource>(attributes()) { + public Iterator<JavaResourcePersistentAttribute> properties() { + return new FilteringIterator<JavaResourcePersistentAttribute, JavaResourcePersistentAttribute>(attributes()) { @Override - protected boolean accept(JavaPersistentAttributeResource o) { + protected boolean accept(JavaResourcePersistentAttribute o) { return o.isForProperty(); } }; } - protected JavaPersistentAttributeResource addAttribute(IMember jdtMember, CompilationUnit astRoot) { - JavaPersistentAttributeResource persistentAttribute = createJavaPersistentAttribute(jdtMember, astRoot); + protected JavaResourcePersistentAttribute addAttribute(IMember jdtMember, CompilationUnit astRoot) { + JavaResourcePersistentAttribute persistentAttribute = createJavaPersistentAttribute(jdtMember, astRoot); addAttribute(persistentAttribute); return persistentAttribute; } - protected void addAttribute(JavaPersistentAttributeResource attribute) { + protected void addAttribute(JavaResourcePersistentAttribute attribute) { addItemToCollection(attribute, this.attributes, ATTRIBUTES_COLLECTION); } - protected JavaPersistentAttributeResource createJavaPersistentAttribute(IMember member, CompilationUnit astRoot) { + protected JavaResourcePersistentAttribute createJavaPersistentAttribute(IMember member, CompilationUnit astRoot) { Attribute attribute = null; if (member instanceof IField) { attribute = new FieldAttribute((IField) member, this.modifySharedDocumentCommandExecutorProvider(), this.annotationEditFormatter()); @@ -262,17 +268,17 @@ public class JavaPersistentTypeResourceImpl extends AbstractJavaPersistentResour else { throw new IllegalArgumentException(); } - JavaPersistentAttributeResource javaPersistentAttribute = new JavaPersistentAttributeResourceImpl(this, attribute); + JavaResourcePersistentAttribute javaPersistentAttribute = new JavaPersistentAttributeResourceImpl(this, attribute); javaPersistentAttribute.initialize(astRoot); return javaPersistentAttribute; } - protected void removeAttribute(JavaPersistentAttributeResource attribute) { + protected void removeAttribute(JavaResourcePersistentAttribute attribute) { removeItemFromCollection(attribute, this.attributes, ATTRIBUTES_COLLECTION); } - protected JavaPersistentAttributeResource attributeFor(IMember member) { - for (JavaPersistentAttributeResource persistentAttribute : this.attributes) { + protected JavaResourcePersistentAttribute attributeFor(IMember member) { + for (JavaResourcePersistentAttribute persistentAttribute : this.attributes) { if (persistentAttribute.isFor(member)) { return persistentAttribute; } @@ -353,10 +359,10 @@ public class JavaPersistentTypeResourceImpl extends AbstractJavaPersistentResour super.resolveTypes(astRoot); this.setSuperClassQualifiedName(this.superClassQualifiedName(astRoot)); - for (JavaPersistentAttributeResource attribute : this.attributes) { + for (JavaResourcePersistentAttribute attribute : this.attributes) { attribute.resolveTypes(astRoot); } - for (JavaPersistentTypeResource persistentType : this.nestedTypes) { + for (JavaResourcePersistentType persistentType : this.nestedTypes) { persistentType.resolveTypes(astRoot); } } @@ -376,9 +382,9 @@ public class JavaPersistentTypeResourceImpl extends AbstractJavaPersistentResour protected void updateNestedTypes(CompilationUnit astRoot) { IType[] declaredTypes = getMember().declaredTypes(); - List<JavaPersistentTypeResource> nestedTypesToRemove = new ArrayList<JavaPersistentTypeResource>(this.nestedTypes); + List<JavaResourcePersistentType> nestedTypesToRemove = new ArrayList<JavaResourcePersistentType>(this.nestedTypes); for (IType declaredType : declaredTypes) { - JavaPersistentTypeResource nestedType = nestedTypeFor(declaredType); + JavaResourcePersistentType nestedType = nestedTypeFor(declaredType); if (nestedType == null) { nestedType = addNestedType(declaredType, astRoot); } @@ -387,31 +393,31 @@ public class JavaPersistentTypeResourceImpl extends AbstractJavaPersistentResour } nestedType.updateFromJava(astRoot); } - for (JavaPersistentTypeResource nestedType : nestedTypesToRemove) { + for (JavaResourcePersistentType nestedType : nestedTypesToRemove) { removeNestedType(nestedType); } } protected void updatePersistentAttributes(CompilationUnit astRoot) { - List<JavaPersistentAttributeResource> persistentAttributesToRemove = new ArrayList<JavaPersistentAttributeResource>(this.attributes); + List<JavaResourcePersistentAttribute> persistentAttributesToRemove = new ArrayList<JavaResourcePersistentAttribute>(this.attributes); updatePersistentFields(astRoot, persistentAttributesToRemove); updatePersistentProperties(astRoot, persistentAttributesToRemove); - for (JavaPersistentAttributeResource persistentAttribute : persistentAttributesToRemove) { + for (JavaResourcePersistentAttribute persistentAttribute : persistentAttributesToRemove) { removeAttribute(persistentAttribute); } } - protected void updatePersistentFields(CompilationUnit astRoot, List<JavaPersistentAttributeResource> persistentAttributesToRemove) { + protected void updatePersistentFields(CompilationUnit astRoot, List<JavaResourcePersistentAttribute> persistentAttributesToRemove) { updatePersistentAttributes(astRoot, persistentAttributesToRemove, getMember().fields()); } - protected void updatePersistentProperties(CompilationUnit astRoot, List<JavaPersistentAttributeResource> persistentAttributesToRemove) { + protected void updatePersistentProperties(CompilationUnit astRoot, List<JavaResourcePersistentAttribute> persistentAttributesToRemove) { updatePersistentAttributes(astRoot, persistentAttributesToRemove, getMember().methods()); } - protected void updatePersistentAttributes(CompilationUnit astRoot, List<JavaPersistentAttributeResource> persistentAttributesToRemove, IMember[] members) { + protected void updatePersistentAttributes(CompilationUnit astRoot, List<JavaResourcePersistentAttribute> persistentAttributesToRemove, IMember[] members) { for (IMember member : members) { - JavaPersistentAttributeResource persistentAttribute = attributeFor(member); + JavaResourcePersistentAttribute persistentAttribute = attributeFor(member); if (persistentAttribute == null) { persistentAttribute = addAttribute(member, astRoot); } @@ -423,7 +429,7 @@ public class JavaPersistentTypeResourceImpl extends AbstractJavaPersistentResour } public boolean hasAnyAttributeAnnotations() { - for (JavaPersistentAttributeResource attribute : CollectionTools.iterable(attributes())) { + for (JavaResourcePersistentAttribute attribute : CollectionTools.iterable(attributes())) { if (attribute.hasAnyAnnotation()) { return true; } @@ -444,14 +450,14 @@ public class JavaPersistentTypeResourceImpl extends AbstractJavaPersistentResour private AccessType calculateAccessType() { boolean hasPersistableFields = false; boolean hasPersistableProperties = false; - for (JavaPersistentAttributeResource field : CollectionTools.iterable(fields())) { + for (JavaResourcePersistentAttribute field : CollectionTools.iterable(fields())) { hasPersistableFields = true; if (field.hasAnyAnnotation()) { // any field is annotated => FIELD return AccessType.FIELD; } } - for (JavaPersistentAttributeResource property : CollectionTools.iterable(properties())) { + for (JavaResourcePersistentAttribute property : CollectionTools.iterable(properties())) { hasPersistableProperties = true; if (property.hasAnyAnnotation()) { // none of the fields are annotated and a getter is annotated => PROPERTY diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaResource.java deleted file mode 100644 index 1293852736..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaResource.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.IJpaAnnotationProvider; -import org.eclipse.jpt.core.internal.ITextRange; -import org.eclipse.jpt.utility.internal.CommandExecutorProvider; -import org.eclipse.jpt.utility.internal.node.Node; - -public interface JavaResource extends Node -{ - void initialize(CompilationUnit astRoot); - - JavaResourceModel resourceModel(); - - JpaCompilationUnitResource root(); - - IJpaAnnotationProvider annotationProvider(); - - CommandExecutorProvider modifySharedDocumentCommandExecutorProvider(); - - void updateFromJava(CompilationUnit astRoot); - - /** - * Use to resolve type information that could be dependent on other files being added/removed - */ - void resolveTypes(CompilationUnit astRoot); - - /** - * Return the ITextRange - */ - ITextRange textRange(CompilationUnit astRoot); -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaResourceModel.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaResourceModel.java index 9d6553effc..2870b120b1 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaResourceModel.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaResourceModel.java @@ -15,9 +15,9 @@ import org.eclipse.core.resources.IFile; import org.eclipse.jdt.core.ElementChangedEvent; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaElementDelta; +import org.eclipse.jpt.core.JpaAnnotationProvider; +import org.eclipse.jpt.core.ResourceModelListener; import org.eclipse.jpt.core.internal.AbstractResourceModel; -import org.eclipse.jpt.core.internal.IJpaAnnotationProvider; -import org.eclipse.jpt.core.internal.IResourceModelListener; import org.eclipse.jpt.core.internal.jdtutility.AnnotationEditFormatter; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; import org.eclipse.jpt.utility.internal.BitTools; @@ -26,17 +26,17 @@ import org.eclipse.jpt.utility.internal.CommandExecutorProvider; public class JavaResourceModel extends AbstractResourceModel { - private final Collection<IResourceModelListener> resourceModelListeners; + private final Collection<ResourceModelListener> resourceModelListeners; private final JpaCompilationUnitResource compilationUnitResource; public JavaResourceModel( - IFile file, IJpaAnnotationProvider annotationProvider, + IFile file, JpaAnnotationProvider annotationProvider, CommandExecutorProvider modifySharedDocumentCommandExecutorProvider, AnnotationEditFormatter annotationEditFormatter) { super(); - this.resourceModelListeners = new ArrayList<IResourceModelListener>(); + this.resourceModelListeners = new ArrayList<ResourceModelListener>(); this.compilationUnitResource = new JpaCompilationUnitResource(file, annotationProvider, modifySharedDocumentCommandExecutorProvider, annotationEditFormatter, this); } @@ -50,7 +50,7 @@ public class JavaResourceModel return this.compilationUnitResource; } - public void addResourceModelChangeListener(IResourceModelListener listener) { + public void addResourceModelChangeListener(ResourceModelListener listener) { if (listener == null) { throw new IllegalArgumentException("Listener cannot be null"); } @@ -60,7 +60,7 @@ public class JavaResourceModel this.resourceModelListeners.add(listener); } - public void removeResourceModelChangeListener(IResourceModelListener listener) { + public void removeResourceModelChangeListener(ResourceModelListener listener) { if (!this.resourceModelListeners.contains(listener)) { throw new IllegalArgumentException("Listener " + listener + " was never added"); } @@ -71,7 +71,7 @@ public class JavaResourceModel if (resource() == null) { throw new IllegalStateException("Change events should not be fired during construction"); } - for (IResourceModelListener listener : this.resourceModelListeners) { + for (ResourceModelListener listener : this.resourceModelListeners) { listener.resourceModelChanged(); } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumn.java deleted file mode 100644 index 64ba213410..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumn.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - - -public interface JoinColumn extends AbstractColumn -{ - String ANNOTATION_NAME = JPA.JOIN_COLUMN; - - /** - * Corresponds to the referencedColumnName element of the javax.persistence.JoinColumn annotation. - * Returns null if the referencedColumnName valuePair does not exist in the annotation - */ - String getReferencedColumnName(); - - /** - * Corresponds to the referencedColumnName element of the javax.persistence.JoinColumn annotation. - * Set to null to remove the referencedColumnName valuePait from the Annotation - */ - void setReferencedColumnName(String referencedColumnName); - String REFERENCED_COLUMN_NAME_PROPERTY = "referencedColumnNameProperty"; - - /** - * Return the ITextRange for the referencedColumnName element. If the - * referencedColumnName element does not exist return the ITextRange - * for the JoinColumn annotation. - */ - ITextRange referencedColumnNameTextRange(CompilationUnit astRoot); - - /** - * Return whether the specified postition touches the referencedColumnName element. - * Return false if the referencedColumnName element does not exist. - */ - boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnImpl.java index a6a2179503..db9cc8c9ba 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnImpl.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; @@ -22,6 +22,14 @@ import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +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.NestableJoinColumn; public class JoinColumnImpl extends AbstractColumnImpl implements NestableJoinColumn { @@ -34,17 +42,17 @@ public class JoinColumnImpl extends AbstractColumnImpl implements NestableJoinCo private String referencedColumnName; - public JoinColumnImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { + public JoinColumnImpl(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 JoinColumnImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa) { + public JoinColumnImpl(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) { this(parent, member, daa, new MemberAnnotationAdapter(member, daa)); } - public JoinColumnImpl(JavaResource parent, Member member, IndexedDeclarationAnnotationAdapter idaa) { + public JoinColumnImpl(JavaResourceNode parent, Member member, IndexedDeclarationAnnotationAdapter idaa) { this(parent, member, idaa, new MemberIndexedAnnotationAdapter(member, idaa)); } @@ -104,7 +112,7 @@ public class JoinColumnImpl extends AbstractColumnImpl implements NestableJoinCo @Override public void initializeFrom(NestableAnnotation oldAnnotation) { super.initializeFrom(oldAnnotation); - JoinColumn oldColumn = (JoinColumn) oldAnnotation; + JoinColumnAnnotation oldColumn = (JoinColumnAnnotation) oldAnnotation; setReferencedColumnName(oldColumn.getReferencedColumnName()); } @@ -120,7 +128,7 @@ public class JoinColumnImpl extends AbstractColumnImpl implements NestableJoinCo firePropertyChanged(REFERENCED_COLUMN_NAME_PROPERTY, oldReferencedColumnName, newReferencedColumnName); } - public ITextRange referencedColumnNameTextRange(CompilationUnit astRoot) { + public TextRange referencedColumnNameTextRange(CompilationUnit astRoot) { return this.elementTextRange(this.referencedColumnNameDeclarationAdapter, astRoot); } @@ -140,11 +148,11 @@ public class JoinColumnImpl extends AbstractColumnImpl implements NestableJoinCo // ********** static methods ********** - static JoinColumnImpl createJoinColumn(JavaResource parent, Member member) { + static JoinColumnImpl createJoinColumn(JavaResourceNode parent, Member member) { return new JoinColumnImpl(parent, member, DECLARATION_ANNOTATION_ADAPTER); } - static JoinColumnImpl createNestedJoinColumn(JavaResource parent, Member member, int index, DeclarationAnnotationAdapter joinColumnsAdapter) { + static JoinColumnImpl createNestedJoinColumn(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter joinColumnsAdapter) { IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, joinColumnsAdapter); IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(member, idaa); return new JoinColumnImpl(parent, member, idaa, annotationAdapter); @@ -153,7 +161,7 @@ public class JoinColumnImpl extends AbstractColumnImpl implements NestableJoinCo private static IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter joinColumnsAdapter) { return new NestedIndexedDeclarationAnnotationAdapter(joinColumnsAdapter, index, JPA.JOIN_COLUMN); } - static NestableJoinColumn createJoinTableJoinColumn(JavaResource parent, Member member, int index) { + static NestableJoinColumn createJoinTableJoinColumn(JavaResourceNode parent, Member member, int index) { return new JoinColumnImpl(parent, member, buildJoinTableAnnotationAdapter(index)); } @@ -161,7 +169,7 @@ public class JoinColumnImpl extends AbstractColumnImpl implements NestableJoinCo return new NestedIndexedDeclarationAnnotationAdapter(JoinTableImpl.DECLARATION_ANNOTATION_ADAPTER, JPA.JOIN_TABLE__JOIN_COLUMNS, index, JPA.JOIN_COLUMN); } - static NestableJoinColumn createJoinTableInverseJoinColumn(JavaResource parent, Member member, int index) { + static NestableJoinColumn createJoinTableInverseJoinColumn(JavaResourceNode parent, Member member, int index) { return new JoinColumnImpl(parent, member, buildJoinTableInverseAnnotationAdapter(index)); } @@ -170,7 +178,7 @@ public class JoinColumnImpl extends AbstractColumnImpl implements NestableJoinCo } - static NestableJoinColumn createAssociationOverrideJoinColumn(DeclarationAnnotationAdapter associationOverrideAdapter, JavaResource parent, Member member, int index) { + static NestableJoinColumn createAssociationOverrideJoinColumn(DeclarationAnnotationAdapter associationOverrideAdapter, JavaResourceNode parent, Member member, int index) { return new JoinColumnImpl(parent, member, buildAssociationOverrideAnnotationAdapter(associationOverrideAdapter, index)); } @@ -199,11 +207,11 @@ public class JoinColumnImpl extends AbstractColumnImpl implements NestableJoinCo super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return JoinColumnImpl.createJoinColumn(parent, member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumns.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumns.java deleted file mode 100644 index fe16741052..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumns.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - - -public interface JoinColumns extends ContainerAnnotation<NestableJoinColumn> -{ - String ANNOTATION_NAME = JPA.JOIN_COLUMNS; - - String JOIN_COLUMNS_LIST = "joinColumnsList"; - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnsImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnsImpl.java index 646af96df7..b9b5b5d35f 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnsImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnsImpl.java @@ -17,6 +17,12 @@ import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation; +import org.eclipse.jpt.core.resource.java.JoinColumns; +import org.eclipse.jpt.core.resource.java.NestableJoinColumn; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; @@ -27,7 +33,7 @@ public class JoinColumnsImpl extends AbstractAnnotationResource<Member> implemen private List<NestableJoinColumn> joinColumns; - protected JoinColumnsImpl(JavaResource parent, Member member) { + protected JoinColumnsImpl(JavaResourceNode parent, Member member) { super(parent, member, DECLARATION_ANNOTATION_ADAPTER); this.joinColumns = new ArrayList<NestableJoinColumn>(); } @@ -41,7 +47,7 @@ public class JoinColumnsImpl extends AbstractAnnotationResource<Member> implemen } public String getNestableAnnotationName() { - return JoinColumn.ANNOTATION_NAME; + return JoinColumnAnnotation.ANNOTATION_NAME; } public ListIterator<NestableJoinColumn> nestedAnnotations() { @@ -134,11 +140,11 @@ public class JoinColumnsImpl extends AbstractAnnotationResource<Member> implemen super(); } - public JoinColumns buildAnnotation(JavaPersistentResource parent, Member member) { + public JoinColumns buildAnnotation(JavaResourcePersistentMember parent, Member member) { return new JoinColumnsImpl(parent, member); } - public JoinColumns buildNullAnnotation(JavaPersistentResource parent, Member member) { + public JoinColumns buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTable.java deleted file mode 100644 index 2b0e2eecb2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTable.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import java.util.ListIterator; - -public interface JoinTable extends Table -{ - String ANNOTATION_NAME = JPA.JOIN_TABLE; - - ListIterator<JoinColumn> joinColumns(); - - JoinColumn joinColumnAt(int index); - - int indexOfJoinColumn(JoinColumn joinColumn); - - int joinColumnsSize(); - - JoinColumn addJoinColumn(int index); - - void removeJoinColumn(int index); - - void moveJoinColumn(int targetIndex, int sourceIndex); - String JOIN_COLUMNS_LIST = "joinColumnsList"; - - ListIterator<JoinColumn> inverseJoinColumns(); - - JoinColumn inverseJoinColumnAt(int index); - - int indexOfInverseJoinColumn(JoinColumn joinColumn); - - int inverseJoinColumnsSize(); - - JoinColumn addInverseJoinColumn(int index); - - void removeInverseJoinColumn(int index); - - void moveInverseJoinColumn(int targetIndex, int sourceIndex); - String INVERSE_JOIN_COLUMNS_LIST = "inverseJoinColumnsList"; - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTableImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTableImpl.java index 83ab0a803b..242d58ebb1 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTableImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTableImpl.java @@ -13,19 +13,29 @@ import java.util.ArrayList; import java.util.List; import java.util.ListIterator; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.ContainerAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +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.NestableJoinColumn; +import org.eclipse.jpt.core.resource.java.NestableUniqueConstraint; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; -public class JoinTableImpl extends AbstractTableResource implements JoinTable +public class JoinTableImpl extends AbstractTableResource implements JoinTableAnnotation { - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JoinTable.ANNOTATION_NAME); + public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JoinTableAnnotation.ANNOTATION_NAME); private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.JOIN_TABLE__NAME); @@ -41,7 +51,7 @@ public class JoinTableImpl extends AbstractTableResource implements JoinTable private final InverseJoinColumnsContainerAnnotation inverseJoinColumnsContainerAnnotation; - protected JoinTableImpl(JavaResource parent, Member member) { + protected JoinTableImpl(JavaResourceNode parent, Member member) { super(parent, member, DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER)); this.joinColumns = new ArrayList<NestableJoinColumn>(); this.inverseJoinColumns = new ArrayList<NestableJoinColumn>(); @@ -57,7 +67,7 @@ public class JoinTableImpl extends AbstractTableResource implements JoinTable } public String getAnnotationName() { - return JoinTable.ANNOTATION_NAME; + return JoinTableAnnotation.ANNOTATION_NAME; } @Override @@ -98,8 +108,8 @@ public class JoinTableImpl extends AbstractTableResource implements JoinTable ContainerAnnotationTools.updateNestedAnnotationsFromJava(astRoot, this.inverseJoinColumnsContainerAnnotation); } - public ListIterator<JoinColumn> joinColumns() { - return new CloneListIterator<JoinColumn>(this.joinColumns); + public ListIterator<JoinColumnAnnotation> joinColumns() { + return new CloneListIterator<JoinColumnAnnotation>(this.joinColumns); } public int joinColumnsSize() { @@ -110,13 +120,13 @@ public class JoinTableImpl extends AbstractTableResource implements JoinTable return this.joinColumns.get(index); } - public int indexOfJoinColumn(JoinColumn joinColumn) { + public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) { return this.joinColumns.indexOf(joinColumn); } - public JoinColumn addJoinColumn(int index) { + public JoinColumnAnnotation addJoinColumn(int index) { NestableJoinColumn joinColumn = (NestableJoinColumn) ContainerAnnotationTools.addNestedAnnotation(index, this.joinColumnsContainerAnnotation); - fireItemAdded(JoinTable.JOIN_COLUMNS_LIST, index, joinColumn); + fireItemAdded(JoinTableAnnotation.JOIN_COLUMNS_LIST, index, joinColumn); return joinColumn; } @@ -138,15 +148,15 @@ public class JoinTableImpl extends AbstractTableResource implements JoinTable public void moveJoinColumn(int targetIndex, int sourceIndex) { moveJoinColumnInternal(targetIndex, sourceIndex); ContainerAnnotationTools.synchAnnotationsAfterMove(targetIndex, sourceIndex, this.joinColumnsContainerAnnotation); - fireItemMoved(JoinTable.JOIN_COLUMNS_LIST, targetIndex, sourceIndex); + fireItemMoved(JoinTableAnnotation.JOIN_COLUMNS_LIST, targetIndex, sourceIndex); } protected void moveJoinColumnInternal(int targetIndex, int sourceIndex) { CollectionTools.move(this.joinColumns, targetIndex, sourceIndex); } - public ListIterator<JoinColumn> inverseJoinColumns() { - return new CloneListIterator<JoinColumn>(this.inverseJoinColumns); + public ListIterator<JoinColumnAnnotation> inverseJoinColumns() { + return new CloneListIterator<JoinColumnAnnotation>(this.inverseJoinColumns); } public int inverseJoinColumnsSize() { @@ -157,13 +167,13 @@ public class JoinTableImpl extends AbstractTableResource implements JoinTable return this.inverseJoinColumns.get(index); } - public int indexOfInverseJoinColumn(JoinColumn joinColumn) { + public int indexOfInverseJoinColumn(JoinColumnAnnotation joinColumn) { return this.inverseJoinColumns.indexOf(joinColumn); } - public JoinColumn addInverseJoinColumn(int index) { + public JoinColumnAnnotation addInverseJoinColumn(int index) { NestableJoinColumn inverseJoinColumn = (NestableJoinColumn) ContainerAnnotationTools.addNestedAnnotation(index, this.inverseJoinColumnsContainerAnnotation); - fireItemAdded(JoinTable.INVERSE_JOIN_COLUMNS_LIST, index, inverseJoinColumn); + fireItemAdded(JoinTableAnnotation.INVERSE_JOIN_COLUMNS_LIST, index, inverseJoinColumn); return inverseJoinColumn; } @@ -185,7 +195,7 @@ public class JoinTableImpl extends AbstractTableResource implements JoinTable public void moveInverseJoinColumn(int targetIndex, int sourceIndex) { moveInverseJoinColumnInternal(targetIndex, sourceIndex); ContainerAnnotationTools.synchAnnotationsAfterMove(targetIndex, sourceIndex, this.inverseJoinColumnsContainerAnnotation); - fireItemMoved(JoinTable.INVERSE_JOIN_COLUMNS_LIST, targetIndex, sourceIndex); + fireItemMoved(JoinTableAnnotation.INVERSE_JOIN_COLUMNS_LIST, targetIndex, sourceIndex); } protected void moveInverseJoinColumnInternal(int targetIndex, int sourceIndex) { @@ -340,7 +350,7 @@ public class JoinTableImpl extends AbstractTableResource implements JoinTable JoinTableImpl.this.updateFromJava(astRoot); } - public ITextRange textRange(CompilationUnit astRoot) { + public TextRange textRange(CompilationUnit astRoot) { return JoinTableImpl.this.textRange(astRoot); } } @@ -363,16 +373,16 @@ public class JoinTableImpl extends AbstractTableResource implements JoinTable super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return new JoinTableImpl(parent, member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return new NullJoinTable(parent); } public String getAnnotationName() { - return JoinTable.ANNOTATION_NAME; + return JoinTableAnnotation.ANNOTATION_NAME; } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JpaCompilationUnitResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JpaCompilationUnitResource.java index 522ffe59ea..95d2dc3f8a 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JpaCompilationUnitResource.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JpaCompilationUnitResource.java @@ -15,16 +15,18 @@ import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.IJpaAnnotationProvider; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.JpaAnnotationProvider; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationEditFormatter; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; import org.eclipse.jpt.utility.internal.CommandExecutorProvider; import org.eclipse.jpt.utility.internal.node.Node; -public class JpaCompilationUnitResource extends AbstractResource implements JavaResource +public class JpaCompilationUnitResource extends AbstractResource implements JavaResourceNode { - protected final IJpaAnnotationProvider annotationProvider; + protected final JpaAnnotationProvider annotationProvider; protected final CommandExecutorProvider modifySharedDocumentCommandExecutorProvider; @@ -38,14 +40,14 @@ public class JpaCompilationUnitResource extends AbstractResource implements Java * a public/protected no-arg constructor and there is no way to access * it in a non-public/protected class. */ - protected JavaPersistentTypeResource persistentType; + protected JavaResourcePersistentType persistentType; public static final String PERSISTENT_TYPE_PROPERTY = "persistentTypeProperty"; protected final JavaResourceModel javaResourceModel; public JpaCompilationUnitResource( IFile file, - IJpaAnnotationProvider annotationProvider, + JpaAnnotationProvider annotationProvider, CommandExecutorProvider modifySharedDocumentCommandExecutorProvider, AnnotationEditFormatter annotationEditFormatter, JavaResourceModel javaResourceModel) { @@ -93,7 +95,7 @@ public class JpaCompilationUnitResource extends AbstractResource implements Java } @Override - public IJpaAnnotationProvider annotationProvider() { + public JpaAnnotationProvider annotationProvider() { return this.annotationProvider; } @@ -119,7 +121,7 @@ public class JpaCompilationUnitResource extends AbstractResource implements Java return this.compilationUnit; } - public JavaPersistentTypeResource javaPersistentTypeResource(String fullyQualifiedTypeName) { + public JavaResourcePersistentType javaPersistentTypeResource(String fullyQualifiedTypeName) { return getPersistentType().javaPersistentTypeResource(fullyQualifiedTypeName); } @@ -127,7 +129,7 @@ public class JpaCompilationUnitResource extends AbstractResource implements Java * The persistentType resource for the compilation unit's primary type. * Will be null if the primary type is null. */ - public JavaPersistentTypeResource getPersistentType() { + public JavaResourcePersistentType getPersistentType() { return this.persistentType; //TODO should i only be returning this if it returns true to isPersistable? //that's how we handle nestedTypes on JavaPersistentTypeResource @@ -138,13 +140,13 @@ public class JpaCompilationUnitResource extends AbstractResource implements Java // return null; } - protected void setPersistentType(JavaPersistentTypeResource newPersistentType) { - JavaPersistentTypeResource oldPersistentType = this.persistentType; + protected void setPersistentType(JavaResourcePersistentType newPersistentType) { + JavaResourcePersistentType oldPersistentType = this.persistentType; this.persistentType = newPersistentType; firePropertyChanged(PERSISTENT_TYPE_PROPERTY, oldPersistentType, newPersistentType); } - private JavaPersistentTypeResource createJavaPersistentType(IType iType, CompilationUnit astRoot) { + private JavaResourcePersistentType createJavaPersistentType(IType iType, CompilationUnit astRoot) { return JavaPersistentTypeResourceImpl.createJavaPersistentType(this, iType, @@ -169,7 +171,7 @@ public class JpaCompilationUnitResource extends AbstractResource implements Java } - public ITextRange textRange(CompilationUnit astRoot) { + public TextRange textRange(CompilationUnit astRoot) { return null;//this.selectionTextRange(); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Lob.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Lob.java deleted file mode 100644 index 8000242ad4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Lob.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -/** - * Corresponds to the javax.persistence.Lob annotation - */ -public interface Lob extends JavaResource -{ - String ANNOTATION_NAME = JPA.LOB; - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/LobImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/LobImpl.java index 1a910eca13..ebf04ab0f3 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/LobImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/LobImpl.java @@ -14,12 +14,17 @@ import org.eclipse.jpt.core.internal.jdtutility.Attribute; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +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.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.Lob; public class LobImpl extends AbstractAnnotationResource<Attribute> implements Lob { public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - protected LobImpl(JavaResource parent, Attribute attribute) { + protected LobImpl(JavaResourceNode parent, Attribute attribute) { super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); } @@ -55,11 +60,11 @@ public class LobImpl extends AbstractAnnotationResource<Attribute> implements Lo super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return new LobImpl(parent, (Attribute) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToMany.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToMany.java deleted file mode 100644 index db1281ce13..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToMany.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - - -public interface ManyToMany extends RelationshipMapping -{ - String ANNOTATION_NAME = JPA.MANY_TO_MANY; - - /** - * Corresponds to the mappedBy element of the ManyToMany annotation. - * Returns null if the mappedBy element does not exist in java. - */ - String getMappedBy(); - - /** - * Corresponds to the mappedBy element of the ManyToMany annotation. - * Set to null to remove the mappedBy element. - */ - void setMappedBy(String mappedBy); - String MAPPED_BY_PROPERTY = "mappedByProperty"; - - /** - * Return the ITextRange for the mappedBy element. If the mappedBy element - * does not exist return the ITextRange for the ManyToMany annotation. - */ - ITextRange mappedByTextRange(CompilationUnit astRoot); - - /** - * Return whether the specified postition touches the mappedBy element. - * Return false if the mappedBy element does not exist. - */ - boolean mappedByTouches(int pos, CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToManyImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToManyImpl.java index a0cfc4be9c..3f2ad484bd 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToManyImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToManyImpl.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Attribute; import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter; @@ -18,6 +18,12 @@ import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.ManyToMany; public class ManyToManyImpl extends AbstractRelationshipMappingAnnotation implements ManyToMany @@ -36,7 +42,7 @@ public class ManyToManyImpl extends AbstractRelationshipMappingAnnotation implem private String mappedBy; - protected ManyToManyImpl(JavaPersistentAttributeResource parent, Attribute attribute) { + protected ManyToManyImpl(JavaResourcePersistentAttribute parent, Attribute attribute) { super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); this.mappedByAdapter = buildAnnotationElementAdapter(MAPPED_BY_ADAPTER); } @@ -93,7 +99,7 @@ public class ManyToManyImpl extends AbstractRelationshipMappingAnnotation implem return this.mappedByAdapter.getValue(astRoot); } - public ITextRange mappedByTextRange(CompilationUnit astRoot) { + public TextRange mappedByTextRange(CompilationUnit astRoot) { return elementTextRange(MAPPED_BY_ADAPTER, astRoot); } @@ -140,11 +146,11 @@ public class ManyToManyImpl extends AbstractRelationshipMappingAnnotation implem super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { - return new ManyToManyImpl((JavaPersistentAttributeResource) parent, (Attribute) member); + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { + return new ManyToManyImpl((JavaResourcePersistentAttribute) parent, (Attribute) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOne.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOne.java deleted file mode 100644 index 8da89e934b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOne.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - - -public interface ManyToOne extends RelationshipMapping -{ - String ANNOTATION_NAME = JPA.MANY_TO_ONE; - - /** - * Corresponds to the optional element of the ManyToOne annotation. - * Returns null if the optional element does not exist in java. - */ - Boolean getOptional(); - - /** - * Corresponds to the optional element of the ManyToOne annotation. - * Set to null to remove the optional element. - */ - void setOptional(Boolean optional); - String OPTIONAL_PROPERTY = "optionalProperty"; - - /** - * Return the ITextRange for the optional element. If the optional element - * does not exist return the ITextRange for the ManyToOne annotation. - */ - ITextRange optionalTextRange(CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOneImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOneImpl.java index 6d529fb0c7..06aa6b1a50 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOneImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOneImpl.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Attribute; import org.eclipse.jpt.core.internal.jdtutility.BooleanExpressionConverter; @@ -19,6 +19,12 @@ import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.ManyToOne; public class ManyToOneImpl extends AbstractRelationshipMappingAnnotation implements ManyToOne @@ -37,7 +43,7 @@ public class ManyToOneImpl extends AbstractRelationshipMappingAnnotation impleme private Boolean optional; - protected ManyToOneImpl(JavaPersistentAttributeResource parent, Attribute attribute) { + protected ManyToOneImpl(JavaResourcePersistentAttribute parent, Attribute attribute) { super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); this.optionalAdapter = this.buildBooleanAnnotationElementAdapter(OPTIONAL_ADAPTER); } @@ -83,7 +89,7 @@ public class ManyToOneImpl extends AbstractRelationshipMappingAnnotation impleme firePropertyChanged(OPTIONAL_PROPERTY, oldOptional, newOptional); } - public ITextRange optionalTextRange(CompilationUnit astRoot) { + public TextRange optionalTextRange(CompilationUnit astRoot) { return elementTextRange(OPTIONAL_ADAPTER, astRoot); } @@ -139,11 +145,11 @@ public class ManyToOneImpl extends AbstractRelationshipMappingAnnotation impleme super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { - return new ManyToOneImpl((JavaPersistentAttributeResource) parent, (Attribute) member); + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { + return new ManyToOneImpl((JavaResourcePersistentAttribute) parent, (Attribute) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MapKey.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MapKey.java deleted file mode 100644 index 6b3ef7cfb7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MapKey.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.eclipse.jpt.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - -/** - * Corresponds to the javax.persistence.MapKey annotation - */ -public interface MapKey extends JavaResource -{ - String ANNOTATION_NAME = JPA.MAP_KEY; - - String getName(); - void setName(String name); - String NAME_PROPERTY = "nameProperty"; - - /** - * Return the ITextRange for the name element. If the name element - * does not exist return the ITextRange for the MapKey annotation. - */ - ITextRange nameTextRange(CompilationUnit astRoot); - - /** - * Return whether the specified postition touches the name element. - * Return false if the name element does not exist. - */ - public boolean nameTouches(int pos, CompilationUnit astRoot); -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MapKeyImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MapKeyImpl.java index 1213817801..ca73af4396 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MapKeyImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MapKeyImpl.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Attribute; import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter; @@ -19,6 +19,12 @@ import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdap import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.MapKey; public class MapKeyImpl extends AbstractAnnotationResource<Attribute> implements MapKey { @@ -31,7 +37,7 @@ public class MapKeyImpl extends AbstractAnnotationResource<Attribute> implements private String name; - protected MapKeyImpl(JavaResource parent, Attribute attribute) { + protected MapKeyImpl(JavaResourceNode parent, Attribute attribute) { super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); this.nameAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, NAME_ADAPTER); } @@ -55,7 +61,7 @@ public class MapKeyImpl extends AbstractAnnotationResource<Attribute> implements firePropertyChanged(NAME_PROPERTY, oldName, newName); } - public ITextRange nameTextRange(CompilationUnit astRoot) { + public TextRange nameTextRange(CompilationUnit astRoot) { return this.elementTextRange(NAME_ADAPTER, astRoot); } @@ -96,11 +102,11 @@ public class MapKeyImpl extends AbstractAnnotationResource<Attribute> implements super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return new MapKeyImpl(parent, (Attribute) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclass.java deleted file mode 100644 index c2176c5141..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclass.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - - -public interface MappedSuperclass extends JavaResource -{ - String ANNOTATION_NAME = JPA.MAPPED_SUPERCLASS; - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclassImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclassImpl.java index d10a797dc2..94a2943663 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclassImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclassImpl.java @@ -14,13 +14,18 @@ import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Type; +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; -public class MappedSuperclassImpl extends AbstractAnnotationResource<Type> implements MappedSuperclass +public class MappedSuperclassImpl extends AbstractAnnotationResource<Type> implements MappedSuperclassAnnotation { private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - protected MappedSuperclassImpl(JavaPersistentTypeResource parent, Type type) { + protected MappedSuperclassImpl(JavaResourcePersistentType parent, Type type) { super(parent, type, DECLARATION_ANNOTATION_ADAPTER); } @@ -55,11 +60,11 @@ public class MappedSuperclassImpl extends AbstractAnnotationResource<Type> imple super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { - return new MappedSuperclassImpl((JavaPersistentTypeResource) parent, (Type) member); + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { + return new MappedSuperclassImpl((JavaResourcePersistentType) parent, (Type) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedColumn.java deleted file mode 100644 index 2b74348f53..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedColumn.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - - -public interface NamedColumn extends JavaResource -{ - /** - * Corresponds to the name element of the *Column annotation. - * Returns null if the name valuePair does not exist in the annotation - */ - String getName(); - - /** - * Corresponds to the name element of the *Column annotation. - * Set to null to remove the name valuePair from the annotation - */ - void setName(String name); - String NAME_PROPERTY = "nameProperty"; - - /** - * Corresponds to the columnDefinition element of the *Column annotation. - * Returns null if the columnDefinition valuePair does not exist in the annotation - */ - String getColumnDefinition(); - - /** - * Corresponds to the columnDefinition element of the *Column annotation. - * Set to null to remove the columnDefinition valuePair from the annotation - */ - void setColumnDefinition(String columnDefinition); - String COLUMN_DEFINITION_PROPERTY = "columnDefinitionPropety"; - - /** - * Return the ITextRange for the name element. If the name element - * does not exist return the ITextRange for the *Column annotation. - */ - ITextRange nameTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the columnDefinition element. If the columnDefinition - * element does not exist return the ITextRange for the *Column annotation. - */ - ITextRange columnDefinitionTextRange(CompilationUnit astRoot); - - /** - * Return whether the specified postition touches the name element. - * Return false if the name element does not exist. - */ - boolean nameTouches(int pos, CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueries.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueries.java deleted file mode 100644 index 6c5411798d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueries.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - - -public interface NamedNativeQueries extends ContainerAnnotation<NestableNamedNativeQuery> -{ - String ANNOTATION_NAME = JPA.NAMED_NATIVE_QUERIES; - - String NAMED_NATIVE_QUERIES_LIST = "namedNativeQueriesList"; -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueriesImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueriesImpl.java index bb4e015f04..95b3107086 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueriesImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueriesImpl.java @@ -17,6 +17,13 @@ import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Type; +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.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.NamedNativeQueries; +import org.eclipse.jpt.core.resource.java.NamedNativeQueryAnnotation; +import org.eclipse.jpt.core.resource.java.NestableNamedNativeQuery; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; @@ -27,7 +34,7 @@ public class NamedNativeQueriesImpl extends AbstractAnnotationResource<Type> imp private List<NestableNamedNativeQuery> namedNativeQueries; - protected NamedNativeQueriesImpl(JavaResource parent, Type type) { + protected NamedNativeQueriesImpl(JavaResourceNode parent, Type type) { super(parent, type, DECLARATION_ANNOTATION_ADAPTER); this.namedNativeQueries = new ArrayList<NestableNamedNativeQuery>(); } @@ -41,7 +48,7 @@ public class NamedNativeQueriesImpl extends AbstractAnnotationResource<Type> imp } public String getNestableAnnotationName() { - return NamedNativeQuery.ANNOTATION_NAME; + return NamedNativeQueryAnnotation.ANNOTATION_NAME; } public String getElementName() { @@ -133,11 +140,11 @@ public class NamedNativeQueriesImpl extends AbstractAnnotationResource<Type> imp super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return new NamedNativeQueriesImpl(parent, (Type) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQuery.java deleted file mode 100644 index 031805f3b1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQuery.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - - -/** - * Corresponds to the javax.persistence.NamedNativeQuery annotation - */ -public interface NamedNativeQuery extends Query -{ - String ANNOTATION_NAME = JPA.NAMED_NATIVE_QUERY; - - /** - * Corresponds to the resultClass element of the NamedNativeQuery annotation. - * Returns null if the resultClass element does not exist in java. - */ - String getResultClass(); - - /** - * Corresponds to the resultClass element of the NamedNativeQuery annotation. - * Set to null to remove the resultClass element. - */ - void setResultClass(String resultClass); - String RESULT_CLASS_PROPERTY = "resultClassProperty"; - - /** - * Corresponds to the resultSetMapping element of the NamedNativeQuery annotation. - * Returns null if the resultSetMapping element does not exist in java. - */ - String getResultSetMapping(); - - /** - * Corresponds to the resultSetMapping element of the NamedNativeQuery annotation. - * Set to null to remove the resultSetMapping element. - */ - void setResultSetMapping(String resultSetMapping); - String RESULT_SET_MAPPING_PROPERTY = "resultSetMappingProperty"; - - String getFullyQualifiedResultClass(); - String FULLY_QUALIFIED_RESULT_CLASS_PROPERTY = "fullyQualifiedResultClassProperty"; - - /** - * Return the ITextRange for the resultClass element. If resultClass element - * does not exist return the ITextRange for the NamedNativeQuery annotation. - */ - ITextRange resultClassTextRange(CompilationUnit astRoot); - - - /** - * Return the ITextRange for the resultSetMapping element. If resultSetMapping element - * does not exist return the ITextRange for the NamedNativeQuery annotation. - */ - ITextRange resultSetMappingTextRange(CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueryImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueryImpl.java index 571ae650ea..17cc898955 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueryImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueryImpl.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter; @@ -26,6 +26,15 @@ import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotati import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.SimpleTypeStringExpressionConverter; import org.eclipse.jpt.core.internal.jdtutility.Type; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +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.NestableNamedNativeQuery; +import org.eclipse.jpt.core.resource.java.NestableQueryHint; public class NamedNativeQueryImpl extends AbstractNamedQuery implements NestableNamedNativeQuery @@ -50,7 +59,7 @@ public class NamedNativeQueryImpl extends AbstractNamedQuery private String resultSetMapping; - protected NamedNativeQueryImpl(JavaResource parent, Type type, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { + protected NamedNativeQueryImpl(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { super(parent, type, daa, annotationAdapter); this.resultClassDeclarationAdapter = resultClassAdapter(daa); this.resultClassAdapter = this.buildAdapter(this.resultClassDeclarationAdapter); @@ -95,7 +104,7 @@ public class NamedNativeQueryImpl extends AbstractNamedQuery @Override public void initializeFrom(NestableAnnotation oldAnnotation) { super.initializeFrom(oldAnnotation); - NamedNativeQuery oldNamedQuery = (NamedNativeQuery) oldAnnotation; + NamedNativeQueryAnnotation oldNamedQuery = (NamedNativeQueryAnnotation) oldAnnotation; setResultClass(oldNamedQuery.getResultClass()); setResultSetMapping(oldNamedQuery.getResultSetMapping()); } @@ -132,11 +141,11 @@ public class NamedNativeQueryImpl extends AbstractNamedQuery firePropertyChanged(RESULT_SET_MAPPING_PROPERTY, oldResultSetMapping, newResultSetMapping); } - public ITextRange resultClassTextRange(CompilationUnit astRoot) { + public TextRange resultClassTextRange(CompilationUnit astRoot) { return this.elementTextRange(this.resultClassDeclarationAdapter, astRoot); } - public ITextRange resultSetMappingTextRange(CompilationUnit astRoot) { + public TextRange resultSetMappingTextRange(CompilationUnit astRoot) { return this.elementTextRange(this.resultSetMappingDeclarationAdapter, astRoot); } @@ -169,11 +178,11 @@ public class NamedNativeQueryImpl extends AbstractNamedQuery } // ********** static methods ********** - static NamedNativeQueryImpl createNamedNativeQuery(JavaResource parent, Type type) { + static NamedNativeQueryImpl createNamedNativeQuery(JavaResourceNode parent, Type type) { return new NamedNativeQueryImpl(parent, type, DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(type, DECLARATION_ANNOTATION_ADAPTER)); } - static NamedNativeQueryImpl createNestedNamedNativeQuery(JavaResource parent, Type type, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) { + static NamedNativeQueryImpl createNestedNamedNativeQuery(JavaResourceNode parent, Type type, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) { IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter); IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(type, idaa); return new NamedNativeQueryImpl(parent, type, idaa, annotationAdapter); @@ -202,11 +211,11 @@ public class NamedNativeQueryImpl extends AbstractNamedQuery super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return NamedNativeQueryImpl.createNamedNativeQuery(parent, (Type) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueries.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueries.java deleted file mode 100644 index aa4d867556..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueries.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - - -public interface NamedQueries extends ContainerAnnotation<NestableNamedQuery> -{ - String ANNOTATION_NAME = JPA.NAMED_QUERIES; - - String NAMED_QUERIES_LIST = "namedQueriesList"; -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueriesImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueriesImpl.java index 09d376cd7c..c5b859e111 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueriesImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueriesImpl.java @@ -17,6 +17,13 @@ import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Type; +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.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.NamedQueries; +import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation; +import org.eclipse.jpt.core.resource.java.NestableNamedQuery; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; @@ -27,7 +34,7 @@ public class NamedQueriesImpl extends AbstractAnnotationResource<Type> implement private List<NestableNamedQuery> namedQueries; - protected NamedQueriesImpl(JavaResource parent, Type type) { + protected NamedQueriesImpl(JavaResourceNode parent, Type type) { super(parent, type, DECLARATION_ANNOTATION_ADAPTER); this.namedQueries = new ArrayList<NestableNamedQuery>(); } @@ -41,7 +48,7 @@ public class NamedQueriesImpl extends AbstractAnnotationResource<Type> implement } public String getNestableAnnotationName() { - return NamedQuery.ANNOTATION_NAME; + return NamedQueryAnnotation.ANNOTATION_NAME; } public String getElementName() { @@ -132,11 +139,11 @@ public class NamedQueriesImpl extends AbstractAnnotationResource<Type> implement super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return new NamedQueriesImpl(parent, (Type) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQuery.java deleted file mode 100644 index 65ed8460bb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQuery.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -/** - * Corresponds to the javax.persistence.NamedQuery annotation - */ -public interface NamedQuery extends Query -{ - String ANNOTATION_NAME = JPA.NAMED_QUERY; - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueryImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueryImpl.java index b7bf11399f..cf7c96b5c5 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueryImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueryImpl.java @@ -19,6 +19,13 @@ import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Type; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.NestableNamedQuery; +import org.eclipse.jpt.core.resource.java.NestableQueryHint; public class NamedQueryImpl extends AbstractNamedQuery implements NestableNamedQuery @@ -26,7 +33,7 @@ public class NamedQueryImpl extends AbstractNamedQuery public static final SimpleDeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - protected NamedQueryImpl(JavaResource parent, Type type, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { + protected NamedQueryImpl(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { super(parent, type, daa, annotationAdapter); } @@ -51,11 +58,11 @@ public class NamedQueryImpl extends AbstractNamedQuery } // ********** static methods ********** - static NamedQueryImpl createNamedQuery(JavaResource parent, Type type) { + static NamedQueryImpl createNamedQuery(JavaResourceNode parent, Type type) { return new NamedQueryImpl(parent, type, DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(type, DECLARATION_ANNOTATION_ADAPTER)); } - static NamedQueryImpl createNestedNamedQuery(JavaResource parent, Type type, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) { + static NamedQueryImpl createNestedNamedQuery(JavaResourceNode parent, Type type, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) { IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter); IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(type, idaa); return new NamedQueryImpl(parent, type, idaa, annotationAdapter); @@ -84,11 +91,11 @@ public class NamedQueryImpl extends AbstractNamedQuery super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return NamedQueryImpl.createNamedQuery(parent, (Type) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableAnnotation.java deleted file mode 100644 index 36229ce0d3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableAnnotation.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - - -public interface NestableAnnotation extends Annotation -{ - //currently using this when the NestableAnnotation is moved from - //standalone to nested or from nested to standalone. - //not the greatest since you have to make sure to call all setter methods - void initializeFrom(NestableAnnotation oldAnnotation); - - /** - * Should only be called when the NestableAnnotation is actually nested - * @param newIndex - */ - void moveAnnotation(int newIndex); -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableAssociationOverride.java deleted file mode 100644 index 9b698a89cf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableAssociationOverride.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.eclipse.jpt.core.internal.resource.java; - -public interface NestableAssociationOverride - extends AssociationOverride, NestableAnnotation -{} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableAttributeOverride.java deleted file mode 100644 index 7e0dcc41fd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableAttributeOverride.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.eclipse.jpt.core.internal.resource.java; - -public interface NestableAttributeOverride - extends AttributeOverride, NestableAnnotation -{} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableJoinColumn.java deleted file mode 100644 index 003b2afc9c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableJoinColumn.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.eclipse.jpt.core.internal.resource.java; - -interface NestableJoinColumn extends JoinColumn, NestableAnnotation -{} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableNamedNativeQuery.java deleted file mode 100644 index 05ee12d7fa..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableNamedNativeQuery.java +++ /dev/null @@ -1,13 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -public interface NestableNamedNativeQuery extends NamedNativeQuery, NestableAnnotation -{} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableNamedQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableNamedQuery.java deleted file mode 100644 index 85d0cb8ed5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableNamedQuery.java +++ /dev/null @@ -1,13 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -public interface NestableNamedQuery extends NamedQuery, NestableAnnotation -{} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestablePrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestablePrimaryKeyJoinColumn.java deleted file mode 100644 index 1a7f8741ac..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestablePrimaryKeyJoinColumn.java +++ /dev/null @@ -1,13 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -interface NestablePrimaryKeyJoinColumn extends PrimaryKeyJoinColumn, NestableAnnotation -{} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableQueryHint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableQueryHint.java deleted file mode 100644 index b64e966b60..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableQueryHint.java +++ /dev/null @@ -1,13 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -public interface NestableQueryHint extends QueryHint, NestableAnnotation -{} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableSecondaryTable.java deleted file mode 100644 index aab4dffc23..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableSecondaryTable.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.eclipse.jpt.core.internal.resource.java; - -public interface NestableSecondaryTable extends SecondaryTable, NestableAnnotation -{} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableUniqueConstraint.java deleted file mode 100644 index 366206bbcb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableUniqueConstraint.java +++ /dev/null @@ -1,13 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -public interface NestableUniqueConstraint extends UniqueConstraint, NestableAnnotation -{} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAbstractColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAbstractColumn.java index b520112fb0..6aca12636b 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAbstractColumn.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAbstractColumn.java @@ -10,17 +10,20 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; +import org.eclipse.jpt.core.resource.java.AbstractColumnAnnotation; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; -public abstract class NullAbstractColumn extends NullNamedColumn implements AbstractColumn, Annotation +public abstract class NullAbstractColumn extends NullNamedColumn implements AbstractColumnAnnotation, Annotation { - protected NullAbstractColumn(JavaResource parent) { + protected NullAbstractColumn(JavaResourceNode parent) { super(parent); } @Override - protected abstract AbstractColumn createColumnResource(); + protected abstract AbstractColumnAnnotation createColumnResource(); public String getTable() { return null; @@ -72,23 +75,23 @@ public abstract class NullAbstractColumn extends NullNamedColumn implements Abst } } - public ITextRange tableTextRange(CompilationUnit astRoot) { + public TextRange tableTextRange(CompilationUnit astRoot) { return null; } - public ITextRange uniqueTextRange(CompilationUnit astRoot) { + public TextRange uniqueTextRange(CompilationUnit astRoot) { return null; } - public ITextRange updatableTextRange(CompilationUnit astRoot) { + public TextRange updatableTextRange(CompilationUnit astRoot) { return null; } - public ITextRange insertableTextRange(CompilationUnit astRoot) { + public TextRange insertableTextRange(CompilationUnit astRoot) { return null; } - public ITextRange nullableTextRange(CompilationUnit astRoot) { + public TextRange nullableTextRange(CompilationUnit astRoot) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAbstractTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAbstractTable.java index 36f9738410..dd58083a43 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAbstractTable.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAbstractTable.java @@ -11,18 +11,22 @@ package org.eclipse.jpt.core.internal.resource.java; import java.util.ListIterator; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.TableAnnotation; +import org.eclipse.jpt.core.resource.java.UniqueConstraint; import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator; -public abstract class NullAbstractTable extends AbstractResource implements Table, Annotation +public abstract class NullAbstractTable extends AbstractResource implements TableAnnotation, Annotation { - protected NullAbstractTable(JavaPersistentResource parent) { + protected NullAbstractTable(JavaResourcePersistentMember parent) { super(parent); } @Override - public JavaPersistentResource parent() { - return (JavaPersistentResource) super.parent(); + public JavaResourcePersistentMember parent() { + return (JavaResourcePersistentMember) super.parent(); } public void initialize(CompilationUnit astRoot) { @@ -41,8 +45,8 @@ public abstract class NullAbstractTable extends AbstractResource implements Tabl throw new UnsupportedOperationException(); } - protected Table createTableResource() { - return (Table) parent().addAnnotation(getAnnotationName()); + protected TableAnnotation createTableResource() { + return (TableAnnotation) parent().addAnnotation(getAnnotationName()); } public String getName() { @@ -102,19 +106,19 @@ public abstract class NullAbstractTable extends AbstractResource implements Tabl return 0; } - public ITextRange textRange(CompilationUnit astRoot) { + public TextRange textRange(CompilationUnit astRoot) { return null; } - public ITextRange nameTextRange(CompilationUnit astRoot) { + public TextRange nameTextRange(CompilationUnit astRoot) { return null; } - public ITextRange catalogTextRange(CompilationUnit astRoot) { + public TextRange catalogTextRange(CompilationUnit astRoot) { return null; } - public ITextRange schemaTextRange(CompilationUnit astRoot) { + public TextRange schemaTextRange(CompilationUnit astRoot) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAssociationOverride.java index 8528e3dff3..52120530a7 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAssociationOverride.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAssociationOverride.java @@ -11,15 +11,20 @@ package org.eclipse.jpt.core.internal.resource.java; import java.util.ListIterator; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation; import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator; -public class NullAssociationOverride extends AbstractResource implements AssociationOverride, Annotation +public class NullAssociationOverride extends AbstractResource implements AssociationOverrideAnnotation, Annotation { private String name; - public NullAssociationOverride(JavaResource parent, String name) { + public NullAssociationOverride(JavaResourceNode parent, String name) { super(parent); this.name = name; } @@ -41,7 +46,7 @@ public class NullAssociationOverride extends AbstractResource implements Associa } public String getAnnotationName() { - return AssociationOverride.ANNOTATION_NAME; + return AssociationOverrideAnnotation.ANNOTATION_NAME; } public String getName() { @@ -54,15 +59,15 @@ public class NullAssociationOverride extends AbstractResource implements Associa } } - public ListIterator<JoinColumn> joinColumns() { + public ListIterator<JoinColumnAnnotation> joinColumns() { return EmptyListIterator.instance(); } - public JoinColumn joinColumnAt(int index) { + public JoinColumnAnnotation joinColumnAt(int index) { return null; } - public int indexOfJoinColumn(JoinColumn joinColumn) { + public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) { throw new UnsupportedOperationException(); } @@ -70,7 +75,7 @@ public class NullAssociationOverride extends AbstractResource implements Associa return 0; } - public JoinColumn addJoinColumn(int index) { + public JoinColumnAnnotation addJoinColumn(int index) { throw new UnsupportedOperationException(); } @@ -83,12 +88,12 @@ public class NullAssociationOverride extends AbstractResource implements Associa } @Override - public JavaPersistentResource parent() { - return (JavaPersistentResource) super.parent(); + public JavaResourcePersistentMember parent() { + return (JavaResourcePersistentMember) super.parent(); } - protected AssociationOverride createAssociationOverrideResource() { - return (AssociationOverride) parent().addAnnotation(getAnnotationName()); + protected AssociationOverrideAnnotation createAssociationOverrideResource() { + return (AssociationOverrideAnnotation) parent().addAnnotation(getAnnotationName()); } public void updateFromJava(CompilationUnit astRoot) { @@ -100,11 +105,11 @@ public class NullAssociationOverride extends AbstractResource implements Associa return false; } - public ITextRange nameTextRange(CompilationUnit astRoot) { + public TextRange nameTextRange(CompilationUnit astRoot) { return null; } - public ITextRange textRange(CompilationUnit astRoot) { + public TextRange textRange(CompilationUnit astRoot) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverride.java index 3907bf15ca..a463e96ec1 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverride.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverride.java @@ -10,10 +10,15 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation; +import org.eclipse.jpt.core.resource.java.ColumnAnnotation; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; -public class NullAttributeOverride extends AbstractResource implements AttributeOverride, Annotation +public class NullAttributeOverride extends AbstractResource implements AttributeOverrideAnnotation, Annotation { //TODO should I hold on to the IColumnMapping that this attribute override is built from? //this would make it more similar to the Virtual mappings concept in xml @@ -23,7 +28,7 @@ public class NullAttributeOverride extends AbstractResource implements Attribute private String name; - public NullAttributeOverride(JavaResource parent, String name) { + public NullAttributeOverride(JavaResourceNode parent, String name) { super(parent); this.name = name; this.column = new NullAttributeOverrideColumn(this); @@ -46,7 +51,7 @@ public class NullAttributeOverride extends AbstractResource implements Attribute } public String getAnnotationName() { - return AttributeOverride.ANNOTATION_NAME; + return AttributeOverrideAnnotation.ANNOTATION_NAME; } public String getName() { @@ -59,15 +64,15 @@ public class NullAttributeOverride extends AbstractResource implements Attribute } } - public Column getNonNullColumn() { + public ColumnAnnotation getNonNullColumn() { return getColumn(); } - public Column getColumn() { + public ColumnAnnotation getColumn() { return this.column; } - public Column addColumn() { + public ColumnAnnotation addColumn() { throw new UnsupportedOperationException(); } @@ -76,12 +81,12 @@ public class NullAttributeOverride extends AbstractResource implements Attribute } @Override - public JavaPersistentResource parent() { - return (JavaPersistentResource) super.parent(); + public JavaResourcePersistentMember parent() { + return (JavaResourcePersistentMember) super.parent(); } - protected AttributeOverride createAttributeOverrideResource() { - return (AttributeOverride) parent().addAnnotation(getAnnotationName()); + protected AttributeOverrideAnnotation createAttributeOverrideResource() { + return (AttributeOverrideAnnotation) parent().addAnnotation(getAnnotationName()); } public void updateFromJava(CompilationUnit astRoot) { @@ -93,11 +98,11 @@ public class NullAttributeOverride extends AbstractResource implements Attribute return false; } - public ITextRange nameTextRange(CompilationUnit astRoot) { + public TextRange nameTextRange(CompilationUnit astRoot) { return null; } - public ITextRange textRange(CompilationUnit astRoot) { + public TextRange textRange(CompilationUnit astRoot) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverrideColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverrideColumn.java index d065d165a9..fda89806cc 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverrideColumn.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverrideColumn.java @@ -10,26 +10,29 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation; +import org.eclipse.jpt.core.resource.java.ColumnAnnotation; -public class NullAttributeOverrideColumn extends NullAbstractColumn implements Column, Annotation +public class NullAttributeOverrideColumn extends NullAbstractColumn implements ColumnAnnotation, Annotation { - public NullAttributeOverrideColumn(AttributeOverride parent) { + public NullAttributeOverrideColumn(AttributeOverrideAnnotation parent) { super(parent); } @Override - public AttributeOverride parent() { - return (AttributeOverride) super.parent(); + public AttributeOverrideAnnotation parent() { + return (AttributeOverrideAnnotation) super.parent(); } public String getAnnotationName() { - return Column.ANNOTATION_NAME; + return ColumnAnnotation.ANNOTATION_NAME; } @Override - protected Column createColumnResource() { + protected ColumnAnnotation createColumnResource() { return parent().addColumn(); } @@ -63,15 +66,15 @@ public class NullAttributeOverrideColumn extends NullAbstractColumn implements C } } - public ITextRange scaleTextRange(CompilationUnit astRoot) { + public TextRange scaleTextRange(CompilationUnit astRoot) { return null; } - public ITextRange lengthTextRange(CompilationUnit astRoot) { + public TextRange lengthTextRange(CompilationUnit astRoot) { return null; } - public ITextRange precisionTextRange(CompilationUnit astRoot) { + public TextRange precisionTextRange(CompilationUnit astRoot) { return null; } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBasic.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBasic.java index 5aa5ac84aa..ab22d3c691 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBasic.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBasic.java @@ -10,12 +10,16 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.Basic; +import org.eclipse.jpt.core.resource.java.FetchType; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; public class NullBasic extends AbstractResource implements Basic, Annotation { - protected NullBasic(JavaPersistentResource parent) { + protected NullBasic(JavaResourcePersistentMember parent) { super(parent); } @@ -40,8 +44,8 @@ public class NullBasic extends AbstractResource implements Basic, Annotation } @Override - public JavaPersistentResource parent() { - return (JavaPersistentResource) super.parent(); + public JavaResourcePersistentMember parent() { + return (JavaResourcePersistentMember) super.parent(); } protected Basic createBasicResource() { @@ -73,15 +77,15 @@ public class NullBasic extends AbstractResource implements Basic, Annotation throw new UnsupportedOperationException(); } - public ITextRange textRange(CompilationUnit astRoot) { + public TextRange textRange(CompilationUnit astRoot) { return null; } - public ITextRange fetchTextRange(CompilationUnit astRoot) { + public TextRange fetchTextRange(CompilationUnit astRoot) { return null; } - public ITextRange optionalTextRange(CompilationUnit astRoot) { + public TextRange optionalTextRange(CompilationUnit astRoot) { return null; } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullColumn.java index e17b948d89..420df097b9 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullColumn.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullColumn.java @@ -10,27 +10,30 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.ColumnAnnotation; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -public class NullColumn extends NullAbstractColumn implements Column, Annotation +public class NullColumn extends NullAbstractColumn implements ColumnAnnotation, Annotation { - public NullColumn(JavaPersistentResource parent) { + public NullColumn(JavaResourcePersistentMember parent) { super(parent); } @Override - public JavaPersistentResource parent() { - return (JavaPersistentResource) super.parent(); + public JavaResourcePersistentMember parent() { + return (JavaResourcePersistentMember) super.parent(); } public String getAnnotationName() { - return Column.ANNOTATION_NAME; + return ColumnAnnotation.ANNOTATION_NAME; } @Override - protected Column createColumnResource() { - return (Column) parent().addAnnotation(getAnnotationName()); + protected ColumnAnnotation createColumnResource() { + return (ColumnAnnotation) parent().addAnnotation(getAnnotationName()); } public Integer getLength() { @@ -63,15 +66,15 @@ public class NullColumn extends NullAbstractColumn implements Column, Annotation } } - public ITextRange scaleTextRange(CompilationUnit astRoot) { + public TextRange scaleTextRange(CompilationUnit astRoot) { return null; } - public ITextRange lengthTextRange(CompilationUnit astRoot) { + public TextRange lengthTextRange(CompilationUnit astRoot) { return null; } - public ITextRange precisionTextRange(CompilationUnit astRoot) { + public TextRange precisionTextRange(CompilationUnit astRoot) { return null; } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorColumn.java index 35d3b6fc1e..6bfa0ab74f 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorColumn.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorColumn.java @@ -9,26 +9,31 @@ ******************************************************************************/ package org.eclipse.jpt.core.internal.resource.java; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.DiscriminatorColumnAnnotation; +import org.eclipse.jpt.core.resource.java.DiscriminatorType; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -public class NullDiscriminatorColumn extends NullNamedColumn implements DiscriminatorColumn, Annotation + +public class NullDiscriminatorColumn extends NullNamedColumn implements DiscriminatorColumnAnnotation, Annotation { - public NullDiscriminatorColumn(JavaPersistentResource parent) { + public NullDiscriminatorColumn(JavaResourcePersistentMember parent) { super(parent); } @Override - public JavaPersistentResource parent() { - return (JavaPersistentResource) super.parent(); + public JavaResourcePersistentMember parent() { + return (JavaResourcePersistentMember) super.parent(); } public String getAnnotationName() { - return DiscriminatorColumn.ANNOTATION_NAME; + return DiscriminatorColumnAnnotation.ANNOTATION_NAME; } @Override - protected DiscriminatorColumn createColumnResource() { - return (DiscriminatorColumn) parent().addAnnotation(getAnnotationName()); + protected DiscriminatorColumnAnnotation createColumnResource() { + return (DiscriminatorColumnAnnotation) parent().addAnnotation(getAnnotationName()); } public DiscriminatorType getDiscriminatorType() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorValue.java index 21062e8f64..394461f841 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorValue.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorValue.java @@ -10,18 +10,21 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.DiscriminatorValue; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; public class NullDiscriminatorValue extends AbstractResource implements DiscriminatorValue, Annotation { - protected NullDiscriminatorValue(JavaPersistentResource parent) { + protected NullDiscriminatorValue(JavaResourcePersistentMember parent) { super(parent); } @Override - public JavaPersistentResource parent() { - return (JavaPersistentResource) super.parent(); + public JavaResourcePersistentMember parent() { + return (JavaResourcePersistentMember) super.parent(); } public void initialize(CompilationUnit astRoot) { @@ -63,11 +66,11 @@ public class NullDiscriminatorValue extends AbstractResource implements Discrimi } - public ITextRange valueTextRange(CompilationUnit astRoot) { + public TextRange valueTextRange(CompilationUnit astRoot) { return null; } - public ITextRange textRange(CompilationUnit astRoot) { + public TextRange textRange(CompilationUnit astRoot) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEmbedded.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEmbedded.java index 80625329ed..1aa8255055 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEmbedded.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEmbedded.java @@ -10,12 +10,15 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.Embedded; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; public class NullEmbedded extends AbstractResource implements Embedded, Annotation { - protected NullEmbedded(JavaPersistentResource parent) { + protected NullEmbedded(JavaResourcePersistentMember parent) { super(parent); } @@ -40,8 +43,8 @@ public class NullEmbedded extends AbstractResource implements Embedded, Annotati } @Override - public JavaPersistentResource parent() { - return (JavaPersistentResource) super.parent(); + public JavaResourcePersistentMember parent() { + return (JavaResourcePersistentMember) super.parent(); } @@ -49,7 +52,7 @@ public class NullEmbedded extends AbstractResource implements Embedded, Annotati throw new UnsupportedOperationException(); } - public ITextRange textRange(CompilationUnit astRoot) { + public TextRange textRange(CompilationUnit astRoot) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEnumerated.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEnumerated.java index 43108a09c8..69c511f83c 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEnumerated.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEnumerated.java @@ -10,18 +10,22 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.EnumType; +import org.eclipse.jpt.core.resource.java.Enumerated; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; public class NullEnumerated extends AbstractResource implements Enumerated, Annotation { - protected NullEnumerated(JavaPersistentResource parent) { + protected NullEnumerated(JavaResourcePersistentMember parent) { super(parent); } @Override - public JavaPersistentResource parent() { - return (JavaPersistentResource) super.parent(); + public JavaResourcePersistentMember parent() { + return (JavaResourcePersistentMember) super.parent(); } public void initialize(CompilationUnit astRoot) { @@ -63,11 +67,11 @@ public class NullEnumerated extends AbstractResource implements Enumerated, Anno throw new UnsupportedOperationException(); } - public ITextRange textRange(CompilationUnit astRoot) { + public TextRange textRange(CompilationUnit astRoot) { return null; } - public ITextRange valueTextRange(CompilationUnit astRoot) { + public TextRange valueTextRange(CompilationUnit astRoot) { return null; } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullInheritance.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullInheritance.java index 6c80cff7a0..86a27db0a5 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullInheritance.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullInheritance.java @@ -10,18 +10,22 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.Inheritance; +import org.eclipse.jpt.core.resource.java.InheritanceType; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; public class NullInheritance extends AbstractResource implements Inheritance, Annotation { - protected NullInheritance(JavaPersistentResource parent) { + protected NullInheritance(JavaResourcePersistentMember parent) { super(parent); } @Override - public JavaPersistentResource parent() { - return (JavaPersistentResource) super.parent(); + public JavaResourcePersistentMember parent() { + return (JavaResourcePersistentMember) super.parent(); } public void initialize(CompilationUnit astRoot) { @@ -64,11 +68,11 @@ public class NullInheritance extends AbstractResource implements Inheritance, An } - public ITextRange strategyTextRange(CompilationUnit astRoot) { + public TextRange strategyTextRange(CompilationUnit astRoot) { return null; } - public ITextRange textRange(CompilationUnit astRoot) { + public TextRange textRange(CompilationUnit astRoot) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinColumn.java index 677233f3ef..e3b713cc68 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinColumn.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinColumn.java @@ -10,22 +10,25 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation; -public class NullJoinColumn extends NullAbstractColumn implements JoinColumn, Annotation +public class NullJoinColumn extends NullAbstractColumn implements JoinColumnAnnotation, Annotation { - public NullJoinColumn(JavaResource parent) { + public NullJoinColumn(JavaResourceNode parent) { super(parent); } public String getAnnotationName() { - return JoinColumn.ANNOTATION_NAME; + return JoinColumnAnnotation.ANNOTATION_NAME; } @Override - protected JoinColumn createColumnResource() { + protected JoinColumnAnnotation createColumnResource() { throw new UnsupportedOperationException(); } @@ -37,7 +40,7 @@ public class NullJoinColumn extends NullAbstractColumn implements JoinColumn, An throw new UnsupportedOperationException(); } - public ITextRange referencedColumnNameTextRange(CompilationUnit astRoot) { + public TextRange referencedColumnNameTextRange(CompilationUnit astRoot) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinTable.java index ddada229ea..a70b34fa70 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinTable.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinTable.java @@ -10,40 +10,43 @@ package org.eclipse.jpt.core.internal.resource.java; import java.util.ListIterator; +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.utility.internal.iterators.EmptyListIterator; -public class NullJoinTable extends NullAbstractTable implements JoinTable +public class NullJoinTable extends NullAbstractTable implements JoinTableAnnotation { - protected NullJoinTable(JavaPersistentResource parent) { + protected NullJoinTable(JavaResourcePersistentMember parent) { super(parent); } public String getAnnotationName() { - return JoinTable.ANNOTATION_NAME; + return JoinTableAnnotation.ANNOTATION_NAME; } - public JoinColumn addInverseJoinColumn(int index) { + public JoinColumnAnnotation addInverseJoinColumn(int index) { throw new UnsupportedOperationException(); } - public JoinColumn addJoinColumn(int index) { + public JoinColumnAnnotation addJoinColumn(int index) { throw new UnsupportedOperationException(); } - public int indexOfInverseJoinColumn(JoinColumn joinColumn) { + public int indexOfInverseJoinColumn(JoinColumnAnnotation joinColumn) { throw new UnsupportedOperationException(); } - public int indexOfJoinColumn(JoinColumn joinColumn) { + public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) { throw new UnsupportedOperationException(); } - public JoinColumn inverseJoinColumnAt(int index) { + public JoinColumnAnnotation inverseJoinColumnAt(int index) { return null; } - public ListIterator<JoinColumn> inverseJoinColumns() { + public ListIterator<JoinColumnAnnotation> inverseJoinColumns() { return EmptyListIterator.instance(); } @@ -51,11 +54,11 @@ public class NullJoinTable extends NullAbstractTable implements JoinTable return 0; } - public JoinColumn joinColumnAt(int index) { + public JoinColumnAnnotation joinColumnAt(int index) { return null; } - public ListIterator<JoinColumn> joinColumns() { + public ListIterator<JoinColumnAnnotation> joinColumns() { return EmptyListIterator.instance(); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullNamedColumn.java index be9274e05b..4736a22b6f 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullNamedColumn.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullNamedColumn.java @@ -10,12 +10,15 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.NamedColumnAnnotation; -public abstract class NullNamedColumn extends AbstractResource implements NamedColumn, Annotation +public abstract class NullNamedColumn extends AbstractResource implements NamedColumnAnnotation, Annotation { - protected NullNamedColumn(JavaResource parent) { + protected NullNamedColumn(JavaResourceNode parent) { super(parent); } @@ -35,7 +38,7 @@ public abstract class NullNamedColumn extends AbstractResource implements NamedC throw new UnsupportedOperationException(); } - protected abstract NamedColumn createColumnResource(); + protected abstract NamedColumnAnnotation createColumnResource(); public String getName() { return null; @@ -61,15 +64,15 @@ public abstract class NullNamedColumn extends AbstractResource implements NamedC throw new UnsupportedOperationException(); } - public ITextRange textRange(CompilationUnit astRoot) { + public TextRange textRange(CompilationUnit astRoot) { return null; } - public ITextRange columnDefinitionTextRange(CompilationUnit astRoot) { + public TextRange columnDefinitionTextRange(CompilationUnit astRoot) { return null; } - public ITextRange nameTextRange(CompilationUnit astRoot) { + public TextRange nameTextRange(CompilationUnit astRoot) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullPrimaryKeyJoinColumn.java index d0f4fb65d7..b2b1d0da3b 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullPrimaryKeyJoinColumn.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullPrimaryKeyJoinColumn.java @@ -10,22 +10,25 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation; -public class NullPrimaryKeyJoinColumn extends NullNamedColumn implements PrimaryKeyJoinColumn, Annotation +public class NullPrimaryKeyJoinColumn extends NullNamedColumn implements PrimaryKeyJoinColumnAnnotation, Annotation { - public NullPrimaryKeyJoinColumn(JavaResource parent) { + public NullPrimaryKeyJoinColumn(JavaResourceNode parent) { super(parent); } public String getAnnotationName() { - return PrimaryKeyJoinColumn.ANNOTATION_NAME; + return PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME; } @Override - protected PrimaryKeyJoinColumn createColumnResource() { + protected PrimaryKeyJoinColumnAnnotation createColumnResource() { throw new UnsupportedOperationException(); } @@ -37,7 +40,7 @@ public class NullPrimaryKeyJoinColumn extends NullNamedColumn implements Primary throw new UnsupportedOperationException(); } - public ITextRange referencedColumnNameTextRange(CompilationUnit astRoot) { + public TextRange referencedColumnNameTextRange(CompilationUnit astRoot) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTable.java index 27b5886f53..a0832f080b 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTable.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTable.java @@ -9,15 +9,18 @@ ******************************************************************************/ package org.eclipse.jpt.core.internal.resource.java; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.TableAnnotation; -public class NullTable extends NullAbstractTable implements Table + +public class NullTable extends NullAbstractTable implements TableAnnotation { - protected NullTable(JavaPersistentResource parent) { + protected NullTable(JavaResourcePersistentMember parent) { super(parent); } public String getAnnotationName() { - return Table.ANNOTATION_NAME; + return TableAnnotation.ANNOTATION_NAME; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTemporal.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTemporal.java index bdaf366091..4c67947c17 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTemporal.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTemporal.java @@ -10,12 +10,16 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.Temporal; +import org.eclipse.jpt.core.resource.java.TemporalType; public class NullTemporal extends AbstractResource implements Temporal, Annotation { - protected NullTemporal(JavaPersistentResource parent) { + protected NullTemporal(JavaResourcePersistentMember parent) { super(parent); } @@ -40,8 +44,8 @@ public class NullTemporal extends AbstractResource implements Temporal, Annotati } @Override - public JavaPersistentResource parent() { - return (JavaPersistentResource) super.parent(); + public JavaResourcePersistentMember parent() { + return (JavaResourcePersistentMember) super.parent(); } protected Temporal createTemporalResource() { @@ -63,11 +67,11 @@ public class NullTemporal extends AbstractResource implements Temporal, Annotati throw new UnsupportedOperationException(); } - public ITextRange textRange(CompilationUnit astRoot) { + public TextRange textRange(CompilationUnit astRoot) { return null; } - public ITextRange valueTextRange(CompilationUnit astRoot) { + public TextRange valueTextRange(CompilationUnit astRoot) { return null; } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToMany.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToMany.java deleted file mode 100644 index d243d76c19..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToMany.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - - -public interface OneToMany extends RelationshipMapping -{ - String ANNOTATION_NAME = JPA.ONE_TO_MANY; - - /** - * Corresponds to the mappedBy element of the OneToMany annotation. - * Returns null if the mappedBy element does not exist in java. - */ - String getMappedBy(); - - /** - * Corresponds to the mappedBy element of the OneToMany annotation. - * Set to null to remove the mappedBy element. - */ - void setMappedBy(String mappedBy); - String MAPPED_BY_PROPERTY = "mappedByProperty"; - - /** - * Return the ITextRange for the mappedBy element. If the mappedBy element - * does not exist return the ITextRange for the OneToMany annotation. - */ - ITextRange mappedByTextRange(CompilationUnit astRoot); - - /** - * Return whether the specified postition touches the mappedBy element. - * Return false if the mappedBy element does not exist. - */ - boolean mappedByTouches(int pos, CompilationUnit astRoot); -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToManyImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToManyImpl.java index 8adb00642a..d5a6d6059f 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToManyImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToManyImpl.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Attribute; import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter; @@ -18,6 +18,12 @@ import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.OneToMany; public class OneToManyImpl extends AbstractRelationshipMappingAnnotation implements OneToMany { @@ -35,7 +41,7 @@ public class OneToManyImpl extends AbstractRelationshipMappingAnnotation impleme private String mappedBy; - protected OneToManyImpl(JavaPersistentAttributeResource parent, Attribute attribute) { + protected OneToManyImpl(JavaResourcePersistentAttribute parent, Attribute attribute) { super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); this.mappedByAdapter = buildAnnotationElementAdapter(MAPPED_BY_ADAPTER); } @@ -81,7 +87,7 @@ public class OneToManyImpl extends AbstractRelationshipMappingAnnotation impleme firePropertyChanged(MAPPED_BY_PROPERTY, oldMappedBy, newMappedBy); } - public ITextRange mappedByTextRange(CompilationUnit astRoot) { + public TextRange mappedByTextRange(CompilationUnit astRoot) { return elementTextRange(MAPPED_BY_ADAPTER, astRoot); } @@ -136,11 +142,11 @@ public class OneToManyImpl extends AbstractRelationshipMappingAnnotation impleme super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { - return new OneToManyImpl((JavaPersistentAttributeResource) parent, (Attribute) member); + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { + return new OneToManyImpl((JavaResourcePersistentAttribute) parent, (Attribute) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOne.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOne.java deleted file mode 100644 index bc7524d5bd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOne.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - - -public interface OneToOne extends RelationshipMapping -{ - String ANNOTATION_NAME = JPA.ONE_TO_ONE; - - /** - * Corresponds to the optional element of the OneToOne annotation. - * Returns null if the optional element does not exist in java. - */ - Boolean getOptional(); - - /** - * Corresponds to the optional element of the OneToOne annotation. - * Set to null to remove the optional element. - */ - void setOptional(Boolean optional); - String OPTIONAL_PROPERTY = "optionalProperty"; - - /** - * Corresponds to the mappedBy element of the OneToOne annotation. - * Returns null if the mappedBy element does not exist in java. - */ - String getMappedBy(); - - /** - * Corresponds to the mappedBy element of the OneToOne annotation. - * Set to null to remove the mappedBy element. - */ - void setMappedBy(String mappedBy); - String MAPPED_BY_PROPERTY = "mappedByProperty"; - - /** - * Return the ITextRange for the mappedBy element. If the mappedBy element - * does not exist return the ITextRange for the OneToOne annotation. - */ - ITextRange mappedByTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the optional element. If the optional element - * does not exist return the ITextRange for the OneToOne annotation. - */ - ITextRange optionalTextRange(CompilationUnit astRoot); - - /** - * Return whether the specified postition touches the mappedBy element. - * Return false if the mappedBy element does not exist. - */ - boolean mappedByTouches(int pos, CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOneImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOneImpl.java index 2830753b90..6064819b1d 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOneImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOneImpl.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Attribute; import org.eclipse.jpt.core.internal.jdtutility.BooleanExpressionConverter; @@ -19,6 +19,12 @@ import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.OneToOne; public class OneToOneImpl extends AbstractRelationshipMappingAnnotation implements OneToOne { @@ -43,7 +49,7 @@ public class OneToOneImpl extends AbstractRelationshipMappingAnnotation implemen private String mappedBy; - public OneToOneImpl(JavaPersistentAttributeResource parent, Attribute attribute) { + public OneToOneImpl(JavaResourcePersistentAttribute parent, Attribute attribute) { super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); this.mappedByAdapter = buildAnnotationElementAdapter(MAPPED_BY_ADAPTER); this.optionalAdapter = this.buildBooleanAnnotationElementAdapter(OPTIONAL_ADAPTER); @@ -102,11 +108,11 @@ public class OneToOneImpl extends AbstractRelationshipMappingAnnotation implemen firePropertyChanged(MAPPED_BY_PROPERTY, oldMappedBy, newMappedBy); } - public ITextRange mappedByTextRange(CompilationUnit astRoot) { + public TextRange mappedByTextRange(CompilationUnit astRoot) { return elementTextRange(MAPPED_BY_ADAPTER, astRoot); } - public ITextRange optionalTextRange(CompilationUnit astRoot) { + public TextRange optionalTextRange(CompilationUnit astRoot) { return elementTextRange(OPTIONAL_ADAPTER, astRoot); } @@ -176,11 +182,11 @@ public class OneToOneImpl extends AbstractRelationshipMappingAnnotation implemen super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { - return new OneToOneImpl((JavaPersistentAttributeResource) parent, (Attribute) member); + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { + return new OneToOneImpl((JavaResourcePersistentAttribute) parent, (Attribute) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OrderBy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OrderBy.java deleted file mode 100644 index 840bda9f89..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OrderBy.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - -/** - * Corresponds to the javax.persistence.OrderBy annotation - */ -public interface OrderBy extends JavaResource -{ - String ANNOTATION_NAME = JPA.ORDER_BY; - - /** - * Corresponds to the value element of the javax.persistence.OrderBy annotation. - * Returns null if the value valuePair does not exist in the annotation - */ - String getValue(); - - /** - * Corresponds to the value element of the javax.persistence.OrderBy annotation. - * Setting the value to null will not remove the OrderBy annotation - */ - void setValue(String value); - String VALUE_PROPERTY = "valueProperty"; - - /** - * Return the ITextRange for the value element. If the value element - * does not exist return the ITextRange for the OrderBy annotation. - */ - ITextRange valueTextRange(CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OrderByImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OrderByImpl.java index 2060997817..db3e5e31b8 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OrderByImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OrderByImpl.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Attribute; import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter; @@ -19,6 +19,12 @@ import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdap import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.OrderBy; public class OrderByImpl extends AbstractAnnotationResource<Attribute> implements OrderBy { @@ -31,7 +37,7 @@ public class OrderByImpl extends AbstractAnnotationResource<Attribute> implement private String value; - protected OrderByImpl(JavaResource parent, Attribute attribute) { + protected OrderByImpl(JavaResourceNode parent, Attribute attribute) { super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, VALUE_ADAPTER); } @@ -55,7 +61,7 @@ public class OrderByImpl extends AbstractAnnotationResource<Attribute> implement firePropertyChanged(VALUE_PROPERTY, oldValue, newValue); } - public ITextRange valueTextRange(CompilationUnit astRoot) { + public TextRange valueTextRange(CompilationUnit astRoot) { return this.elementTextRange(VALUE_ADAPTER, astRoot); } @@ -92,11 +98,11 @@ public class OrderByImpl extends AbstractAnnotationResource<Attribute> implement super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return new OrderByImpl(parent, (Attribute) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OverrideImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OverrideImpl.java index 9c939d5cfb..0c801d9dc9 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OverrideImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OverrideImpl.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter; @@ -19,10 +19,14 @@ import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdap import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.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.OverrideAnnotation; public abstract class OverrideImpl extends AbstractAnnotationResource<Member> - implements OverrideResource + implements OverrideAnnotation { // hold this so we can get the 'name' text range private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter; @@ -32,7 +36,7 @@ public abstract class OverrideImpl private String name; - protected OverrideImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { + protected OverrideImpl(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { super(parent, member, daa, annotationAdapter); this.nameDeclarationAdapter = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JPA.ATTRIBUTE_OVERRIDE__NAME, false); // false = do not remove annotation when empty this.nameAdapter = new ShortCircuitAnnotationElementAdapter<String>(getMember(),this.nameDeclarationAdapter); @@ -51,7 +55,7 @@ public abstract class OverrideImpl } public void initializeFrom(NestableAnnotation oldAnnotation) { - OverrideResource oldOverride = (OverrideResource) oldAnnotation; + OverrideAnnotation oldOverride = (OverrideAnnotation) oldAnnotation; setName(oldOverride.getName()); } @@ -64,10 +68,10 @@ public abstract class OverrideImpl String oldName = this.name; this.name = newName; this.nameAdapter.setValue(newName); - firePropertyChanged(OverrideResource.NAME_PROPERTY, oldName, newName); + firePropertyChanged(OverrideAnnotation.NAME_PROPERTY, oldName, newName); } - public ITextRange nameTextRange(CompilationUnit astRoot) { + public TextRange nameTextRange(CompilationUnit astRoot) { return this.elementTextRange(this.nameDeclarationAdapter, astRoot); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OverrideResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OverrideResource.java deleted file mode 100644 index a2bcce1a13..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OverrideResource.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - -/** - * Corresponds to the javax.persistence.AttributeOverride annotation - */ -public interface OverrideResource extends JavaResource -{ - - /** - * Corresponds to the name element of the AttributeOverride annotation. - * Returns null if the name element does not exist in java. - */ - String getName(); - - /** - * Corresponds to the name element of the AttributeOverride annotation. - * Set to null to remove the name element. - */ - void setName(String name); - String NAME_PROPERTY = "nameProperty"; - - /** - * Return the ITextRange for the name element. If name element - * does not exist return the ITextRange for the AttributeOverride annotation. - */ - ITextRange nameTextRange(CompilationUnit astRoot); - - /** - * Return whether the specified postition touches the table element. - * Return false if the table element does not exist. - */ - boolean nameTouches(int pos, CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumn.java deleted file mode 100644 index 9beeb4d454..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumn.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - -public interface PrimaryKeyJoinColumn extends NamedColumn -{ - String ANNOTATION_NAME = JPA.PRIMARY_KEY_JOIN_COLUMN; - - String getReferencedColumnName(); - - void setReferencedColumnName(String referencedColumnName); - String REFERENCED_COLUMN_NAME_PROPERTY = "referencedColumnNameProperty"; - - /** - * Return whether the specified postition touches the referencedColumnName element. - * Return false if the referencedColumnName element does not exist. - */ - boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot); - - /** - * Return the ITextRange for the referencedColumnName element. If the referencedColumnName - * element does not exist return the ITextRange for the PrimaryKeyJoinColumn annotation. - */ - ITextRange referencedColumnNameTextRange(CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnImpl.java index 748f524b3a..ab74e5f8e7 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnImpl.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; @@ -22,6 +22,14 @@ import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.NestableAnnotation; +import org.eclipse.jpt.core.resource.java.NestablePrimaryKeyJoinColumn; +import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation; public class PrimaryKeyJoinColumnImpl extends AbstractNamedColumn implements NestablePrimaryKeyJoinColumn { @@ -35,17 +43,17 @@ public class PrimaryKeyJoinColumnImpl extends AbstractNamedColumn implements Nes private String referencedColumnName; - protected PrimaryKeyJoinColumnImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { + protected PrimaryKeyJoinColumnImpl(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); } - protected PrimaryKeyJoinColumnImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa) { + protected PrimaryKeyJoinColumnImpl(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) { this(parent, member, daa, new MemberAnnotationAdapter(member, daa)); } - protected PrimaryKeyJoinColumnImpl(JavaResource parent, Member member, IndexedDeclarationAnnotationAdapter idaa) { + protected PrimaryKeyJoinColumnImpl(JavaResourceNode parent, Member member, IndexedDeclarationAnnotationAdapter idaa) { this(parent, member, idaa, new MemberIndexedAnnotationAdapter(member, idaa)); } @@ -80,7 +88,7 @@ public class PrimaryKeyJoinColumnImpl extends AbstractNamedColumn implements Nes @Override public void initializeFrom(NestableAnnotation oldAnnotation) { super.initializeFrom(oldAnnotation); - PrimaryKeyJoinColumn oldColumn = (PrimaryKeyJoinColumn) oldAnnotation; + PrimaryKeyJoinColumnAnnotation oldColumn = (PrimaryKeyJoinColumnAnnotation) oldAnnotation; setReferencedColumnName(oldColumn.getReferencedColumnName()); } @@ -109,17 +117,17 @@ public class PrimaryKeyJoinColumnImpl extends AbstractNamedColumn implements Nes return this.elementTouches(this.referencedColumnNameDeclarationAdapter, pos, astRoot); } - public ITextRange referencedColumnNameTextRange(CompilationUnit astRoot) { + public TextRange referencedColumnNameTextRange(CompilationUnit astRoot) { return this.elementTextRange(this.referencedColumnNameDeclarationAdapter, astRoot); } // ********** static methods ********** - static PrimaryKeyJoinColumnImpl createPrimaryKeyJoinColumn(JavaResource parent, Member member) { + static PrimaryKeyJoinColumnImpl createPrimaryKeyJoinColumn(JavaResourceNode parent, Member member) { return new PrimaryKeyJoinColumnImpl(parent, member, DECLARATION_ANNOTATION_ADAPTER); } - static PrimaryKeyJoinColumnImpl createNestedPrimaryKeyJoinColumn(JavaResource parent, Member member, int index, DeclarationAnnotationAdapter pkJoinColumnsAdapter) { + static PrimaryKeyJoinColumnImpl createNestedPrimaryKeyJoinColumn(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter pkJoinColumnsAdapter) { IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, pkJoinColumnsAdapter); IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(member, idaa); return new PrimaryKeyJoinColumnImpl(parent, member, idaa, annotationAdapter); @@ -130,7 +138,7 @@ public class PrimaryKeyJoinColumnImpl extends AbstractNamedColumn implements Nes } - static NestablePrimaryKeyJoinColumn createSecondaryTablePrimaryKeyJoinColumn(DeclarationAnnotationAdapter secondaryTableAdapter, JavaResource parent, Member member, int index) { + static NestablePrimaryKeyJoinColumn createSecondaryTablePrimaryKeyJoinColumn(DeclarationAnnotationAdapter secondaryTableAdapter, JavaResourceNode parent, Member member, int index) { return new PrimaryKeyJoinColumnImpl(parent, member, buildSecondaryTableAnnotationAdapter(secondaryTableAdapter, index)); } @@ -158,11 +166,11 @@ public class PrimaryKeyJoinColumnImpl extends AbstractNamedColumn implements Nes super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return PrimaryKeyJoinColumnImpl.createPrimaryKeyJoinColumn(parent, member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumns.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumns.java deleted file mode 100644 index aa138896f6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumns.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - - -public interface PrimaryKeyJoinColumns extends ContainerAnnotation<NestablePrimaryKeyJoinColumn> -{ - String ANNOTATION_NAME = JPA.PRIMARY_KEY_JOIN_COLUMNS; - - String PK_JOIN_COLUMNS_LIST = "pkJoinColumnsList"; -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnsImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnsImpl.java index 6dd22c8148..b11def2a89 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnsImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnsImpl.java @@ -17,6 +17,12 @@ import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.NestablePrimaryKeyJoinColumn; +import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation; +import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumns; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; @@ -27,7 +33,7 @@ public class PrimaryKeyJoinColumnsImpl extends AbstractAnnotationResource<Member private List<NestablePrimaryKeyJoinColumn> pkJoinColumns; - protected PrimaryKeyJoinColumnsImpl(JavaResource parent, Member member) { + protected PrimaryKeyJoinColumnsImpl(JavaResourceNode parent, Member member) { super(parent, member, DECLARATION_ANNOTATION_ADAPTER); this.pkJoinColumns = new ArrayList<NestablePrimaryKeyJoinColumn>(); } @@ -41,7 +47,7 @@ public class PrimaryKeyJoinColumnsImpl extends AbstractAnnotationResource<Member } public String getNestableAnnotationName() { - return PrimaryKeyJoinColumn.ANNOTATION_NAME; + return PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME; } public String getElementName() { @@ -134,11 +140,11 @@ public class PrimaryKeyJoinColumnsImpl extends AbstractAnnotationResource<Member super(); } - public PrimaryKeyJoinColumns buildAnnotation(JavaPersistentResource parent, Member member) { + public PrimaryKeyJoinColumns buildAnnotation(JavaResourcePersistentMember parent, Member member) { return new PrimaryKeyJoinColumnsImpl(parent, member); } - public PrimaryKeyJoinColumns buildNullAnnotation(JavaPersistentResource parent, Member member) { + public PrimaryKeyJoinColumns buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Query.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Query.java deleted file mode 100644 index 2b773ab540..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Query.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import java.util.ListIterator; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - -public interface Query extends JavaResource -{ - String getName(); - void setName(String name); - String NAME_PROPERTY = "nameProperty"; - - String getQuery(); - void setQuery(String query); - String QUERY_PROPERTY = "queryProperty"; - - ListIterator<QueryHint> hints(); - - QueryHint hintAt(int index); - - int indexOfHint(QueryHint hint); - - int hintsSize(); - - QueryHint addHint(int index); - - void removeHint(int index); - - void moveHint(int targetIndex, int sourceIndex); - String HINTS_LIST = "hintsList"; - - /** - * Return the ITextRange for the name element. If name element - * does not exist return the ITextRange for the *Query annotation. - */ - ITextRange nameTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the query element. If query element - * does not exist return the ITextRange for the *Query annotation. - */ - ITextRange queryTextRange(CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/QueryHint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/QueryHint.java deleted file mode 100644 index ae34487564..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/QueryHint.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - -/** - * Corresponds to the javax.persistence.QueryHint annotation - */ -public interface QueryHint extends JavaResource -{ - String ANNOTATION_NAME = JPA.QUERY_HINT; - - /** - * Corresponds to the name element of the QueryHint annotation. - * Returns null if the name valuePair does not exist in the annotation - */ - String getName(); - - /** - * Corresponds to the name element of the QueryHint annotation. - * Setting to null will remove the name valuePair - */ - void setName(String name); - String NAME_PROPERTY = "nameProperty"; - - /** - * Corresponds to the value element of the QueryHint annotation. - * Returns null if the value valuePair does not exist in the annotation - */ - String getValue(); - - /** - * Corresponds to the value element of the QueryHint annotation. - * Setting to null will remove the value valuePair - */ - void setValue(String value); - String VALUE_PROPERTY = "valueProperty"; - - /** - * Return the ITextRange for the name element. If the name element - * does not exist return the ITextRange for the QueryHint annotation. - */ - ITextRange nameTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the value element. If the value element - * does not exist return the ITextRange for the QueryHint annotation. - */ - ITextRange valueTextRange(CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/QueryHintImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/QueryHintImpl.java index 0e342e39aa..25dac71043 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/QueryHintImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/QueryHintImpl.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; @@ -21,6 +21,11 @@ import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Type; +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.NestableQueryHint; +import org.eclipse.jpt.core.resource.java.QueryHintAnnotation; public class QueryHintImpl extends AbstractAnnotationResource<Type> implements NestableQueryHint @@ -40,7 +45,7 @@ public class QueryHintImpl extends AbstractAnnotationResource<Type> private String value; - public QueryHintImpl(JavaResource parent, Type type, IndexedDeclarationAnnotationAdapter idaa) { + public QueryHintImpl(JavaResourceNode parent, Type type, IndexedDeclarationAnnotationAdapter idaa) { super(parent, type, idaa, new MemberIndexedAnnotationAdapter(type, idaa)); this.nameDeclarationAdapter = this.nameAdapter(idaa); this.nameAdapter = this.buildAdapter(this.nameDeclarationAdapter); @@ -97,11 +102,11 @@ public class QueryHintImpl extends AbstractAnnotationResource<Type> firePropertyChanged(VALUE_PROPERTY, oldValue, newValue); } - public ITextRange nameTextRange(CompilationUnit astRoot) { + public TextRange nameTextRange(CompilationUnit astRoot) { return this.elementTextRange(this.nameDeclarationAdapter, astRoot); } - public ITextRange valueTextRange(CompilationUnit astRoot) { + public TextRange valueTextRange(CompilationUnit astRoot) { return this.elementTextRange(this.valueDeclarationAdapter, astRoot); } @@ -124,13 +129,13 @@ public class QueryHintImpl extends AbstractAnnotationResource<Type> } public void initializeFrom(NestableAnnotation oldAnnotation) { - QueryHint oldQueryHint = (QueryHint) oldAnnotation; + QueryHintAnnotation oldQueryHint = (QueryHintAnnotation) oldAnnotation; setName(oldQueryHint.getName()); setValue(oldQueryHint.getValue()); } // ********** static methods ********** - static QueryHintImpl createNamedQueryQueryHint(JavaResource parent, Type type, DeclarationAnnotationAdapter namedQueryAdapter, int index) { + static QueryHintImpl createNamedQueryQueryHint(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter namedQueryAdapter, int index) { return new QueryHintImpl(parent, type, buildNamedQueryQueryHintAnnotationAdapter(namedQueryAdapter, index)); } @@ -138,7 +143,7 @@ public class QueryHintImpl extends AbstractAnnotationResource<Type> return new NestedIndexedDeclarationAnnotationAdapter(namedQueryAdapter, JPA.NAMED_QUERY__HINTS, index, JPA.QUERY_HINT); } - static QueryHintImpl createNamedNativeQueryQueryHint(JavaResource parent, Type type, DeclarationAnnotationAdapter namedNativeQueryAdapter, int index) { + static QueryHintImpl createNamedNativeQueryQueryHint(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter namedNativeQueryAdapter, int index) { return new QueryHintImpl(parent, type, buildNamedNativeQueryQueryHintAnnotationAdapter(namedNativeQueryAdapter, index)); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/RelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/RelationshipMapping.java deleted file mode 100644 index 86f713160e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/RelationshipMapping.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - - - -public interface RelationshipMapping extends JavaResource -{ - /** - * Corresponds to the targetEntity element of the relationship - * annotations (ManyToMany, OneToMany, ManyToOne, OneToOne). - * Returns null if the targetEntity element does not exist in java. - * Returns the portion of the targetEntity preceding the .class. - * <p> - * @ManyToMany(targetEntity=Employee.class) - * </p> - * will return "Employee" - **/ - String getTargetEntity(); - - /** - * Corresponds to the targetEntity of the relationship - * annotations (ManyToMany, OneToMany, ManyToOne, OneToOne). - * Set to null to remove the targetEntity element. - */ - void setTargetEntity(String targetEntity); - String TARGET_ENTITY_PROPERTY = "targetEntityProperty"; - - /** - * Returns the qualified targetEntity name as it is resolved in the AST - * <p> - * @ManyToMany(targetEntity=Employee.class) - * </p> - * will return "model.Employee" if there is an import for model.Employee - * @return - */ - String getFullyQualifiedTargetEntity(); - String FULLY_QUALFIEID_TARGET_ENTITY_PROPERTY = "fullyQualifiedTargetEntityProperty"; - - /** - * Corresponds to the fetch element of the relationship - * annotations (ManyToMany, OneToMany, ManyToOne, OneToOne). - * Returns null if the fetch element does not exist in java. - */ - FetchType getFetch(); - - /** - * Corresponds to the fetch element of the relationship - * annotations (ManyToMany, OneToMany, ManyToOne, OneToOne). - * Set to null to remove the fetch element. - */ - void setFetch(FetchType fetch); - String FETCH_PROPERTY = "fetchProperty"; - - boolean isCascadeAll(); - void setCascadeAll(boolean all); - String CASCADE_ALL_PROPERTY = "cascadeAllProperty"; - - boolean isCascadeMerge(); - void setCascadeMerge(boolean merge); - String CASCADE_MERGE_PROPERTY = "cascadeMergeProperty"; - - boolean isCascadePersist(); - void setCascadePersist(boolean persist); - String CASCADE_PERSIST_PROPERTY = "cascadePersistProperty"; - - boolean isCascadeRefresh(); - void setCascadeRefresh(boolean refresh); - String CASCADE_REFRESH_PROPERTY = "cascadeRefreshProperty"; - - boolean isCascadeRemove(); - void setCascadeRemove(boolean remove); - String CASCADE_REMOVE_PROPERTY = "cascadeRemoveProperty"; - - - /** - * Return the ITextRange for the targetEntity element. If the targetEntity element - * does not exist return the ITextRange for the mapping annotation. - */ - ITextRange targetEntityTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the fetch element. If the fetch element - * does not exist return the ITextRange for the mapping annotation. - */ - ITextRange fetchTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the cascade element. If the cascade element - * does not exist return the ITextRange for the mapping annotation. - */ - ITextRange cascadeTextRange(CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTable.java deleted file mode 100644 index 5873e8b101..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTable.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import java.util.ListIterator; - - -public interface SecondaryTable extends Table -{ - String ANNOTATION_NAME = JPA.SECONDARY_TABLE; - - ListIterator<PrimaryKeyJoinColumn> pkJoinColumns(); - - PrimaryKeyJoinColumn pkJoinColumnAt(int index); - - int indexOfPkJoinColumn(PrimaryKeyJoinColumn pkJoinColumn); - - int pkJoinColumnsSize(); - - PrimaryKeyJoinColumn addPkJoinColumn(int index); - - void removePkJoinColumn(int index); - - void movePkJoinColumn(int targetIndex, int sourceIndex); - - String PK_JOIN_COLUMNS_LIST = "pkJoinColumnsList"; -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTableImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTableImpl.java index 9b2a97efd6..78b2954721 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTableImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTableImpl.java @@ -13,7 +13,7 @@ import java.util.ArrayList; import java.util.List; import java.util.ListIterator; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; @@ -25,19 +25,32 @@ import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.ContainerAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.NestableAnnotation; +import org.eclipse.jpt.core.resource.java.NestablePrimaryKeyJoinColumn; +import org.eclipse.jpt.core.resource.java.NestableSecondaryTable; +import org.eclipse.jpt.core.resource.java.NestableUniqueConstraint; +import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation; +import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation; +import org.eclipse.jpt.core.resource.java.UniqueConstraint; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; public class SecondaryTableImpl extends AbstractTableResource implements NestableSecondaryTable { - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(SecondaryTable.ANNOTATION_NAME); + private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(SecondaryTableAnnotation.ANNOTATION_NAME); private final List<NestablePrimaryKeyJoinColumn> pkJoinColumns; private final PkJoinColumnsContainerAnnotation pkJoinColumnsContainerAnnotation; - protected SecondaryTableImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { + protected SecondaryTableImpl(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { super(parent, member, daa, annotationAdapter); this.pkJoinColumns = new ArrayList<NestablePrimaryKeyJoinColumn>(); this.pkJoinColumnsContainerAnnotation = new PkJoinColumnsContainerAnnotation(); @@ -69,7 +82,7 @@ public class SecondaryTableImpl extends AbstractTableResource implements Nestabl } public String getAnnotationName() { - return SecondaryTable.ANNOTATION_NAME; + return SecondaryTableAnnotation.ANNOTATION_NAME; } public void moveAnnotation(int newIndex) { @@ -77,7 +90,7 @@ public class SecondaryTableImpl extends AbstractTableResource implements Nestabl } public void initializeFrom(NestableAnnotation oldAnnotation) { - SecondaryTable oldSecondaryTable = (SecondaryTable) oldAnnotation; + SecondaryTableAnnotation oldSecondaryTable = (SecondaryTableAnnotation) oldAnnotation; setName(oldSecondaryTable.getName()); setCatalog(oldSecondaryTable.getCatalog()); setSchema(oldSecondaryTable.getSchema()); @@ -85,7 +98,7 @@ public class SecondaryTableImpl extends AbstractTableResource implements Nestabl NestableUniqueConstraint newUniqueConstraint = addUniqueConstraint(oldSecondaryTable.indexOfUniqueConstraint(uniqueConstraint)); newUniqueConstraint.initializeFrom((NestableAnnotation) uniqueConstraint); } - for (PrimaryKeyJoinColumn pkJoinColumn : CollectionTools.iterable(oldSecondaryTable.pkJoinColumns())) { + for (PrimaryKeyJoinColumnAnnotation pkJoinColumn : CollectionTools.iterable(oldSecondaryTable.pkJoinColumns())) { NestablePrimaryKeyJoinColumn newPkJoinColumn = addPkJoinColumn(oldSecondaryTable.indexOfPkJoinColumn(pkJoinColumn)); newPkJoinColumn.initializeFrom((NestableAnnotation) pkJoinColumn); } @@ -99,8 +112,8 @@ public class SecondaryTableImpl extends AbstractTableResource implements Nestabl // ************* SecondaryTable implementation ******************* - public ListIterator<PrimaryKeyJoinColumn> pkJoinColumns() { - return new CloneListIterator<PrimaryKeyJoinColumn>(this.pkJoinColumns); + public ListIterator<PrimaryKeyJoinColumnAnnotation> pkJoinColumns() { + return new CloneListIterator<PrimaryKeyJoinColumnAnnotation>(this.pkJoinColumns); } public int pkJoinColumnsSize() { @@ -111,13 +124,13 @@ public class SecondaryTableImpl extends AbstractTableResource implements Nestabl return this.pkJoinColumns.get(index); } - public int indexOfPkJoinColumn(PrimaryKeyJoinColumn joinColumn) { + public int indexOfPkJoinColumn(PrimaryKeyJoinColumnAnnotation joinColumn) { return this.pkJoinColumns.indexOf(joinColumn); } public NestablePrimaryKeyJoinColumn addPkJoinColumn(int index) { NestablePrimaryKeyJoinColumn pkJoinColumn = (NestablePrimaryKeyJoinColumn) ContainerAnnotationTools.addNestedAnnotation(index, this.pkJoinColumnsContainerAnnotation); - fireItemAdded(SecondaryTable.PK_JOIN_COLUMNS_LIST, index, pkJoinColumn); + fireItemAdded(SecondaryTableAnnotation.PK_JOIN_COLUMNS_LIST, index, pkJoinColumn); return pkJoinColumn; } @@ -133,13 +146,13 @@ public class SecondaryTableImpl extends AbstractTableResource implements Nestabl } protected void removePkJoinColumn(NestablePrimaryKeyJoinColumn pkJoinColumn) { - removeItemFromList(pkJoinColumn, this.pkJoinColumns, SecondaryTable.PK_JOIN_COLUMNS_LIST); + removeItemFromList(pkJoinColumn, this.pkJoinColumns, SecondaryTableAnnotation.PK_JOIN_COLUMNS_LIST); } public void movePkJoinColumn(int targetIndex, int sourceIndex) { movePkJoinColumnInternal(targetIndex, sourceIndex); ContainerAnnotationTools.synchAnnotationsAfterMove(targetIndex, sourceIndex, this.pkJoinColumnsContainerAnnotation); - fireItemMoved(SecondaryTable.PK_JOIN_COLUMNS_LIST, targetIndex, sourceIndex); + fireItemMoved(SecondaryTableAnnotation.PK_JOIN_COLUMNS_LIST, targetIndex, sourceIndex); } protected void movePkJoinColumnInternal(int targetIndex, int sourceIndex) { @@ -162,11 +175,11 @@ public class SecondaryTableImpl extends AbstractTableResource implements Nestabl } // ********** static methods ********** - static SecondaryTableImpl createSecondaryTable(JavaResource parent, Member member) { + static SecondaryTableImpl createSecondaryTable(JavaResourceNode parent, Member member) { return new SecondaryTableImpl(parent, member, DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER)); } - static SecondaryTableImpl createNestedSecondaryTable(JavaResource parent, Member member, int index, DeclarationAnnotationAdapter secondaryTablesAdapter) { + static SecondaryTableImpl createNestedSecondaryTable(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter secondaryTablesAdapter) { IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, secondaryTablesAdapter); IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(member, idaa); return new SecondaryTableImpl(parent, member, idaa, annotationAdapter); @@ -265,7 +278,7 @@ public class SecondaryTableImpl extends AbstractTableResource implements Nestabl SecondaryTableImpl.this.updateFromJava(astRoot); } - public ITextRange textRange(CompilationUnit astRoot) { + public TextRange textRange(CompilationUnit astRoot) { return SecondaryTableImpl.this.textRange(astRoot); } @@ -293,16 +306,16 @@ public class SecondaryTableImpl extends AbstractTableResource implements Nestabl super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return SecondaryTableImpl.createSecondaryTable(parent, member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } public String getAnnotationName() { - return SecondaryTable.ANNOTATION_NAME; + return SecondaryTableAnnotation.ANNOTATION_NAME; } } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTables.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTables.java deleted file mode 100644 index df10a3cabc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTables.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - - -public interface SecondaryTables extends ContainerAnnotation<NestableSecondaryTable> -{ - String ANNOTATION_NAME = JPA.SECONDARY_TABLES; - - String SECONDARY_TABLES_LIST = "secondaryTablesList"; -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTablesImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTablesImpl.java index 9acf0d174d..68424d1ca5 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTablesImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTablesImpl.java @@ -16,6 +16,13 @@ import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +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.NestableSecondaryTable; +import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation; +import org.eclipse.jpt.core.resource.java.SecondaryTables; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; @@ -25,7 +32,7 @@ public class SecondaryTablesImpl extends AbstractAnnotationResource<Member> impl private final List<NestableSecondaryTable> secondaryTables; - protected SecondaryTablesImpl(JavaPersistentTypeResource parent, Member member) { + protected SecondaryTablesImpl(JavaResourcePersistentType parent, Member member) { super(parent, member, DECLARATION_ANNOTATION_ADAPTER); this.secondaryTables = new ArrayList<NestableSecondaryTable>(); } @@ -39,7 +46,7 @@ public class SecondaryTablesImpl extends AbstractAnnotationResource<Member> impl } public String getNestableAnnotationName() { - return SecondaryTable.ANNOTATION_NAME; + return SecondaryTableAnnotation.ANNOTATION_NAME; } public String getElementName() { @@ -136,11 +143,11 @@ public class SecondaryTablesImpl extends AbstractAnnotationResource<Member> impl super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { - return new SecondaryTablesImpl((JavaPersistentTypeResource) parent, member); + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { + return new SecondaryTablesImpl((JavaResourcePersistentType) parent, member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGenerator.java deleted file mode 100644 index 5d7510ea56..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGenerator.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - - -/** - * Corresponds to the javax.persistence.SequenceGenerator annotation - */ -public interface SequenceGenerator extends Generator -{ - String ANNOTATION_NAME = JPA.SEQUENCE_GENERATOR; - - /** - * Corresponds to the sequenceName element of the SequenceGenerator annotation. - * Returns null if the sequenceName element does not exist in java. If no other memberValuePairs exist - * the SequenceGenerator annotation will be removed as well. - */ - String getSequenceName(); - - /** - * Corresponds to the sequenceName element of the SequenceGenerator annotation. - * Set to null to remove the sequenceName element. If no other memberValuePairs exist - * the SequenceGenerator annotation will be removed as well. - */ - void setSequenceName(String sequenceName); - String SEQUENCE_NAME_PROPERTY = "sequenceNameProperty"; - - /** - * Return the ITextRange for the sequenceName element. If the sequenceName element - * does not exist return the ITextRange for the SequenceGenerator annotation. - */ - ITextRange sequenceNameTextRange(CompilationUnit astRoot); - - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGeneratorImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGeneratorImpl.java index 89b4966956..685e6c4313 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGeneratorImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGeneratorImpl.java @@ -10,14 +10,20 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; - -public class SequenceGeneratorImpl extends GeneratorImpl implements SequenceGenerator +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation; + +public class SequenceGeneratorImpl extends GeneratorImpl implements SequenceGeneratorAnnotation { private final AnnotationElementAdapter<String> sequenceNameAdapter; @@ -33,7 +39,7 @@ public class SequenceGeneratorImpl extends GeneratorImpl implements SequenceGene private String sequenceName; - protected SequenceGeneratorImpl(JavaResource parent, Member member) { + protected SequenceGeneratorImpl(JavaResourceNode parent, Member member) { super(parent, member, DECLARATION_ANNOTATION_ADAPTER); this.sequenceNameAdapter = this.buildAdapter(SEQUENCE_NAME_ADAPTER); } @@ -82,7 +88,7 @@ public class SequenceGeneratorImpl extends GeneratorImpl implements SequenceGene firePropertyChanged(SEQUENCE_NAME_PROPERTY, oldSequenceName, newSequenceName); } - public ITextRange sequenceNameTextRange(CompilationUnit astRoot) { + public TextRange sequenceNameTextRange(CompilationUnit astRoot) { return this.elementTextRange(SEQUENCE_NAME_ADAPTER, astRoot); } @@ -125,11 +131,11 @@ public class SequenceGeneratorImpl extends GeneratorImpl implements SequenceGene super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return new SequenceGeneratorImpl(parent, member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Table.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Table.java deleted file mode 100644 index 9c3db55e29..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Table.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import java.util.ListIterator; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - -public interface Table extends JavaResource -{ - String ANNOTATION_NAME = JPA.TABLE; - - String getName(); - void setName(String name); - String NAME_PROPERTY = "nameProperty"; - - String getCatalog(); - void setCatalog(String catalog); - String CATALOG_PROPERTY = "catalogProperty"; - - String getSchema(); - void setSchema(String schema); - String SCHEMA_PROPERTY = "schemaProperty"; - - ListIterator<UniqueConstraint> uniqueConstraints(); - - UniqueConstraint uniqueConstraintAt(int index); - - int indexOfUniqueConstraint(UniqueConstraint uniqueConstraint); - - int uniqueConstraintsSize(); - - UniqueConstraint addUniqueConstraint(int index); - - void removeUniqueConstraint(int index); - - void moveUniqueConstraint(int targetIndex, int sourceIndex); - String UNIQUE_CONSTRAINTS_LIST = "uniqueConstraintsList"; - - /** - * Return the ITextRange for the name element. If the name element - * does not exist return the ITextRange for the *Table annotation. - */ - ITextRange nameTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the catalog element. If the catalog element - * does not exist return the ITextRange for the *Table annotation. - */ - ITextRange catalogTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the schema element. If the schema element - * does not exist return the ITextRange for the *Table annotation. - */ - ITextRange schemaTextRange(CompilationUnit astRoot); - - /** - * Return whether the specified postition touches the name element. - * Return false if the name element does not exist. - */ - boolean nameTouches(int pos, CompilationUnit astRoot); - - /** - * Return whether the specified postition touches the schema element. - * Return false if the name element does not exist. - */ - boolean schemaTouches(int pos, CompilationUnit astRoot); - - /** - * Return whether the specified postition touches the catalog element. - * Return false if the name element does not exist. - */ - boolean catalogTouches(int pos, CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableGenerator.java deleted file mode 100644 index 87b6897a0b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableGenerator.java +++ /dev/null @@ -1,165 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import java.util.ListIterator; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - -/** - * Corresponds to the javax.persistence.TableGenerator annotation - */ -public interface TableGenerator extends Generator -{ - - String ANNOTATION_NAME = JPA.TABLE_GENERATOR; - - /** - * Corresponds to the table element of the TableGenerator annotation. - * Returns null if the table element does not exist in java. If no other memberValuePairs exist - * the TableGenerator annotation will be removed as well. - */ - String getTable(); - - /** - * Corresponds to the table element of the TableGenerator annotation. - * Set to null to remove the table element. If no other memberValuePairs exist - * the TableGenerator annotation will be removed as well. - */ - void setTable(String table); - String TABLE_PROPERTY = "tableProperty"; - - /** - * Corresponds to the catalog element of the TableGenerator annotation. - * Returns null if the catalog element does not exist in java. If no other memberValuePairs exist - * the TableGenerator annotation will be removed as well. - */ - String getCatalog(); - - /** - * Corresponds to the catalog element of the TableGenerator annotation. - * Set to null to remove the catalog element. If no other memberValuePairs exist - * the TableGenerator annotation will be removed as well. - */ - void setCatalog(String catalog); - String CATALOG_PROPERTY = "catalogProperty"; - - /** - * Corresponds to the schema element of the TableGenerator annotation. - * Returns null if the schema element does not exist in java. If no other memberValuePairs exist - * the TableGenerator annotation will be removed as well. - */ - String getSchema(); - - /** - * Corresponds to the schema element of the TableGenerator annotation. - * Set to null to remove the schema element. If no other memberValuePairs exist - * the TableGenerator annotation will be removed as well. - */ - void setSchema(String schema); - String SCHEMA_PROPERTY = "schemaProperty"; - - /** - * Corresponds to the pkColumnName element of the TableGenerator annotation. - * Returns null if the pkColumnName element does not exist in java. If no other memberValuePairs exist - * the TableGenerator annotation will be removed as well. - */ - String getPkColumnName(); - - /** - * Corresponds to the pkColumnName element of the TableGenerator annotation. - * Set to null to remove the pkColumnName element. If no other memberValuePairs exist - * the TableGenerator annotation will be removed as well. - */ - void setPkColumnName(String pkColumnName); - String PK_COLUMN_NAME_PROPERTY = "pkColumnNameProperty"; - - /** - * Corresponds to the valueColumnName element of the TableGenerator annotation. - * Returns null if the valueColumnName element does not exist in java. If no other memberValuePairs exist - * the TableGenerator annotation will be removed as well. - */ - String getValueColumnName(); - - /** - * Corresponds to the valueColumnName element of the TableGenerator annotation. - * Set to null to remove the valueColumnName element. If no other memberValuePairs exist - * the TableGenerator annotation will be removed as well. - */ - void setValueColumnName(String valueColumnName); - String VALUE_COLUMN_NAME_PROPERTY = "valueColumnNameProperty"; - - /** - * Corresponds to the pkColumnValue element of the TableGenerator annotation. - * Returns null if the pkColumnValue element does not exist in java. If no other memberValuePairs exist - * the TableGenerator annotation will be removed as well. - */ - String getPkColumnValue(); - - /** - * Corresponds to the pkColumnValue element of the TableGenerator annotation. - * Set to null to remove the pkColumnValue element. If no other memberValuePairs exist - * the TableGenerator annotation will be removed as well. - */ - void setPkColumnValue(String pkColumnValue); - String PK_COLUMN_VALUE_PROPERTY = "pkColumnValueProperty"; - - ListIterator<UniqueConstraint> uniqueConstraints(); - - UniqueConstraint uniqueConstraintAt(int index); - - int indexOfUniqueConstraint(UniqueConstraint uniqueConstraint); - - int uniqueConstraintsSize(); - - UniqueConstraint addUniqueConstraint(int index); - - void removeUniqueConstraint(int index); - - void moveUniqueConstraint(int targetIndex, int sourceIndex); - String UNIQUE_CONSTRAINTS_LIST = "uniqueConstraintsList"; - - /** - * Return the ITextRange for the table element. If the table element - * does not exist return the ITextRange for the TableGenerator annotation. - */ - ITextRange tableTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the catalog element. If the catalog element - * does not exist return the ITextRange for the TableGenerator annotation. - */ - ITextRange catalogTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the schema element. If the schema element - * does not exist return the ITextRange for the TableGenerator annotation. - */ - ITextRange schemaTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the pkColumnName element. If the pkColumnName element - * does not exist return the ITextRange for the TableGenerator annotation. - */ - ITextRange pkColumnNameTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the valueColumnName element. If the valueColumnName element - * does not exist return the ITextRange for the TableGenerator annotation. - */ - ITextRange valueColumnNameTextRange(CompilationUnit astRoot); - - /** - * Return the ITextRange for the pkColumnValue element. If the pkColumnValue element - * does not exist return the ITextRange for the TableGenerator annotation. - */ - ITextRange pkColumnValueTextRange(CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableGeneratorImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableGeneratorImpl.java index 13bda4e0ae..fdd67560b4 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableGeneratorImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableGeneratorImpl.java @@ -13,16 +13,26 @@ import java.util.ArrayList; import java.util.List; import java.util.ListIterator; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.ContainerAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.NestableUniqueConstraint; +import org.eclipse.jpt.core.resource.java.TableAnnotation; +import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation; +import org.eclipse.jpt.core.resource.java.UniqueConstraint; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; -public class TableGeneratorImpl extends GeneratorImpl implements TableGenerator +public class TableGeneratorImpl extends GeneratorImpl implements TableGeneratorAnnotation { private final AnnotationElementAdapter<String> tableAdapter; @@ -73,7 +83,7 @@ public class TableGeneratorImpl extends GeneratorImpl implements TableGenerator private final UniqueConstraintsContainerAnnotation uniqueConstraintsContainerAnnotation; - protected TableGeneratorImpl(JavaResource parent, Member member) { + protected TableGeneratorImpl(JavaResourceNode parent, Member member) { super(parent, member, DECLARATION_ANNOTATION_ADAPTER); this.tableAdapter = this.buildAdapter(TABLE_ADAPTER); this.catalogAdapter = this.buildAdapter(CATALOG_ADAPTER); @@ -208,7 +218,7 @@ public class TableGeneratorImpl extends GeneratorImpl implements TableGenerator public NestableUniqueConstraint addUniqueConstraint(int index) { NestableUniqueConstraint uniqueConstraint = (NestableUniqueConstraint) ContainerAnnotationTools.addNestedAnnotation(index, this.uniqueConstraintsContainerAnnotation); - fireItemAdded(TableGenerator.UNIQUE_CONSTRAINTS_LIST, index, uniqueConstraint); + fireItemAdded(TableGeneratorAnnotation.UNIQUE_CONSTRAINTS_LIST, index, uniqueConstraint); return uniqueConstraint; } @@ -230,7 +240,7 @@ public class TableGeneratorImpl extends GeneratorImpl implements TableGenerator public void moveUniqueConstraint(int targetIndex, int sourceIndex) { moveUniqueConstraintInternal(targetIndex, sourceIndex); ContainerAnnotationTools.synchAnnotationsAfterMove(targetIndex, sourceIndex, this.uniqueConstraintsContainerAnnotation); - fireItemMoved(Table.UNIQUE_CONSTRAINTS_LIST, targetIndex, sourceIndex); + fireItemMoved(TableAnnotation.UNIQUE_CONSTRAINTS_LIST, targetIndex, sourceIndex); } protected void moveUniqueConstraintInternal(int targetIndex, int sourceIndex) { @@ -249,27 +259,27 @@ public class TableGeneratorImpl extends GeneratorImpl implements TableGenerator return UniqueConstraintImpl.createTableGeneratorUniqueConstraint(this, this.getMember(), index); } - public ITextRange tableTextRange(CompilationUnit astRoot) { + public TextRange tableTextRange(CompilationUnit astRoot) { return this.elementTextRange(TABLE_ADAPTER, astRoot); } - public ITextRange catalogTextRange(CompilationUnit astRoot) { + public TextRange catalogTextRange(CompilationUnit astRoot) { return this.elementTextRange(CATALOG_ADAPTER, astRoot); } - public ITextRange schemaTextRange(CompilationUnit astRoot) { + public TextRange schemaTextRange(CompilationUnit astRoot) { return this.elementTextRange(SCHEMA_ADAPTER, astRoot); } - public ITextRange pkColumnNameTextRange(CompilationUnit astRoot) { + public TextRange pkColumnNameTextRange(CompilationUnit astRoot) { return this.elementTextRange(PK_COLUMN_NAME_ADAPTER, astRoot); } - public ITextRange pkColumnValueTextRange(CompilationUnit astRoot) { + public TextRange pkColumnValueTextRange(CompilationUnit astRoot) { return this.elementTextRange(PK_COLUMN_VALUE_ADAPTER, astRoot); } - public ITextRange valueColumnNameTextRange(CompilationUnit astRoot) { + public TextRange valueColumnNameTextRange(CompilationUnit astRoot) { return this.elementTextRange(VALUE_COLUMN_NAME_ADAPTER, astRoot); } @@ -411,7 +421,7 @@ public class TableGeneratorImpl extends GeneratorImpl implements TableGenerator TableGeneratorImpl.this.updateFromJava(astRoot); } - public ITextRange textRange(CompilationUnit astRoot) { + public TextRange textRange(CompilationUnit astRoot) { return TableGeneratorImpl.this.textRange(astRoot); } @@ -439,11 +449,11 @@ public class TableGeneratorImpl extends GeneratorImpl implements TableGenerator super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return new TableGeneratorImpl(parent, member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableImpl.java index 65548173e8..555be9be6e 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableImpl.java @@ -15,6 +15,13 @@ import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdap import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.NestableUniqueConstraint; +import org.eclipse.jpt.core.resource.java.TableAnnotation; public class TableImpl extends AbstractTableResource { @@ -28,12 +35,12 @@ public class TableImpl extends AbstractTableResource private static final DeclarationAnnotationElementAdapter<String> CATALOG_ADAPTER = ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.TABLE__CATALOG); - protected TableImpl(JavaResource parent, Member member) { + protected TableImpl(JavaResourceNode parent, Member member) { super(parent, member, DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER)); } public String getAnnotationName() { - return Table.ANNOTATION_NAME; + return TableAnnotation.ANNOTATION_NAME; } @Override @@ -78,11 +85,11 @@ public class TableImpl extends AbstractTableResource super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return new TableImpl(parent, member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return new NullTable(parent); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Temporal.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Temporal.java deleted file mode 100644 index 2e7a1a8eb0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Temporal.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; - -/** - * Corresponds to the javax.persistence.Temporal annotation - */ -public interface Temporal extends JavaResource -{ - String ANNOTATION_NAME = JPA.TEMPORAL; - - /** - * Corresponds to the value element of the Temporal annotation. - * Returns null if the value element does not exist in java. - */ - TemporalType getValue(); - - /** - * Corresponds to the value element of the Temporal annotation. - * Set to null to remove the value element. - */ - void setValue(TemporalType value); - String VALUE_PROPERTY = "valueProperty"; - - /** - * Return the ITextRange for the value element. If the value element - * does not exist return the ITextRange for the Temporal annotation. - */ - ITextRange valueTextRange(CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalImpl.java index e001eaf4a4..c5f1d0ff35 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalImpl.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.core.internal.resource.java; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.Attribute; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; @@ -19,6 +19,13 @@ import org.eclipse.jpt.core.internal.jdtutility.EnumDeclarationAnnotationElement import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +import org.eclipse.jpt.core.resource.java.Annotation; +import org.eclipse.jpt.core.resource.java.AnnotationDefinition; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.Temporal; +import org.eclipse.jpt.core.resource.java.TemporalType; public class TemporalImpl extends AbstractAnnotationResource<Attribute> implements Temporal { @@ -30,7 +37,7 @@ public class TemporalImpl extends AbstractAnnotationResource<Attribute> implemen private TemporalType value; - protected TemporalImpl(JavaResource parent, Attribute attribute) { + protected TemporalImpl(JavaResourceNode parent, Attribute attribute) { super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, VALUE_ADAPTER); } @@ -54,7 +61,7 @@ public class TemporalImpl extends AbstractAnnotationResource<Attribute> implemen firePropertyChanged(VALUE_PROPERTY, oldValue, newValue); } - public ITextRange valueTextRange(CompilationUnit astRoot) { + public TextRange valueTextRange(CompilationUnit astRoot) { return this.elementTextRange(VALUE_ADAPTER, astRoot); } @@ -90,11 +97,11 @@ public class TemporalImpl extends AbstractAnnotationResource<Attribute> implemen super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { return new TemporalImpl(parent, (Attribute) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return new NullTemporal(parent); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalType.java deleted file mode 100644 index add5a13e9a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalType.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - - -public enum TemporalType { - - DATE, - TIME, - TIMESTAMP; - - - public static TemporalType fromJavaAnnotationValue(Object javaAnnotationValue) { - if (javaAnnotationValue == null) { - return null; - } - if (javaAnnotationValue.equals(JPA.TEMPORAL_TYPE__DATE)) { - return DATE; - } - if (javaAnnotationValue.equals(JPA.TEMPORAL_TYPE__TIME)) { - return TIME; - } - if (javaAnnotationValue.equals(JPA.TEMPORAL_TYPE__TIMESTAMP)) { - return TIMESTAMP; - } - return null; - } - - public static String toJavaAnnotationValue(TemporalType temporalType) { - if (temporalType == null) { - return null; - } - switch (temporalType) { - case DATE : - return JPA.TEMPORAL_TYPE__DATE; - case TIME : - return JPA.TEMPORAL_TYPE__TIME; - case TIMESTAMP : - return JPA.TEMPORAL_TYPE__TIMESTAMP; - default : - throw new IllegalArgumentException("unknown temporal type: " + temporalType); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Transient.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Transient.java deleted file mode 100644 index 4d86d7451e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Transient.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -/** - * Corresponds to the javax.persistence.Transient annotation - */ -public interface Transient extends JavaResource -{ - String ANNOTATION_NAME = JPA.TRANSIENT; - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TransientImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TransientImpl.java index 114ecd0127..1e7e7b36b0 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TransientImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TransientImpl.java @@ -14,12 +14,17 @@ import org.eclipse.jpt.core.internal.jdtutility.Attribute; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +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.Transient; public class TransientImpl extends AbstractAnnotationResource<Attribute> implements Transient { private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - protected TransientImpl(JavaPersistentAttributeResource parent, Attribute attribute) { + protected TransientImpl(JavaResourcePersistentAttribute parent, Attribute attribute) { super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); } @@ -54,11 +59,11 @@ public class TransientImpl extends AbstractAnnotationResource<Attribute> impleme super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { - return new TransientImpl((JavaPersistentAttributeResource) parent, (Attribute) member); + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { + return new TransientImpl((JavaResourcePersistentAttribute) parent, (Attribute) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/UniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/UniqueConstraint.java deleted file mode 100644 index e0913f94ec..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/UniqueConstraint.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - -import java.util.ListIterator; -import org.eclipse.jdt.core.dom.CompilationUnit; - -/** - * Corresponds to the javax.persistence.UniqueConstraint annotation - */ -public interface UniqueConstraint extends JavaResource -{ - String ANNOTATION_NAME = JPA.UNIQUE_CONSTRAINT; - - ListIterator<String> columnNames(); - - int columnNamesSize(); - - void addColumnName(String columnName); - - void removeColumnName(String columnName); - String COLUMN_NAMES_LIST = "columnNamesList"; - - /** - * Return whether the specified postition touches the columnNames element. - * Return false if the columnNames element does not exist. - */ - boolean columnNamesTouches(int pos, CompilationUnit astRoot); - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/UniqueConstraintImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/UniqueConstraintImpl.java index 5060256f4f..fef81ac5d7 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/UniqueConstraintImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/UniqueConstraintImpl.java @@ -26,6 +26,11 @@ import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitArrayAnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.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.NestableUniqueConstraint; +import org.eclipse.jpt.core.resource.java.UniqueConstraint; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; @@ -41,7 +46,7 @@ public class UniqueConstraintImpl extends AbstractAnnotationResource<Member> imp private final List<String> columnNames; - public UniqueConstraintImpl(JavaResource parent, Member member, IndexedDeclarationAnnotationAdapter idaa) { + public UniqueConstraintImpl(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); @@ -127,7 +132,7 @@ public class UniqueConstraintImpl extends AbstractAnnotationResource<Member> imp } // ********** static methods ********** - static NestableUniqueConstraint createSecondaryTableUniqueConstraint(JavaResource parent, Member member, DeclarationAnnotationAdapter declarationAnnotationAdapter, int index) { + static NestableUniqueConstraint createSecondaryTableUniqueConstraint(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter declarationAnnotationAdapter, int index) { return new UniqueConstraintImpl(parent, member, buildSecondaryTableUniqueConstraintAnnotationAdapter(declarationAnnotationAdapter, index)); } @@ -135,7 +140,7 @@ public class UniqueConstraintImpl extends AbstractAnnotationResource<Member> imp return new NestedIndexedDeclarationAnnotationAdapter(declarationAnnotationAdapter, JPA.SECONDARY_TABLE__UNIQUE_CONSTRAINTS, index, JPA.UNIQUE_CONSTRAINT); } - static NestableUniqueConstraint createJoinTableUniqueConstraint(JavaResource parent, Member member, int index) { + static NestableUniqueConstraint createJoinTableUniqueConstraint(JavaResourceNode parent, Member member, int index) { return new UniqueConstraintImpl(parent, member, buildJoinTableUniqueConstraintAnnotationAdapter(index)); } @@ -143,7 +148,7 @@ public class UniqueConstraintImpl extends AbstractAnnotationResource<Member> imp return new NestedIndexedDeclarationAnnotationAdapter(JoinTableImpl.DECLARATION_ANNOTATION_ADAPTER, JPA.JOIN_TABLE__UNIQUE_CONSTRAINTS, index, JPA.UNIQUE_CONSTRAINT); } - static NestableUniqueConstraint createTableUniqueConstraint(JavaResource parent, Member member, int index) { + static NestableUniqueConstraint createTableUniqueConstraint(JavaResourceNode parent, Member member, int index) { return new UniqueConstraintImpl(parent, member, buildTableUniqueConstraintAnnotationAdapter(index)); } @@ -151,7 +156,7 @@ public class UniqueConstraintImpl extends AbstractAnnotationResource<Member> imp return new NestedIndexedDeclarationAnnotationAdapter(TableImpl.DECLARATION_ANNOTATION_ADAPTER, JPA.TABLE__UNIQUE_CONSTRAINTS, index, JPA.UNIQUE_CONSTRAINT); } - static NestableUniqueConstraint createTableGeneratorUniqueConstraint(JavaResource parent, Member member, int index) { + static NestableUniqueConstraint createTableGeneratorUniqueConstraint(JavaResourceNode parent, Member member, int index) { return new UniqueConstraintImpl(parent, member, buildTableGeneratorUniqueConstraintAnnotationAdapter(index)); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Version.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Version.java deleted file mode 100644 index 29172ed4bb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Version.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.resource.java; - - -/** - * Corresponds to the javax.persistence.Version annotation - */ -public interface Version extends JavaResource -{ - String ANNOTATION_NAME = JPA.VERSION; - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/VersionImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/VersionImpl.java index f6f675a429..560c600141 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/VersionImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/VersionImpl.java @@ -14,12 +14,17 @@ import org.eclipse.jpt.core.internal.jdtutility.Attribute; import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.jdtutility.Member; import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter; +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.Version; public class VersionImpl extends AbstractAnnotationResource<Attribute> implements Version { private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - public VersionImpl(JavaPersistentAttributeResource parent, Attribute attribute) { + public VersionImpl(JavaResourcePersistentAttribute parent, Attribute attribute) { super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); } @@ -54,11 +59,11 @@ public class VersionImpl extends AbstractAnnotationResource<Attribute> implement super(); } - public Annotation buildAnnotation(JavaPersistentResource parent, Member member) { - return new VersionImpl((JavaPersistentAttributeResource) parent, (Attribute) member); + public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { + return new VersionImpl((JavaResourcePersistentAttribute) parent, (Attribute) member); } - public Annotation buildNullAnnotation(JavaPersistentResource parent, Member member) { + public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { return null; } |