blob: 9cfdd1c0ec15b06e166d9612b35d713e761d8ead [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.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.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.jca.JcaPackage;
import org.eclipse.jst.j2ee.jca.SecurityPermission;
/**
* Specifies a security permission that is required by the resource adapter code.
*
* The security permission listed in the deployment descriptor are ones that are different from those required by the default permission set as specified in the connector specification. The optional description can mention specific reason that resource adapter requires a given security permission.
* @generated
*/
public class SecurityPermissionImpl extends J2EEEObjectImpl implements SecurityPermission {
/**
* 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 #getSpecification() <em>Specification</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSpecification()
* @generated
* @ordered
*/
protected static final String SPECIFICATION_EDEFAULT = null;
/**
* @generated This field/method will be replaced during code generation.
*/
protected String specification = SPECIFICATION_EDEFAULT;
/**
* 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 SecurityPermissionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return JcaPackage.Literals.SECURITY_PERMISSION;
}
/**
* @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.SECURITY_PERMISSION__DESCRIPTION, oldDescription, description));
}
/**
* @generated This field/method will be replaced during code generation
* The element permission-spec specifies a security permission based on the Security policy file syntax.
*/
public String getSpecification() {
return specification;
}
/**
* @generated This field/method will be replaced during code generation.
*/
public void setSpecification(String newSpecification) {
String oldSpecification = specification;
specification = newSpecification;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, JcaPackage.SECURITY_PERMISSION__SPECIFICATION, oldSpecification, specification));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList getDescriptions() {
if (descriptions == null) {
descriptions = new EObjectContainmentEList(Description.class, this, JcaPackage.SECURITY_PERMISSION__DESCRIPTIONS);
}
return descriptions;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case JcaPackage.SECURITY_PERMISSION__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 JcaPackage.SECURITY_PERMISSION__DESCRIPTION:
return getDescription();
case JcaPackage.SECURITY_PERMISSION__SPECIFICATION:
return getSpecification();
case JcaPackage.SECURITY_PERMISSION__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 JcaPackage.SECURITY_PERMISSION__DESCRIPTION:
setDescription((String)newValue);
return;
case JcaPackage.SECURITY_PERMISSION__SPECIFICATION:
setSpecification((String)newValue);
return;
case JcaPackage.SECURITY_PERMISSION__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 JcaPackage.SECURITY_PERMISSION__DESCRIPTION:
setDescription(DESCRIPTION_EDEFAULT);
return;
case JcaPackage.SECURITY_PERMISSION__SPECIFICATION:
setSpecification(SPECIFICATION_EDEFAULT);
return;
case JcaPackage.SECURITY_PERMISSION__DESCRIPTIONS:
getDescriptions().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID) {
switch (featureID) {
case JcaPackage.SECURITY_PERMISSION__DESCRIPTION:
return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
case JcaPackage.SECURITY_PERMISSION__SPECIFICATION:
return SPECIFICATION_EDEFAULT == null ? specification != null : !SPECIFICATION_EDEFAULT.equals(specification);
case JcaPackage.SECURITY_PERMISSION__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(", specification: ");
result.append(specification);
result.append(')');
return result.toString();
}
}