/******************************************************************************* * 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.common.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.CommonPackage; import org.eclipse.jst.j2ee.common.Description; import org.eclipse.jst.j2ee.common.Identity; /** * Specifies the run-as identity to be used for the execution of the methods of an enterprise bean. It contains an optional description, and the name of a security role. * @generated */ public class IdentityImpl extends J2EEEObjectImpl implements Identity { /** * 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 #getRoleName() <em>Role Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getRoleName() * @generated * @ordered */ protected static final String ROLE_NAME_EDEFAULT = null; /** * @generated This field/method will be replaced during code generation. */ protected String roleName = ROLE_NAME_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; public IdentityImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return CommonPackage.Literals.IDENTITY; } /** * @generated This field/method will be replaced during code generation * The description is used by the ejb-jar file producer to provide text describing the run as identity. * * The description should include any information that the ejb-jar file producer wants to provide to the consumer of the ejb-jar file (i.e. to the Deployer). Typically, the tools used by the ejb-jar file consumer will display the description when processing the list of dependents. */ 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, CommonPackage.IDENTITY__DESCRIPTION, oldDescription, description)); } /** * @generated This field/method will be replaced during code generation * The role-name element contains the name of a security role. * * The name must conform to the lexical rules for an NMTOKEN. */ public String getRoleName() { return roleName; } /** * @generated This field/method will be replaced during code generation. */ public void setRoleName(String newRoleName) { String oldRoleName = roleName; roleName = newRoleName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, CommonPackage.IDENTITY__ROLE_NAME, oldRoleName, roleName)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList getDescriptions() { if (descriptions == null) { descriptions = new EObjectContainmentEList(Description.class, this, CommonPackage.IDENTITY__DESCRIPTIONS); } return descriptions; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case CommonPackage.IDENTITY__DESCRIPTIONS: return ((InternalEList)getDescriptions()).basicRemove(otherEnd, 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 CommonPackage.IDENTITY__DESCRIPTION: return getDescription(); case CommonPackage.IDENTITY__ROLE_NAME: return getRoleName(); case CommonPackage.IDENTITY__DESCRIPTIONS: return getDescriptions(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case CommonPackage.IDENTITY__DESCRIPTION: setDescription((String)newValue); return; case CommonPackage.IDENTITY__ROLE_NAME: setRoleName((String)newValue); return; case CommonPackage.IDENTITY__DESCRIPTIONS: getDescriptions().clear(); getDescriptions().addAll((Collection)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case CommonPackage.IDENTITY__DESCRIPTION: setDescription(DESCRIPTION_EDEFAULT); return; case CommonPackage.IDENTITY__ROLE_NAME: setRoleName(ROLE_NAME_EDEFAULT); return; case CommonPackage.IDENTITY__DESCRIPTIONS: getDescriptions().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case CommonPackage.IDENTITY__DESCRIPTION: return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description); case CommonPackage.IDENTITY__ROLE_NAME: return ROLE_NAME_EDEFAULT == null ? roleName != null : !ROLE_NAME_EDEFAULT.equals(roleName); case CommonPackage.IDENTITY__DESCRIPTIONS: return descriptions != null && !descriptions.isEmpty(); } return super.eIsSet(featureID); } /** * @generated This field/method will be replaced during code generation. */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (description: "); //$NON-NLS-1$ result.append(description); result.append(", roleName: "); //$NON-NLS-1$ result.append(roleName); result.append(')'); return result.toString(); } }