blob: 238dba3eec0537ad5accf06964bdb976720f80b9 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2001, 2006 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.ejb.internal.impl;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
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;
import org.eclipse.jst.j2ee.common.Description;
import org.eclipse.jst.j2ee.common.internal.impl.J2EEEObjectImpl;
import org.eclipse.jst.j2ee.ejb.EjbPackage;
import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
import org.eclipse.jst.j2ee.ejb.ExcludeList;
import org.eclipse.jst.j2ee.ejb.MethodElement;
/**
* The exclude list element defines a set of methods which the Assembler marks to be uncallable. It contains one or more methods.
*
* If the method permission relation contains methods that are in the exclude list, the Deployer must consider those methods to be uncallable.
* @generated
*/
public class ExcludeListImpl extends J2EEEObjectImpl implements ExcludeList {
/**
* 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;
/**
* @generated This field/method will be replaced during code generation.
*/
protected EList methodElements = null;
/**
* 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;
public ExcludeListImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return EjbPackage.Literals.EXCLUDE_LIST;
}
/**
* @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, EjbPackage.EXCLUDE_LIST__DESCRIPTION, oldDescription, description));
}
/**
* @generated This field/method will be replaced during code generation
*/
public EList getMethodElements() {
if (methodElements == null) {
methodElements = new EObjectContainmentEList(MethodElement.class, this, EjbPackage.EXCLUDE_LIST__METHOD_ELEMENTS);
}
return methodElements;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList getDescriptions() {
if (descriptions == null) {
descriptions = new EObjectContainmentEList(Description.class, this, EjbPackage.EXCLUDE_LIST__DESCRIPTIONS);
}
return descriptions;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case EjbPackage.EXCLUDE_LIST__METHOD_ELEMENTS:
return ((InternalEList)getMethodElements()).basicRemove(otherEnd, msgs);
case EjbPackage.EXCLUDE_LIST__DESCRIPTIONS:
return ((InternalEList)getDescriptions()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case EjbPackage.EXCLUDE_LIST__DESCRIPTION:
return getDescription();
case EjbPackage.EXCLUDE_LIST__METHOD_ELEMENTS:
return getMethodElements();
case EjbPackage.EXCLUDE_LIST__DESCRIPTIONS:
return getDescriptions();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case EjbPackage.EXCLUDE_LIST__DESCRIPTION:
setDescription((String)newValue);
return;
case EjbPackage.EXCLUDE_LIST__METHOD_ELEMENTS:
getMethodElements().clear();
getMethodElements().addAll((Collection)newValue);
return;
case EjbPackage.EXCLUDE_LIST__DESCRIPTIONS:
getDescriptions().clear();
getDescriptions().addAll((Collection)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(int featureID) {
switch (featureID) {
case EjbPackage.EXCLUDE_LIST__DESCRIPTION:
setDescription(DESCRIPTION_EDEFAULT);
return;
case EjbPackage.EXCLUDE_LIST__METHOD_ELEMENTS:
getMethodElements().clear();
return;
case EjbPackage.EXCLUDE_LIST__DESCRIPTIONS:
getDescriptions().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID) {
switch (featureID) {
case EjbPackage.EXCLUDE_LIST__DESCRIPTION:
return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
case EjbPackage.EXCLUDE_LIST__METHOD_ELEMENTS:
return methodElements != null && !methodElements.isEmpty();
case EjbPackage.EXCLUDE_LIST__DESCRIPTIONS:
return descriptions != null && !descriptions.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* @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(')');
return result.toString();
}
public List getMethodElements(EnterpriseBean anEJB) {
if (anEJB == null)
return Collections.EMPTY_LIST;
List result = new ArrayList();
List elements = getMethodElements();
MethodElement me;
for (int i = 0; i < elements.size(); i++) {
me = (MethodElement) elements.get(i);
if (anEJB.equals(me.getEnterpriseBean()))
result.add(me);
}
return result;
}
}