/* * JBoss, Home of Professional Open Source. * * See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing. * * See the AUTHORS.txt file distributed with this work for a full listing of individual contributors. */ package org.teiid.datatools.models.teiidsqlmodel.impl; import org.eclipse.datatools.modelbase.sql.tables.impl.ViewTableImpl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.teiid.datatools.models.teiidsqlmodel.Document; import org.teiid.datatools.models.teiidsqlmodel.TeiidSchema; import org.teiid.datatools.models.teiidsqlmodel.TeiidsqlmodelPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Document</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.teiid.datatools.models.teiidsqlmodel.impl.DocumentImpl#getSchema <em>Schema</em>}</li> * </ul> * </p> * * @generated * * @since 8.0 */ public class DocumentImpl extends ViewTableImpl implements Document { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final String copyright = "Teiid Designer (http://www.jboss.org/projects/teiiddesigner.html) is copyright 2000-2010 MetaMatrix, Inc. and Red Hat, Inc. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which is available at http://www.eclipse.org/legal/epl-v10.html. Some portions may be licensed to Red Hat, Inc. under one or more contributor license agreements."; //$NON-NLS-1$ /** * The cached value of the '{@link #getSchema() <em>Schema</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getSchema() * @generated * @ordered */ protected TeiidSchema schema; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected DocumentImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return TeiidsqlmodelPackage.Literals.DOCUMENT; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public TeiidSchema getSchema() { if (schema != null && schema.eIsProxy()) { InternalEObject oldSchema = (InternalEObject)schema; schema = (TeiidSchema)eResolveProxy(oldSchema); if (schema != oldSchema) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, TeiidsqlmodelPackage.DOCUMENT__SCHEMA, oldSchema, schema)); } } return schema; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public TeiidSchema basicGetSchema() { return schema; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetSchema(TeiidSchema newSchema, NotificationChain msgs) { TeiidSchema oldSchema = schema; schema = newSchema; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TeiidsqlmodelPackage.DOCUMENT__SCHEMA, oldSchema, newSchema); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void setSchema(TeiidSchema newSchema) { if (newSchema != schema) { NotificationChain msgs = null; if (schema != null) msgs = ((InternalEObject)schema).eInverseRemove(this, TeiidsqlmodelPackage.TEIID_SCHEMA__DOCUMENTS, TeiidSchema.class, msgs); if (newSchema != null) msgs = ((InternalEObject)newSchema).eInverseAdd(this, TeiidsqlmodelPackage.TEIID_SCHEMA__DOCUMENTS, TeiidSchema.class, msgs); msgs = basicSetSchema(newSchema, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, TeiidsqlmodelPackage.DOCUMENT__SCHEMA, newSchema, newSchema)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case TeiidsqlmodelPackage.DOCUMENT__SCHEMA: if (schema != null) msgs = ((InternalEObject)schema).eInverseRemove(this, TeiidsqlmodelPackage.TEIID_SCHEMA__DOCUMENTS, TeiidSchema.class, msgs); return basicSetSchema((TeiidSchema)otherEnd, msgs); } return super.eInverseAdd(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case TeiidsqlmodelPackage.DOCUMENT__SCHEMA: return basicSetSchema(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case TeiidsqlmodelPackage.DOCUMENT__SCHEMA: if (resolve) return getSchema(); return basicGetSchema(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case TeiidsqlmodelPackage.DOCUMENT__SCHEMA: setSchema((TeiidSchema)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case TeiidsqlmodelPackage.DOCUMENT__SCHEMA: setSchema((TeiidSchema)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case TeiidsqlmodelPackage.DOCUMENT__SCHEMA: return schema != null; } return super.eIsSet(featureID); } } //DocumentImpl