/*-
* ============LICENSE_START==========================================
* OPENECOMP - DCAE
* ===================================================================
* Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
* ===================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END============================================
*/
/**
*/
package org.openecomp.ncomp.openstack.neutron.impl;
import org.openecomp.ncomp.openstack.neutron.NeutronPackage;
import org.openecomp.ncomp.openstack.neutron.NeutronSecurityGroup;
import org.openecomp.ncomp.openstack.neutron.NeutronSecurityRule;
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.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
*
* An implementation of the model object 'Security Group'.
*
*
* The following features are implemented:
*
* - {@link org.openecomp.ncomp.openstack.neutron.impl.NeutronSecurityGroupImpl#getId Id}
* - {@link org.openecomp.ncomp.openstack.neutron.impl.NeutronSecurityGroupImpl#getName Name}
* - {@link org.openecomp.ncomp.openstack.neutron.impl.NeutronSecurityGroupImpl#getDescription Description}
* - {@link org.openecomp.ncomp.openstack.neutron.impl.NeutronSecurityGroupImpl#getSecurity_group_rules Security group rules}
* - {@link org.openecomp.ncomp.openstack.neutron.impl.NeutronSecurityGroupImpl#getTenant_id Tenant id}
*
*
*
* @generated
*/
public class NeutronSecurityGroupImpl extends NeutronObjectImpl implements NeutronSecurityGroup {
/**
* The default value of the '{@link #getId() Id}' attribute.
*
*
* @see #getId()
* @generated
* @ordered
*/
protected static final String ID_EDEFAULT = null;
/**
* The cached value of the '{@link #getId() Id}' attribute.
*
*
* @see #getId()
* @generated
* @ordered
*/
protected String id = ID_EDEFAULT;
/**
* The default value of the '{@link #getName() Name}' attribute.
*
*
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() Name}' attribute.
*
*
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The default value of the '{@link #getDescription() Description}' attribute.
*
*
* @see #getDescription()
* @generated
* @ordered
*/
protected static final String DESCRIPTION_EDEFAULT = null;
/**
* The cached value of the '{@link #getDescription() Description}' attribute.
*
*
* @see #getDescription()
* @generated
* @ordered
*/
protected String description = DESCRIPTION_EDEFAULT;
/**
* The cached value of the '{@link #getSecurity_group_rules() Security group rules}' containment reference list.
*
*
* @see #getSecurity_group_rules()
* @generated
* @ordered
*/
protected EList security_group_rules;
/**
* The default value of the '{@link #getTenant_id() Tenant id}' attribute.
*
*
* @see #getTenant_id()
* @generated
* @ordered
*/
protected static final String TENANT_ID_EDEFAULT = null;
/**
* The cached value of the '{@link #getTenant_id() Tenant id}' attribute.
*
*
* @see #getTenant_id()
* @generated
* @ordered
*/
protected String tenant_id = TENANT_ID_EDEFAULT;
/**
*
*
* @generated
*/
protected NeutronSecurityGroupImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return NeutronPackage.Literals.NEUTRON_SECURITY_GROUP;
}
/**
*
*
* @generated
*/
public String getId() {
return id;
}
/**
*
*
* @generated
*/
public void setId(String newId) {
String oldId = id;
id = newId;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, NeutronPackage.NEUTRON_SECURITY_GROUP__ID, oldId, id));
}
/**
*
*
* @generated
*/
public String getName() {
return name;
}
/**
*
*
* @generated
*/
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, NeutronPackage.NEUTRON_SECURITY_GROUP__NAME, oldName, name));
}
/**
*
*
* @generated
*/
public String getDescription() {
return description;
}
/**
*
*
* @generated
*/
public void setDescription(String newDescription) {
String oldDescription = description;
description = newDescription;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, NeutronPackage.NEUTRON_SECURITY_GROUP__DESCRIPTION, oldDescription, description));
}
/**
*
*
* @generated
*/
public EList getSecurity_group_rules() {
if (security_group_rules == null) {
security_group_rules = new EObjectContainmentEList(NeutronSecurityRule.class, this, NeutronPackage.NEUTRON_SECURITY_GROUP__SECURITY_GROUP_RULES);
}
return security_group_rules;
}
/**
*
*
* @generated
*/
public String getTenant_id() {
return tenant_id;
}
/**
*
*
* @generated
*/
public void setTenant_id(String newTenant_id) {
String oldTenant_id = tenant_id;
tenant_id = newTenant_id;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, NeutronPackage.NEUTRON_SECURITY_GROUP__TENANT_ID, oldTenant_id, tenant_id));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case NeutronPackage.NEUTRON_SECURITY_GROUP__SECURITY_GROUP_RULES:
return ((InternalEList>)getSecurity_group_rules()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case NeutronPackage.NEUTRON_SECURITY_GROUP__ID:
return getId();
case NeutronPackage.NEUTRON_SECURITY_GROUP__NAME:
return getName();
case NeutronPackage.NEUTRON_SECURITY_GROUP__DESCRIPTION:
return getDescription();
case NeutronPackage.NEUTRON_SECURITY_GROUP__SECURITY_GROUP_RULES:
return getSecurity_group_rules();
case NeutronPackage.NEUTRON_SECURITY_GROUP__TENANT_ID:
return getTenant_id();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case NeutronPackage.NEUTRON_SECURITY_GROUP__ID:
setId((String)newValue);
return;
case NeutronPackage.NEUTRON_SECURITY_GROUP__NAME:
setName((String)newValue);
return;
case NeutronPackage.NEUTRON_SECURITY_GROUP__DESCRIPTION:
setDescription((String)newValue);
return;
case NeutronPackage.NEUTRON_SECURITY_GROUP__SECURITY_GROUP_RULES:
getSecurity_group_rules().clear();
getSecurity_group_rules().addAll((Collection extends NeutronSecurityRule>)newValue);
return;
case NeutronPackage.NEUTRON_SECURITY_GROUP__TENANT_ID:
setTenant_id((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case NeutronPackage.NEUTRON_SECURITY_GROUP__ID:
setId(ID_EDEFAULT);
return;
case NeutronPackage.NEUTRON_SECURITY_GROUP__NAME:
setName(NAME_EDEFAULT);
return;
case NeutronPackage.NEUTRON_SECURITY_GROUP__DESCRIPTION:
setDescription(DESCRIPTION_EDEFAULT);
return;
case NeutronPackage.NEUTRON_SECURITY_GROUP__SECURITY_GROUP_RULES:
getSecurity_group_rules().clear();
return;
case NeutronPackage.NEUTRON_SECURITY_GROUP__TENANT_ID:
setTenant_id(TENANT_ID_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case NeutronPackage.NEUTRON_SECURITY_GROUP__ID:
return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
case NeutronPackage.NEUTRON_SECURITY_GROUP__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case NeutronPackage.NEUTRON_SECURITY_GROUP__DESCRIPTION:
return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
case NeutronPackage.NEUTRON_SECURITY_GROUP__SECURITY_GROUP_RULES:
return security_group_rules != null && !security_group_rules.isEmpty();
case NeutronPackage.NEUTRON_SECURITY_GROUP__TENANT_ID:
return TENANT_ID_EDEFAULT == null ? tenant_id != null : !TENANT_ID_EDEFAULT.equals(tenant_id);
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (id: ");
result.append(id);
result.append(", name: ");
result.append(name);
result.append(", description: ");
result.append(description);
result.append(", tenant_id: ");
result.append(tenant_id);
result.append(')');
return result.toString();
}
} //NeutronSecurityGroupImpl