| /******************************************************************************* |
| * Copyright (c) 2009, 2011 Oracle. All rights reserved. |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v1.0, which accompanies this distribution |
| * and is available at http://www.eclipse.org/legal/epl-v10.html. |
| * |
| * Contributors: |
| * Oracle - initial API and implementation |
| ******************************************************************************/ |
| package org.eclipse.jpt.jpa.core.internal.context.orm; |
| |
| import org.eclipse.jpt.common.core.utility.TextRange; |
| import org.eclipse.jpt.jpa.core.context.PersistentAttribute; |
| import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn; |
| import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable; |
| import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationshipStrategy; |
| import org.eclipse.jpt.jpa.core.context.ReadOnlyTable; |
| import org.eclipse.jpt.jpa.core.context.orm.OrmMappingJoinTableRelationship; |
| import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; |
| import org.eclipse.jpt.jpa.core.internal.context.JptValidator; |
| import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; |
| import org.eclipse.jpt.jpa.core.internal.jpa1.context.InverseJoinColumnValidator; |
| import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinColumnValidator; |
| import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionProvider; |
| import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableValidator; |
| import org.eclipse.jpt.jpa.core.jpa2.context.ReadOnlyOverrideRelationship2_0; |
| import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingJoinTableRelationshipStrategy2_0; |
| |
| public class GenericOrmMappingJoinTableRelationshipStrategy |
| extends AbstractOrmJoinTableRelationshipStrategy |
| implements OrmMappingJoinTableRelationshipStrategy2_0 |
| { |
| public GenericOrmMappingJoinTableRelationshipStrategy(OrmMappingJoinTableRelationship parent) { |
| super(parent); |
| } |
| |
| |
| public boolean isOverridable() { |
| return this.getJpaPlatformVariation().isJoinTableOverridable(); |
| } |
| |
| public ReadOnlyRelationshipStrategy selectOverrideStrategy(ReadOnlyOverrideRelationship2_0 overrideRelationship) { |
| return overrideRelationship.getJoinTableStrategy(); |
| } |
| |
| |
| // ********** validation ********** |
| |
| public boolean validatesAgainstDatabase() { |
| return this.getRelationshipMapping().validatesAgainstDatabase(); |
| } |
| |
| public TextRange getValidationTextRange() { |
| return this.getRelationship().getValidationTextRange(); |
| } |
| |
| protected PersistentAttribute getPersistentAttribute() { |
| return getRelationshipMapping().getPersistentAttribute(); |
| } |
| |
| public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { |
| return new JoinColumnValidator(this.getPersistentAttribute(), column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); |
| } |
| |
| public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { |
| return new InverseJoinColumnValidator(this.getPersistentAttribute(), column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); |
| } |
| |
| public JptValidator buildTableValidator(ReadOnlyTable table, TableTextRangeResolver textRangeResolver) { |
| return new JoinTableValidator(this.getPersistentAttribute(), (ReadOnlyJoinTable) table, textRangeResolver); |
| } |
| } |