blob: a726ef14857b042bdb6fbba7cfdd32db1ad15a17 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2001, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jst.j2ee.jca.internal.impl;
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.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.jst.j2ee.common.Description;
import org.eclipse.jst.j2ee.jca.JcaPackage;
import org.eclipse.jst.j2ee.jca.License;
/**
* Specifies licensing requirements for the resource adapter module. Specifies whether a license is required to deploy and use this resource adapter, and an optional description of the licensing terms (examples: duration of license, number of connection restrictions).
*/
public class LicenseImpl extends EObjectImpl implements License, EObject{
/**
* The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescription()
* @generated
* @ordered
*/
protected static final String DESCRIPTION_EDEFAULT = null;
/**
* @generated This field/method will be replaced during code generation.
*/
/**
* @generated This field/method will be replaced during code generation.
*/
protected String description = DESCRIPTION_EDEFAULT;
/**
* The default value of the '{@link #isRequired() <em>Required</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isRequired()
* @generated
* @ordered
*/
protected static final boolean REQUIRED_EDEFAULT = false;
/**
* @generated This field/method will be replaced during code generation.
*/
protected boolean required = REQUIRED_EDEFAULT;
/**
* This is true if the Required attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean requiredESet = false;
/**
* The cached value of the '{@link #getDescriptions() <em>Descriptions</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescriptions()
* @generated
* @ordered
*/
protected EList descriptions = null;
protected LicenseImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return JcaPackage.eINSTANCE.getLicense();
}
/**
* @generated This field/method will be replaced during code generation
*/
public String getDescription() {
return description;
}
/**
* @generated This field/method will be replaced during code generation.
*/
public void setDescription(String newDescription) {
String oldDescription = description;
description = newDescription;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, JcaPackage.LICENSE__DESCRIPTION, oldDescription, description));
}
/**
* @generated This field/method will be replaced during code generation
*/
public boolean isRequired() {
return required;
}
/**
* @generated This field/method will be replaced during code generation.
*/
public void setRequired(boolean newRequired) {
boolean oldRequired = required;
required = newRequired;
boolean oldRequiredESet = requiredESet;
requiredESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, JcaPackage.LICENSE__REQUIRED, oldRequired, required, !oldRequiredESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unsetRequired() {
boolean oldRequired = required;
boolean oldRequiredESet = requiredESet;
required = REQUIRED_EDEFAULT;
requiredESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, JcaPackage.LICENSE__REQUIRED, oldRequired, REQUIRED_EDEFAULT, oldRequiredESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetRequired() {
return requiredESet;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList getDescriptions() {
if (descriptions == null) {
descriptions = new EObjectContainmentEList(Description.class, this, JcaPackage.LICENSE__DESCRIPTIONS);
}
return descriptions;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) {
if (featureID >= 0) {
switch (eDerivedStructuralFeatureID(featureID, baseClass)) {
case JcaPackage.LICENSE__DESCRIPTIONS:
return ((InternalEList)getDescriptions()).basicRemove(otherEnd, msgs);
default:
return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs);
}
}
return eBasicSetContainer(null, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(EStructuralFeature eFeature, boolean resolve) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case JcaPackage.LICENSE__DESCRIPTION:
return getDescription();
case JcaPackage.LICENSE__REQUIRED:
return isRequired() ? Boolean.TRUE : Boolean.FALSE;
case JcaPackage.LICENSE__DESCRIPTIONS:
return getDescriptions();
}
return eDynamicGet(eFeature, resolve);
}
/**
* @generated This field/method will be replaced during code generation.
*/
public boolean eIsSet(EStructuralFeature eFeature) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case JcaPackage.LICENSE__DESCRIPTION:
return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
case JcaPackage.LICENSE__REQUIRED:
return isSetRequired();
case JcaPackage.LICENSE__DESCRIPTIONS:
return descriptions != null && !descriptions.isEmpty();
}
return eDynamicIsSet(eFeature);
}
/**
* @generated This field/method will be replaced during code generation.
*/
public void eSet(EStructuralFeature eFeature, Object newValue) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case JcaPackage.LICENSE__DESCRIPTION:
setDescription((String)newValue);
return;
case JcaPackage.LICENSE__REQUIRED:
setRequired(((Boolean)newValue).booleanValue());
return;
case JcaPackage.LICENSE__DESCRIPTIONS:
getDescriptions().clear();
getDescriptions().addAll((Collection)newValue);
return;
}
eDynamicSet(eFeature, newValue);
}
/**
* @generated This field/method will be replaced during code generation.
*/
public void eUnset(EStructuralFeature eFeature) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case JcaPackage.LICENSE__DESCRIPTION:
setDescription(DESCRIPTION_EDEFAULT);
return;
case JcaPackage.LICENSE__REQUIRED:
unsetRequired();
return;
case JcaPackage.LICENSE__DESCRIPTIONS:
getDescriptions().clear();
return;
}
eDynamicUnset(eFeature);
}
/**
* @generated This field/method will be replaced during code generation.
*/
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (description: ");
result.append(description);
result.append(", required: ");
if (requiredESet) result.append(required); else result.append("<unset>");
result.append(')');
return result.toString();
}
}