| /******************************************************************************* |
| * 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.AbstractOrmOneToOneMapping; |
| import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch; |
| import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkOneToOneMapping2_0; |
| import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkPrivateOwned; |
| import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit; |
| import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlOneToOne; |
| import org.eclipse.wst.validation.internal.provisional.core.IMessage; |
| import org.eclipse.wst.validation.internal.provisional.core.IReporter; |
| |
| public class EclipseLinkOrmOneToOneMapping |
| extends AbstractOrmOneToOneMapping<XmlOneToOne> |
| implements EclipseLinkOneToOneMapping2_0 |
| { |
| protected final EclipseLinkOrmPrivateOwned privateOwned; |
| |
| protected final EclipseLinkOrmJoinFetch joinFetch; |
| |
| |
| protected EclipseLinkOrmOneToOneMapping(OrmSpecifiedPersistentAttribute parent, XmlOneToOne xmlMapping) { |
| super(parent, xmlMapping); |
| this.privateOwned = new EclipseLinkOrmPrivateOwned(this); |
| this.joinFetch = new EclipseLinkOrmJoinFetch(this); |
| } |
| |
| |
| // ********** synchronize/update ********** |
| |
| @Override |
| public void synchronizeWithResourceModel(IProgressMonitor monitor) { |
| super.synchronizeWithResourceModel(monitor); |
| this.privateOwned.synchronizeWithResourceModel(monitor); |
| this.joinFetch.synchronizeWithResourceModel(monitor); |
| } |
| |
| @Override |
| public void update(IProgressMonitor monitor) { |
| super.update(monitor); |
| this.privateOwned.update(monitor); |
| this.joinFetch.update(monitor); |
| } |
| |
| |
| // ********** private owned ********** |
| |
| public EclipseLinkPrivateOwned getPrivateOwned() { |
| return this.privateOwned; |
| } |
| |
| |
| // ********** join fetch ********** |
| |
| public EclipseLinkJoinFetch getJoinFetch() { |
| return this.joinFetch; |
| } |
| |
| |
| // ********** validation ********** |
| |
| @Override |
| public void validate(List<IMessage> messages, IReporter reporter) { |
| super.validate(messages, reporter); |
| // TODO - private owned, join fetch validation |
| } |
| |
| // ********** completion proposals ********** |
| |
| @Override |
| @SuppressWarnings("unchecked") |
| protected Iterable<String> getCandidateTargetEntityClassNames() { |
| return IterableTools.concatenate( |
| super.getCandidateTargetEntityClassNames(), |
| IterableTools.sort(((EclipseLinkPersistenceUnit) this.getPersistenceUnit()).getEclipseLinkDynamicPersistentTypeNames()) |
| ); |
| } |
| } |