blob: 08a32e6b9a5d9d824ef9fa0f1b59f8e0ed9b716c [file] [log] [blame]
/*******************************************************************************
* Copyright 2011 Chair for Applied Software Engineering,
* Technische Universitaet Muenchen.
* All rights reserved. This program and the accompanying materials
* are made available under 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.client.test.model.organization.impl;
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;
import org.eclipse.emf.emfstore.client.test.model.organization.OrganizationPackage;
import org.eclipse.emf.emfstore.client.test.model.organization.User;
import org.eclipse.emf.emfstore.client.test.model.task.TaskPackage;
import org.eclipse.emf.emfstore.client.test.model.task.WorkItem;
/**
* <!-- 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 org.eclipse.emf.emfstore.client.test.model.organization.impl.UserImpl#getEmail <em>Email</em>}</li>
* <li>{@link org.eclipse.emf.emfstore.client.test.model.organization.impl.UserImpl#getFirstName <em>First Name</em>}</li>
* <li>{@link org.eclipse.emf.emfstore.client.test.model.organization.impl.UserImpl#getLastName <em>Last Name</em>}</li>
* <li>{@link org.eclipse.emf.emfstore.client.test.model.organization.impl.UserImpl#getWorkItemsToReview <em>Work Items
* To Review</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class UserImpl extends OrgUnitImpl implements User {
/**
* 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 #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;
/**
* The cached value of the '{@link #getWorkItemsToReview() <em>Work Items To Review</em>}' reference list. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @see #getWorkItemsToReview()
* @generated
* @ordered
*/
protected EList<WorkItem> workItemsToReview;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected UserImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return OrganizationPackage.Literals.USER;
}
/**
* <!-- 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, OrganizationPackage.USER__EMAIL, oldEmail, email));
}
/**
* <!-- 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, OrganizationPackage.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, OrganizationPackage.USER__LAST_NAME, oldLastName,
lastName));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EList<WorkItem> getWorkItemsToReview() {
if (workItemsToReview == null) {
workItemsToReview = new EObjectWithInverseResolvingEList<WorkItem>(WorkItem.class, this,
OrganizationPackage.USER__WORK_ITEMS_TO_REVIEW, TaskPackage.WORK_ITEM__REVIEWER);
}
return workItemsToReview;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case OrganizationPackage.USER__WORK_ITEMS_TO_REVIEW:
return ((InternalEList<InternalEObject>) (InternalEList<?>) getWorkItemsToReview())
.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 OrganizationPackage.USER__WORK_ITEMS_TO_REVIEW:
return ((InternalEList<?>) getWorkItemsToReview()).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 OrganizationPackage.USER__EMAIL:
return getEmail();
case OrganizationPackage.USER__FIRST_NAME:
return getFirstName();
case OrganizationPackage.USER__LAST_NAME:
return getLastName();
case OrganizationPackage.USER__WORK_ITEMS_TO_REVIEW:
return getWorkItemsToReview();
}
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 OrganizationPackage.USER__EMAIL:
setEmail((String) newValue);
return;
case OrganizationPackage.USER__FIRST_NAME:
setFirstName((String) newValue);
return;
case OrganizationPackage.USER__LAST_NAME:
setLastName((String) newValue);
return;
case OrganizationPackage.USER__WORK_ITEMS_TO_REVIEW:
getWorkItemsToReview().clear();
getWorkItemsToReview().addAll((Collection<? extends WorkItem>) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case OrganizationPackage.USER__EMAIL:
setEmail(EMAIL_EDEFAULT);
return;
case OrganizationPackage.USER__FIRST_NAME:
setFirstName(FIRST_NAME_EDEFAULT);
return;
case OrganizationPackage.USER__LAST_NAME:
setLastName(LAST_NAME_EDEFAULT);
return;
case OrganizationPackage.USER__WORK_ITEMS_TO_REVIEW:
getWorkItemsToReview().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case OrganizationPackage.USER__EMAIL:
return EMAIL_EDEFAULT == null ? email != null : !EMAIL_EDEFAULT.equals(email);
case OrganizationPackage.USER__FIRST_NAME:
return FIRST_NAME_EDEFAULT == null ? firstName != null : !FIRST_NAME_EDEFAULT.equals(firstName);
case OrganizationPackage.USER__LAST_NAME:
return LAST_NAME_EDEFAULT == null ? lastName != null : !LAST_NAME_EDEFAULT.equals(lastName);
case OrganizationPackage.USER__WORK_ITEMS_TO_REVIEW:
return workItemsToReview != null && !workItemsToReview.isEmpty();
}
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(", firstName: ");
result.append(firstName);
result.append(", lastName: ");
result.append(lastName);
result.append(')');
return result.toString();
}
} // UserImpl