| /******************************************************************************* |
| * 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.internal.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.emfstore.internal.common.model.util.ModelUtil; |
| import org.eclipse.emf.emfstore.internal.server.model.ModelPackage; |
| import org.eclipse.emf.emfstore.internal.server.model.ProjectId; |
| import org.eclipse.emf.emfstore.internal.server.model.ProjectInfo; |
| import org.eclipse.emf.emfstore.internal.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: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.emf.emfstore.internal.server.model.impl.ProjectInfoImpl#getName <em>Name</em>}</li> |
| * <li>{@link org.eclipse.emf.emfstore.internal.server.model.impl.ProjectInfoImpl#getDescription <em>Description</em>} |
| * </li> |
| * <li>{@link org.eclipse.emf.emfstore.internal.server.model.impl.ProjectInfoImpl#getProjectId <em>Project Id</em>}</li> |
| * <li>{@link org.eclipse.emf.emfstore.internal.server.model.impl.ProjectInfoImpl#getVersion <em>Version</em>}</li> |
| * </ul> |
| * |
| * @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) { |
| final 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) { |
| final 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(ModelUtil.clone(newProjectId)); |
| } |
| |
| // end of custom code |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public ProjectId getProjectId() { |
| if (projectId != null && projectId.eIsProxy()) { |
| final InternalEObject oldProjectId = (InternalEObject) projectId; |
| projectId = (ProjectId) eResolveProxy(oldProjectId); |
| if (projectId != oldProjectId) { |
| final 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) { |
| final ProjectId oldProjectId = projectId; |
| projectId = newProjectId; |
| if (eNotificationRequired()) { |
| final 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()) { |
| final InternalEObject oldVersion = (InternalEObject) version; |
| version = (PrimaryVersionSpec) eResolveProxy(oldVersion); |
| if (version != oldVersion) { |
| final 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) { |
| final PrimaryVersionSpec oldVersion = version; |
| version = newVersion; |
| if (eNotificationRequired()) { |
| final 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(ModelUtil.clone(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(); |
| } |
| |
| final StringBuffer result = new StringBuffer(super.toString()); |
| result.append(" (name: "); //$NON-NLS-1$ |
| result.append(name); |
| result.append(", description: "); //$NON-NLS-1$ |
| result.append(description); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } // ProjectInfoImpl |