| /******************************************************************************* |
| * Copyright (c) 2008, 2015 Oracle. All rights reserved. |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License 2.0, which accompanies this distribution |
| * and is available at https://www.eclipse.org/legal/epl-2.0/. |
| * |
| * Contributors: |
| * Oracle - initial API and implementation |
| ******************************************************************************/ |
| package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm; |
| |
| import java.util.List; |
| import org.eclipse.core.runtime.IProgressMonitor; |
| import org.eclipse.jpt.common.utility.internal.iterable.IterableTools; |
| import org.eclipse.jpt.jpa.core.context.orm.OrmSpecifiedPersistentAttribute; |
| import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmManyToOneMapping; |
| import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch; |
| import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkManyToOneMapping2_0; |
| import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit; |
| import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlManyToOne; |
| import org.eclipse.wst.validation.internal.provisional.core.IMessage; |
| import org.eclipse.wst.validation.internal.provisional.core.IReporter; |
| |
| public class EclipseLinkOrmManyToOneMapping |
| extends AbstractOrmManyToOneMapping<XmlManyToOne> |
| implements EclipseLinkManyToOneMapping2_0 |
| { |
| protected final EclipseLinkOrmJoinFetch joinFetch; |
| |
| |
| protected EclipseLinkOrmManyToOneMapping(OrmSpecifiedPersistentAttribute parent, XmlManyToOne xmlMapping) { |
| super(parent, xmlMapping); |
| this.joinFetch = new EclipseLinkOrmJoinFetch(this); |
| } |
| |
| |
| // ********** synchronize/update ********** |
| |
| @Override |
| public void synchronizeWithResourceModel(IProgressMonitor monitor) { |
| super.synchronizeWithResourceModel(monitor); |
| this.joinFetch.synchronizeWithResourceModel(monitor); |
| } |
| |
| @Override |
| public void update(IProgressMonitor monitor) { |
| super.update(monitor); |
| this.joinFetch.update(monitor); |
| } |
| |
| |
| // ********** join fetch ********** |
| |
| public EclipseLinkJoinFetch getJoinFetch() { |
| return this.joinFetch; |
| } |
| |
| |
| // ********** validation ********** |
| |
| @Override |
| public void validate(List<IMessage> messages, IReporter reporter) { |
| super.validate(messages, reporter); |
| // TODO - join fetch validation |
| } |
| |
| // ********** completion proposals ********** |
| |
| @Override |
| @SuppressWarnings("unchecked") |
| protected Iterable<String> getCandidateTargetEntityClassNames() { |
| return IterableTools.concatenate( |
| super.getCandidateTargetEntityClassNames(), |
| IterableTools.sort(((EclipseLinkPersistenceUnit) this.getPersistenceUnit()).getEclipseLinkDynamicPersistentTypeNames()) |
| ); |
| } |
| } |