/******************************************************************************* * Copyright (c) 2009 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.javaee.ejb.internal.impl; import java.util.Collection; import java.util.List; import javax.xml.datatype.XMLGregorianCalendar; 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.impl.EObjectImpl; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.jst.javaee.core.Description; import org.eclipse.jst.javaee.ejb.NamedMethodType; import org.eclipse.jst.javaee.ejb.TimerScheduleType; import org.eclipse.jst.javaee.ejb.TimerType; import org.eclipse.jst.javaee.ejb.internal.metadata.EjbPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Timer Type</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.jst.javaee.ejb.internal.impl.TimerTypeImpl#getDescription <em>Description</em>}</li> * <li>{@link org.eclipse.jst.javaee.ejb.internal.impl.TimerTypeImpl#getSchedule <em>Schedule</em>}</li> * <li>{@link org.eclipse.jst.javaee.ejb.internal.impl.TimerTypeImpl#getStart <em>Start</em>}</li> * <li>{@link org.eclipse.jst.javaee.ejb.internal.impl.TimerTypeImpl#getEnd <em>End</em>}</li> * <li>{@link org.eclipse.jst.javaee.ejb.internal.impl.TimerTypeImpl#getTimeoutMethod <em>Timeout Method</em>}</li> * <li>{@link org.eclipse.jst.javaee.ejb.internal.impl.TimerTypeImpl#isPersistent <em>Persistent</em>}</li> * <li>{@link org.eclipse.jst.javaee.ejb.internal.impl.TimerTypeImpl#getTimezone <em>Timezone</em>}</li> * <li>{@link org.eclipse.jst.javaee.ejb.internal.impl.TimerTypeImpl#getInfo <em>Info</em>}</li> * <li>{@link org.eclipse.jst.javaee.ejb.internal.impl.TimerTypeImpl#getId <em>Id</em>}</li> * </ul> * </p> * * @generated */ public class TimerTypeImpl extends EObjectImpl implements TimerType { /** * The cached value of the '{@link #getDescription() <em>Description</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getDescription() * @generated * @ordered */ protected EList<Description> description; /** * The cached value of the '{@link #getSchedule() <em>Schedule</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getSchedule() * @generated * @ordered */ protected TimerScheduleType schedule; /** * The default value of the '{@link #getStart() <em>Start</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getStart() * @generated * @ordered */ protected static final XMLGregorianCalendar START_EDEFAULT = null; /** * The cached value of the '{@link #getStart() <em>Start</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getStart() * @generated * @ordered */ protected XMLGregorianCalendar start = START_EDEFAULT; /** * The default value of the '{@link #getEnd() <em>End</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getEnd() * @generated * @ordered */ protected static final XMLGregorianCalendar END_EDEFAULT = null; /** * The cached value of the '{@link #getEnd() <em>End</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getEnd() * @generated * @ordered */ protected XMLGregorianCalendar end = END_EDEFAULT; /** * The cached value of the '{@link #getTimeoutMethod() <em>Timeout Method</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTimeoutMethod() * @generated * @ordered */ protected NamedMethodType timeoutMethod; /** * The default value of the '{@link #isPersistent() <em>Persistent</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isPersistent() * @generated * @ordered */ protected static final boolean PERSISTENT_EDEFAULT = false; /** * The cached value of the '{@link #isPersistent() <em>Persistent</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isPersistent() * @generated * @ordered */ protected boolean persistent = PERSISTENT_EDEFAULT; /** * This is true if the Persistent attribute has been set. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ protected boolean persistentESet; /** * The default value of the '{@link #getTimezone() <em>Timezone</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTimezone() * @generated * @ordered */ protected static final String TIMEZONE_EDEFAULT = null; /** * The cached value of the '{@link #getTimezone() <em>Timezone</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTimezone() * @generated * @ordered */ protected String timezone = TIMEZONE_EDEFAULT; /** * The default value of the '{@link #getInfo() <em>Info</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getInfo() * @generated * @ordered */ protected static final String INFO_EDEFAULT = null; /** * The cached value of the '{@link #getInfo() <em>Info</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getInfo() * @generated * @ordered */ protected String info = INFO_EDEFAULT; /** * The default value of the '{@link #getId() <em>Id</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getId() * @generated * @ordered */ protected static final String ID_EDEFAULT = null; /** * The cached value of the '{@link #getId() <em>Id</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getId() * @generated * @ordered */ protected String id = ID_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected TimerTypeImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return EjbPackage.Literals.TIMER_TYPE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public List<Description> getDescription() { if (description == null) { description = new EObjectContainmentEList<Description>(Description.class, this, EjbPackage.TIMER_TYPE__DESCRIPTION); } return description; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public TimerScheduleType getSchedule() { return schedule; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetSchedule(TimerScheduleType newSchedule, NotificationChain msgs) { TimerScheduleType oldSchedule = schedule; schedule = newSchedule; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EjbPackage.TIMER_TYPE__SCHEDULE, oldSchedule, newSchedule); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setSchedule(TimerScheduleType newSchedule) { if (newSchedule != schedule) { NotificationChain msgs = null; if (schedule != null) msgs = ((InternalEObject)schedule).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EjbPackage.TIMER_TYPE__SCHEDULE, null, msgs); if (newSchedule != null) msgs = ((InternalEObject)newSchedule).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EjbPackage.TIMER_TYPE__SCHEDULE, null, msgs); msgs = basicSetSchedule(newSchedule, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EjbPackage.TIMER_TYPE__SCHEDULE, newSchedule, newSchedule)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public XMLGregorianCalendar getStart() { return start; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setStart(XMLGregorianCalendar newStart) { XMLGregorianCalendar oldStart = start; start = newStart; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EjbPackage.TIMER_TYPE__START, oldStart, start)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public XMLGregorianCalendar getEnd() { return end; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setEnd(XMLGregorianCalendar newEnd) { XMLGregorianCalendar oldEnd = end; end = newEnd; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EjbPackage.TIMER_TYPE__END, oldEnd, end)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NamedMethodType getTimeoutMethod() { return timeoutMethod; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetTimeoutMethod(NamedMethodType newTimeoutMethod, NotificationChain msgs) { NamedMethodType oldTimeoutMethod = timeoutMethod; timeoutMethod = newTimeoutMethod; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EjbPackage.TIMER_TYPE__TIMEOUT_METHOD, oldTimeoutMethod, newTimeoutMethod); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setTimeoutMethod(NamedMethodType newTimeoutMethod) { if (newTimeoutMethod != timeoutMethod) { NotificationChain msgs = null; if (timeoutMethod != null) msgs = ((InternalEObject)timeoutMethod).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EjbPackage.TIMER_TYPE__TIMEOUT_METHOD, null, msgs); if (newTimeoutMethod != null) msgs = ((InternalEObject)newTimeoutMethod).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EjbPackage.TIMER_TYPE__TIMEOUT_METHOD, null, msgs); msgs = basicSetTimeoutMethod(newTimeoutMethod, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EjbPackage.TIMER_TYPE__TIMEOUT_METHOD, newTimeoutMethod, newTimeoutMethod)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isPersistent() { return persistent; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setPersistent(boolean newPersistent) { boolean oldPersistent = persistent; persistent = newPersistent; boolean oldPersistentESet = persistentESet; persistentESet = true; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EjbPackage.TIMER_TYPE__PERSISTENT, oldPersistent, persistent, !oldPersistentESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void unsetPersistent() { boolean oldPersistent = persistent; boolean oldPersistentESet = persistentESet; persistent = PERSISTENT_EDEFAULT; persistentESet = false; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.UNSET, EjbPackage.TIMER_TYPE__PERSISTENT, oldPersistent, PERSISTENT_EDEFAULT, oldPersistentESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isSetPersistent() { return persistentESet; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getTimezone() { return timezone; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setTimezone(String newTimezone) { String oldTimezone = timezone; timezone = newTimezone; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EjbPackage.TIMER_TYPE__TIMEZONE, oldTimezone, timezone)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getInfo() { return info; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setInfo(String newInfo) { String oldInfo = info; info = newInfo; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EjbPackage.TIMER_TYPE__INFO, oldInfo, info)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getId() { return id; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setId(String newId) { String oldId = id; id = newId; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EjbPackage.TIMER_TYPE__ID, oldId, id)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case EjbPackage.TIMER_TYPE__DESCRIPTION: return ((InternalEList<?>)getDescription()).basicRemove(otherEnd, msgs); case EjbPackage.TIMER_TYPE__SCHEDULE: return basicSetSchedule(null, msgs); case EjbPackage.TIMER_TYPE__TIMEOUT_METHOD: return basicSetTimeoutMethod(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 EjbPackage.TIMER_TYPE__DESCRIPTION: return getDescription(); case EjbPackage.TIMER_TYPE__SCHEDULE: return getSchedule(); case EjbPackage.TIMER_TYPE__START: return getStart(); case EjbPackage.TIMER_TYPE__END: return getEnd(); case EjbPackage.TIMER_TYPE__TIMEOUT_METHOD: return getTimeoutMethod(); case EjbPackage.TIMER_TYPE__PERSISTENT: return isPersistent(); case EjbPackage.TIMER_TYPE__TIMEZONE: return getTimezone(); case EjbPackage.TIMER_TYPE__INFO: return getInfo(); case EjbPackage.TIMER_TYPE__ID: return getId(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case EjbPackage.TIMER_TYPE__DESCRIPTION: getDescription().clear(); getDescription().addAll((Collection<? extends Description>)newValue); return; case EjbPackage.TIMER_TYPE__SCHEDULE: setSchedule((TimerScheduleType)newValue); return; case EjbPackage.TIMER_TYPE__START: setStart((XMLGregorianCalendar)newValue); return; case EjbPackage.TIMER_TYPE__END: setEnd((XMLGregorianCalendar)newValue); return; case EjbPackage.TIMER_TYPE__TIMEOUT_METHOD: setTimeoutMethod((NamedMethodType)newValue); return; case EjbPackage.TIMER_TYPE__PERSISTENT: setPersistent((Boolean)newValue); return; case EjbPackage.TIMER_TYPE__TIMEZONE: setTimezone((String)newValue); return; case EjbPackage.TIMER_TYPE__INFO: setInfo((String)newValue); return; case EjbPackage.TIMER_TYPE__ID: setId((String)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case EjbPackage.TIMER_TYPE__DESCRIPTION: getDescription().clear(); return; case EjbPackage.TIMER_TYPE__SCHEDULE: setSchedule((TimerScheduleType)null); return; case EjbPackage.TIMER_TYPE__START: setStart(START_EDEFAULT); return; case EjbPackage.TIMER_TYPE__END: setEnd(END_EDEFAULT); return; case EjbPackage.TIMER_TYPE__TIMEOUT_METHOD: setTimeoutMethod((NamedMethodType)null); return; case EjbPackage.TIMER_TYPE__PERSISTENT: unsetPersistent(); return; case EjbPackage.TIMER_TYPE__TIMEZONE: setTimezone(TIMEZONE_EDEFAULT); return; case EjbPackage.TIMER_TYPE__INFO: setInfo(INFO_EDEFAULT); return; case EjbPackage.TIMER_TYPE__ID: setId(ID_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case EjbPackage.TIMER_TYPE__DESCRIPTION: return description != null && !description.isEmpty(); case EjbPackage.TIMER_TYPE__SCHEDULE: return schedule != null; case EjbPackage.TIMER_TYPE__START: return START_EDEFAULT == null ? start != null : !START_EDEFAULT.equals(start); case EjbPackage.TIMER_TYPE__END: return END_EDEFAULT == null ? end != null : !END_EDEFAULT.equals(end); case EjbPackage.TIMER_TYPE__TIMEOUT_METHOD: return timeoutMethod != null; case EjbPackage.TIMER_TYPE__PERSISTENT: return isSetPersistent(); case EjbPackage.TIMER_TYPE__TIMEZONE: return TIMEZONE_EDEFAULT == null ? timezone != null : !TIMEZONE_EDEFAULT.equals(timezone); case EjbPackage.TIMER_TYPE__INFO: return INFO_EDEFAULT == null ? info != null : !INFO_EDEFAULT.equals(info); case EjbPackage.TIMER_TYPE__ID: return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (start: "); //$NON-NLS-1$ result.append(start); result.append(", end: "); //$NON-NLS-1$ result.append(end); result.append(", persistent: "); //$NON-NLS-1$ if (persistentESet) result.append(persistent); else result.append("<unset>"); //$NON-NLS-1$ result.append(", timezone: "); //$NON-NLS-1$ result.append(timezone); result.append(", info: "); //$NON-NLS-1$ result.append(info); result.append(", id: "); //$NON-NLS-1$ result.append(id); result.append(')'); return result.toString(); } } //TimerTypeImpl