001: /**
002: * <copyright>
003: * </copyright>
004: *
005: * $Id: TransactionTypeImpl.java 7522 2007-09-12 22:00:10Z saul.farber $
006: */package net.opengis.wfs.impl;
007:
008: import java.util.Collection;
009:
010: import net.opengis.wfs.AllSomeType;
011: import net.opengis.wfs.TransactionType;
012: import net.opengis.wfs.WfsPackage;
013:
014: import org.eclipse.emf.common.notify.Notification;
015: import org.eclipse.emf.common.notify.NotificationChain;
016:
017: import org.eclipse.emf.common.util.EList;
018:
019: import org.eclipse.emf.ecore.EClass;
020: import org.eclipse.emf.ecore.InternalEObject;
021:
022: import org.eclipse.emf.ecore.impl.ENotificationImpl;
023:
024: import org.eclipse.emf.ecore.util.BasicFeatureMap;
025: import org.eclipse.emf.ecore.util.FeatureMap;
026: import org.eclipse.emf.ecore.util.InternalEList;
027:
028: /**
029: * <!-- begin-user-doc -->
030: * An implementation of the model object '<em><b>Transaction Type</b></em>'.
031: * <!-- end-user-doc -->
032: * <p>
033: * The following features are implemented:
034: * <ul>
035: * <li>{@link net.opengis.wfs.impl.TransactionTypeImpl#getLockId <em>Lock Id</em>}</li>
036: * <li>{@link net.opengis.wfs.impl.TransactionTypeImpl#getGroup <em>Group</em>}</li>
037: * <li>{@link net.opengis.wfs.impl.TransactionTypeImpl#getInsert <em>Insert</em>}</li>
038: * <li>{@link net.opengis.wfs.impl.TransactionTypeImpl#getUpdate <em>Update</em>}</li>
039: * <li>{@link net.opengis.wfs.impl.TransactionTypeImpl#getDelete <em>Delete</em>}</li>
040: * <li>{@link net.opengis.wfs.impl.TransactionTypeImpl#getNative <em>Native</em>}</li>
041: * <li>{@link net.opengis.wfs.impl.TransactionTypeImpl#getReleaseAction <em>Release Action</em>}</li>
042: * </ul>
043: * </p>
044: *
045: * @generated
046: */
047: public class TransactionTypeImpl extends BaseRequestTypeImpl implements
048: TransactionType {
049: /**
050: * The default value of the '{@link #getLockId() <em>Lock Id</em>}' attribute.
051: * <!-- begin-user-doc -->
052: * <!-- end-user-doc -->
053: * @see #getLockId()
054: * @generated
055: * @ordered
056: */
057: protected static final String LOCK_ID_EDEFAULT = null;
058:
059: /**
060: * The cached value of the '{@link #getLockId() <em>Lock Id</em>}' attribute.
061: * <!-- begin-user-doc -->
062: * <!-- end-user-doc -->
063: * @see #getLockId()
064: * @generated
065: * @ordered
066: */
067: protected String lockId = LOCK_ID_EDEFAULT;
068:
069: /**
070: * The cached value of the '{@link #getGroup() <em>Group</em>}' attribute list.
071: * <!-- begin-user-doc -->
072: * <!-- end-user-doc -->
073: * @see #getGroup()
074: * @generated
075: * @ordered
076: */
077: protected FeatureMap group;
078:
079: /**
080: * The default value of the '{@link #getReleaseAction() <em>Release Action</em>}' attribute.
081: * <!-- begin-user-doc -->
082: * <!-- end-user-doc -->
083: * @see #getReleaseAction()
084: * @generated
085: * @ordered
086: */
087: protected static final AllSomeType RELEASE_ACTION_EDEFAULT = AllSomeType.ALL_LITERAL;
088:
089: /**
090: * The cached value of the '{@link #getReleaseAction() <em>Release Action</em>}' attribute.
091: * <!-- begin-user-doc -->
092: * <!-- end-user-doc -->
093: * @see #getReleaseAction()
094: * @generated
095: * @ordered
096: */
097: protected AllSomeType releaseAction = RELEASE_ACTION_EDEFAULT;
098:
099: /**
100: * This is true if the Release Action attribute has been set.
101: * <!-- begin-user-doc -->
102: * <!-- end-user-doc -->
103: * @generated
104: * @ordered
105: */
106: protected boolean releaseActionESet;
107:
108: /**
109: * <!-- begin-user-doc -->
110: * <!-- end-user-doc -->
111: * @generated
112: */
113: protected TransactionTypeImpl() {
114: super ();
115: }
116:
117: /**
118: * <!-- begin-user-doc -->
119: * <!-- end-user-doc -->
120: * @generated
121: */
122: protected EClass eStaticClass() {
123: return WfsPackage.Literals.TRANSACTION_TYPE;
124: }
125:
126: /**
127: * <!-- begin-user-doc -->
128: * <!-- end-user-doc -->
129: * @generated
130: */
131: public String getLockId() {
132: return lockId;
133: }
134:
135: /**
136: * <!-- begin-user-doc -->
137: * <!-- end-user-doc -->
138: * @generated
139: */
140: public void setLockId(String newLockId) {
141: String oldLockId = lockId;
142: lockId = newLockId;
143: if (eNotificationRequired())
144: eNotify(new ENotificationImpl(this , Notification.SET,
145: WfsPackage.TRANSACTION_TYPE__LOCK_ID, oldLockId,
146: lockId));
147: }
148:
149: /**
150: * <!-- begin-user-doc -->
151: * <!-- end-user-doc -->
152: * @generated
153: */
154: public FeatureMap getGroup() {
155: if (group == null) {
156: group = new BasicFeatureMap(this ,
157: WfsPackage.TRANSACTION_TYPE__GROUP);
158: }
159: return group;
160: }
161:
162: /**
163: * <!-- begin-user-doc -->
164: * <!-- end-user-doc -->
165: * @generated
166: */
167: public EList getInsert() {
168: return getGroup().list(
169: WfsPackage.Literals.TRANSACTION_TYPE__INSERT);
170: }
171:
172: /**
173: * <!-- begin-user-doc -->
174: * <!-- end-user-doc -->
175: * @generated
176: */
177: public EList getUpdate() {
178: return getGroup().list(
179: WfsPackage.Literals.TRANSACTION_TYPE__UPDATE);
180: }
181:
182: /**
183: * <!-- begin-user-doc -->
184: * <!-- end-user-doc -->
185: * @generated
186: */
187: public EList getDelete() {
188: return getGroup().list(
189: WfsPackage.Literals.TRANSACTION_TYPE__DELETE);
190: }
191:
192: /**
193: * <!-- begin-user-doc -->
194: * <!-- end-user-doc -->
195: * @generated
196: */
197: public EList getNative() {
198: return getGroup().list(
199: WfsPackage.Literals.TRANSACTION_TYPE__NATIVE);
200: }
201:
202: /**
203: * <!-- begin-user-doc -->
204: * <!-- end-user-doc -->
205: * @generated
206: */
207: public AllSomeType getReleaseAction() {
208: return releaseAction;
209: }
210:
211: /**
212: * <!-- begin-user-doc -->
213: * <!-- end-user-doc -->
214: * @generated
215: */
216: public void setReleaseAction(AllSomeType newReleaseAction) {
217: AllSomeType oldReleaseAction = releaseAction;
218: releaseAction = newReleaseAction == null ? RELEASE_ACTION_EDEFAULT
219: : newReleaseAction;
220: boolean oldReleaseActionESet = releaseActionESet;
221: releaseActionESet = true;
222: if (eNotificationRequired())
223: eNotify(new ENotificationImpl(this , Notification.SET,
224: WfsPackage.TRANSACTION_TYPE__RELEASE_ACTION,
225: oldReleaseAction, releaseAction,
226: !oldReleaseActionESet));
227: }
228:
229: /**
230: * <!-- begin-user-doc -->
231: * <!-- end-user-doc -->
232: * @generated
233: */
234: public void unsetReleaseAction() {
235: AllSomeType oldReleaseAction = releaseAction;
236: boolean oldReleaseActionESet = releaseActionESet;
237: releaseAction = RELEASE_ACTION_EDEFAULT;
238: releaseActionESet = false;
239: if (eNotificationRequired())
240: eNotify(new ENotificationImpl(this , Notification.UNSET,
241: WfsPackage.TRANSACTION_TYPE__RELEASE_ACTION,
242: oldReleaseAction, RELEASE_ACTION_EDEFAULT,
243: oldReleaseActionESet));
244: }
245:
246: /**
247: * <!-- begin-user-doc -->
248: * <!-- end-user-doc -->
249: * @generated
250: */
251: public boolean isSetReleaseAction() {
252: return releaseActionESet;
253: }
254:
255: /**
256: * <!-- begin-user-doc -->
257: * <!-- end-user-doc -->
258: * @generated
259: */
260: public NotificationChain eInverseRemove(InternalEObject otherEnd,
261: int featureID, NotificationChain msgs) {
262: switch (featureID) {
263: case WfsPackage.TRANSACTION_TYPE__GROUP:
264: return ((InternalEList) getGroup()).basicRemove(otherEnd,
265: msgs);
266: case WfsPackage.TRANSACTION_TYPE__INSERT:
267: return ((InternalEList) getInsert()).basicRemove(otherEnd,
268: msgs);
269: case WfsPackage.TRANSACTION_TYPE__UPDATE:
270: return ((InternalEList) getUpdate()).basicRemove(otherEnd,
271: msgs);
272: case WfsPackage.TRANSACTION_TYPE__DELETE:
273: return ((InternalEList) getDelete()).basicRemove(otherEnd,
274: msgs);
275: case WfsPackage.TRANSACTION_TYPE__NATIVE:
276: return ((InternalEList) getNative()).basicRemove(otherEnd,
277: msgs);
278: }
279: return super .eInverseRemove(otherEnd, featureID, msgs);
280: }
281:
282: /**
283: * <!-- begin-user-doc -->
284: * <!-- end-user-doc -->
285: * @generated
286: */
287: public Object eGet(int featureID, boolean resolve, boolean coreType) {
288: switch (featureID) {
289: case WfsPackage.TRANSACTION_TYPE__LOCK_ID:
290: return getLockId();
291: case WfsPackage.TRANSACTION_TYPE__GROUP:
292: if (coreType)
293: return getGroup();
294: return ((FeatureMap.Internal) getGroup()).getWrapper();
295: case WfsPackage.TRANSACTION_TYPE__INSERT:
296: return getInsert();
297: case WfsPackage.TRANSACTION_TYPE__UPDATE:
298: return getUpdate();
299: case WfsPackage.TRANSACTION_TYPE__DELETE:
300: return getDelete();
301: case WfsPackage.TRANSACTION_TYPE__NATIVE:
302: return getNative();
303: case WfsPackage.TRANSACTION_TYPE__RELEASE_ACTION:
304: return getReleaseAction();
305: }
306: return super .eGet(featureID, resolve, coreType);
307: }
308:
309: /**
310: * <!-- begin-user-doc -->
311: * <!-- end-user-doc -->
312: * @generated
313: */
314: public void eSet(int featureID, Object newValue) {
315: switch (featureID) {
316: case WfsPackage.TRANSACTION_TYPE__LOCK_ID:
317: setLockId((String) newValue);
318: return;
319: case WfsPackage.TRANSACTION_TYPE__GROUP:
320: ((FeatureMap.Internal) getGroup()).set(newValue);
321: return;
322: case WfsPackage.TRANSACTION_TYPE__INSERT:
323: getInsert().clear();
324: getInsert().addAll((Collection) newValue);
325: return;
326: case WfsPackage.TRANSACTION_TYPE__UPDATE:
327: getUpdate().clear();
328: getUpdate().addAll((Collection) newValue);
329: return;
330: case WfsPackage.TRANSACTION_TYPE__DELETE:
331: getDelete().clear();
332: getDelete().addAll((Collection) newValue);
333: return;
334: case WfsPackage.TRANSACTION_TYPE__NATIVE:
335: getNative().clear();
336: getNative().addAll((Collection) newValue);
337: return;
338: case WfsPackage.TRANSACTION_TYPE__RELEASE_ACTION:
339: setReleaseAction((AllSomeType) newValue);
340: return;
341: }
342: super .eSet(featureID, newValue);
343: }
344:
345: /**
346: * <!-- begin-user-doc -->
347: * <!-- end-user-doc -->
348: * @generated
349: */
350: public void eUnset(int featureID) {
351: switch (featureID) {
352: case WfsPackage.TRANSACTION_TYPE__LOCK_ID:
353: setLockId(LOCK_ID_EDEFAULT);
354: return;
355: case WfsPackage.TRANSACTION_TYPE__GROUP:
356: getGroup().clear();
357: return;
358: case WfsPackage.TRANSACTION_TYPE__INSERT:
359: getInsert().clear();
360: return;
361: case WfsPackage.TRANSACTION_TYPE__UPDATE:
362: getUpdate().clear();
363: return;
364: case WfsPackage.TRANSACTION_TYPE__DELETE:
365: getDelete().clear();
366: return;
367: case WfsPackage.TRANSACTION_TYPE__NATIVE:
368: getNative().clear();
369: return;
370: case WfsPackage.TRANSACTION_TYPE__RELEASE_ACTION:
371: unsetReleaseAction();
372: return;
373: }
374: super .eUnset(featureID);
375: }
376:
377: /**
378: * <!-- begin-user-doc -->
379: * <!-- end-user-doc -->
380: * @generated
381: */
382: public boolean eIsSet(int featureID) {
383: switch (featureID) {
384: case WfsPackage.TRANSACTION_TYPE__LOCK_ID:
385: return LOCK_ID_EDEFAULT == null ? lockId != null
386: : !LOCK_ID_EDEFAULT.equals(lockId);
387: case WfsPackage.TRANSACTION_TYPE__GROUP:
388: return group != null && !group.isEmpty();
389: case WfsPackage.TRANSACTION_TYPE__INSERT:
390: return !getInsert().isEmpty();
391: case WfsPackage.TRANSACTION_TYPE__UPDATE:
392: return !getUpdate().isEmpty();
393: case WfsPackage.TRANSACTION_TYPE__DELETE:
394: return !getDelete().isEmpty();
395: case WfsPackage.TRANSACTION_TYPE__NATIVE:
396: return !getNative().isEmpty();
397: case WfsPackage.TRANSACTION_TYPE__RELEASE_ACTION:
398: return isSetReleaseAction();
399: }
400: return super .eIsSet(featureID);
401: }
402:
403: /**
404: * <!-- begin-user-doc -->
405: * <!-- end-user-doc -->
406: * @generated
407: */
408: public String toString() {
409: if (eIsProxy())
410: return super .toString();
411:
412: StringBuffer result = new StringBuffer(super .toString());
413: result.append(" (lockId: ");
414: result.append(lockId);
415: result.append(", group: ");
416: result.append(group);
417: result.append(", releaseAction: ");
418: if (releaseActionESet)
419: result.append(releaseAction);
420: else
421: result.append("<unset>");
422: result.append(')');
423: return result.toString();
424: }
425:
426: } //TransactionTypeImpl
|