summaryrefslogtreecommitdiffstats
path: root/sdo-java/branches/sdo-1.1.1-incubating/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectBase.java
blob: 34216bc1e21b7b60061d1fa593d1e9650c87bcd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
/**
 *
 *  Licensed to the Apache Software Foundation (ASF) under one
 *  or more contributor license agreements.  See the NOTICE file
 *  distributed with this work for additional information
 *  regarding copyright ownership.  The ASF licenses this file
 *  to you under the Apache License, Version 2.0 (the
 *  "License"); you may not use this file except in compliance
 *  with the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed under the License is distributed on an
 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *  KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations
 *  under the License.
 */
package org.apache.tuscany.sdo.impl;


import java.util.List;

import org.apache.tuscany.sdo.SDOFactory;
import org.apache.tuscany.sdo.helper.HelperContextImpl;
import org.apache.tuscany.sdo.util.BasicSequence;
import org.apache.tuscany.sdo.util.DataObjectUtil;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.EStructuralFeature.Setting;
import org.eclipse.emf.ecore.EStructuralFeature.Internal.SettingDelegate;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.BasicFeatureMap;
import org.eclipse.emf.ecore.util.EDataTypeEList;
import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.EObjectEList;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.EObjectWithInverseEList;
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.InternalEList;

import commonj.sdo.Property;
import commonj.sdo.Sequence;
import commonj.sdo.Type;


/**
 * Base implementation of the SDO DataObject interface. Used as base class for generated (static) SDO classes
 */
public abstract class DataObjectBase extends ExtensibleDataObjectImpl
{
  
  protected int OPPOSITE_FEATURE_BASE = EOPPOSITE_FEATURE_BASE; 
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  // Following methods should be proposed SPI for generated subclasses to use
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

  protected boolean isNotifying()
  {
    return changeRecorder != null;
  }
  
  protected interface ChangeKind
  {
    int SET = Notification.SET;
    int UNSET = Notification.UNSET;
    int RESOLVE = Notification.RESOLVE;
  }

  /**
   * notify methods for types: boolean, byte, char, double, float, int, long, short, and Object 
   */
  
  protected void notify(int changeKind, int property, boolean oldBooleanValue, boolean newBooleanValue)
  {
  	eNotify(new ENotificationImpl(this, Notification.SET, property, oldBooleanValue, newBooleanValue));
  }
  
  protected void notify(int changeKind, int property, boolean oldBooleanValue, boolean newBooleanValue, boolean isSetChange)
  {
  	eNotify(new ENotificationImpl(this, Notification.SET, property, oldBooleanValue, newBooleanValue, isSetChange));
  }
  
  protected void notify(int changeKind, int property, byte oldByteValue, byte newByteValue)
  {
  	eNotify(new ENotificationImpl(this, Notification.SET, property, oldByteValue, newByteValue));
  }
  
  protected void notify(int changeKind, int property, byte oldByteValue, byte newByteValue, boolean isSetChange)
  {
  	eNotify(new ENotificationImpl(this, Notification.SET, property, oldByteValue, newByteValue, isSetChange));
  }
  
  protected void notify(int changeKind, int property, char oldCharValue, char newCharValue)
  {
  	eNotify(new ENotificationImpl(this, Notification.SET, property, oldCharValue, newCharValue));
  }
  
  protected void notify(int changeKind, int property, char oldCharValue, char newCharValue, boolean isSetChange)
  {
  	eNotify(new ENotificationImpl(this, Notification.SET, property, oldCharValue, newCharValue, isSetChange));
  }
  
  protected void notify(int changeKind, int property, double oldDoubleValue, double newDoubleValue)
  {
    eNotify(new ENotificationImpl(this, Notification.SET, property, oldDoubleValue, newDoubleValue));
  }
  
  protected void notify(int changeKind, int property, double oldDoubleValue, double newDoubleValue, boolean isSetChange)
  {
    eNotify(new ENotificationImpl(this, Notification.SET, property, oldDoubleValue, newDoubleValue, isSetChange));
  }
  
  protected void notify(int changeKind, int property, float oldFloatValue, float newFloatValue)
  {
    eNotify(new ENotificationImpl(this, Notification.SET, property, oldFloatValue, newFloatValue));
  }
  
  protected void notify(int changeKind, int property, float oldFloatValue, float newFloatValue, boolean isSetChange)
  {
    eNotify(new ENotificationImpl(this, Notification.SET, property, oldFloatValue, newFloatValue, isSetChange));
  }
  
