use of org.eclipse.persistence.sdo.SDODataObject in project eclipselink by eclipse-ee4j.
the class SDOTestCase method preOrderTraversalDataObjectList.
private List<DataObject> preOrderTraversalDataObjectList(SDODataObject currentDO, ArrayList<DataObject> currentList, boolean countNullObjects, boolean recurse) {
if (currentDO != null) {
// add yourself
currentList.add(currentDO);
// check DO's recursively
List instanceProperties = currentDO.getInstanceProperties();
SDOProperty nextProperty = null;
Object value = null;
if (recurse) {
for (int i = 0; i < instanceProperties.size(); i++) {
nextProperty = (SDOProperty) instanceProperties.get(i);
value = currentDO.get(nextProperty);
boolean recurseHopefullyNotToInfinityPlease = true;
if (!nextProperty.getType().isChangeSummaryType() && !nextProperty.getType().isDataType()) {
// infinite loop
if (null != nextProperty.getOpposite()) {
recurseHopefullyNotToInfinityPlease = false;
}
if (nextProperty.isMany()) {
// iterate list
Object manyItem;
// generate a ConcurrentModificationException
for (int index = 0; index < ((List) value).size(); index++) {
manyItem = ((List) value).get(index);
if (manyItem != null && manyItem instanceof SDODataObject) {
preOrderTraversalDataObjectList((SDODataObject) manyItem, currentList, countNullObjects, recurseHopefullyNotToInfinityPlease);
}
}
} else {
if (value != null) {
preOrderTraversalDataObjectList((SDODataObject) value, currentList, countNullObjects, recurseHopefullyNotToInfinityPlease);
}
}
}
}
}
} else {
if (countNullObjects) {
currentList.add(currentDO);
}
}
return currentList;
}
use of org.eclipse.persistence.sdo.SDODataObject in project eclipselink by eclipse-ee4j.
the class SDOTestCase method assertValueStoresReturnedToStartStateAfterUndoChanges.
/**
*/
protected void assertValueStoresReturnedToStartStateAfterUndoChanges(DataObject aRootObject, ValueStore aCurrentValueStoreAfterLoggingFirstOnParam) {
// verify logging is on
assertTrue(aRootObject.getChangeSummary().isLogging());
ValueStore anOriginalValueStoreAfterUndo = (ValueStore) ((SDOChangeSummary) aRootObject.getChangeSummary()).getOriginalValueStores().get(aRootObject);
ValueStore aCurrentValueStoreAfterUndo = ((SDODataObject) aRootObject)._getCurrentValueStore();
assertNull(anOriginalValueStoreAfterUndo);
assertNotNull(aCurrentValueStoreAfterUndo);
// we return the original value store back to the current VS
assertTrue(aCurrentValueStoreAfterUndo == aCurrentValueStoreAfterLoggingFirstOnParam);
}
use of org.eclipse.persistence.sdo.SDODataObject in project eclipselink by eclipse-ee4j.
the class SDOTestCase method assertValueStoresCopiedAndSwappedAfterFirstModifyOperation.
/**
*/
protected void assertValueStoresCopiedAndSwappedAfterFirstModifyOperation(DataObject aRootObject, ValueStore aCurrentValueStoreAfterLoggingFirstOnParam) {
// verify logging is on
assertTrue(aRootObject.getChangeSummary().isLogging());
assertNotNull(aCurrentValueStoreAfterLoggingFirstOnParam);
ValueStore anOriginalValueStoreAfterOperation = (ValueStore) ((SDOChangeSummary) aRootObject.getChangeSummary()).getOriginalValueStores().get(aRootObject);
ValueStore aCurrentValueStoreAfterOperation = ((SDODataObject) aRootObject)._getCurrentValueStore();
assertNotNull(anOriginalValueStoreAfterOperation);
assertNotNull(aCurrentValueStoreAfterOperation);
assertTrue(anOriginalValueStoreAfterOperation == aCurrentValueStoreAfterLoggingFirstOnParam);
}
use of org.eclipse.persistence.sdo.SDODataObject in project eclipselink by eclipse-ee4j.
the class SDOTestCase method assertSequencesReturnedToStartStateAfterUndoChanges.
/**
*/
protected void assertSequencesReturnedToStartStateAfterUndoChanges(DataObject aRootObject, Sequence aCurrentSequenceAfterLoggingFirstOnParam) {
// verify logging is on
assertTrue(aRootObject.getChangeSummary().isLogging());
SDOSequence anOriginalSequenceAfterUndo = (SDOSequence) ((SDOChangeSummary) aRootObject.getChangeSummary()).getOriginalSequences().get(aRootObject);
SDOSequence aCurrentSequenceAfterUndo = ((SDODataObject) aRootObject).getSequence();
assertNull(anOriginalSequenceAfterUndo);
assertNotNull(aCurrentSequenceAfterUndo);
// we return the sequence back to the current VS
assertEquals(aCurrentSequenceAfterUndo.size(), aCurrentSequenceAfterLoggingFirstOnParam.size());
assertTrue(compareSequences(aCurrentSequenceAfterUndo, (SDOSequence) aCurrentSequenceAfterLoggingFirstOnParam, true));
}
use of org.eclipse.persistence.sdo.SDODataObject in project eclipselink by eclipse-ee4j.
the class SDOTestCase method checkOldSettingsValues.
// inOrderNodeList, preOrderNodeList, postOrderNodeList
// function to monitor actual values inside the oldSetting HashMap
protected void checkOldSettingsValues(String values, SDOChangeSummary aCS, List dataObjectList) {
SDODataObject aDataObject = null;
for (int i = 0; i < dataObjectList.size(); i++) {
aDataObject = (SDODataObject) dataObjectList.get(i);
assertEquals(Integer.parseInt(values.substring(i, i + 1)), aCS.getOldValues(aDataObject).size());
}
}
Aggregations