/*-
* ============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.openstack.compute.ComputePackage;
import org.openecomp.ncomp.openstack.compute.OpenstackRequestNewServer;
import org.openecomp.ncomp.openstack.core.VirtualMachineType;
import org.openecomp.ncomp.openstack.core.impl.OpenStackRequestImpl;
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.EDataTypeEList;
/**
*
* An implementation of the model object 'Openstack Request New Server'.
*
*
* The following features are implemented:
*
* - {@link org.openecomp.ncomp.openstack.compute.impl.OpenstackRequestNewServerImpl#getName Name}
* - {@link org.openecomp.ncomp.openstack.compute.impl.OpenstackRequestNewServerImpl#getHypervisor Hypervisor}
* - {@link org.openecomp.ncomp.openstack.compute.impl.OpenstackRequestNewServerImpl#getUser User}
* - {@link org.openecomp.ncomp.openstack.compute.impl.OpenstackRequestNewServerImpl#getNetworks Networks}
* - {@link org.openecomp.ncomp.openstack.compute.impl.OpenstackRequestNewServerImpl#getPorts Ports}
* - {@link org.openecomp.ncomp.openstack.compute.impl.OpenstackRequestNewServerImpl#getUser_data User data}
* - {@link org.openecomp.ncomp.openstack.compute.impl.OpenstackRequestNewServerImpl#getFloatingIp Floating Ip}
* - {@link org.openecomp.ncomp.openstack.compute.impl.OpenstackRequestNewServerImpl#getVmType Vm Type}
*
*
*
* @generated
*/
public class OpenstackRequestNewServerImpl extends OpenStackRequestImpl implements OpenstackRequestNewServer {
/**
* 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 #getHypervisor() Hypervisor}' attribute.
*
*
* @see #getHypervisor()
* @generated
* @ordered
*/
protected static final String HYPERVISOR_EDEFAULT = null;
/**
* The cached value of the '{@link #getHypervisor() Hypervisor}' attribute.
*
*
* @see #getHypervisor()
* @generated
* @ordered
*/
protected String hypervisor = HYPERVISOR_EDEFAULT;
/**
* The default value of the '{@link #getUser() User}' attribute.
*
*
* @see #getUser()
* @generated
* @ordered
*/
protected static final String USER_EDEFAULT = null;
/**
* The cached value of the '{@link #getUser() User}' attribute.
*
*
* @see #getUser()
* @generated
* @ordered
*/
protected String user = USER_EDEFAULT;
/**
* The cached value of the '{@link #getNetworks() Networks}' attribute list.
*
*
* @see #getNetworks()
* @generated
* @ordered
*/
protected EList networks;
/**
* The cached value of the '{@link #getPorts() Ports}' attribute list.
*
*
* @see #getPorts()
* @generated
* @ordered
*/
protected EList ports;
/**
* The default value of the '{@link #getUser_data() User data}' attribute.
*
*
* @see #getUser_data()
* @generated
* @ordered
*/
protected static final String USER_DATA_EDEFAULT = null;
/**
* The cached value of the '{@link #getUser_data() User data}' attribute.
*
*
* @see #getUser_data()
* @generated
* @ordered
*/
protected String user_data = USER_DATA_EDEFAULT;
/**
* The default value of the '{@link #getFloatingIp() Floating Ip}' attribute.
*
*
* @see #getFloatingIp()
* @generated
* @ordered
*/
protected static final String FLOATING_IP_EDEFAULT = null;
/**
* The cached value of the '{@link #getFloatingIp() Floating Ip}' attribute.
*
*
* @see #getFloatingIp()
* @generated
* @ordered
*/
protected String floatingIp = FLOATING_IP_EDEFAULT;
/**
* The cached value of the '{@link #getVmType() Vm Type}' containment reference.
*
*
* @see #getVmType()
* @generated
* @ordered
*/
protected VirtualMachineType vmType;
/**
*
*
* @generated
*/
protected OpenstackRequestNewServerImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return ComputePackage.Literals.OPENSTACK_REQUEST_NEW_SERVER;
}
/**
*
*
* @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, ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__NAME, oldName, name));
}
/**
*
*
* @generated
*/
public String getHypervisor() {
return hypervisor;
}
/**
*
*
* @generated
*/
public void setHypervisor(String newHypervisor) {
String oldHypervisor = hypervisor;
hypervisor = newHypervisor;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__HYPERVISOR, oldHypervisor, hypervisor));
}
/**
*
*
* @generated
*/
public String getUser() {
return user;
}
/**
*
*
* @generated
*/
public void setUser(String newUser) {
String oldUser = user;
user = newUser;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__USER, oldUser, user));
}
/**
*
*
* @generated
*/
public EList getNetworks() {
if (networks == null) {
networks = new EDataTypeEList(String.class, this, ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__NETWORKS);
}
return networks;
}
/**
*
*
* @generated
*/
public EList getPorts() {
if (ports == null) {
ports = new EDataTypeEList(String.class, this, ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__PORTS);
}
return ports;
}
/**
*
*
* @generated
*/
public String getUser_data() {
return user_data;
}
/**
*
*
* @generated
*/
public void setUser_data(String newUser_data) {
String oldUser_data = user_data;
user_data = newUser_data;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__USER_DATA, oldUser_data, user_data));
}
/**
*
*
* @generated
*/
public String getFloatingIp() {
return floatingIp;
}
/**
*
*
* @generated
*/
public void setFloatingIp(String newFloatingIp) {
String oldFloatingIp = floatingIp;
floatingIp = newFloatingIp;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__FLOATING_IP, oldFloatingIp, floatingIp));
}
/**
*
*
* @generated
*/
public VirtualMachineType getVmType() {
return vmType;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetVmType(VirtualMachineType newVmType, NotificationChain msgs) {
VirtualMachineType oldVmType = vmType;
vmType = newVmType;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__VM_TYPE, oldVmType, newVmType);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setVmType(VirtualMachineType newVmType) {
if (newVmType != vmType) {
NotificationChain msgs = null;
if (vmType != null)
msgs = ((InternalEObject)vmType).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__VM_TYPE, null, msgs);
if (newVmType != null)
msgs = ((InternalEObject)newVmType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__VM_TYPE, null, msgs);
msgs = basicSetVmType(newVmType, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__VM_TYPE, newVmType, newVmType));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__VM_TYPE:
return basicSetVmType(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__NAME:
return getName();
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__HYPERVISOR:
return getHypervisor();
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__USER:
return getUser();
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__NETWORKS:
return getNetworks();
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__PORTS:
return getPorts();
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__USER_DATA:
return getUser_data();
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__FLOATING_IP:
return getFloatingIp();
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__VM_TYPE:
return getVmType();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__NAME:
setName((String)newValue);
return;
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__HYPERVISOR:
setHypervisor((String)newValue);
return;
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__USER:
setUser((String)newValue);
return;
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__NETWORKS:
getNetworks().clear();
getNetworks().addAll((Collection extends String>)newValue);
return;
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__PORTS:
getPorts().clear();
getPorts().addAll((Collection extends String>)newValue);
return;
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__USER_DATA:
setUser_data((String)newValue);
return;
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__FLOATING_IP:
setFloatingIp((String)newValue);
return;
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__VM_TYPE:
setVmType((VirtualMachineType)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__NAME:
setName(NAME_EDEFAULT);
return;
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__HYPERVISOR:
setHypervisor(HYPERVISOR_EDEFAULT);
return;
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__USER:
setUser(USER_EDEFAULT);
return;
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__NETWORKS:
getNetworks().clear();
return;
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__PORTS:
getPorts().clear();
return;
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__USER_DATA:
setUser_data(USER_DATA_EDEFAULT);
return;
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__FLOATING_IP:
setFloatingIp(FLOATING_IP_EDEFAULT);
return;
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__VM_TYPE:
setVmType((VirtualMachineType)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__HYPERVISOR:
return HYPERVISOR_EDEFAULT == null ? hypervisor != null : !HYPERVISOR_EDEFAULT.equals(hypervisor);
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__USER:
return USER_EDEFAULT == null ? user != null : !USER_EDEFAULT.equals(user);
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__NETWORKS:
return networks != null && !networks.isEmpty();
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__PORTS:
return ports != null && !ports.isEmpty();
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__USER_DATA:
return USER_DATA_EDEFAULT == null ? user_data != null : !USER_DATA_EDEFAULT.equals(user_data);
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__FLOATING_IP:
return FLOATING_IP_EDEFAULT == null ? floatingIp != null : !FLOATING_IP_EDEFAULT.equals(floatingIp);
case ComputePackage.OPENSTACK_REQUEST_NEW_SERVER__VM_TYPE:
return vmType != null;
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (name: ");
result.append(name);
result.append(", hypervisor: ");
result.append(hypervisor);
result.append(", user: ");
result.append(user);
result.append(", networks: ");
result.append(networks);
result.append(", ports: ");
result.append(ports);
result.append(", user_data: ");
result.append(user_data);
result.append(", floatingIp: ");
result.append(floatingIp);
result.append(')');
return result.toString();
}
} //OpenstackRequestNewServerImpl