001: /**
002: * <copyright>
003: * </copyright>
004: *
005: * $Id: LockFeatureTypeImpl.java 7522 2007-09-12 22:00:10Z saul.farber $
006: */package net.opengis.wfs.impl;
007:
008: import java.math.BigInteger;
009:
010: import java.util.Collection;
011:
012: import net.opengis.wfs.AllSomeType;
013: import net.opengis.wfs.LockFeatureType;
014: import net.opengis.wfs.LockType;
015: import net.opengis.wfs.WfsPackage;
016:
017: import org.eclipse.emf.common.notify.Notification;
018: import org.eclipse.emf.common.notify.NotificationChain;
019:
020: import org.eclipse.emf.common.util.EList;
021:
022: import org.eclipse.emf.ecore.EClass;
023: import org.eclipse.emf.ecore.InternalEObject;
024:
025: import org.eclipse.emf.ecore.impl.ENotificationImpl;
026:
027: import org.eclipse.emf.ecore.util.EObjectContainmentEList;
028: import org.eclipse.emf.ecore.util.InternalEList;
029:
030: /**
031: * <!-- begin-user-doc -->
032: * An implementation of the model object '<em><b>Lock Feature Type</b></em>'.
033: * <!-- end-user-doc -->
034: * <p>
035: * The following features are implemented:
036: * <ul>
037: * <li>{@link net.opengis.wfs.impl.LockFeatureTypeImpl#getLock <em>Lock</em>}</li>
038: * <li>{@link net.opengis.wfs.impl.LockFeatureTypeImpl#getExpiry <em>Expiry</em>}</li>
039: * <li>{@link net.opengis.wfs.impl.LockFeatureTypeImpl#getLockAction <em>Lock Action</em>}</li>
040: * </ul>
041: * </p>
042: *
043: * @generated
044: */
045: public class LockFeatureTypeImpl extends BaseRequestTypeImpl implements
046: LockFeatureType {
047: /**
048: * The cached value of the '{@link #getLock() <em>Lock</em>}' containment reference list.
049: * <!-- begin-user-doc -->
050: * <!-- end-user-doc -->
051: * @see #getLock()
052: * @generated
053: * @ordered
054: */
055: protected EList lock;
056:
057: /**
058: * The default value of the '{@link #getExpiry() <em>Expiry</em>}' attribute.
059: * <!-- begin-user-doc -->
060: * <!-- end-user-doc -->
061: * @see #getExpiry()
062: * @generated
063: * @ordered
064: */
065: protected static final BigInteger EXPIRY_EDEFAULT = new BigInteger(
066: "5");
067:
068: /**
069: * The cached value of the '{@link #getExpiry() <em>Expiry</em>}' attribute.
070: * <!-- begin-user-doc -->
071: * <!-- end-user-doc -->
072: * @see #getExpiry()
073: * @generated
074: * @ordered
075: */
076: protected BigInteger expiry = EXPIRY_EDEFAULT;
077:
078: /**
079: * This is true if the Expiry attribute has been set.
080: * <!-- begin-user-doc -->
081: * <!-- end-user-doc -->
082: * @generated
083: * @ordered
084: */
085: protected boolean expiryESet;
086:
087: /**
088: * The default value of the '{@link #getLockAction() <em>Lock Action</em>}' attribute.
089: * <!-- begin-user-doc -->
090: * <!-- end-user-doc -->
091: * @see #getLockAction()
092: * @generated
093: * @ordered
094: */
095: protected static final AllSomeType LOCK_ACTION_EDEFAULT = AllSomeType.ALL_LITERAL;
096:
097: /**
098: * The cached value of the '{@link #getLockAction() <em>Lock Action</em>}' attribute.
099: * <!-- begin-user-doc -->
100: * <!-- end-user-doc -->
101: * @see #getLockAction()
102: * @generated
103: * @ordered
104: */
105: protected AllSomeType lockAction = LOCK_ACTION_EDEFAULT;
106:
107: /**
108: * This is true if the Lock Action attribute has been set.
109: * <!-- begin-user-doc -->
110: * <!-- end-user-doc -->
111: * @generated
112: * @ordered
113: */
114: protected boolean lockActionESet;
115:
116: /**
117: * <!-- begin-user-doc -->
118: * <!-- end-user-doc -->
119: * @generated
120: */
121: protected LockFeatureTypeImpl() {
122: super ();
123: }
124:
125: /**
126: * <!-- begin-user-doc -->
127: * <!-- end-user-doc -->
128: * @generated
129: */
130: protected EClass eStaticClass() {
131: return WfsPackage.Literals.LOCK_FEATURE_TYPE;
132: }
133:
134: /**
135: * <!-- begin-user-doc -->
136: * <!-- end-user-doc -->
137: * @generated
138: */
139: public EList getLock() {
140: if (lock == null) {
141: lock = new EObjectContainmentEList(LockType.class, this ,
142: WfsPackage.LOCK_FEATURE_TYPE__LOCK);
143: }
144: return lock;
145: }
146:
147: /**
148: * <!-- begin-user-doc -->
149: * <!-- end-user-doc -->
150: * @generated
151: */
152: public BigInteger getExpiry() {
153: return expiry;
154: }
155:
156: /**
157: * <!-- begin-user-doc -->
158: * <!-- end-user-doc -->
159: * @generated
160: */
161: public void setExpiry(BigInteger newExpiry) {
162: BigInteger oldExpiry = expiry;
163: expiry = newExpiry;
164: boolean oldExpiryESet = expiryESet;
165: expiryESet = true;
166: if (eNotificationRequired())
167: eNotify(new ENotificationImpl(this , Notification.SET,
168: WfsPackage.LOCK_FEATURE_TYPE__EXPIRY, oldExpiry,
169: expiry, !oldExpiryESet));
170: }
171:
172: /**
173: * <!-- begin-user-doc -->
174: * <!-- end-user-doc -->
175: * @generated
176: */
177: public void unsetExpiry() {
178: BigInteger oldExpiry = expiry;
179: boolean oldExpiryESet = expiryESet;
180: expiry = EXPIRY_EDEFAULT;
181: expiryESet = false;
182: if (eNotificationRequired())
183: eNotify(new ENotificationImpl(this , Notification.UNSET,
184: WfsPackage.LOCK_FEATURE_TYPE__EXPIRY, oldExpiry,
185: EXPIRY_EDEFAULT, oldExpiryESet));
186: }
187:
188: /**
189: * <!-- begin-user-doc -->
190: * <!-- end-user-doc -->
191: * @generated
192: */
193: public boolean isSetExpiry() {
194: return expiryESet;
195: }
196:
197: /**
198: * <!-- begin-user-doc -->
199: * <!-- end-user-doc -->
200: * @generated
201: */
202: public AllSomeType getLockAction() {
203: return lockAction;
204: }
205:
206: /**
207: * <!-- begin-user-doc -->
208: * <!-- end-user-doc -->
209: * @generated
210: */
211: public void setLockAction(AllSomeType newLockAction) {
212: AllSomeType oldLockAction = lockAction;
213: lockAction = newLockAction == null ? LOCK_ACTION_EDEFAULT
214: : newLockAction;
215: boolean oldLockActionESet = lockActionESet;
216: lockActionESet = true;
217: if (eNotificationRequired())
218: eNotify(new ENotificationImpl(this , Notification.SET,
219: WfsPackage.LOCK_FEATURE_TYPE__LOCK_ACTION,
220: oldLockAction, lockAction, !oldLockActionESet));
221: }
222:
223: /**
224: * <!-- begin-user-doc -->
225: * <!-- end-user-doc -->
226: * @generated
227: */
228: public void unsetLockAction() {
229: AllSomeType oldLockAction = lockAction;
230: boolean oldLockActionESet = lockActionESet;
231: lockAction = LOCK_ACTION_EDEFAULT;
232: lockActionESet = false;
233: if (eNotificationRequired())
234: eNotify(new ENotificationImpl(this , Notification.UNSET,
235: WfsPackage.LOCK_FEATURE_TYPE__LOCK_ACTION,
236: oldLockAction, LOCK_ACTION_EDEFAULT,
237: oldLockActionESet));
238: }
239:
240: /**
241: * <!-- begin-user-doc -->
242: * <!-- end-user-doc -->
243: * @generated
244: */
245: public boolean isSetLockAction() {
246: return lockActionESet;
247: }
248:
249: /**
250: * <!-- begin-user-doc -->
251: * <!-- end-user-doc -->
252: * @generated
253: */
254: public NotificationChain eInverseRemove(InternalEObject otherEnd,
255: int featureID, NotificationChain msgs) {
256: switch (featureID) {
257: case WfsPackage.LOCK_FEATURE_TYPE__LOCK:
258: return ((InternalEList) getLock()).basicRemove(otherEnd,
259: msgs);
260: }
261: return super .eInverseRemove(otherEnd, featureID, msgs);
262: }
263:
264: /**
265: * <!-- begin-user-doc -->
266: * <!-- end-user-doc -->
267: * @generated
268: */
269: public Object eGet(int featureID, boolean resolve, boolean coreType) {
270: switch (featureID) {
271: case WfsPackage.LOCK_FEATURE_TYPE__LOCK:
272: return getLock();
273: case WfsPackage.LOCK_FEATURE_TYPE__EXPIRY:
274: return getExpiry();
275: case WfsPackage.LOCK_FEATURE_TYPE__LOCK_ACTION:
276: return getLockAction();
277: }
278: return super .eGet(featureID, resolve, coreType);
279: }
280:
281: /**
282: * <!-- begin-user-doc -->
283: * <!-- end-user-doc -->
284: * @generated
285: */
286: public void eSet(int featureID, Object newValue) {
287: switch (featureID) {
288: case WfsPackage.LOCK_FEATURE_TYPE__LOCK:
289: getLock().clear();
290: getLock().addAll((Collection) newValue);
291: return;
292: case WfsPackage.LOCK_FEATURE_TYPE__EXPIRY:
293: setExpiry((BigInteger) newValue);
294: return;
295: case WfsPackage.LOCK_FEATURE_TYPE__LOCK_ACTION:
296: setLockAction((AllSomeType) newValue);
297: return;
298: }
299: super .eSet(featureID, newValue);
300: }
301:
302: /**
303: * <!-- begin-user-doc -->
304: * <!-- end-user-doc -->
305: * @generated
306: */
307: public void eUnset(int featureID) {
308: switch (featureID) {
309: case WfsPackage.LOCK_FEATURE_TYPE__LOCK:
310: getLock().clear();
311: return;
312: case WfsPackage.LOCK_FEATURE_TYPE__EXPIRY:
313: unsetExpiry();
314: return;
315: case WfsPackage.LOCK_FEATURE_TYPE__LOCK_ACTION:
316: unsetLockAction();
317: return;
318: }
319: super .eUnset(featureID);
320: }
321:
322: /**
323: * <!-- begin-user-doc -->
324: * <!-- end-user-doc -->
325: * @generated
326: */
327: public boolean eIsSet(int featureID) {
328: switch (featureID) {
329: case WfsPackage.LOCK_FEATURE_TYPE__LOCK:
330: return lock != null && !lock.isEmpty();
331: case WfsPackage.LOCK_FEATURE_TYPE__EXPIRY:
332: return isSetExpiry();
333: case WfsPackage.LOCK_FEATURE_TYPE__LOCK_ACTION:
334: return isSetLockAction();
335: }
336: return super .eIsSet(featureID);
337: }
338:
339: /**
340: * <!-- begin-user-doc -->
341: * <!-- end-user-doc -->
342: * @generated
343: */
344: public String toString() {
345: if (eIsProxy())
346: return super .toString();
347:
348: StringBuffer result = new StringBuffer(super .toString());
349: result.append(" (expiry: ");
350: if (expiryESet)
351: result.append(expiry);
352: else
353: result.append("<unset>");
354: result.append(", lockAction: ");
355: if (lockActionESet)
356: result.append(lockAction);
357: else
358: result.append("<unset>");
359: result.append(')');
360: return result.toString();
361: }
362:
363: } //LockFeatureTypeImpl
|