Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2008-02-25 16:20:08 +0000
committerkmoore2008-02-25 16:20:08 +0000
commit799475ec15f7f5d8838fef3d8397d38fde082111 (patch)
tree45e8be97e6d1f3db423baf767a669e8955790b84 /jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaOneToManyMapping.java
parentb7f9a0cb92fdf23807be30cb6ca97b579f7a7a8b (diff)
downloadwebtools.dali-799475ec15f7f5d8838fef3d8397d38fde082111.tar.gz
webtools.dali-799475ec15f7f5d8838fef3d8397d38fde082111.tar.xz
webtools.dali-799475ec15f7f5d8838fef3d8397d38fde082111.zip
Refactored packages into public API, renamed interfaces
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaOneToManyMapping.java')
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaOneToManyMapping.java91
1 files changed, 91 insertions, 0 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaOneToManyMapping.java
new file mode 100644
index 0000000000..5f7187ed03
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaOneToManyMapping.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * 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.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.MappingKeys;
+import org.eclipse.jpt.core.TextRange;
+import org.eclipse.jpt.core.context.AttributeMapping;
+import org.eclipse.jpt.core.context.java.JavaOneToManyMapping;
+import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.core.resource.java.JPA;
+import org.eclipse.jpt.core.resource.java.OneToMany;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+
+public class GenericJavaOneToManyMapping extends AbstractJavaMultiRelationshipMapping<OneToMany>
+ implements JavaOneToManyMapping
+{
+
+ public GenericJavaOneToManyMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+ public Iterator<String> correspondingAnnotationNames() {
+ return new ArrayIterator<String>(
+ JPA.ORDER_BY,
+ JPA.MAP_KEY,
+ JPA.JOIN_TABLE,
+ JPA.JOIN_COLUMN,
+ JPA.JOIN_COLUMNS);
+ }
+
+
+ public String getKey() {
+ return MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String annotationName() {
+ return OneToMany.ANNOTATION_NAME;
+ }
+
+ @Override
+ protected OneToMany relationshipMapping() {
+ return (OneToMany) this.persistentAttributeResource.mappingAnnotation();
+ }
+
+ // ********** JavaMultiRelationshipMapping implementation **********
+
+ @Override
+ protected boolean mappedByTouches(int pos, CompilationUnit astRoot) {
+ return this.relationshipMapping().mappedByTouches(pos, astRoot);
+ }
+
+ @Override
+ protected void setMappedByOnResourceModel(String mappedBy) {
+ this.relationshipMapping().setMappedBy(mappedBy);
+ }
+
+ @Override
+ protected String mappedBy(OneToMany relationshipMapping) {
+ return relationshipMapping.getMappedBy();
+ }
+
+
+ // ********** INonOwningMapping implementation **********
+ public boolean mappedByIsValid(AttributeMapping mappedByMapping) {
+ String mappedByKey = mappedByMapping.getKey();
+ return (mappedByKey == MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ }
+
+ public TextRange mappedByTextRange(CompilationUnit astRoot) {
+ return this.relationshipMapping().mappedByTextRange(astRoot);
+ }
+
+ @Override
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+ }
+
+} \ No newline at end of file

Back to the top