  protected void notify(int changeKind, int property, int oldIntValue, int newIntValue)
  {
  	eNotify(new ENotificationImpl(this, Notification.SET, property, oldIntValue, newIntValue));
  }
  
  protected void notify(int changeKind, int property, int oldIntValue, int newIntValue, boolean isSetChange)
  {
  	eNotify(new ENotificationImpl(this, Notification.SET, property, oldIntValue, newIntValue, isSetChange));
  }
  
  protected void notify(int changeKind, int property, long oldLongValue, long newLongValue)
  {
  	eNotify(new ENotificationImpl(this, Notification.SET, property, oldLongValue, newLongValue));
  }
  
  protected void notify(int changeKind, int property, long oldLongValue, long newLongValue, boolean isSetChange)
  {
  	eNotify(new ENotificationImpl(this, Notification.SET, property, oldLongValue, newLongValue, isSetChange));
  }
  
  protected void notify(int changeKind, int property, short oldShortValue, short newShortValue)
  {
  	eNotify(new ENotificationImpl(this, Notification.SET, property, oldShortValue, newShortValue));
  }
  
  protected void notify(int changeKind, int property, short oldShortValue, short newShortValue, boolean isSetChange)
  {
  	eNotify(new ENotificationImpl(this, Notification.SET, property, oldShortValue, newShortValue, isSetChange));
  }
  
  protected void notify(int changeKind, int property, Object oldValue, Object newValue)
  {
  	eNotify(new ENotificationImpl(this, Notification.SET, property, oldValue, newValue));
  }
  
  protected void notify(int changeKind, int property, Object oldValue, Object newValue, boolean isSetChange)
  {
  	eNotify(new ENotificationImpl(this, Notification.SET, property, oldValue, newValue, isSetChange));
  }
  
  public interface ListKind
  {
    int CONTAINMENT = 0;
    int CONTAINMENT_UNSETTABLE = 1;
    int CONTAINMENT_RESOLVING = 2;
    int CONTAINMENT_RESOLVING_UNSETTABLE = 3;
    int CONTAINMENT_INVERSE = 4;
    int CONTAINMENT_INVERSE_UNSETTABLE = 5;
    int CONTAINMENT_INVERSE_RESOLVING = 6;
    int CONTAINMENT_INVERSE_RESOLVING_UNSETTABLE = 7;

    int NONCONTAINMENT = 8;
    int NONCONTAINMENT_UNSETTABLE = 9;
    int NONCONTAINMENT_RESOLVING = 10;
    int NONCONTAINMENT_RESOLVING_UNSETTABLE = 11;
    int NONCONTAINMENT_INVERSE = 12;
    int NONCONTAINMENT_INVERSE_UNSETTABLE = 13;
    int NONCONTAINMENT_MANYINVERSE = 14;
    int NONCONTAINMENT_MANYINVERSE_UNSETTABLE = 15;
    int NONCONTAINMENT_INVERSE_RESOLVING = 16;
    int NONCONTAINMENT_INVERSE_RESOLVING_UNSETTABLE = 17;
    int NONCONTAINMENT_MANYINVERSE_RESOLVING = 18;
    int NONCONTAINMENT_MANYINVERSE_RESOLVING_UNSETTABLE = 19;
    
    int DATATYPE = 20;
    int DATATYPE_UNSETTABLE = 21;
    int DATATYPE_UNIQUE = 22;
    int DATATYPE_UNIQUE_UNSETTABLE = 23;
    
    int BASIC = 24;
  }
  
  /**
   * @deprecated
   */
  protected List createPropertyList(int listKind, Class dataClass, int property)
  {
    return createPropertyList(listKind, dataClass, property, 0);
  }
  
