001: /**
002: * <copyright>
003: * </copyright>
004: *
005: * $Id: QueryTypeImpl.java 7522 2007-09-12 22:00:10Z saul.farber $
006: */package net.opengis.wfs.impl;
007:
008: import java.net.URI;
009:
010: import java.util.Collection;
011: import java.util.List;
012:
013: import net.opengis.wfs.QueryType;
014: import net.opengis.wfs.WfsPackage;
015:
016: import org.eclipse.emf.common.notify.Notification;
017: import org.eclipse.emf.common.notify.NotificationChain;
018:
019: import org.eclipse.emf.common.util.EList;
020:
021: import org.eclipse.emf.ecore.EClass;
022: import org.eclipse.emf.ecore.InternalEObject;
023:
024: import org.eclipse.emf.ecore.impl.ENotificationImpl;
025: import org.eclipse.emf.ecore.impl.EObjectImpl;
026:
027: import org.eclipse.emf.ecore.util.BasicFeatureMap;
028: import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;
029: import org.eclipse.emf.ecore.util.FeatureMap;
030: import org.eclipse.emf.ecore.util.InternalEList;
031:
032: import org.opengis.filter.Filter;
033:
034: import org.opengis.filter.expression.Function;
035:
036: import org.opengis.filter.sort.SortBy;
037:
038: /**
039: * <!-- begin-user-doc -->
040: * An implementation of the model object '<em><b>Query Type</b></em>'.
041: * <!-- end-user-doc -->
042: * <p>
043: * The following features are implemented:
044: * <ul>
045: * <li>{@link net.opengis.wfs.impl.QueryTypeImpl#getGroup <em>Group</em>}</li>
046: * <li>{@link net.opengis.wfs.impl.QueryTypeImpl#getPropertyName <em>Property Name</em>}</li>
047: * <li>{@link net.opengis.wfs.impl.QueryTypeImpl#getXlinkPropertyName <em>Xlink Property Name</em>}</li>
048: * <li>{@link net.opengis.wfs.impl.QueryTypeImpl#getFunction <em>Function</em>}</li>
049: * <li>{@link net.opengis.wfs.impl.QueryTypeImpl#getFilter <em>Filter</em>}</li>
050: * <li>{@link net.opengis.wfs.impl.QueryTypeImpl#getSortBy <em>Sort By</em>}</li>
051: * <li>{@link net.opengis.wfs.impl.QueryTypeImpl#getFeatureVersion <em>Feature Version</em>}</li>
052: * <li>{@link net.opengis.wfs.impl.QueryTypeImpl#getHandle <em>Handle</em>}</li>
053: * <li>{@link net.opengis.wfs.impl.QueryTypeImpl#getSrsName <em>Srs Name</em>}</li>
054: * <li>{@link net.opengis.wfs.impl.QueryTypeImpl#getTypeName <em>Type Name</em>}</li>
055: * </ul>
056: * </p>
057: *
058: * @generated
059: */
060: public class QueryTypeImpl extends EObjectImpl implements QueryType {
061: /**
062: * The cached value of the '{@link #getGroup() <em>Group</em>}' attribute list.
063: * <!-- begin-user-doc -->
064: * <!-- end-user-doc -->
065: * @see #getGroup()
066: * @generated
067: * @ordered
068: */
069: protected FeatureMap group;
070:
071: /**
072: * The cached value of the '{@link #getPropertyName() <em>Property Name</em>}' attribute list.
073: * <!-- begin-user-doc -->
074: * <!-- end-user-doc -->
075: * @see #getPropertyName()
076: * @generated
077: * @ordered
078: */
079: protected EList propertyName;
080:
081: /**
082: * The cached value of the '{@link #getFunction() <em>Function</em>}' attribute list.
083: * <!-- begin-user-doc -->
084: * <!-- end-user-doc -->
085: * @see #getFunction()
086: * @generated
087: * @ordered
088: */
089: protected EList function;
090:
091: /**
092: * The default value of the '{@link #getFilter() <em>Filter</em>}' attribute.
093: * <!-- begin-user-doc -->
094: * <!-- end-user-doc -->
095: * @see #getFilter()
096: * @generated
097: * @ordered
098: */
099: protected static final Filter FILTER_EDEFAULT = null;
100:
101: /**
102: * The cached value of the '{@link #getFilter() <em>Filter</em>}' attribute.
103: * <!-- begin-user-doc -->
104: * <!-- end-user-doc -->
105: * @see #getFilter()
106: * @generated
107: * @ordered
108: */
109: protected Filter filter = FILTER_EDEFAULT;
110:
111: /**
112: * The cached value of the '{@link #getSortBy() <em>Sort By</em>}' attribute list.
113: * <!-- begin-user-doc -->
114: * <!-- end-user-doc -->
115: * @see #getSortBy()
116: * @generated
117: * @ordered
118: */
119: protected EList sortBy;
120:
121: /**
122: * The default value of the '{@link #getFeatureVersion() <em>Feature Version</em>}' attribute.
123: * <!-- begin-user-doc -->
124: * <!-- end-user-doc -->
125: * @see #getFeatureVersion()
126: * @generated
127: * @ordered
128: */
129: protected static final String FEATURE_VERSION_EDEFAULT = null;
130:
131: /**
132: * The cached value of the '{@link #getFeatureVersion() <em>Feature Version</em>}' attribute.
133: * <!-- begin-user-doc -->
134: * <!-- end-user-doc -->
135: * @see #getFeatureVersion()
136: * @generated
137: * @ordered
138: */
139: protected String featureVersion = FEATURE_VERSION_EDEFAULT;
140:
141: /**
142: * The default value of the '{@link #getHandle() <em>Handle</em>}' attribute.
143: * <!-- begin-user-doc -->
144: * <!-- end-user-doc -->
145: * @see #getHandle()
146: * @generated
147: * @ordered
148: */
149: protected static final String HANDLE_EDEFAULT = null;
150:
151: /**
152: * The cached value of the '{@link #getHandle() <em>Handle</em>}' attribute.
153: * <!-- begin-user-doc -->
154: * <!-- end-user-doc -->
155: * @see #getHandle()
156: * @generated
157: * @ordered
158: */
159: protected String handle = HANDLE_EDEFAULT;
160:
161: /**
162: * The default value of the '{@link #getSrsName() <em>Srs Name</em>}' attribute.
163: * <!-- begin-user-doc -->
164: * <!-- end-user-doc -->
165: * @see #getSrsName()
166: * @generated
167: * @ordered
168: */
169: protected static final URI SRS_NAME_EDEFAULT = null;
170:
171: /**
172: * The cached value of the '{@link #getSrsName() <em>Srs Name</em>}' attribute.
173: * <!-- begin-user-doc -->
174: * <!-- end-user-doc -->
175: * @see #getSrsName()
176: * @generated
177: * @ordered
178: */
179: protected URI srsName = SRS_NAME_EDEFAULT;
180:
181: /**
182: * The default value of the '{@link #getTypeName() <em>Type Name</em>}' attribute.
183: * <!-- begin-user-doc -->
184: * <!-- end-user-doc -->
185: * @see #getTypeName()
186: * @generated
187: * @ordered
188: */
189: protected static final List TYPE_NAME_EDEFAULT = null;
190:
191: /**
192: * The cached value of the '{@link #getTypeName() <em>Type Name</em>}' attribute.
193: * <!-- begin-user-doc -->
194: * <!-- end-user-doc -->
195: * @see #getTypeName()
196: * @generated
197: * @ordered
198: */
199: protected List typeName = TYPE_NAME_EDEFAULT;
200:
201: /**
202: * <!-- begin-user-doc -->
203: * <!-- end-user-doc -->
204: * @generated
205: */
206: protected QueryTypeImpl() {
207: super ();
208: }
209:
210: /**
211: * <!-- begin-user-doc -->
212: * <!-- end-user-doc -->
213: * @generated
214: */
215: protected EClass eStaticClass() {
216: return WfsPackage.Literals.QUERY_TYPE;
217: }
218:
219: /**
220: * <!-- begin-user-doc -->
221: * <!-- end-user-doc -->
222: * @generated
223: */
224: public FeatureMap getGroup() {
225: if (group == null) {
226: group = new BasicFeatureMap(this ,
227: WfsPackage.QUERY_TYPE__GROUP);
228: }
229: return group;
230: }
231:
232: /**
233: * <!-- begin-user-doc -->
234: * <!-- end-user-doc -->
235: * @generated
236: */
237: public EList getPropertyName() {
238: if (propertyName == null) {
239: propertyName = new EDataTypeUniqueEList(String.class, this ,
240: WfsPackage.QUERY_TYPE__PROPERTY_NAME);
241: }
242: return propertyName;
243: }
244:
245: /**
246: * <!-- begin-user-doc -->
247: * <!-- end-user-doc -->
248: * @generated
249: */
250: public EList getXlinkPropertyName() {
251: return getGroup().list(
252: WfsPackage.Literals.QUERY_TYPE__XLINK_PROPERTY_NAME);
253: }
254:
255: /**
256: * <!-- begin-user-doc -->
257: * <!-- end-user-doc -->
258: * @generated
259: */
260: public EList getFunction() {
261: if (function == null) {
262: function = new EDataTypeUniqueEList(Function.class, this ,
263: WfsPackage.QUERY_TYPE__FUNCTION);
264: }
265: return function;
266: }
267:
268: /**
269: * <!-- begin-user-doc -->
270: * <!-- end-user-doc -->
271: * @generated
272: */
273: public Filter getFilter() {
274: return filter;
275: }
276:
277: /**
278: * <!-- begin-user-doc -->
279: * <!-- end-user-doc -->
280: * @generated
281: */
282: public void setFilter(Filter newFilter) {
283: Filter oldFilter = filter;
284: filter = newFilter;
285: if (eNotificationRequired())
286: eNotify(new ENotificationImpl(this , Notification.SET,
287: WfsPackage.QUERY_TYPE__FILTER, oldFilter, filter));
288: }
289:
290: /**
291: * <!-- begin-user-doc -->
292: * <!-- end-user-doc -->
293: * @generated
294: */
295: public EList getSortBy() {
296: if (sortBy == null) {
297: sortBy = new EDataTypeUniqueEList(SortBy.class, this ,
298: WfsPackage.QUERY_TYPE__SORT_BY);
299: }
300: return sortBy;
301: }
302:
303: /**
304: * <!-- begin-user-doc -->
305: * <!-- end-user-doc -->
306: * @generated
307: */
308: public String getFeatureVersion() {
309: return featureVersion;
310: }
311:
312: /**
313: * <!-- begin-user-doc -->
314: * <!-- end-user-doc -->
315: * @generated
316: */
317: public void setFeatureVersion(String newFeatureVersion) {
318: String oldFeatureVersion = featureVersion;
319: featureVersion = newFeatureVersion;
320: if (eNotificationRequired())
321: eNotify(new ENotificationImpl(this , Notification.SET,
322: WfsPackage.QUERY_TYPE__FEATURE_VERSION,
323: oldFeatureVersion, featureVersion));
324: }
325:
326: /**
327: * <!-- begin-user-doc -->
328: * <!-- end-user-doc -->
329: * @generated
330: */
331: public String getHandle() {
332: return handle;
333: }
334:
335: /**
336: * <!-- begin-user-doc -->
337: * <!-- end-user-doc -->
338: * @generated
339: */
340: public void setHandle(String newHandle) {
341: String oldHandle = handle;
342: handle = newHandle;
343: if (eNotificationRequired())
344: eNotify(new ENotificationImpl(this , Notification.SET,
345: WfsPackage.QUERY_TYPE__HANDLE, oldHandle, handle));
346: }
347:
348: /**
349: * <!-- begin-user-doc -->
350: * <!-- end-user-doc -->
351: * @generated
352: */
353: public URI getSrsName() {
354: return srsName;
355: }
356:
357: /**
358: * <!-- begin-user-doc -->
359: * <!-- end-user-doc -->
360: * @generated
361: */
362: public void setSrsName(URI newSrsName) {
363: URI oldSrsName = srsName;
364: srsName = newSrsName;
365: if (eNotificationRequired())
366: eNotify(new ENotificationImpl(this , Notification.SET,
367: WfsPackage.QUERY_TYPE__SRS_NAME, oldSrsName,
368: srsName));
369: }
370:
371: /**
372: * <!-- begin-user-doc -->
373: * <!-- end-user-doc -->
374: * @generated
375: */
376: public List getTypeName() {
377: return typeName;
378: }
379:
380: /**
381: * <!-- begin-user-doc -->
382: * <!-- end-user-doc -->
383: * @generated
384: */
385: public void setTypeName(List newTypeName) {
386: List oldTypeName = typeName;
387: typeName = newTypeName;
388: if (eNotificationRequired())
389: eNotify(new ENotificationImpl(this , Notification.SET,
390: WfsPackage.QUERY_TYPE__TYPE_NAME, oldTypeName,
391: typeName));
392: }
393:
394: /**
395: * <!-- begin-user-doc -->
396: * <!-- end-user-doc -->
397: * @generated
398: */
399: public NotificationChain eInverseRemove(InternalEObject otherEnd,
400: int featureID, NotificationChain msgs) {
401: switch (featureID) {
402: case WfsPackage.QUERY_TYPE__GROUP:
403: return ((InternalEList) getGroup()).basicRemove(otherEnd,
404: msgs);
405: case WfsPackage.QUERY_TYPE__XLINK_PROPERTY_NAME:
406: return ((InternalEList) getXlinkPropertyName())
407: .basicRemove(otherEnd, msgs);
408: }
409: return super .eInverseRemove(otherEnd, featureID, msgs);
410: }
411:
412: /**
413: * <!-- begin-user-doc -->
414: * <!-- end-user-doc -->
415: * @generated
416: */
417: public Object eGet(int featureID, boolean resolve, boolean coreType) {
418: switch (featureID) {
419: case WfsPackage.QUERY_TYPE__GROUP:
420: if (coreType)
421: return getGroup();
422: return ((FeatureMap.Internal) getGroup()).getWrapper();
423: case WfsPackage.QUERY_TYPE__PROPERTY_NAME:
424: return getPropertyName();
425: case WfsPackage.QUERY_TYPE__XLINK_PROPERTY_NAME:
426: return getXlinkPropertyName();
427: case WfsPackage.QUERY_TYPE__FUNCTION:
428: return getFunction();
429: case WfsPackage.QUERY_TYPE__FILTER:
430: return getFilter();
431: case WfsPackage.QUERY_TYPE__SORT_BY:
432: return getSortBy();
433: case WfsPackage.QUERY_TYPE__FEATURE_VERSION:
434: return getFeatureVersion();
435: case WfsPackage.QUERY_TYPE__HANDLE:
436: return getHandle();
437: case WfsPackage.QUERY_TYPE__SRS_NAME:
438: return getSrsName();
439: case WfsPackage.QUERY_TYPE__TYPE_NAME:
440: return getTypeName();
441: }
442: return super .eGet(featureID, resolve, coreType);
443: }
444:
445: /**
446: * <!-- begin-user-doc -->
447: * <!-- end-user-doc -->
448: * @generated
449: */
450: public void eSet(int featureID, Object newValue) {
451: switch (featureID) {
452: case WfsPackage.QUERY_TYPE__GROUP:
453: ((FeatureMap.Internal) getGroup()).set(newValue);
454: return;
455: case WfsPackage.QUERY_TYPE__PROPERTY_NAME:
456: getPropertyName().clear();
457: getPropertyName().addAll((Collection) newValue);
458: return;
459: case WfsPackage.QUERY_TYPE__XLINK_PROPERTY_NAME:
460: getXlinkPropertyName().clear();
461: getXlinkPropertyName().addAll((Collection) newValue);
462: return;
463: case WfsPackage.QUERY_TYPE__FUNCTION:
464: getFunction().clear();
465: getFunction().addAll((Collection) newValue);
466: return;
467: case WfsPackage.QUERY_TYPE__FILTER:
468: setFilter((Filter) newValue);
469: return;
470: case WfsPackage.QUERY_TYPE__SORT_BY:
471: getSortBy().clear();
472: getSortBy().addAll((Collection) newValue);
473: return;
474: case WfsPackage.QUERY_TYPE__FEATURE_VERSION:
475: setFeatureVersion((String) newValue);
476: return;
477: case WfsPackage.QUERY_TYPE__HANDLE:
478: setHandle((String) newValue);
479: return;
480: case WfsPackage.QUERY_TYPE__SRS_NAME:
481: setSrsName((URI) newValue);
482: return;
483: case WfsPackage.QUERY_TYPE__TYPE_NAME:
484: setTypeName((List) newValue);
485: return;
486: }
487: super .eSet(featureID, newValue);
488: }
489:
490: /**
491: * <!-- begin-user-doc -->
492: * <!-- end-user-doc -->
493: * @generated
494: */
495: public void eUnset(int featureID) {
496: switch (featureID) {
497: case WfsPackage.QUERY_TYPE__GROUP:
498: getGroup().clear();
499: return;
500: case WfsPackage.QUERY_TYPE__PROPERTY_NAME:
501: getPropertyName().clear();
502: return;
503: case WfsPackage.QUERY_TYPE__XLINK_PROPERTY_NAME:
504: getXlinkPropertyName().clear();
505: return;
506: case WfsPackage.QUERY_TYPE__FUNCTION:
507: getFunction().clear();
508: return;
509: case WfsPackage.QUERY_TYPE__FILTER:
510: setFilter(FILTER_EDEFAULT);
511: return;
512: case WfsPackage.QUERY_TYPE__SORT_BY:
513: getSortBy().clear();
514: return;
515: case WfsPackage.QUERY_TYPE__FEATURE_VERSION:
516: setFeatureVersion(FEATURE_VERSION_EDEFAULT);
517: return;
518: case WfsPackage.QUERY_TYPE__HANDLE:
519: setHandle(HANDLE_EDEFAULT);
520: return;
521: case WfsPackage.QUERY_TYPE__SRS_NAME:
522: setSrsName(SRS_NAME_EDEFAULT);
523: return;
524: case WfsPackage.QUERY_TYPE__TYPE_NAME:
525: setTypeName(TYPE_NAME_EDEFAULT);
526: return;
527: }
528: super .eUnset(featureID);
529: }
530:
531: /**
532: * <!-- begin-user-doc -->
533: * <!-- end-user-doc -->
534: * @generated
535: */
536: public boolean eIsSet(int featureID) {
537: switch (featureID) {
538: case WfsPackage.QUERY_TYPE__GROUP:
539: return group != null && !group.isEmpty();
540: case WfsPackage.QUERY_TYPE__PROPERTY_NAME:
541: return propertyName != null && !propertyName.isEmpty();
542: case WfsPackage.QUERY_TYPE__XLINK_PROPERTY_NAME:
543: return !getXlinkPropertyName().isEmpty();
544: case WfsPackage.QUERY_TYPE__FUNCTION:
545: return function != null && !function.isEmpty();
546: case WfsPackage.QUERY_TYPE__FILTER:
547: return FILTER_EDEFAULT == null ? filter != null
548: : !FILTER_EDEFAULT.equals(filter);
549: case WfsPackage.QUERY_TYPE__SORT_BY:
550: return sortBy != null && !sortBy.isEmpty();
551: case WfsPackage.QUERY_TYPE__FEATURE_VERSION:
552: return FEATURE_VERSION_EDEFAULT == null ? featureVersion != null
553: : !FEATURE_VERSION_EDEFAULT.equals(featureVersion);
554: case WfsPackage.QUERY_TYPE__HANDLE:
555: return HANDLE_EDEFAULT == null ? handle != null
556: : !HANDLE_EDEFAULT.equals(handle);
557: case WfsPackage.QUERY_TYPE__SRS_NAME:
558: return SRS_NAME_EDEFAULT == null ? srsName != null
559: : !SRS_NAME_EDEFAULT.equals(srsName);
560: case WfsPackage.QUERY_TYPE__TYPE_NAME:
561: return TYPE_NAME_EDEFAULT == null ? typeName != null
562: : !TYPE_NAME_EDEFAULT.equals(typeName);
563: }
564: return super .eIsSet(featureID);
565: }
566:
567: /**
568: * <!-- begin-user-doc -->
569: * <!-- end-user-doc -->
570: * @generated
571: */
572: public String toString() {
573: if (eIsProxy())
574: return super .toString();
575:
576: StringBuffer result = new StringBuffer(super .toString());
577: result.append(" (group: ");
578: result.append(group);
579: result.append(", propertyName: ");
580: result.append(propertyName);
581: result.append(", function: ");
582: result.append(function);
583: result.append(", filter: ");
584: result.append(filter);
585: result.append(", sortBy: ");
586: result.append(sortBy);
587: result.append(", featureVersion: ");
588: result.append(featureVersion);
589: result.append(", handle: ");
590: result.append(handle);
591: result.append(", srsName: ");
592: result.append(srsName);
593: result.append(", typeName: ");
594: result.append(typeName);
595: result.append(')');
596: return result.toString();
597: }
598:
599: } //QueryTypeImpl
|