/* 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.Organization;
import org.flowerplatform.web.entity.WorkingDirectory;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Working Directory</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.flowerplatform.web.entity.impl.WorkingDirectoryImpl#getOrganization <em>Organization</em>}</li>
* <li>{@link org.flowerplatform.web.entity.impl.WorkingDirectoryImpl#getPathFromOrganization <em>Path From Organization</em>}</li>
* <li>{@link org.flowerplatform.web.entity.impl.WorkingDirectoryImpl#getColor <em>Color</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class WorkingDirectoryImpl extends EntityImpl implements WorkingDirectory {
/**
* The cached value of the '{@link #getOrganization() <em>Organization</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOrganization()
* @generated
* @ordered
*/
protected Organization organization;
/**
* The default value of the '{@link #getPathFromOrganization() <em>Path From Organization</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPathFromOrganization()
* @generated
* @ordered
*/
protected static final String PATH_FROM_ORGANIZATION_EDEFAULT = null;
/**
* The cached value of the '{@link #getPathFromOrganization() <em>Path From Organization</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPathFromOrganization()
* @generated
* @ordered
*/
protected String pathFromOrganization = PATH_FROM_ORGANIZATION_EDEFAULT;
/**
* The default value of the '{@link #getColor() <em>Color</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getColor()
* @generated
* @ordered
*/
protected static final int COLOR_EDEFAULT = 0;
/**
* The cached value of the '{@link #getColor() <em>Color</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getColor()
* @generated
* @ordered
*/
protected int color = COLOR_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected WorkingDirectoryImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return EntityPackage.Literals.WORKING_DIRECTORY;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Organization getOrganization() {
if (organization != null && organization.eIsProxy()) {
InternalEObject oldOrganization = (InternalEObject)organization;
organization = (Organization)eResolveProxy(oldOrganization);
if (organization != oldOrganization) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, EntityPackage.WORKING_DIRECTORY__ORGANIZATION, oldOrganization, organization));
}
}
return organization;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Organization basicGetOrganization() {
return organization;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetOrganization(Organization newOrganization, NotificationChain msgs) {
Organization oldOrganization = organization;
organization = newOrganization;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EntityPackage.WORKING_DIRECTORY__ORGANIZATION, oldOrganization, newOrganization);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOrganization(Organization newOrganization) {
if (newOrganization != organization) {
NotificationChain msgs = null;
if (organization != null)
msgs = ((InternalEObject)organization).eInverseRemove(this, EntityPackage.ORGANIZATION__WORKING_DIRECTORIES, Organization.class, msgs);
if (newOrganization != null)
msgs = ((InternalEObject)newOrganization).eInverseAdd(this, EntityPackage.ORGANIZATION__WORKING_DIRECTORIES, Organization.class, msgs);
msgs = basicSetOrganization(newOrganization, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EntityPackage.WORKING_DIRECTORY__ORGANIZATION, newOrganization, newOrganization));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getPathFromOrganization() {
return pathFromOrganization;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPathFromOrganization(String newPathFromOrganization) {
String oldPathFromOrganization = pathFromOrganization;
pathFromOrganization = newPathFromOrganization;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EntityPackage.WORKING_DIRECTORY__PATH_FROM_ORGANIZATION, oldPathFromOrganization, pathFromOrganization));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getColor() {
return color;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setColor(int newColor) {
int oldColor = color;
color = newColor;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EntityPackage.WORKING_DIRECTORY__COLOR, oldColor, color));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case EntityPackage.WORKING_DIRECTORY__ORGANIZATION:
if (organization != null)
msgs = ((InternalEObject)organization).eInverseRemove(this, EntityPackage.ORGANIZATION__WORKING_DIRECTORIES, Organization.class, msgs);
return basicSetOrganization((Organization)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.WORKING_DIRECTORY__ORGANIZATION:
return basicSetOrganization(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.WORKING_DIRECTORY__ORGANIZATION:
if (resolve) return getOrganization();
return basicGetOrganization();
case EntityPackage.WORKING_DIRECTORY__PATH_FROM_ORGANIZATION:
return getPathFromOrganization();
case EntityPackage.WORKING_DIRECTORY__COLOR:
return getColor();
}
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.WORKING_DIRECTORY__ORGANIZATION:
setOrganization((Organization)newValue);
return;
case EntityPackage.WORKING_DIRECTORY__PATH_FROM_ORGANIZATION:
setPathFromOrganization((String)newValue);
return;
case EntityPackage.WORKING_DIRECTORY__COLOR:
setColor((Integer)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case EntityPackage.WORKING_DIRECTORY__ORGANIZATION:
setOrganization((Organization)null);
return;
case EntityPackage.WORKING_DIRECTORY__PATH_FROM_ORGANIZATION:
setPathFromOrganization(PATH_FROM_ORGANIZATION_EDEFAULT);
return;
case EntityPackage.WORKING_DIRECTORY__COLOR:
setColor(COLOR_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case EntityPackage.WORKING_DIRECTORY__ORGANIZATION:
return organization != null;
case EntityPackage.WORKING_DIRECTORY__PATH_FROM_ORGANIZATION:
return PATH_FROM_ORGANIZATION_EDEFAULT == null ? pathFromOrganization != null : !PATH_FROM_ORGANIZATION_EDEFAULT.equals(pathFromOrganization);
case EntityPackage.WORKING_DIRECTORY__COLOR:
return color != COLOR_EDEFAULT;
}
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(" (pathFromOrganization: ");
result.append(pathFromOrganization);
result.append(", color: ");
result.append(color);
result.append(')');
return result.toString();
}
} //WorkingDirectoryImpl