/*-
* ============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.compute.impl;
import org.openecomp.ncomp.core.impl.NamedEntityImpl;
import org.openecomp.ncomp.openstack.compute.ComputePackage;
import org.openecomp.ncomp.openstack.compute.SecurityGroup;
import org.openecomp.ncomp.openstack.compute.SecurityRule;
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.compute.impl.SecurityGroupImpl#getRules Rules}
* - {@link org.openecomp.ncomp.openstack.compute.impl.SecurityGroupImpl#getTenant_id Tenant id}
* - {@link org.openecomp.ncomp.openstack.compute.impl.SecurityGroupImpl#getId Id}
* - {@link org.openecomp.ncomp.openstack.compute.impl.SecurityGroupImpl#getDescription Description}
*
*
* @generated
*/
public class SecurityGroupImpl extends NamedEntityImpl implements SecurityGroup {
/**
* The cached value of the '{@link #getRules() Rules}' containment reference list.
*
*
* @see #getRules()
* @generated
* @ordered
*/
protected EList 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;
/**
* 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 #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;
/**
*
*
* @generated
*/
protected SecurityGroupImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return ComputePackage.Literals.SECURITY_GROUP;
}
/**
*
*
* @generated
*/
public EList getRules() {
if (rules == null) {
rules = new EObjectContainmentEList(SecurityRule.class, this, ComputePackage.SECURITY_GROUP__RULES);
}
return 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, ComputePackage.SECURITY_GROUP__TENANT_ID, oldTenant_id, tenant_id));
}
/**
*
*
* @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, ComputePackage.SECURITY_GROUP__ID, oldId, id));
}
/**
*
*
* @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, ComputePackage.SECURITY_GROUP__DESCRIPTION, oldDescription, description));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ComputePackage.SECURITY_GROUP__RULES:
return ((InternalEList>)getRules()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ComputePackage.SECURITY_GROUP__RULES:
return getRules();
case ComputePackage.SECURITY_GROUP__TENANT_ID:
return getTenant_id();
case ComputePackage.SECURITY_GROUP__ID:
return getId();
case ComputePackage.SECURITY_GROUP__DESCRIPTION:
return getDescription();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ComputePackage.SECURITY_GROUP__RULES:
getRules().clear();
getRules().addAll((Collection extends SecurityRule>)newValue);
return;
case ComputePackage.SECURITY_GROUP__TENANT_ID:
setTenant_id((String)newValue);
return;
case ComputePackage.SECURITY_GROUP__ID:
setId((String)newValue);
return;
case ComputePackage.SECURITY_GROUP__DESCRIPTION:
setDescription((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ComputePackage.SECURITY_GROUP__RULES:
getRules().clear();
return;
case ComputePackage.SECURITY_GROUP__TENANT_ID:
setTenant_id(TENANT_ID_EDEFAULT);
return;
case ComputePackage.SECURITY_GROUP__ID:
setId(ID_EDEFAULT);
return;
case ComputePackage.SECURITY_GROUP__DESCRIPTION:
setDescription(DESCRIPTION_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ComputePackage.SECURITY_GROUP__RULES:
return rules != null && !rules.isEmpty();
case ComputePackage.SECURITY_GROUP__TENANT_ID:
return TENANT_ID_EDEFAULT == null ? tenant_id != null : !TENANT_ID_EDEFAULT.equals(tenant_id);
case ComputePackage.SECURITY_GROUP__ID:
return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
case ComputePackage.SECURITY_GROUP__DESCRIPTION:
return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (tenant_id: ");
result.append(tenant_id);
result.append(", id: ");
result.append(id);
result.append(", description: ");
result.append(description);
result.append(')');
return result.toString();
}
} //SecurityGroupImpl