/******************************************************************************* * 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.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.ecore.impl.EObjectImpl; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.emfstore.server.model.ModelPackage; import org.eclipse.emf.emfstore.server.model.ProjectId; import org.eclipse.emf.emfstore.server.model.ProjectInfo; import org.eclipse.emf.emfstore.server.model.versioning.PrimaryVersionSpec; /** * <!-- begin-user-doc --> An implementation of the model object ' <em><b>Project Info</b></em>'. <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.emf.emfstore.server.model.impl.ProjectInfoImpl#getName <em>Name</em>}</li> * <li>{@link org.eclipse.emf.emfstore.server.model.impl.ProjectInfoImpl#getDescription <em>Description</em>}</li> * <li>{@link org.eclipse.emf.emfstore.server.model.impl.ProjectInfoImpl#getProjectId <em>Project Id</em>}</li> * <li>{@link org.eclipse.emf.emfstore.server.model.impl.ProjectInfoImpl#getVersion <em>Version</em>}</li> * </ul> * </p> * * @generated */ public class ProjectInfoImpl extends EObjectImpl implements ProjectInfo { /** * 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 default value of the '{@link #getDescription() <em>Description</em>}' attribute. * <!-- begin-user-doc --> <!-- end-user-doc --> * @see #getDescription() * @generated * @ordered */ protected static final String DESCRIPTION_EDEFAULT = null; /** * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute. * <!-- begin-user-doc --> <!-- end-user-doc --> * @see #getDescription() * @generated * @ordered */ protected String description = DESCRIPTION_EDEFAULT; /** * 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; /** * The cached value of the '{@link #getVersion() <em>Version</em>}' containment reference. * <!-- begin-user-doc --> <!-- end-user-doc --> * @see #getVersion() * @generated * @ordered */ protected PrimaryVersionSpec version; /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ protected ProjectInfoImpl() { super(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return ModelPackage.Literals.PROJECT_INFO; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.PROJECT_INFO__NAME, oldName, name)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public String getDescription() { return description; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public void setDescription(String newDescription) { String oldDescription = description; description = newDescription; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.PROJECT_INFO__DESCRIPTION, oldDescription, description)); } /** * Set a copy of the given id. <!-- begin-user-doc --> <!-- end-user-doc --> * * @param newProjectId * the id. * @generated NOT */ public void setProjectId(ProjectId newProjectId) { setProjectIdGen(EcoreUtil.copy(newProjectId)); } // end of custom code /** * <!-- 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 - ModelPackage.PROJECT_INFO__PROJECT_ID, null, null); if (newProjectId.eInternalContainer() == null) { msgs = newProjectId.eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ModelPackage.PROJECT_INFO__PROJECT_ID, null, msgs); } if (msgs != null) msgs.dispatch(); if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModelPackage.PROJECT_INFO__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, ModelPackage.PROJECT_INFO__PROJECT_ID, oldProjectId, newProjectId); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public void setProjectIdGen(ProjectId newProjectId) { if (newProjectId != projectId) { NotificationChain msgs = null; if (projectId != null) msgs = ((InternalEObject)projectId).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ModelPackage.PROJECT_INFO__PROJECT_ID, null, msgs); if (newProjectId != null) msgs = ((InternalEObject)newProjectId).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ModelPackage.PROJECT_INFO__PROJECT_ID, null, msgs); msgs = basicSetProjectId(newProjectId, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.PROJECT_INFO__PROJECT_ID, newProjectId, newProjectId)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public PrimaryVersionSpec getVersion() { if (version != null && version.eIsProxy()) { InternalEObject oldVersion = (InternalEObject)version; version = (PrimaryVersionSpec)eResolveProxy(oldVersion); if (version != oldVersion) { InternalEObject newVersion = (InternalEObject)version; NotificationChain msgs = oldVersion.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ModelPackage.PROJECT_INFO__VERSION, null, null); if (newVersion.eInternalContainer() == null) { msgs = newVersion.eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ModelPackage.PROJECT_INFO__VERSION, null, msgs); } if (msgs != null) msgs.dispatch(); if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModelPackage.PROJECT_INFO__VERSION, oldVersion, version)); } } return version; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public PrimaryVersionSpec basicGetVersion() { return version; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public NotificationChain basicSetVersion(PrimaryVersionSpec newVersion, NotificationChain msgs) { PrimaryVersionSpec oldVersion = version; version = newVersion; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ModelPackage.PROJECT_INFO__VERSION, oldVersion, newVersion); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated not */ public void setVersion(PrimaryVersionSpec newVersion) { setVersionGen(EcoreUtil.copy(newVersion)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public void setVersionGen(PrimaryVersionSpec newVersion) { if (newVersion != version) { NotificationChain msgs = null; if (version != null) msgs = ((InternalEObject)version).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ModelPackage.PROJECT_INFO__VERSION, null, msgs); if (newVersion != null) msgs = ((InternalEObject)newVersion).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ModelPackage.PROJECT_INFO__VERSION, null, msgs); msgs = basicSetVersion(newVersion, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.PROJECT_INFO__VERSION, newVersion, newVersion)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case ModelPackage.PROJECT_INFO__PROJECT_ID: return basicSetProjectId(null, msgs); case ModelPackage.PROJECT_INFO__VERSION: return basicSetVersion(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 ModelPackage.PROJECT_INFO__NAME: return getName(); case ModelPackage.PROJECT_INFO__DESCRIPTION: return getDescription(); case ModelPackage.PROJECT_INFO__PROJECT_ID: if (resolve) return getProjectId(); return basicGetProjectId(); case ModelPackage.PROJECT_INFO__VERSION: if (resolve) return getVersion(); return basicGetVersion(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case ModelPackage.PROJECT_INFO__NAME: setName((String)newValue); return; case ModelPackage.PROJECT_INFO__DESCRIPTION: setDescription((String)newValue); return; case ModelPackage.PROJECT_INFO__PROJECT_ID: setProjectId((ProjectId)newValue); return; case ModelPackage.PROJECT_INFO__VERSION: setVersion((PrimaryVersionSpec)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ModelPackage.PROJECT_INFO__NAME: setName(NAME_EDEFAULT); return; case ModelPackage.PROJECT_INFO__DESCRIPTION: setDescription(DESCRIPTION_EDEFAULT); return; case ModelPackage.PROJECT_INFO__PROJECT_ID: setProjectId((ProjectId)null); return; case ModelPackage.PROJECT_INFO__VERSION: setVersion((PrimaryVersionSpec)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ModelPackage.PROJECT_INFO__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case ModelPackage.PROJECT_INFO__DESCRIPTION: return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description); case ModelPackage.PROJECT_INFO__PROJECT_ID: return projectId != null; case ModelPackage.PROJECT_INFO__VERSION: return version != null; } 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: "); result.append(name); result.append(", description: "); result.append(description); result.append(')'); return result.toString(); } } // ProjectInfoImpl