/*******************************************************************************
* Copyright (c) 2008-2011 Chair for Applied Software Engineering,
* Technische Universitaet Muenchen.
* 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:
******************************************************************************/
package org.eclipse.emf.emfstore.server.model.versioning.events.server.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.emfstore.server.model.ProjectId;
import org.eclipse.emf.emfstore.server.model.versioning.events.server.ServerPackage;
import org.eclipse.emf.emfstore.server.model.versioning.events.server.ServerProjectEvent;
/**
* <!-- begin-user-doc --> An implementation of the model object '<em><b>Project Event</b></em>'. <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.emf.emfstore.server.model.versioning.events.server.impl.ServerProjectEventImpl#getProjectId <em>Project Id</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public abstract class ServerProjectEventImpl extends ServerEventImpl implements ServerProjectEvent {
/**
* The cached value of the '{@link #getProjectId() <em>Project Id</em>}' containment reference.
* <!-- begin-user-doc
* --> <!-- end-user-doc -->
* @see #getProjectId()
* @generated
* @ordered
*/
protected ProjectId projectId;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
protected ServerProjectEventImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ServerPackage.Literals.SERVER_PROJECT_EVENT;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public ProjectId getProjectId() {
if (projectId != null && projectId.eIsProxy()) {
InternalEObject oldProjectId = (InternalEObject)projectId;
projectId = (ProjectId)eResolveProxy(oldProjectId);
if (projectId != oldProjectId) {
InternalEObject newProjectId = (InternalEObject)projectId;
NotificationChain msgs = oldProjectId.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ServerPackage.SERVER_PROJECT_EVENT__PROJECT_ID, null, null);
if (newProjectId.eInternalContainer() == null) {
msgs = newProjectId.eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ServerPackage.SERVER_PROJECT_EVENT__PROJECT_ID, null, msgs);
}
if (msgs != null) msgs.dispatch();
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ServerPackage.SERVER_PROJECT_EVENT__PROJECT_ID, oldProjectId, projectId));
}
}
return projectId;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public ProjectId basicGetProjectId() {
return projectId;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetProjectId(ProjectId newProjectId, NotificationChain msgs) {
ProjectId oldProjectId = projectId;
projectId = newProjectId;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ServerPackage.SERVER_PROJECT_EVENT__PROJECT_ID, oldProjectId, newProjectId);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void setProjectId(ProjectId newProjectId) {
if (newProjectId != projectId) {
NotificationChain msgs = null;
if (projectId != null)
msgs = ((InternalEObject)projectId).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ServerPackage.SERVER_PROJECT_EVENT__PROJECT_ID, null, msgs);
if (newProjectId != null)
msgs = ((InternalEObject)newProjectId).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ServerPackage.SERVER_PROJECT_EVENT__PROJECT_ID, null, msgs);
msgs = basicSetProjectId(newProjectId, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ServerPackage.SERVER_PROJECT_EVENT__PROJECT_ID, newProjectId, newProjectId));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ServerPackage.SERVER_PROJECT_EVENT__PROJECT_ID:
return basicSetProjectId(null, 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 ServerPackage.SERVER_PROJECT_EVENT__PROJECT_ID:
if (resolve) return getProjectId();
return basicGetProjectId();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ServerPackage.SERVER_PROJECT_EVENT__PROJECT_ID:
setProjectId((ProjectId)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ServerPackage.SERVER_PROJECT_EVENT__PROJECT_ID:
setProjectId((ProjectId)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ServerPackage.SERVER_PROJECT_EVENT__PROJECT_ID:
return projectId != null;
}
return super.eIsSet(featureID);
}
} // ServerProjectEventImpl