blob: f9101f9ce894719b12c1cc5fec7ec939e8077a29 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2009, 2019 Xored Software Inc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Xored Software Inc - initial API and implementation and/or initial documentation
*******************************************************************************/
package org.eclipse.rcptt.ecl.data.commands.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
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.EDataTypeUniqueEList;
import org.eclipse.rcptt.ecl.core.impl.CommandImpl;
import org.eclipse.rcptt.ecl.data.commands.CommandsPackage;
import org.eclipse.rcptt.ecl.data.commands.SelectColumns;
import org.eclipse.rcptt.ecl.data.objects.Table;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Select Columns</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.rcptt.ecl.data.commands.impl.SelectColumnsImpl#getTable <em>Table</em>}</li>
* <li>{@link org.eclipse.rcptt.ecl.data.commands.impl.SelectColumnsImpl#getColumns <em>Columns</em>}</li>
* </ul>
*
* @generated
*/
public class SelectColumnsImpl extends CommandImpl implements SelectColumns {
/**
* The cached value of the '{@link #getTable() <em>Table</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTable()
* @generated
* @ordered
*/
protected Table table;
/**
* The cached value of the '{@link #getColumns() <em>Columns</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getColumns()
* @generated
* @ordered
*/
protected EList<String> columns;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected SelectColumnsImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return CommandsPackage.Literals.SELECT_COLUMNS;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Table getTable() {
if (table != null && table.eIsProxy()) {
InternalEObject oldTable = (InternalEObject)table;
table = (Table)eResolveProxy(oldTable);
if (table != oldTable) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, CommandsPackage.SELECT_COLUMNS__TABLE, oldTable, table));
}
}
return table;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Table basicGetTable() {
return table;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTable(Table newTable) {
Table oldTable = table;
table = newTable;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CommandsPackage.SELECT_COLUMNS__TABLE, oldTable, table));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<String> getColumns() {
if (columns == null) {
columns = new EDataTypeUniqueEList<String>(String.class, this, CommandsPackage.SELECT_COLUMNS__COLUMNS);
}
return columns;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case CommandsPackage.SELECT_COLUMNS__TABLE:
if (resolve) return getTable();
return basicGetTable();
case CommandsPackage.SELECT_COLUMNS__COLUMNS:
return getColumns();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case CommandsPackage.SELECT_COLUMNS__TABLE:
setTable((Table)newValue);
return;
case CommandsPackage.SELECT_COLUMNS__COLUMNS:
getColumns().clear();
getColumns().addAll((Collection<? extends String>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case CommandsPackage.SELECT_COLUMNS__TABLE:
setTable((Table)null);
return;
case CommandsPackage.SELECT_COLUMNS__COLUMNS:
getColumns().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case CommandsPackage.SELECT_COLUMNS__TABLE:
return table != null;
case CommandsPackage.SELECT_COLUMNS__COLUMNS:
return columns != null && !columns.isEmpty();
}
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(" (columns: ");
result.append(columns);
result.append(')');
return result.toString();
}
} //SelectColumnsImpl