/** * ***************************************************************************** * Copyright (c) 2014 BestSolution.at and others. * 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: * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation * ******************************************************************************* */ package at.bestsolution.persistence.tasktracker.impl; import at.bestsolution.persistence.tasktracker.Person; import at.bestsolution.persistence.tasktracker.TaskRepository; import at.bestsolution.persistence.tasktracker.TasktrackerPackage; 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.util.EcoreUtil; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Person</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link at.bestsolution.persistence.tasktracker.impl.PersonImpl#getFirstname <em>Firstname</em>}</li> * <li>{@link at.bestsolution.persistence.tasktracker.impl.PersonImpl#getLastname <em>Lastname</em>}</li> * <li>{@link at.bestsolution.persistence.tasktracker.impl.PersonImpl#getRepository <em>Repository</em>}</li> * </ul> * </p> * * @generated */ public class PersonImpl extends BaseObjectImpl implements Person { /** * The default value of the '{@link #getFirstname() <em>Firstname</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getFirstname() * @generated * @ordered */ protected static final String FIRSTNAME_EDEFAULT = null; /** * The cached value of the '{@link #getFirstname() <em>Firstname</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getFirstname() * @generated * @ordered */ protected String firstname = FIRSTNAME_EDEFAULT; /** * The default value of the '{@link #getLastname() <em>Lastname</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getLastname() * @generated * @ordered */ protected static final String LASTNAME_EDEFAULT = null; /** * The cached value of the '{@link #getLastname() <em>Lastname</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getLastname() * @generated * @ordered */ protected String lastname = LASTNAME_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected PersonImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return TasktrackerPackage.Literals.PERSON; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getFirstname() { return firstname; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setFirstname(String newFirstname) { String oldFirstname = firstname; firstname = newFirstname; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, TasktrackerPackage.PERSON__FIRSTNAME, oldFirstname, firstname)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLastname() { return lastname; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setLastname(String newLastname) { String oldLastname = lastname; lastname = newLastname; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, TasktrackerPackage.PERSON__LASTNAME, oldLastname, lastname)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public TaskRepository getRepository() { if (eContainerFeatureID() != TasktrackerPackage.PERSON__REPOSITORY) return null; return (TaskRepository)eInternalContainer(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetRepository(TaskRepository newRepository, NotificationChain msgs) { msgs = eBasicSetContainer((InternalEObject)newRepository, TasktrackerPackage.PERSON__REPOSITORY, msgs); return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setRepository(TaskRepository newRepository) { if (newRepository != eInternalContainer() || (eContainerFeatureID() != TasktrackerPackage.PERSON__REPOSITORY && newRepository != null)) { if (EcoreUtil.isAncestor(this, newRepository)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); NotificationChain msgs = null; if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newRepository != null) msgs = ((InternalEObject)newRepository).eInverseAdd(this, TasktrackerPackage.TASK_REPOSITORY__PERSON_LIST, TaskRepository.class, msgs); msgs = basicSetRepository(newRepository, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, TasktrackerPackage.PERSON__REPOSITORY, newRepository, newRepository)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case TasktrackerPackage.PERSON__REPOSITORY: if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); return basicSetRepository((TaskRepository)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 TasktrackerPackage.PERSON__REPOSITORY: return basicSetRepository(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { switch (eContainerFeatureID()) { case TasktrackerPackage.PERSON__REPOSITORY: return eInternalContainer().eInverseRemove(this, TasktrackerPackage.TASK_REPOSITORY__PERSON_LIST, TaskRepository.class, msgs); } return super.eBasicRemoveFromContainerFeature(msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case TasktrackerPackage.PERSON__FIRSTNAME: return getFirstname(); case TasktrackerPackage.PERSON__LASTNAME: return getLastname(); case TasktrackerPackage.PERSON__REPOSITORY: return getRepository(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case TasktrackerPackage.PERSON__FIRSTNAME: setFirstname((String)newValue); return; case TasktrackerPackage.PERSON__LASTNAME: setLastname((String)newValue); return; case TasktrackerPackage.PERSON__REPOSITORY: setRepository((TaskRepository)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case TasktrackerPackage.PERSON__FIRSTNAME: setFirstname(FIRSTNAME_EDEFAULT); return; case TasktrackerPackage.PERSON__LASTNAME: setLastname(LASTNAME_EDEFAULT); return; case TasktrackerPackage.PERSON__REPOSITORY: setRepository((TaskRepository)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case TasktrackerPackage.PERSON__FIRSTNAME: return FIRSTNAME_EDEFAULT == null ? firstname != null : !FIRSTNAME_EDEFAULT.equals(firstname); case TasktrackerPackage.PERSON__LASTNAME: return LASTNAME_EDEFAULT == null ? lastname != null : !LASTNAME_EDEFAULT.equals(lastname); case TasktrackerPackage.PERSON__REPOSITORY: return getRepository() != 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(" (firstname: "); result.append(firstname); result.append(", lastname: "); result.append(lastname); result.append(')'); return result.toString(); } } //PersonImpl