/**
* Copyright (c) 2011 Object Management Group (SAEM metamodel)
* Copyright (c) 2010-2011 United States Government as represented by the Administrator for The National Aeronautics and Space Administration. All Rights Reserved.
*/
package net.certware.evidence.evidence.impl;
import net.certware.evidence.evidence.EvidencePackage;
import net.certware.evidence.evidence.HasRoleIn;
import net.certware.evidence.evidence.Organization;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Has Role In</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link net.certware.evidence.evidence.impl.HasRoleInImpl#getRole <em>Role</em>}</li>
* <li>{@link net.certware.evidence.evidence.impl.HasRoleInImpl#getOrganization <em>Organization</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class HasRoleInImpl extends EvidencePropertyImpl implements HasRoleIn {
/**
* The default value of the '{@link #getRole() <em>Role</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRole()
* @generated
* @ordered
*/
protected static final String ROLE_EDEFAULT = null;
/**
* The cached value of the '{@link #getRole() <em>Role</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRole()
* @generated
* @ordered
*/
protected String role = ROLE_EDEFAULT;
/**
* The cached value of the '{@link #getOrganization() <em>Organization</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOrganization()
* @generated
* @ordered
*/
protected Organization organization;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected HasRoleInImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return EvidencePackage.Literals.HAS_ROLE_IN;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getRole() {
return role;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRole(String newRole) {
String oldRole = role;
role = newRole;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EvidencePackage.HAS_ROLE_IN__ROLE, oldRole, role));
}
/**
* <!-- 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, EvidencePackage.HAS_ROLE_IN__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 void setOrganization(Organization newOrganization) {
Organization oldOrganization = organization;
organization = newOrganization;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EvidencePackage.HAS_ROLE_IN__ORGANIZATION, oldOrganization, organization));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case EvidencePackage.HAS_ROLE_IN__ROLE:
return getRole();
case EvidencePackage.HAS_ROLE_IN__ORGANIZATION:
if (resolve) return getOrganization();
return basicGetOrganization();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case EvidencePackage.HAS_ROLE_IN__ROLE:
setRole((String)newValue);
return;
case EvidencePackage.HAS_ROLE_IN__ORGANIZATION:
setOrganization((Organization)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case EvidencePackage.HAS_ROLE_IN__ROLE:
setRole(ROLE_EDEFAULT);
return;
case EvidencePackage.HAS_ROLE_IN__ORGANIZATION:
setOrganization((Organization)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case EvidencePackage.HAS_ROLE_IN__ROLE:
return ROLE_EDEFAULT == null ? role != null : !ROLE_EDEFAULT.equals(role);
case EvidencePackage.HAS_ROLE_IN__ORGANIZATION:
return organization != null;
}
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(" (role: "); //$NON-NLS-1$
result.append(role);
result.append(')');
return result.toString();
}
} //HasRoleInImpl