/* license-start
*
* Copyright (C) 2008 - 2013 Crispico, <http://www.crispico.com/>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details, at <http://www.gnu.org/licenses/>.
*
* Contributors:
* Crispico - Initial API and implementation
*
* license-end
*/
/**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.flowerplatform.web.entity.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.flowerplatform.web.entity.EntityPackage;
import org.flowerplatform.web.entity.Group;
import org.flowerplatform.web.entity.GroupUser;
import org.flowerplatform.web.entity.User;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Group User</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.flowerplatform.web.entity.impl.GroupUserImpl#getGroup <em>Group</em>}</li>
* <li>{@link org.flowerplatform.web.entity.impl.GroupUserImpl#getUser <em>User</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class GroupUserImpl extends EntityImpl implements GroupUser {
/**
* The cached value of the '{@link #getGroup() <em>Group</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getGroup()
* @generated
* @ordered
*/
protected Group group;
/**
* The cached value of the '{@link #getUser() <em>User</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUser()
* @generated
* @ordered
*/
protected User user;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected GroupUserImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return EntityPackage.Literals.GROUP_USER;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Group getGroup() {
if (group != null && group.eIsProxy()) {
InternalEObject oldGroup = (InternalEObject)group;
group = (Group)eResolveProxy(oldGroup);
if (group != oldGroup) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, EntityPackage.GROUP_USER__GROUP, oldGroup, group));
}
}
return group;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Group basicGetGroup() {
return group;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetGroup(Group newGroup, NotificationChain msgs) {
Group oldGroup = group;
group = newGroup;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EntityPackage.GROUP_USER__GROUP, oldGroup, newGroup);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setGroup(Group newGroup) {
if (newGroup != group) {
NotificationChain msgs = null;
if (group != null)
msgs = ((InternalEObject)group).eInverseRemove(this, EntityPackage.GROUP__GROUP_USERS, Group.class, msgs);
if (newGroup != null)
msgs = ((InternalEObject)newGroup).eInverseAdd(this, EntityPackage.GROUP__GROUP_USERS, Group.class, msgs);
msgs = basicSetGroup(newGroup, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EntityPackage.GROUP_USER__GROUP, newGroup, newGroup));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public User getUser() {
if (user != null && user.eIsProxy()) {
InternalEObject oldUser = (InternalEObject)user;
user = (User)eResolveProxy(oldUser);
if (user != oldUser) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, EntityPackage.GROUP_USER__USER, oldUser, user));
}
}
return user;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public User basicGetUser() {
return user;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetUser(User newUser, NotificationChain msgs) {
User oldUser = user;
user = newUser;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EntityPackage.GROUP_USER__USER, oldUser, newUser);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setUser(User newUser) {
if (newUser != user) {
NotificationChain msgs = null;
if (user != null)
msgs = ((InternalEObject)user).eInverseRemove(this, EntityPackage.USER__GROUP_USERS, User.class, msgs);
if (newUser != null)
msgs = ((InternalEObject)newUser).eInverseAdd(this, EntityPackage.USER__GROUP_USERS, User.class, msgs);
msgs = basicSetUser(newUser, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EntityPackage.GROUP_USER__USER, newUser, newUser));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case EntityPackage.GROUP_USER__GROUP:
if (group != null)
msgs = ((InternalEObject)group).eInverseRemove(this, EntityPackage.GROUP__GROUP_USERS, Group.class, msgs);
return basicSetGroup((Group)otherEnd, msgs);
case EntityPackage.GROUP_USER__USER:
if (user != null)
msgs = ((InternalEObject)user).eInverseRemove(this, EntityPackage.USER__GROUP_USERS, User.class, msgs);
return basicSetUser((User)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 EntityPackage.GROUP_USER__GROUP:
return basicSetGroup(null, msgs);
case EntityPackage.GROUP_USER__USER:
return basicSetUser(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 EntityPackage.GROUP_USER__GROUP:
if (resolve) return getGroup();
return basicGetGroup();
case EntityPackage.GROUP_USER__USER:
if (resolve) return getUser();
return basicGetUser();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case EntityPackage.GROUP_USER__GROUP:
setGroup((Group)newValue);
return;
case EntityPackage.GROUP_USER__USER:
setUser((User)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case EntityPackage.GROUP_USER__GROUP:
setGroup((Group)null);
return;
case EntityPackage.GROUP_USER__USER:
setUser((User)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case EntityPackage.GROUP_USER__GROUP:
return group != null;
case EntityPackage.GROUP_USER__USER:
return user != null;
}
return super.eIsSet(featureID);
}
} //GroupUserImpl