/** */ package fr.inria.atlanmod.collaboro.history.impl; import fr.inria.atlanmod.collaboro.history.Collaboration; import fr.inria.atlanmod.collaboro.history.HistoryPackage; import fr.inria.atlanmod.collaboro.history.User; import fr.inria.atlanmod.collaboro.history.Vote; import java.util.Collection; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; 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.EObjectWithInverseResolvingEList; import org.eclipse.emf.ecore.util.InternalEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>User</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link fr.inria.atlanmod.collaboro.history.impl.UserImpl#getVotes <em>Votes</em>}</li> * <li>{@link fr.inria.atlanmod.collaboro.history.impl.UserImpl#getCollaborations <em>Collaborations</em>}</li> * <li>{@link fr.inria.atlanmod.collaboro.history.impl.UserImpl#getEmail <em>Email</em>}</li> * <li>{@link fr.inria.atlanmod.collaboro.history.impl.UserImpl#getPasword <em>Pasword</em>}</li> * <li>{@link fr.inria.atlanmod.collaboro.history.impl.UserImpl#getFirstName <em>First Name</em>}</li> * <li>{@link fr.inria.atlanmod.collaboro.history.impl.UserImpl#getLastName <em>Last Name</em>}</li> * </ul> * </p> * * @generated */ public class UserImpl extends IdElementImpl implements User { /** * The cached value of the '{@link #getVotes() <em>Votes</em>}' reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getVotes() * @generated * @ordered */ protected EList<Vote> votes; /** * The cached value of the '{@link #getCollaborations() <em>Collaborations</em>}' reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCollaborations() * @generated * @ordered */ protected EList<Collaboration> collaborations; /** * The default value of the '{@link #getEmail() <em>Email</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getEmail() * @generated * @ordered */ protected static final String EMAIL_EDEFAULT = null; /** * The cached value of the '{@link #getEmail() <em>Email</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getEmail() * @generated * @ordered */ protected String email = EMAIL_EDEFAULT; /** * The default value of the '{@link #getPasword() <em>Pasword</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getPasword() * @generated * @ordered */ protected static final String PASWORD_EDEFAULT = null; /** * The cached value of the '{@link #getPasword() <em>Pasword</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getPasword() * @generated * @ordered */ protected String pasword = PASWORD_EDEFAULT; /** * The default value of the '{@link #getFirstName() <em>First Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getFirstName() * @generated * @ordered */ protected static final String FIRST_NAME_EDEFAULT = null; /** * The cached value of the '{@link #getFirstName() <em>First Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getFirstName() * @generated * @ordered */ protected String firstName = FIRST_NAME_EDEFAULT; /** * The default value of the '{@link #getLastName() <em>Last Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getLastName() * @generated * @ordered */ protected static final String LAST_NAME_EDEFAULT = null; /** * The cached value of the '{@link #getLastName() <em>Last Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getLastName() * @generated * @ordered */ protected String lastName = LAST_NAME_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected UserImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return HistoryPackage.Literals.USER; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Vote> getVotes() { if (votes == null) { votes = new EObjectWithInverseResolvingEList<Vote>(Vote.class, this, HistoryPackage.USER__VOTES, HistoryPackage.VOTE__USER); } return votes; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Collaboration> getCollaborations() { if (collaborations == null) { collaborations = new EObjectWithInverseResolvingEList<Collaboration>(Collaboration.class, this, HistoryPackage.USER__COLLABORATIONS, HistoryPackage.COLLABORATION__PROPOSED_BY); } return collaborations; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getEmail() { return email; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setEmail(String newEmail) { String oldEmail = email; email = newEmail; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, HistoryPackage.USER__EMAIL, oldEmail, email)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getPasword() { return pasword; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setPasword(String newPasword) { String oldPasword = pasword; pasword = newPasword; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, HistoryPackage.USER__PASWORD, oldPasword, pasword)); } /** * <!-- 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, HistoryPackage.USER__FIRST_NAME, 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, HistoryPackage.USER__LAST_NAME, oldLastName, lastName)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case HistoryPackage.USER__VOTES: return ((InternalEList<InternalEObject>)(InternalEList<?>)getVotes()).basicAdd(otherEnd, msgs); case HistoryPackage.USER__COLLABORATIONS: return ((InternalEList<InternalEObject>)(InternalEList<?>)getCollaborations()).basicAdd(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 HistoryPackage.USER__VOTES: return ((InternalEList<?>)getVotes()).basicRemove(otherEnd, msgs); case HistoryPackage.USER__COLLABORATIONS: return ((InternalEList<?>)getCollaborations()).basicRemove(otherEnd, 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 HistoryPackage.USER__VOTES: return getVotes(); case HistoryPackage.USER__COLLABORATIONS: return getCollaborations(); case HistoryPackage.USER__EMAIL: return getEmail(); case HistoryPackage.USER__PASWORD: return getPasword(); case HistoryPackage.USER__FIRST_NAME: return getFirstName(); case HistoryPackage.USER__LAST_NAME: return getLastName(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case HistoryPackage.USER__VOTES: getVotes().clear(); getVotes().addAll((Collection<? extends Vote>)newValue); return; case HistoryPackage.USER__COLLABORATIONS: getCollaborations().clear(); getCollaborations().addAll((Collection<? extends Collaboration>)newValue); return; case HistoryPackage.USER__EMAIL: setEmail((String)newValue); return; case HistoryPackage.USER__PASWORD: setPasword((String)newValue); return; case HistoryPackage.USER__FIRST_NAME: setFirstName((String)newValue); return; case HistoryPackage.USER__LAST_NAME: setLastName((String)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case HistoryPackage.USER__VOTES: getVotes().clear(); return; case HistoryPackage.USER__COLLABORATIONS: getCollaborations().clear(); return; case HistoryPackage.USER__EMAIL: setEmail(EMAIL_EDEFAULT); return; case HistoryPackage.USER__PASWORD: setPasword(PASWORD_EDEFAULT); return; case HistoryPackage.USER__FIRST_NAME: setFirstName(FIRST_NAME_EDEFAULT); return; case HistoryPackage.USER__LAST_NAME: setLastName(LAST_NAME_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case HistoryPackage.USER__VOTES: return votes != null && !votes.isEmpty(); case HistoryPackage.USER__COLLABORATIONS: return collaborations != null && !collaborations.isEmpty(); case HistoryPackage.USER__EMAIL: return EMAIL_EDEFAULT == null ? email != null : !EMAIL_EDEFAULT.equals(email); case HistoryPackage.USER__PASWORD: return PASWORD_EDEFAULT == null ? pasword != null : !PASWORD_EDEFAULT.equals(pasword); case HistoryPackage.USER__FIRST_NAME: return FIRST_NAME_EDEFAULT == null ? firstName != null : !FIRST_NAME_EDEFAULT.equals(firstName); case HistoryPackage.USER__LAST_NAME: return LAST_NAME_EDEFAULT == null ? lastName != null : !LAST_NAME_EDEFAULT.equals(lastName); } 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(" (email: "); result.append(email); result.append(", pasword: "); result.append(pasword); result.append(", firstName: "); result.append(firstName); result.append(", lastName: "); result.append(lastName); result.append(')'); return result.toString(); } } //UserImpl