diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyRelationshipReference.java')
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyRelationshipReference.java | 155 |
1 files changed, 0 insertions, 155 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyRelationshipReference.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyRelationshipReference.java deleted file mode 100644 index 5cc467d12b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyRelationshipReference.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.MappingKeys; -import org.eclipse.jpt.core.context.AttributeMapping; -import org.eclipse.jpt.core.context.JoiningStrategy; -import org.eclipse.jpt.core.context.java.JavaJoinColumnEnabledRelationshipReference; -import org.eclipse.jpt.core.context.java.JavaJoinColumnJoiningStrategy; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaOneToManyRelationshipReference; -import org.eclipse.jpt.core.internal.context.java.GenericJavaJoinColumnJoiningStrategy; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToManyRelationshipReference; -import org.eclipse.jpt.utility.Filter; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JavaEclipseLinkOneToManyRelationshipReference - extends AbstractJavaOneToManyRelationshipReference - implements EclipseLinkOneToManyRelationshipReference, - JavaJoinColumnEnabledRelationshipReference -{ - protected final JavaJoinColumnJoiningStrategy joinColumnJoiningStrategy; - - - public JavaEclipseLinkOneToManyRelationshipReference( - JavaEclipseLinkOneToManyMapping parent) { - super(parent); - this.joinColumnJoiningStrategy = buildJoinColumnJoiningStrategy(); - } - - - protected JavaJoinColumnJoiningStrategy buildJoinColumnJoiningStrategy() { - return new GenericJavaJoinColumnJoiningStrategy(this); - } - - @Override - public JavaEclipseLinkOneToManyMapping getRelationshipMapping() { - return (JavaEclipseLinkOneToManyMapping) getParent(); - } - - - @Override - protected JoiningStrategy calculatePredominantJoiningStrategy() { - if (this.mappedByJoiningStrategy.getMappedByAttribute() != null) { - return this.mappedByJoiningStrategy; - } - else if (this.joinColumnJoiningStrategy.hasSpecifiedJoinColumns()) { - return this.joinColumnJoiningStrategy; - } - else { - return this.joinTableJoiningStrategy; - } - } - - @Override - public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) { - Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot); - if (result == null) { - result = this.joinColumnJoiningStrategy.javaCompletionProposals(pos, filter, astRoot); - } - return result; - } - - - // **************** mapped by ********************************************** - - @Override - public void setMappedByJoiningStrategy() { - super.setMappedByJoiningStrategy(); - this.joinColumnJoiningStrategy.removeStrategy(); - } - - @Override - public boolean mayBeMappedBy(AttributeMapping mappedByMapping) { - return super.mayBeMappedBy(mappedByMapping) || - mappedByMapping.getKey() == MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - - // **************** join table ********************************************* - - @Override - public void setJoinTableJoiningStrategy() { - super.setJoinTableJoiningStrategy(); - this.joinColumnJoiningStrategy.removeStrategy(); - } - - @Override - public boolean mayHaveDefaultJoinTable() { - return super.mayHaveDefaultJoinTable() - && ! this.joinColumnJoiningStrategy.hasSpecifiedJoinColumns(); - } - - - // **************** join columns ******************************************* - - public JavaJoinColumnJoiningStrategy getJoinColumnJoiningStrategy() { - return this.joinColumnJoiningStrategy; - } - - public boolean usesJoinColumnJoiningStrategy() { - return getPredominantJoiningStrategy() == this.joinColumnJoiningStrategy; - } - - public void setJoinColumnJoiningStrategy() { - this.joinColumnJoiningStrategy.addStrategy(); - this.mappedByJoiningStrategy.removeStrategy(); - this.joinTableJoiningStrategy.removeStrategy(); - } - - public void unsetJoinColumnJoiningStrategy() { - this.joinColumnJoiningStrategy.removeStrategy(); - } - - public boolean mayHaveDefaultJoinColumn() { - return this.mappedByJoiningStrategy.getMappedByAttribute() == null - && this.joinTableJoiningStrategy.getJoinTable() == null; - } - - - - // **************** resource => context ************************************ - - @Override - protected void initializeJoiningStrategies() { - this.joinColumnJoiningStrategy.initialize(); - super.initializeJoiningStrategies(); - } - - @Override - protected void updateJoiningStrategies() { - this.joinColumnJoiningStrategy.update(); - super.updateJoiningStrategies(); - } - - - // **************** Validation ********************************************* - - @Override - public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.joinColumnJoiningStrategy.validate(messages, reporter, astRoot); - } -} |