1 17 package org.eclipse.emf.ecore.sdo.impl; 18 19 20 import java.io.ObjectStreamException ; 21 import java.math.BigDecimal ; 22 import java.math.BigInteger ; 23 import java.util.Collection ; 24 import java.util.Collections ; 25 import java.util.Date ; 26 import java.util.HashMap ; 27 import java.util.HashSet ; 28 import java.util.Iterator ; 29 import java.util.List ; 30 import java.util.Map ; 31 import java.util.Set ; 32 33 import org.eclipse.emf.common.notify.Notification; 34 import org.eclipse.emf.common.notify.NotificationChain; 35 import org.eclipse.emf.common.util.BasicEList; 36 import org.eclipse.emf.common.util.EList; 37 import org.eclipse.emf.common.util.UniqueEList; 38 import org.eclipse.emf.ecore.EClass; 39 import org.eclipse.emf.ecore.EObject; 40 import org.eclipse.emf.ecore.EStructuralFeature; 41 import org.eclipse.emf.ecore.InternalEObject; 42 import org.eclipse.emf.ecore.change.ChangeDescription; 43 import org.eclipse.emf.ecore.change.FeatureChange; 44 import org.eclipse.emf.ecore.change.impl.ChangeDescriptionImpl; 45 import org.eclipse.emf.ecore.change.util.ChangeRecorder; 46 import org.eclipse.emf.ecore.impl.ENotificationImpl; 47 import org.eclipse.emf.ecore.sdo.EChangeSummary; 48 import org.eclipse.emf.ecore.sdo.EDataGraph; 49 import org.eclipse.emf.ecore.sdo.EProperty; 50 import org.eclipse.emf.ecore.sdo.InternalEDataObject; 51 import org.eclipse.emf.ecore.sdo.SDOFactory; 52 import org.eclipse.emf.ecore.sdo.SDOPackage; 53 import org.eclipse.emf.ecore.sdo.util.BasicESequence; 54 import org.eclipse.emf.ecore.sdo.util.SDOUtil; 55 import org.eclipse.emf.ecore.util.DelegatingFeatureMap; 56 import org.eclipse.emf.ecore.util.EcoreUtil; 57 import org.eclipse.emf.ecore.util.FeatureMapUtil; 58 import org.eclipse.emf.ecore.util.InternalEList; 59 60 import commonj.sdo.ChangeSummary; 61 import commonj.sdo.DataGraph; 62 import commonj.sdo.DataObject; 63 import commonj.sdo.Property; 64 import commonj.sdo.Sequence; 65 import commonj.sdo.Type; 66 67 68 84 public class EChangeSummaryImpl extends ChangeDescriptionImpl implements EChangeSummary, InternalEDataObject 85 { 86 94 protected static final boolean LOGGING_EDEFAULT = false; 95 96 104 protected EDataGraph eDataGraph = null; 105 106 protected ChangeRecorder changeRecorder = null; 107 protected EList cachedObjectsToDetach = null; 108 protected HashMap cachedSDOObjectChanges = new HashMap (); 109 110 115 protected EChangeSummaryImpl() 116 { 117 super(); 118 } 119 120 125 protected EClass eStaticClass() 126 { 127 return SDOPackage.eINSTANCE.getEChangeSummary(); 128 } 129 130 135 public boolean isLogging() 136 { 137 return changeRecorder != null; 138 } 139 140 145 public EDataGraph getEDataGraph() 146 { 147 return eDataGraph; 148 } 149 150 155 public NotificationChain basicSetEDataGraph(EDataGraph newEDataGraph, NotificationChain msgs) 156 { 157 EDataGraph oldEDataGraph = eDataGraph; 158 eDataGraph = newEDataGraph; 159 if (eNotificationRequired()) 160 { 161 ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SDOPackage.ECHANGE_SUMMARY__EDATA_GRAPH, oldEDataGraph, newEDataGraph); 162 if (msgs == null) msgs = notification; else msgs.add(notification); 163 } 164 return msgs; 165 } 166 167 172 public void setEDataGraph(EDataGraph newEDataGraph) 173 { 174 if (newEDataGraph != eDataGraph) 175 { 176 NotificationChain msgs = null; 177 if (eDataGraph != null) 178 msgs = ((InternalEObject)eDataGraph).eInverseRemove(this, SDOPackage.EDATA_GRAPH__ECHANGE_SUMMARY, EDataGraph.class, msgs); 179 if (newEDataGraph != null) 180 msgs = ((InternalEObject)newEDataGraph).eInverseAdd(this, SDOPackage.EDATA_GRAPH__ECHANGE_SUMMARY, EDataGraph.class, msgs); 181 msgs = basicSetEDataGraph(newEDataGraph, msgs); 182 if (msgs != null) msgs.dispatch(); 183 } 184 else if (eNotificationRequired()) 185 eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.ECHANGE_SUMMARY__EDATA_GRAPH, newEDataGraph, newEDataGraph)); 186 } 187 188 193 public void beginLogging() 194 { 195 if (isLogging()) 196 { 197 throw new IllegalStateException ("Already logging"); 198 } 199 200 getObjectsToAttach().clear(); 201 getObjectChanges().clear(); 202 getResourceChanges().clear(); 203 204 oldContainmentInformation = null; 205 changeRecorder = new SDOChangeRecorder(); 206 changeRecorder.beginRecording(Collections.singleton(getEDataGraph().getRootResource())); 207 if (eNotificationRequired()) 208 eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.ECHANGE_SUMMARY__LOGGING, false, true)); 209 } 210 211 216 public void resumeLogging() 217 { 218 if (isLogging()) 219 { 220 throw new IllegalStateException ("Already logging"); 221 } 222 223 oldContainmentInformation = null; 224 225 changeRecorder = new SDOChangeRecorder(); 226 changeRecorder.beginRecording(this, Collections.singleton(getEDataGraph().getRootResource())); 227 228 if (eNotificationRequired()) 229 eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.ECHANGE_SUMMARY__LOGGING, false, true)); 230 } 231 232 protected class SDOChangeRecorder extends ChangeRecorder 233 { 234 public SDOChangeRecorder() 235 { 236 super(); 237 } 238 239 public void beginRecording(ChangeDescription changeDescription, Collection rootObjects) 240 { 241 deletedObjects = null; 242 cachedObjectsToDetach = null; 243 super.beginRecording(changeDescription, rootObjects); 244 } 245 246 protected ChangeDescription createChangeDescription() 247 { 248 return EChangeSummaryImpl.this; 249 } 250 251 protected FeatureChange createFeatureChange(EObject eObject, EStructuralFeature eStructuralFeature, Object value, boolean isSet) 252 { 253 EProperty eProperty = SDOUtil.adaptProperty(eStructuralFeature); 254 if (eProperty.isReadOnly()) 255 { 256 if (SDOUtil.getDataGraph(eObject) != null) 257 { 258 throw 259 new IllegalStateException 260 ("The property '" + eProperty.getName() + "' of type '" + 261 SDOUtil.adaptType(eStructuralFeature.getEContainingClass()).getName() + "' is read only"); 262 } 263 } 264 return SDOFactory.eINSTANCE.createEChangeSummarySetting(eStructuralFeature, value, isSet); 265 } 266 267 protected void consolidateChanges() 268 { 269 deletedObjects = null; 270 cachedObjectsToDetach = null; 271 super.consolidateChanges(); 272 } 273 } 274 275 280 public void endLogging() 281 { 282 if (!isLogging()) 283 { 284 throw new IllegalStateException ("Not currently logging"); 285 } 286 287 changeRecorder.endRecording(); 288 changeRecorder.dispose(); 289 changeRecorder = null; 290 if (eNotificationRequired()) 291 eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.ECHANGE_SUMMARY__LOGGING, true, false)); 292 } 293 294 299 public boolean isCreated(DataObject dataObject) 300 { 301 return getObjectsToDetach().contains(dataObject); 302 } 303 304 309 public boolean isDeleted(DataObject dataObject) 310 { 311 return getDeletedObjects().contains(dataObject); 312 } 313 314 319 public List getOldValues(DataObject dataObject) 320 { 321 List sdoSettings = (List )cachedSDOObjectChanges.get(dataObject); 322 if (sdoSettings != null) 323 { 324 return sdoSettings; 325 } 326 List settings = (List )getObjectChanges().get(dataObject); 327 for (int i = 0; i < settings.size(); i++) 330 { 331 FeatureChange change = (FeatureChange)settings.get(i); 332 EStructuralFeature feature = change.getFeature(); 333 if (FeatureMapUtil.isFeatureMap(feature)) 334 { 335 final List values = (List )change.getValue(); 336 if (sdoSettings == null) 337 { 338 sdoSettings = new BasicEList(settings); 339 } 340 DelegatingFeatureMap featureMap = new DelegatingFeatureMap(((InternalEObject)dataObject), feature) 341 { 342 protected final List theList = values; 343 344 protected List delegateList() 345 { 346 return theList; 347 } 348 }; 349 350 sdoSettings.set(i, SDOFactory.eINSTANCE.createEChangeSummarySetting(feature, new BasicESequence(featureMap), change.isSet())); 352 for (int k = 0; k < featureMap.size(); k++) 354 { 355 EStructuralFeature f = featureMap.getEStructuralFeature(k); 356 sdoSettings.add(SDOFactory.eINSTANCE.createEChangeSummarySetting(f, featureMap.get(f, false), true)); 357 } 358 } 359 } 360 sdoSettings = (sdoSettings != null) ? sdoSettings : settings; 361 cachedSDOObjectChanges.put(dataObject, sdoSettings); 362 return sdoSettings; 363 } 364 365 370 public void summarize() 371 { 372 if (!isLogging()) 373 { 374 throw new IllegalStateException ("Not currently logging"); 375 } 376 377 changeRecorder.summarize(); 378 } 379 380 public boolean isChanged(DataObject dataObject) 381 { 382 return getObjectChanges().containsKey(dataObject) && !isDeleted(dataObject) && !isCreated(dataObject); 383 } 384 385 public Setting getOldValue(DataObject dataObject, Property property) 386 { 387 for (Iterator i = getOldValues(dataObject).iterator(); i.hasNext(); ) 388 { 389 Setting setting = (Setting)i.next(); 390 if (setting.getProperty() == property) 391 { 392 return setting; 393 } 394 } 395 396 return null; 397 } 398 399 public DataObject getOldContainer(DataObject dataObject) 400 { 401 return (DataObject)getOldContainer((EObject)dataObject); 402 } 403 404 public Property getOldContainmentProperty(DataObject dataObject) 405 { 406 return SDOUtil.adaptProperty(getOldContainmentFeature((EObject)dataObject)); 407 } 408 409 public EList getObjectsToDetach() 410 { 411 if (cachedObjectsToDetach == null) 412 { 413 cachedObjectsToDetach = super.getObjectsToDetach(); 414 } 415 return cachedObjectsToDetach; 416 } 417 418 423 public Object get(String path) 424 { 425 return SDOUtil.get(this, path); 426 } 427 428 433 public void set(String path, Object value) 434 { 435 SDOUtil.set(this, path, value); 436 } 437 438 443 public boolean isSet(String path) 444 { 445 return SDOUtil.isSet(this, path); 446 } 447 448 453 public void unset(String path) 454 { 455 SDOUtil.unset(this, path); 456 } 457 458 463 public Object get(int propertyIndex) 464 { 465 return SDOUtil.get(this, propertyIndex); 466 } 467 468 473 public void set(int propertyIndex, Object value) 474 { 475 SDOUtil.set(this, propertyIndex, value); 476 } 477 478 483 public boolean isSet(int propertyIndex) 484 { 485 return SDOUtil.isSet(this, propertyIndex); 486 } 487 488 493 public void unset(int propertyIndex) 494 { 495 SDOUtil.unset(this, propertyIndex); 496 } 497 498 503 public Object get(Property property) 504 { 505 return SDOUtil.get(this, property); 506 } 507 508 513 public void set(Property property, Object value) 514 { 515 SDOUtil.set(this, property, value); 516 } 517 518 523 public boolean isSet(Property property) 524 { 525 return SDOUtil.isSet(this, property); 526 } 527 528 533 public void unset(Property property) 534 { 535 SDOUtil.unset(this, property); 536 } 537 538 543 public DataObject getContainer() 544 { 545 return SDOUtil.getContainer(this); 546 } 547 548 553 public Property getContainmentProperty() 554 { 555 return SDOUtil.getContainmentProperty(this); 556 } 557 558 563 public DataGraph getDataGraph() 564 { 565 return getEDataGraph(); 566 } 567 568 protected Set deletedObjects; 569 570 protected void preApply(boolean reverse) 571 { 572 super.preApply(reverse); 573 deletedObjects = null; 574 } 575 576 protected Set getDeletedObjects() 577 { 578 if (deletedObjects == null) 579 { 580 deletedObjects = new HashSet (); 581 for (Iterator i = EcoreUtil.getAllContents(getObjectsToAttach()); i.hasNext(); ) 582 { 583 deletedObjects.add(i.next()); 584 } 585 } 586 return deletedObjects; 587 } 588 589 594 public EList getChangedDataObjectsGen() 595 { 596 EList result = new UniqueEList.FastCompare(getDeletedObjects()); 597 result.addAll(getObjectsToDetach()); 598 for (Iterator i = getObjectChanges().iterator(); i.hasNext(); ) 599 { 600 Map.Entry entry = (Map.Entry )i.next(); 601 result.add(entry.getKey()); 602 } 603 return result; 604 } 605 606 public List getChangedDataObjects() 607 { 608 return getChangedDataObjectsGen(); 609 } 610 611 616 public Type getType() 617 { 618 return SDOUtil.getType(this); 619 } 620 621 626 public BigDecimal getBigDecimal(String path) 627 { 628 return SDOUtil.getBigDecimal(this, path); 629 } 630 631 636 public BigInteger getBigInteger(String path) 637 { 638 return SDOUtil.getBigInteger(this, path); 639 } 640 641 646 public boolean getBoolean(String path) 647 { 648 return SDOUtil.getBoolean(this, path); 649 } 650 651 656 public byte getByte(String path) 657 { 658 return SDOUtil.getByte(this, path); 659 } 660 661 666 public byte[] getBytes(String path) 667 { 668 return SDOUtil.getBytes(this, path); 669 } 670 671 676 public char getChar(String path) 677 { 678 return SDOUtil.getChar(this, path); 679 } 680 681 686 public DataObject getDataObject(String path) 687 { 688 return SDOUtil.getDataObject(this, path); 689 } 690 691 696 public Date getDate(String path) 697 { 698 return SDOUtil.getDate(this, path); 699 } 700 701 706 public double getDouble(String path) 707 { 708 return SDOUtil.getDouble(this, path); 709 } 710 711 716 public float getFloat(String path) 717 { 718 return SDOUtil.getFloat(this, path); 719 } 720 721 726 public int getInt(String path) 727 { 728 return SDOUtil.getInt(this, path); 729 } 730 731 736 public List getList(String path) 737 { 738 return SDOUtil.getList(this, path); 739 } 740 741 746 public long getLong(String path) 747 { 748 return SDOUtil.getLong(this, path); 749 } 750 751 756 public Sequence getSequence(String path) 757 { 758 return SDOUtil.getSequence(this, path); 759 } 760 761 766 public short getShort(String path) 767 { 768 return SDOUtil.getShort(this, path); 769 } 770 771 776 public String getString(String path) 777 { 778 return SDOUtil.getString(this, path); 779 } 780 781 786 public void setBigDecimal(String path, BigDecimal value) 787 { 788 SDOUtil.setBigDecimal(this, path, value); 789 } 790 791 796 public void setBigInteger(String path, BigInteger value) 797 { 798 SDOUtil.setBigInteger(this, path, value); 799 } 800 801 806 public void setBoolean(String path, boolean value) 807 { 808 SDOUtil.setBoolean(this, path, value); 809 } 810 811 816 public void setByte(String path, byte value) 817 { 818 SDOUtil.setByte(this, path, value); 819 } 820 821 826 public void setBytes(String path, byte[] value) 827 { 828 SDOUtil.setBytes(this, path, value); 829 } 830 831 836 public void setChar(String path, char value) 837 { 838 SDOUtil.setChar(this, path, value); 839 } 840 841 846 public void setDataObject(String path, DataObject value) 847 { 848 SDOUtil.setDataObject(this, path, value); 849 } 850 851 856 public void setDate(String path, Date value) 857 { 858 SDOUtil.setDate(this, path, value); 859 } 860 861 866 public void setDouble(String path, double value) 867 { 868 SDOUtil.setDouble(this, path, value); 869 } 870 871 876 public void setFloat(String path, float value) 877 { 878 SDOUtil.setFloat(this, path, value); 879 } 880 881 886 public void setInt(String path, int value) 887 { 888 SDOUtil.setInt(this, path, value); 889 } 890 891 896 public void setList(String path, List value) 897 { 898 SDOUtil.setList(this, path, value); 899 } 900 901 906 public void setLong(String path, long value) 907 { 908 SDOUtil.setLong(this, path, value); 909 } 910 911 916 public void setShort(String path, short value) 917 { 918 SDOUtil.setShort(this, path, value); 919 } 920 921 926 public void setString(String path, String value) 927 { 928 SDOUtil.setString(this, path, value); 929 } 930 931 936 public BigDecimal getBigDecimal(int propertyIndex) 937 { 938 return SDOUtil.getBigDecimal(this, propertyIndex); 939 } 940 941 946 public BigInteger getBigInteger(int propertyIndex) 947 { 948 return SDOUtil.getBigInteger(this, propertyIndex); 949 } 950 951 956 public boolean getBoolean(int propertyIndex) 957 { 958 return SDOUtil.getBoolean(this, propertyIndex); 959 } 960 961 966 public byte getByte(int propertyIndex) 967 { 968 return SDOUtil.getByte(this, propertyIndex); 969 } 970 971 976 public byte[] getBytes(int propertyIndex) 977 { 978 return SDOUtil.getBytes(this, propertyIndex); 979 } 980 981 986 public char getChar(int propertyIndex) 987 { 988 return SDOUtil.getChar(this, propertyIndex); 989 } 990 991 996 public DataObject getDataObject(int propertyIndex) 997 { 998 return SDOUtil.getDataObject(this, propertyIndex); 999 } 1000 1001 1006 public Date getDate(int propertyIndex) 1007 { 1008 return SDOUtil.getDate(this, propertyIndex); 1009 } 1010 1011 1016 public double getDouble(int propertyIndex) 1017 { 1018 return SDOUtil.getDouble(this, propertyIndex); 1019 } 1020 1021 1026 public float getFloat(int propertyIndex) 1027 { 1028 return SDOUtil.getFloat(this, propertyIndex); 1029 } 1030 1031 1036 public int getInt(int propertyIndex) 1037 { 1038 return SDOUtil.getInt(this, propertyIndex); 1039 } 1040 1041 1046 public List getList(int propertyIndex) 1047 { 1048 return SDOUtil.getList(this, propertyIndex); 1049 } 1050 1051 1056 public long getLong(int propertyIndex) 1057 { 1058 return SDOUtil.getLong(this, propertyIndex); 1059 } 1060 1061 1066 public Sequence getSequence(int propertyIndex) 1067 { 1068 return SDOUtil.getSequence(this, propertyIndex); 1069 } 1070 1071 1076 public short getShort(int propertyIndex) 1077 { 1078 return SDOUtil.getShort(this, propertyIndex); 1079 } 1080 1081 1086 public String getString(int propertyIndex) 1087 { 1088 return SDOUtil.getString(this, propertyIndex); 1089 } 1090 1091 1096 public void setBigDecimal(int propertyIndex, BigDecimal value) 1097 { 1098 SDOUtil.setBigDecimal(this, propertyIndex, value); 1099 } 1100 1101 1106 public void setBigInteger(int propertyIndex, BigInteger value) 1107 { 1108 SDOUtil.setBigInteger(this, propertyIndex, value); 1109 } 1110 1111 1116 public void setBoolean(int propertyIndex, boolean value) 1117 { 1118 SDOUtil.setBoolean(this, propertyIndex, value); 1119 } 1120 1121 1126 public void setByte(int propertyIndex, byte value) 1127 { 1128 SDOUtil.setByte(this, propertyIndex, value); 1129 } 1130 1131 1136 public void setBytes(int propertyIndex, byte[] value) 1137 { 1138 SDOUtil.setBytes(this, propertyIndex, value); 1139 } 1140 1141 1146 public void setChar(int propertyIndex, char value) 1147 { 1148 SDOUtil.setChar(this, propertyIndex, value); 1149 } 1150 1151 1156 public void setDataObject(int propertyIndex, DataObject value) 1157 { 1158 SDOUtil.setDataObject(this, propertyIndex, value); 1159 } 1160 1161 1166 public void setDate(int propertyIndex, Date value) 1167 { 1168 SDOUtil.setDate(this, propertyIndex, value); 1169 } 1170 1171 1176 public void setDouble(int propertyIndex, double value) 1177 { 1178 SDOUtil.setDouble(this, propertyIndex, value); 1179 } 1180 1181 1186 public void setFloat(int propertyIndex, float value) 1187 { 1188 SDOUtil.setFloat(this, propertyIndex, value); 1189 } 1190 1191 1196 public void setInt(int propertyIndex, int value) 1197 { 1198 SDOUtil.setInt(this, propertyIndex, value); 1199 } 1200 1201 1206 public void setList(int propertyIndex, List value) 1207 { 1208 SDOUtil.setList(this, propertyIndex, value); 1209 } 1210 1211 1216 public void setLong(int propertyIndex, long value) 1217 { 1218 SDOUtil.setLong(this, propertyIndex, value); 1219 } 1220 1221 1226 public void setShort(int propertyIndex, short value) 1227 { 1228 SDOUtil.setShort(this, propertyIndex, value); 1229 } 1230 1231 1236 public void setString(int propertyIndex, String value) 1237 { 1238 SDOUtil.setString(this, propertyIndex, value); 1239 } 1240 1241 1246 public BigDecimal getBigDecimal(Property property) 1247 { 1248 return SDOUtil.getBigDecimal(this, property); 1249 } 1250 1251 1256 public BigInteger getBigInteger(Property property) 1257 { 1258 return SDOUtil.getBigInteger(this, property); 1259 } 1260 1261 1266 public boolean getBoolean(Property property) 1267 { 1268 return SDOUtil.getBoolean(this, property); 1269 } 1270 1271 1276 public byte getByte(Property property) 1277 { 1278 return SDOUtil.getByte(this, property); 1279 } 1280 1281 1286 public byte[] getBytes(Property property) 1287 { 1288 return SDOUtil.getBytes(this, property); 1289 } 1290 1291 1296 public char getChar(Property property) 1297 { 1298 return SDOUtil.getChar(this, property); 1299 } 1300 1301 1306 public DataObject getDataObject(Property property) 1307 { 1308 return SDOUtil.getDataObject(this, property); 1309 } 1310 1311 1316 public Date getDate(Property property) 1317 { 1318 return SDOUtil.getDate(this, property); 1319 } 1320 1321 1326 public double getDouble(Property property) 1327 { 1328 return SDOUtil.getDouble(this, property); 1329 } 1330 1331 1336 public float getFloat(Property property) 1337 { 1338 return SDOUtil.getFloat(this, property); 1339 } 1340 1341 1346 public int getInt(Property property) 1347 { 1348 return SDOUtil.getInt(this, property); 1349 } 1350 1351 1356 public List getList(Property property) 1357 { 1358 return SDOUtil.getList(this, property); 1359 } 1360 1361 1366 public long getLong(Property property) 1367 { 1368 return SDOUtil.getLong(this, property); 1369 } 1370 1371 1376 public Sequence getSequence(Property property) 1377 { 1378 return SDOUtil.getSequence(this, property); 1379 } 1380 1381 1386 public short getShort(Property property) 1387 { 1388 return SDOUtil.getShort(this, property); 1389 } 1390 1391 1396 public String getString(Property property) 1397 { 1398 return SDOUtil.getString(this, property); 1399 } 1400 1401 1406 public void setBigDecimal(Property property, BigDecimal value) 1407 { 1408 SDOUtil.setBigDecimal(this, property, value); 1409 } 1410 1411 1416 public void setBigInteger(Property property, BigInteger value) 1417 { 1418 SDOUtil.setBigInteger(this, property, value); 1419 } 1420 1421 1426 public void setBoolean(Property property, boolean value) 1427 { 1428 SDOUtil.setBoolean(this, property, value); 1429 } 1430 1431 1436 public void setByte(Property property, byte value) 1437 { 1438 SDOUtil.setByte(this, property, value); 1439 } 1440 1441 1446 public void setBytes(Property property, byte[] value) 1447 { 1448 SDOUtil.setBytes(this, property, value); 1449 } 1450 1451 1456 public void setChar(Property property, char value) 1457 { 1458 SDOUtil.setChar(this, property, value); 1459 } 1460 1461 1466 public void setDataObject(Property property, DataObject value) 1467 { 1468 SDOUtil.setDataObject(this, property, value); 1469 } 1470 1471 1476 public void setDate(Property property, Date value) 1477 { 1478 SDOUtil.setDate(this, property, value); 1479 } 1480 1481 1486 public void setDouble(Property property, double value) 1487 { 1488 SDOUtil.setDouble(this, property, value); 1489 } 1490 1491 1496 public void setFloat(Property property, float value) 1497 { 1498 SDOUtil.setFloat(this, property, value); 1499 } 1500 1501 1506 public void setInt(Property property, int value) 1507 { 1508 SDOUtil.setInt(this, property, value); 1509 } 1510 1511 1516 public void setList(Property property, List value) 1517 { 1518 SDOUtil.setList(this, property, value); 1519 } 1520 1521 1526 public void setLong(Property property, long value) 1527 { 1528 SDOUtil.setLong(this, property, value); 1529 } 1530 1531 1536 public void setShort(Property property, short value) 1537 { 1538 SDOUtil.setShort(this, property, value); 1539 } 1540 1541 1546 public void setString(Property property, String value) 1547 { 1548 SDOUtil.setString(this, property, value); 1549 } 1550 1551 1556 public DataObject createDataObject(String propertyName) 1557 { 1558 return SDOUtil.createDataObject(this, propertyName); 1559 } 1560 1561 1566 public DataObject createDataObject(int propertyIndex) 1567 { 1568 return SDOUtil.createDataObject(this, propertyIndex); 1569 } 1570 1571 1576 public DataObject createDataObject(Property property) 1577 { 1578 return SDOUtil.createDataObject(this, property); 1579 } 1580 1581 1586 public DataObject createDataObject(String propertyName, String namespaceURI, String typeName) 1587 { 1588 return SDOUtil.createDataObject(this, propertyName, namespaceURI, typeName); 1589 } 1590 1591 1596 public DataObject createDataObject(int propertyIndex, String namespaceURI, String typeName) 1597 { 1598 return SDOUtil.createDataObject(this, propertyIndex, namespaceURI, typeName); 1599 } 1600 1601 1606 public DataObject createDataObject(Property property, Type type) 1607 { 1608 return SDOUtil.createDataObject(this, property, type); 1609 } 1610 1611 1616 public void delete() 1617 { 1618 SDOUtil.delete(this); 1619 } 1620 1621 1626 public List getInstanceProperties() 1627 { 1628 return SDOUtil.getInstanceProperties(this); 1629 } 1630 1631 1636 public Object writeReplace() throws ObjectStreamException 1637 { 1638 return SDOUtil.writeReplace(this); 1639 } 1640 1641 1646 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) 1647 { 1648 if (featureID >= 0) 1649 { 1650 switch (eDerivedStructuralFeatureID(featureID, baseClass)) 1651 { 1652 case SDOPackage.ECHANGE_SUMMARY__EDATA_GRAPH: 1653 if (eDataGraph != null) 1654 msgs = ((InternalEObject)eDataGraph).eInverseRemove(this, SDOPackage.EDATA_GRAPH__ECHANGE_SUMMARY, EDataGraph.class, msgs); 1655 return basicSetEDataGraph((EDataGraph)otherEnd, msgs); 1656 default: 1657 return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); 1658 } 1659 } 1660 if (eContainer != null) 1661 msgs = eBasicRemoveFromContainer(msgs); 1662 return eBasicSetContainer(otherEnd, featureID, msgs); 1663 } 1664 1665 1670 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) 1671 { 1672 if (featureID >= 0) 1673 { 1674 switch (eDerivedStructuralFeatureID(featureID, baseClass)) 1675 { 1676 case SDOPackage.ECHANGE_SUMMARY__OBJECT_CHANGES: 1677 return ((InternalEList)getObjectChanges()).basicRemove(otherEnd, msgs); 1678 case SDOPackage.ECHANGE_SUMMARY__OBJECTS_TO_ATTACH: 1679 return ((InternalEList)getObjectsToAttach()).basicRemove(otherEnd, msgs); 1680 case SDOPackage.ECHANGE_SUMMARY__RESOURCE_CHANGES: 1681 return ((InternalEList)getResourceChanges()).basicRemove(otherEnd, msgs); 1682 case SDOPackage.ECHANGE_SUMMARY__EDATA_GRAPH: 1683 return basicSetEDataGraph(null, msgs); 1684 default: 1685 return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); 1686 } 1687 } 1688 return eBasicSetContainer(null, featureID, msgs); 1689 } 1690 1691 1696 public Object eGet(EStructuralFeature eFeature, boolean resolve) 1697 { 1698 switch (eDerivedStructuralFeatureID(eFeature)) 1699 { 1700 case SDOPackage.ECHANGE_SUMMARY__OBJECT_CHANGES: 1701 return getObjectChanges(); 1702 case SDOPackage.ECHANGE_SUMMARY__OBJECTS_TO_DETACH: 1703 return getObjectsToDetach(); 1704 case SDOPackage.ECHANGE_SUMMARY__OBJECTS_TO_ATTACH: 1705 return getObjectsToAttach(); 1706 case SDOPackage.ECHANGE_SUMMARY__RESOURCE_CHANGES: 1707 return getResourceChanges(); 1708 case SDOPackage.ECHANGE_SUMMARY__LOGGING: 1709 return isLogging() ? Boolean.TRUE : Boolean.FALSE; 1710 case SDOPackage.ECHANGE_SUMMARY__DATA_GRAPH: 1711 return getDataGraph(); 1712 case SDOPackage.ECHANGE_SUMMARY__CHANGED_DATA_OBJECTS: 1713 return getChangedDataObjects(); 1714 case SDOPackage.ECHANGE_SUMMARY__EDATA_GRAPH: 1715 return getEDataGraph(); 1716 } 1717 return eDynamicGet(eFeature, resolve); 1718 } 1719 1720 1725 public void eSet(EStructuralFeature eFeature, Object newValue) 1726 { 1727 switch (eDerivedStructuralFeatureID(eFeature)) 1728 { 1729 case SDOPackage.ECHANGE_SUMMARY__OBJECT_CHANGES: 1730 getObjectChanges().clear(); 1731 getObjectChanges().addAll((Collection )newValue); 1732 return; 1733 case SDOPackage.ECHANGE_SUMMARY__OBJECTS_TO_DETACH: 1734 getObjectsToDetach().clear(); 1735 getObjectsToDetach().addAll((Collection )newValue); 1736 return; 1737 case SDOPackage.ECHANGE_SUMMARY__OBJECTS_TO_ATTACH: 1738 getObjectsToAttach().clear(); 1739 getObjectsToAttach().addAll((Collection )newValue); 1740 return; 1741 case SDOPackage.ECHANGE_SUMMARY__RESOURCE_CHANGES: 1742 getResourceChanges().clear(); 1743 getResourceChanges().addAll((Collection )newValue); 1744 return; 1745 case SDOPackage.ECHANGE_SUMMARY__EDATA_GRAPH: 1746 setEDataGraph((EDataGraph)newValue); 1747 return; 1748 } 1749 eDynamicSet(eFeature, newValue); 1750 } 1751 1752 1757 public void eUnset(EStructuralFeature eFeature) 1758 { 1759 switch (eDerivedStructuralFeatureID(eFeature)) 1760 { 1761 case SDOPackage.ECHANGE_SUMMARY__OBJECT_CHANGES: 1762 getObjectChanges().clear(); 1763 return; 1764 case SDOPackage.ECHANGE_SUMMARY__OBJECTS_TO_DETACH: 1765 getObjectsToDetach().clear(); 1766 return; 1767 case SDOPackage.ECHANGE_SUMMARY__OBJECTS_TO_ATTACH: 1768 getObjectsToAttach().clear(); 1769 return; 1770 case SDOPackage.ECHANGE_SUMMARY__RESOURCE_CHANGES: 1771 getResourceChanges().clear(); 1772 return; 1773 case SDOPackage.ECHANGE_SUMMARY__EDATA_GRAPH: 1774 setEDataGraph((EDataGraph)null); 1775 return; 1776 } 1777 eDynamicUnset(eFeature); 1778 } 1779 1780 1785 public boolean eIsSet(EStructuralFeature eFeature) 1786 { 1787 switch (eDerivedStructuralFeatureID(eFeature)) 1788 { 1789 case SDOPackage.ECHANGE_SUMMARY__OBJECT_CHANGES: 1790 return objectChanges != null && !objectChanges.isEmpty(); 1791 case SDOPackage.ECHANGE_SUMMARY__OBJECTS_TO_DETACH: 1792 return objectsToDetach != null && !objectsToDetach.isEmpty(); 1793 case SDOPackage.ECHANGE_SUMMARY__OBJECTS_TO_ATTACH: 1794 return objectsToAttach != null && !objectsToAttach.isEmpty(); 1795 case SDOPackage.ECHANGE_SUMMARY__RESOURCE_CHANGES: 1796 return resourceChanges != null && !resourceChanges.isEmpty(); 1797 case SDOPackage.ECHANGE_SUMMARY__LOGGING: 1798 return isLogging() != LOGGING_EDEFAULT; 1799 case SDOPackage.ECHANGE_SUMMARY__DATA_GRAPH: 1800 return getDataGraph() != null; 1801 case SDOPackage.ECHANGE_SUMMARY__CHANGED_DATA_OBJECTS: 1802 return !getChangedDataObjects().isEmpty(); 1803 case SDOPackage.ECHANGE_SUMMARY__EDATA_GRAPH: 1804 return eDataGraph != null; 1805 } 1806 return eDynamicIsSet(eFeature); 1807 } 1808 1809 1814 public int eBaseStructuralFeatureID(int derivedFeatureID, Class baseClass) 1815 { 1816 if (baseClass == ChangeSummary.class) 1817 { 1818 switch (derivedFeatureID) 1819 { 1820 case SDOPackage.ECHANGE_SUMMARY__LOGGING: return SDOPackage.CHANGE_SUMMARY__LOGGING; 1821 case SDOPackage.ECHANGE_SUMMARY__DATA_GRAPH: return SDOPackage.CHANGE_SUMMARY__DATA_GRAPH; 1822 case SDOPackage.ECHANGE_SUMMARY__CHANGED_DATA_OBJECTS: return SDOPackage.CHANGE_SUMMARY__CHANGED_DATA_OBJECTS; 1823 default: return -1; 1824 } 1825 } 1826 return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); 1827 } 1828 1829 1834 public int eDerivedStructuralFeatureID(int baseFeatureID, Class baseClass) 1835 { 1836 if (baseClass == ChangeSummary.class) 1837 { 1838 switch (baseFeatureID) 1839 { 1840 case SDOPackage.CHANGE_SUMMARY__LOGGING: return SDOPackage.ECHANGE_SUMMARY__LOGGING; 1841 case SDOPackage.CHANGE_SUMMARY__DATA_GRAPH: return SDOPackage.ECHANGE_SUMMARY__DATA_GRAPH; 1842 case SDOPackage.CHANGE_SUMMARY__CHANGED_DATA_OBJECTS: return SDOPackage.ECHANGE_SUMMARY__CHANGED_DATA_OBJECTS; 1843 default: return -1; 1844 } 1845 } 1846 return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); 1847 } 1848 1849} | Popular Tags |