org.eclipse.bpmn2.impl.RelationshipImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kie-wb-common-stunner-bpmn-emf Show documentation
Show all versions of kie-wb-common-stunner-bpmn-emf Show documentation
Kie Workbench - Common - Stunner - BPMN Definition Set - GWT Support for Eclipse EMF/XMI
/**
*
*
* Copyright (c) 2010 SAP AG.
* 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:
* Reiner Hille-Doering (SAP AG) - initial API and implementation and/or initial documentation
*
*
*/
package org.eclipse.bpmn2.impl;
import com.google.gwt.user.client.rpc.GwtTransient;
import java.util.Collection;
import org.eclipse.bpmn2.Bpmn2Package;
import org.eclipse.bpmn2.Relationship;
import org.eclipse.bpmn2.RelationshipDirection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
/**
*
* An implementation of the model object 'Relationship'.
*
*
* The following features are implemented:
*
*
* - {@link org.eclipse.bpmn2.impl.RelationshipImpl#getSources Sources}
* - {@link org.eclipse.bpmn2.impl.RelationshipImpl#getTargets Targets}
* - {@link org.eclipse.bpmn2.impl.RelationshipImpl#getDirection Direction}
* - {@link org.eclipse.bpmn2.impl.RelationshipImpl#getType Type}
*
*
* @generated
*/
public class RelationshipImpl extends BaseElementImpl implements Relationship {
/**
* The cached value of the '{@link #getSources() Sources}' reference list.
*
*
* @see #getSources()
* @generated
* @ordered
*/
@GwtTransient
protected EList sources;
/**
* The cached value of the '{@link #getTargets() Targets}' reference list.
*
*
* @see #getTargets()
* @generated
* @ordered
*/
@GwtTransient
protected EList targets;
/**
* The default value of the '{@link #getDirection() Direction}' attribute.
*
*
* @see #getDirection()
* @generated
* @ordered
*/
protected static final RelationshipDirection DIRECTION_EDEFAULT = RelationshipDirection.NONE;
/**
* The cached value of the '{@link #getDirection() Direction}' attribute.
*
*
* @see #getDirection()
* @generated
* @ordered
*/
@GwtTransient
protected RelationshipDirection direction = DIRECTION_EDEFAULT;
/**
* The default value of the '{@link #getType() Type}' attribute.
*
*
* @see #getType()
* @generated
* @ordered
*/
protected static final String TYPE_EDEFAULT = null;
/**
* The cached value of the '{@link #getType() Type}' attribute.
*
*
* @see #getType()
* @generated
* @ordered
*/
@GwtTransient
protected String type = TYPE_EDEFAULT;
/**
*
*
* @generated
*/
protected RelationshipImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return Bpmn2Package.Literals.RELATIONSHIP;
}
/**
*
*
* @generated
*/
@Override
public EList getSources() {
if (sources == null) {
sources = new EObjectResolvingEList(EObject.class, this, Bpmn2Package.RELATIONSHIP__SOURCES);
}
return sources;
}
/**
*
*
* @generated
*/
@Override
public EList getTargets() {
if (targets == null) {
targets = new EObjectResolvingEList(EObject.class, this, Bpmn2Package.RELATIONSHIP__TARGETS);
}
return targets;
}
/**
*
*
* @generated
*/
@Override
public RelationshipDirection getDirection() {
return direction;
}
/**
*
*
* @generated
*/
@Override
public void setDirection(RelationshipDirection newDirection) {
RelationshipDirection oldDirection = direction;
direction = newDirection == null ? DIRECTION_EDEFAULT : newDirection;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, Bpmn2Package.RELATIONSHIP__DIRECTION, oldDirection,
direction));
}
/**
*
*
* @generated
*/
@Override
public String getType() {
return type;
}
/**
*
*
* @generated
*/
@Override
public void setType(String newType) {
String oldType = type;
type = newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, Bpmn2Package.RELATIONSHIP__TYPE, oldType, type));
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case Bpmn2Package.RELATIONSHIP__SOURCES:
return getSources();
case Bpmn2Package.RELATIONSHIP__TARGETS:
return getTargets();
case Bpmn2Package.RELATIONSHIP__DIRECTION:
return getDirection();
case Bpmn2Package.RELATIONSHIP__TYPE:
return getType();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case Bpmn2Package.RELATIONSHIP__SOURCES:
getSources().clear();
getSources().addAll((Collection extends EObject>) newValue);
return;
case Bpmn2Package.RELATIONSHIP__TARGETS:
getTargets().clear();
getTargets().addAll((Collection extends EObject>) newValue);
return;
case Bpmn2Package.RELATIONSHIP__DIRECTION:
setDirection((RelationshipDirection) newValue);
return;
case Bpmn2Package.RELATIONSHIP__TYPE:
setType((String) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case Bpmn2Package.RELATIONSHIP__SOURCES:
getSources().clear();
return;
case Bpmn2Package.RELATIONSHIP__TARGETS:
getTargets().clear();
return;
case Bpmn2Package.RELATIONSHIP__DIRECTION:
setDirection(DIRECTION_EDEFAULT);
return;
case Bpmn2Package.RELATIONSHIP__TYPE:
setType(TYPE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case Bpmn2Package.RELATIONSHIP__SOURCES:
return sources != null && !sources.isEmpty();
case Bpmn2Package.RELATIONSHIP__TARGETS:
return targets != null && !targets.isEmpty();
case Bpmn2Package.RELATIONSHIP__DIRECTION:
return direction != DIRECTION_EDEFAULT;
case Bpmn2Package.RELATIONSHIP__TYPE:
return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type);
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString() {
if (eIsProxy())
return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (direction: ");
result.append(direction);
result.append(", type: ");
result.append(type);
result.append(')');
return result.toString();
}
} //RelationshipImpl
© 2015 - 2025 Weber Informatics LLC | Privacy Policy