  protected List createPropertyList(int listKind, Class dataClass, int property, int reverseProperty)
  {
    switch (listKind)
    {
      case ListKind.CONTAINMENT:
        return new EObjectContainmentEList(dataClass, this, property);
      case ListKind.CONTAINMENT_INVERSE_RESOLVING_UNSETTABLE:
        return new EObjectContainmentWithInverseEList.Unsettable.Resolving(dataClass, this, property, reverseProperty);
      case ListKind.CONTAINMENT_INVERSE_RESOLVING:
        return new EObjectContainmentWithInverseEList.Resolving(dataClass, this, property, reverseProperty);
      case ListKind.CONTAINMENT_INVERSE_UNSETTABLE:
        return new EObjectContainmentWithInverseEList.Unsettable(dataClass, this, property, reverseProperty);
      case ListKind.CONTAINMENT_INVERSE:
        return new EObjectContainmentWithInverseEList(dataClass, this, property, reverseProperty);
      case ListKind.CONTAINMENT_RESOLVING_UNSETTABLE:
        return new EObjectContainmentEList.Unsettable.Resolving(dataClass, this, property);
      case ListKind.CONTAINMENT_RESOLVING:
        return new EObjectContainmentEList.Resolving(dataClass, this, property);
      case ListKind.CONTAINMENT_UNSETTABLE:
        return new EObjectContainmentEList.Unsettable(dataClass, this, property);
      case ListKind.NONCONTAINMENT_MANYINVERSE_RESOLVING_UNSETTABLE:
        return new EObjectWithInverseResolvingEList.Unsettable.ManyInverse(dataClass, this, property, reverseProperty);
      case ListKind.NONCONTAINMENT_MANYINVERSE_RESOLVING:
        return new EObjectWithInverseResolvingEList.ManyInverse(dataClass, this, property, reverseProperty);
      case ListKind.NONCONTAINMENT_INVERSE_RESOLVING_UNSETTABLE:
        return new EObjectWithInverseResolvingEList.Unsettable(dataClass, this, property, reverseProperty);
      case ListKind.NONCONTAINMENT_INVERSE_RESOLVING:
        return new EObjectWithInverseResolvingEList(dataClass, this, property, reverseProperty);
      case ListKind.NONCONTAINMENT_MANYINVERSE_UNSETTABLE:
        return new EObjectWithInverseEList.Unsettable.ManyInverse(dataClass, this, property, reverseProperty);
      case ListKind.NONCONTAINMENT_MANYINVERSE:
        return new EObjectWithInverseEList.ManyInverse(dataClass, this, property, reverseProperty);
      case ListKind.NONCONTAINMENT_INVERSE_UNSETTABLE:
        return new EObjectWithInverseEList.Unsettable(dataClass, this, property, reverseProperty);
      case ListKind.NONCONTAINMENT_INVERSE:
        return new EObjectWithInverseEList(dataClass, this, property, reverseProperty);
      case ListKind.NONCONTAINMENT_RESOLVING_UNSETTABLE:
        return new EObjectResolvingEList.Unsettable(dataClass, this, property);
      case ListKind.NONCONTAINMENT_RESOLVING:
        return new EObjectResolvingEList(dataClass, this, property);
      case ListKind.NONCONTAINMENT_UNSETTABLE:
        return new EObjectEList.Unsettable(dataClass, this, property);
      case ListKind.NONCONTAINMENT:
        return new EObjectEList(dataClass, this, property);
      case ListKind.DATATYPE_UNIQUE_UNSETTABLE:
        return new EDataTypeUniqueEList.Unsettable(dataClass, this, property);
      case ListKind.DATATYPE_UNIQUE:
        return new EDataTypeUniqueEList(dataClass, this, property);
      case ListKind.DATATYPE_UNSETTABLE:
        return new EDataTypeEList.Unsettable(dataClass, this, property);
      case ListKind.DATATYPE:
        return new EDataTypeEList(dataClass, this, property);
    }
    return null;
  }
  
  protected BasicSequence createSequence(int property) {
    return new BasicSequence(new BasicFeatureMap(this, property));
  }
  
