| /** |
| * <copyright> |
| * Copyright (c) 2005 IBM Corporation and others. |
| * 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/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * IBM Corporation - initial API and implementation |
| * </copyright> |
| * |
| * $Id: LinkImpl.java,v 1.9 2011/03/30 18:54:25 rbrodt Exp $ |
| */ |
| package org.eclipse.bpel.model.impl; |
| |
| import java.util.Collection; |
| |
| import org.eclipse.bpel.model.BPELPackage; |
| import org.eclipse.bpel.model.Link; |
| import org.eclipse.bpel.model.Source; |
| import org.eclipse.bpel.model.Target; |
| import org.eclipse.bpel.model.util.BPELConstants; |
| import org.eclipse.bpel.model.util.ReconciliationHelper; |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| import org.eclipse.emf.common.util.EList; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Link</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.bpel.model.impl.LinkImpl#getName <em>Name</em>}</li> |
| * <li>{@link org.eclipse.bpel.model.impl.LinkImpl#getSources <em>Sources</em>}</li> |
| * <li>{@link org.eclipse.bpel.model.impl.LinkImpl#getTargets <em>Targets</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class LinkImpl extends BPELExtensibleElementImpl implements Link { |
| /** |
| * The default value of the '{@link #getName() <em>Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected static final String NAME_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getName() <em>Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected String name = NAME_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getSources() <em>Sources</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSources() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Source> sources; |
| |
| /** |
| * The cached value of the '{@link #getTargets() <em>Targets</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTargets() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Target> targets; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected LinkImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return BPELPackage.Literals.LINK; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getName() { |
| return name; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| */ |
| public void setName(String newName) { |
| String oldName = name; |
| if (!isReconciling) { |
| ReconciliationHelper.replaceAttribute(this, BPELConstants.AT_NAME, |
| newName); |
| } |
| name = newName; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, |
| BPELPackage.LINK__NAME, oldName, name)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Source> getSources() { |
| if (sources == null) { |
| sources = new EObjectWithInverseResolvingEList<Source>( |
| Source.class, this, BPELPackage.LINK__SOURCES, |
| BPELPackage.SOURCE__LINK); |
| } |
| return sources; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Target> getTargets() { |
| if (targets == null) { |
| targets = new EObjectWithInverseResolvingEList<Target>( |
| Target.class, this, BPELPackage.LINK__TARGETS, |
| BPELPackage.TARGET__LINK); |
| } |
| return targets; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, |
| int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case BPELPackage.LINK__SOURCES: |
| return ((InternalEList<InternalEObject>) (InternalEList<?>) getSources()) |
| .basicAdd(otherEnd, msgs); |
| case BPELPackage.LINK__TARGETS: |
| return ((InternalEList<InternalEObject>) (InternalEList<?>) getTargets()) |
| .basicAdd(otherEnd, msgs); |
| } |
| return super.eInverseAdd(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, |
| int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case BPELPackage.LINK__SOURCES: |
| return ((InternalEList<?>) getSources()) |
| .basicRemove(otherEnd, msgs); |
| case BPELPackage.LINK__TARGETS: |
| return ((InternalEList<?>) getTargets()) |
| .basicRemove(otherEnd, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case BPELPackage.LINK__NAME: |
| return getName(); |
| case BPELPackage.LINK__SOURCES: |
| return getSources(); |
| case BPELPackage.LINK__TARGETS: |
| return getTargets(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case BPELPackage.LINK__NAME: |
| setName((String) newValue); |
| return; |
| case BPELPackage.LINK__SOURCES: |
| getSources().clear(); |
| getSources().addAll((Collection<? extends Source>) newValue); |
| return; |
| case BPELPackage.LINK__TARGETS: |
| getTargets().clear(); |
| getTargets().addAll((Collection<? extends Target>) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case BPELPackage.LINK__NAME: |
| setName(NAME_EDEFAULT); |
| return; |
| case BPELPackage.LINK__SOURCES: |
| getSources().clear(); |
| return; |
| case BPELPackage.LINK__TARGETS: |
| getTargets().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case BPELPackage.LINK__NAME: |
| return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT |
| .equals(name); |
| case BPELPackage.LINK__SOURCES: |
| return sources != null && !sources.isEmpty(); |
| case BPELPackage.LINK__TARGETS: |
| return targets != null && !targets.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) |
| return super.toString(); |
| |
| StringBuffer result = new StringBuffer(super.toString()); |
| result.append(" (name: "); //$NON-NLS-1$ |
| result.append(name); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //LinkImpl |