/* 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.SVNCommentEntity;
import org.flowerplatform.web.entity.User;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>SVN Comment Entity</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.flowerplatform.web.entity.impl.SVNCommentEntityImpl#getBody <em>Body</em>}</li>
* <li>{@link org.flowerplatform.web.entity.impl.SVNCommentEntityImpl#getUser <em>User</em>}</li>
* <li>{@link org.flowerplatform.web.entity.impl.SVNCommentEntityImpl#getTimestamp <em>Timestamp</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class SVNCommentEntityImpl extends EntityImpl implements SVNCommentEntity {
/**
* The default value of the '{@link #getBody() <em>Body</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBody()
* @generated
* @ordered
*/
protected static final String BODY_EDEFAULT = null;
/**
* The cached value of the '{@link #getBody() <em>Body</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBody()
* @generated
* @ordered
*/
protected String body = BODY_EDEFAULT;
/**
* The cached value of the '{@link #getUser() <em>User</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUser()
* @generated
* @ordered
*/
protected User user;
/**
* The default value of the '{@link #getTimestamp() <em>Timestamp</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTimestamp()
* @generated
* @ordered
*/
protected static final long TIMESTAMP_EDEFAULT = 0L;
/**
* The cached value of the '{@link #getTimestamp() <em>Timestamp</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTimestamp()
* @generated
* @ordered
*/
protected long timestamp = TIMESTAMP_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected SVNCommentEntityImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return EntityPackage.Literals.SVN_COMMENT_ENTITY;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getBody() {
return body;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBody(String newBody) {
String oldBody = body;
body = newBody;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EntityPackage.SVN_COMMENT_ENTITY__BODY, oldBody, body));
}
/**
* <!-- 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.SVN_COMMENT_ENTITY__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.SVN_COMMENT_ENTITY__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__SVN_COMMENTS, User.class, msgs);
if (newUser != null)
msgs = ((InternalEObject)newUser).eInverseAdd(this, EntityPackage.USER__SVN_COMMENTS, User.class, msgs);
msgs = basicSetUser(newUser, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EntityPackage.SVN_COMMENT_ENTITY__USER, newUser, newUser));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public long getTimestamp() {
return timestamp;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTimestamp(long newTimestamp) {
long oldTimestamp = timestamp;
timestamp = newTimestamp;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EntityPackage.SVN_COMMENT_ENTITY__TIMESTAMP, oldTimestamp, timestamp));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case EntityPackage.SVN_COMMENT_ENTITY__USER:
if (user != null)
msgs = ((InternalEObject)user).eInverseRemove(this, EntityPackage.USER__SVN_COMMENTS, 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.SVN_COMMENT_ENTITY__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.SVN_COMMENT_ENTITY__BODY:
return getBody();
case EntityPackage.SVN_COMMENT_ENTITY__USER:
if (resolve) return getUser();
return basicGetUser();
case EntityPackage.SVN_COMMENT_ENTITY__TIMESTAMP:
return getTimestamp();
}
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.SVN_COMMENT_ENTITY__BODY:
setBody((String)newValue);
return;
case EntityPackage.SVN_COMMENT_ENTITY__USER:
setUser((User)newValue);
return;
case EntityPackage.SVN_COMMENT_ENTITY__TIMESTAMP:
setTimestamp((Long)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case EntityPackage.SVN_COMMENT_ENTITY__BODY:
setBody(BODY_EDEFAULT);
return;
case EntityPackage.SVN_COMMENT_ENTITY__USER:
setUser((User)null);
return;
case EntityPackage.SVN_COMMENT_ENTITY__TIMESTAMP:
setTimestamp(TIMESTAMP_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case EntityPackage.SVN_COMMENT_ENTITY__BODY:
return BODY_EDEFAULT == null ? body != null : !BODY_EDEFAULT.equals(body);
case EntityPackage.SVN_COMMENT_ENTITY__USER:
return user != null;
case EntityPackage.SVN_COMMENT_ENTITY__TIMESTAMP:
return timestamp != TIMESTAMP_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(" (body: ");
result.append(body);
result.append(", timestamp: ");
result.append(timestamp);
result.append(')');
return result.toString();
}
} //SVNCommentEntityImpl