  protected Sequence createSequence(Sequence sequence, Type type, int propertyIndex) {
    return new BasicSequence((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)sequence).featureMap().list(((EClass)type).getEStructuralFeature(propertyIndex)));
  }
  
  protected void createChangeSummary(int property) {
    ChangeSummaryImpl changeSummary = (ChangeSummaryImpl)SDOFactory.eINSTANCE.createChangeSummary();
    set(property, changeSummary);
    changeSummary.setDataObject(this);
  }
  
  /*
   * get the value of the type's property at propertyIndex via the sequence  
   * @param seq
   * @param type
   * @param propertyIndex
   * @return
   */
  protected Object get(Sequence seq, Type type, int propertyIndex) {
    return ((FeatureMap.Internal.Wrapper)seq).featureMap().get(((EClass)type).getEStructuralFeature(propertyIndex), true);
  }
  
  protected List getList(Sequence seq, Type type, int propertyIndex) {
    return ((FeatureMap.Internal.Wrapper)seq).featureMap().list(((EClass)type).getEStructuralFeature(propertyIndex));
  }
  
  protected void set(Sequence seq, Type type, int propertyIndex, Object newValue) {
    ((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)seq).featureMap()).set(((EClass)type).getEStructuralFeature(propertyIndex), newValue);
  }
  
  protected void unset(Sequence seq, Type type, int propertyIndex) {
    ((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)seq).featureMap()).clear(((EClass)type).getEStructuralFeature(propertyIndex));
     
  }
  protected boolean isSet(Sequence seq, Type type, int propertyIndex) {
    return !((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)seq).featureMap()).isEmpty(((EClass)type).getEStructuralFeature(propertyIndex));     
  }
  
  protected boolean isSequenceEmpty(Sequence sequence) {
    return ((FeatureMap.Internal.Wrapper)sequence).featureMap().isEmpty();  
  }
  
  protected void setSequence(Sequence seq, Object newValue) {
    ((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)seq).featureMap()).set(newValue);
  }
  
  protected void unsetSequence(Sequence seq) {
    ((FeatureMap.Internal.Wrapper)seq).featureMap().clear();
  }

  protected ChangeContext basicAdd(Sequence seq, Type type, int propertyIndex, Object newValue, ChangeContext changeContext) {
    ChangeContextImpl changeContextImpl = (ChangeContextImpl)changeContext;
    changeContextImpl.notificationChain = ((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)seq).featureMap()).basicAdd(((EClass)type).getEStructuralFeature(propertyIndex), newValue, changeContextImpl.notificationChain);
    return changeContextImpl;
  }
  
  private ChangeContextImpl initializeChangeContext(ChangeContext changeContext)
  {
    ChangeContextImpl changeContextImpl;
    if (changeContext == null) 
    {
      changeContextImpl = new ChangeContextImpl(null);
    } else 
    {
      changeContextImpl = (ChangeContextImpl)changeContext;
    }
    return changeContextImpl;
  }
  
  protected interface ChangeContext {}

  
  protected ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext)
  {
    ChangeContextImpl changeContextImpl = initializeChangeContext(changeContext);
    changeContextImpl.notificationChain = super.eInverseRemove((InternalEObject)otherEnd, propertyIndex, changeContextImpl.notificationChain);
    return changeContextImpl;
  }
  
  protected ChangeContext inverseAdd(Object otherEnd, int propertyIndex, ChangeContext changeContext)
  {
    ChangeContextImpl changeContextImpl = initializeChangeContext(changeContext);
    changeContextImpl.notificationChain = super.eInverseAdd((InternalEObject)otherEnd, propertyIndex, changeContextImpl.notificationChain);
    return changeContextImpl;
  }

  protected ChangeContext inverseRemove(Object thisEnd, Object otherEnd, int propertyIndex, Class baseClass, ChangeContext changeContext)
  {
    ChangeContextImpl changeContextImpl = initializeChangeContext(changeContext);
    changeContextImpl.notificationChain = ((InternalEObject)thisEnd).eInverseRemove((InternalEObject)otherEnd, propertyIndex, baseClass, changeContextImpl.notificationChain);
    return changeContextImpl;
  }

  protected ChangeContext inverseAdd(Object thisEnd, Object otherEnd, int propertyIndex, Class baseClass, ChangeContext changeContext)
  {
    ChangeContextImpl changeContextImpl = initializeChangeContext(changeContext);
    changeContextImpl.notificationChain = ((InternalEObject)thisEnd).eInverseAdd((InternalEObject)otherEnd, propertyIndex, baseClass, changeContextImpl.notificationChain);
    return changeContextImpl;
  }
  
  protected ChangeContext addNotification(Object notifier, int eventType, int featureID, Object oldValue, Object newValue, boolean isSetChanged, ChangeContext changeContext) 
  {
    ENotificationImpl notification = new ENotificationImpl((InternalEObject)notifier, eventType, featureID, oldValue, newValue, isSetChanged );
    ChangeContextImpl changeContextImpl = initializeChangeContext(changeContext);
    if (changeContextImpl.notificationChain == null) changeContextImpl.notificationChain = notification; else changeContextImpl.notificationChain.add(notification);
    return changeContextImpl;
  }
  
  protected ChangeContext addNotification(Object notifier, int eventType, int featureID, Object oldValue, Object newValue, ChangeContext changeContext) 
  {
    ENotificationImpl notification = new ENotificationImpl((InternalEObject)notifier, eventType, featureID, oldValue, newValue);
    ChangeContextImpl changeContextImpl = initializeChangeContext(changeContext);
    if (changeContextImpl.notificationChain == null) changeContextImpl.notificationChain = notification; else changeContextImpl.notificationChain.add(notification);
    return changeContextImpl;
  }
  
  protected ChangeContext removeFromList(List propertyList, Object objectToRemove, ChangeContext changeContext)
  {
    ChangeContextImpl changeContextImpl = initializeChangeContext(changeContext);
    changeContextImpl.notificationChain = ((InternalEList)propertyList).basicRemove(objectToRemove, changeContextImpl.notificationChain); 
    return changeContextImpl;
  }
  
  protected ChangeContext removeFromSequence(Sequence sequence, Object otherEnd, ChangeContext changeContext) 
  {
    ChangeContextImpl changeContextImpl = initializeChangeContext(changeContext);
    changeContextImpl.notificationChain = ((InternalEList)((FeatureMap.Internal.Wrapper)sequence).featureMap()).basicRemove(otherEnd, changeContextImpl.notificationChain);
    return changeContextImpl;
  }
  
  protected void dispatch(ChangeContext changeContext)
  {
    ChangeContextImpl changeContextImpl = initializeChangeContext(changeContext);
    if (changeContextImpl.notificationChain != null)
    {
      changeContextImpl.notificationChain.dispatch();
    }
  }

  protected boolean isProxy() // FB TODO : regen models and then remove this method
  {
    return eIsProxy();
  }
  
  protected boolean isProxy(Object object)
  {
    return ((EObject)object).eIsProxy();
  }
  
  protected Object resolveProxy(Object proxy)
  {
    Resource resource = this.eResource();
    ResourceSet resourceSet = resource != null ? resource.getResourceSet() : null;
    if (resourceSet != null) return EcoreUtil.resolve((EObject)proxy, resourceSet);
      
    URI proxyURI = ((InternalEObject)proxy).eProxyURI();
    if (proxyURI != null)
    {
      EPackage ePackage = HelperContextImpl.getBuiltInModelRegistry().getEPackage(proxyURI.trimFragment().toString());
      if (ePackage != null)
      {
        resource = ePackage.eResource();
        if (resource != null)
        {
          return resource.getEObject(proxyURI.fragment().toString());
        }
      }
    }
    return null;
  }
  

  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  // Following methods override EMF methods to work with pure SDO generated subclasses
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  
  public EClass eStaticClass()
  {
    return (EClass)getStaticType();
  }
  
  public Type getStaticType() // must be overridden in subclasses
  {
    throw new UnsupportedOperationException();
  }
  
  public int eStaticFeatureCount()
  {
    return getStaticPropertyCount();  
  }
  
  public int getStaticPropertyCount() // must be overridden in subclasses
  {
    throw new UnsupportedOperationException();
  }
  
  protected int internalConvertIndex(int internalIndex)
  {
    return internalIndex;
  }
  
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    Object result = get(internalConvertIndex(featureID), resolve);
    if (coreType)
    {
      if (result instanceof FeatureMap.Internal.Wrapper) result = ((FeatureMap.Internal.Wrapper)result).featureMap();
    }
    return result;
  }

  public void eSet(int featureID, Object newValue)
  {
    set(internalConvertIndex(featureID), newValue);
  } 

  public void eUnset(int featureID)
  {
    unset(internalConvertIndex(featureID));
  }
  
  public boolean eIsSet(int featureID)
  {
    return isSet(internalConvertIndex(featureID));
  }
  
  private class ChangeContextImpl implements ChangeContext
  {
    protected NotificationChain notificationChain;
    public ChangeContextImpl(NotificationChain notificationChain) {
      this.notificationChain = notificationChain;
    }
  }
  
  //FB TODO ... review this? ... what about eInverseAdd?
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int internalIndex, NotificationChain msgs)
  {
    return ((ChangeContextImpl)inverseRemove(otherEnd, internalConvertIndex(internalIndex), new ChangeContextImpl(msgs))).notificationChain;
  }
  
  public String toString()
  {
    StringBuffer result = new StringBuffer(getClass().getName());
    result.append('@');
    result.append(Integer.toHexString(hashCode()));
    if (eIsProxy())
    {
      result.append(" (proxyURI: ");
      result.append(eProxyURI());
      result.append(')');
    }
    return result.toString();
  }
  
} //DataObjectBase