Search in sources :

Example 21 with SDOChangeSummary

use of org.eclipse.persistence.sdo.SDOChangeSummary in project eclipselink by eclipse-ee4j.

the class SDODataObjectGetPathTest method testGetPathFromAncestorDetachedFromChildToAncestorInsideListWrapperLoggingOn.

// TODO: This case fails to find a path because the oldSettings map is not populated during detach()
public void testGetPathFromAncestorDetachedFromChildToAncestorInsideListWrapperLoggingOn() {
    SDODataObject anItem = (SDODataObject) aRoot5.get("items/item[2]");
    // start logging
    SDOChangeSummary aCS = aRoot5.getChangeSummary();
    aCS.beginLogging();
    assertTrue(aCS.isLogging());
    // delete source object
    // SDODataObject deletedObject = ((SDODataObject)aRoot5.get("items"));
    anItem.detach();
    // String aPath = anItem.getPathFromAncestor(aCS, aRoot5, useXPathFormat);
    String aPath = ((SDOMarshalListener) ((SDOXMLHelper) xmlHelper).getXmlMarshaller().getMarshalListener()).getPathFromAncestor(anItem, aRoot5, aRoot5.getChangeSummary());
    // SDODataObject anItemFromPath = (SDODataObject)aRoot5.get(aPath);
    assertNotNull(aPath);
    // TODO: no storage of deleted indexed postition - defaults to size() = start of list for now
    // see SDODataObject: index = ((SDODataObject)parent).getList(aChild).size();
    assertEquals("ns0:items/ns0:item[2]", aPath);
}
Also used : SDOChangeSummary(org.eclipse.persistence.sdo.SDOChangeSummary) SDOMarshalListener(org.eclipse.persistence.sdo.helper.SDOMarshalListener) SDOXMLHelper(org.eclipse.persistence.sdo.helper.SDOXMLHelper) SDODataObject(org.eclipse.persistence.sdo.SDODataObject)

Example 22 with SDOChangeSummary

use of org.eclipse.persistence.sdo.SDOChangeSummary in project eclipselink by eclipse-ee4j.

the class SDODataObjectGetPathTest method setChangeSummary.

private SDOChangeSummary setChangeSummary(SDODataObject aCSRoot) {
    // get and set change summary (temp workaround does not propagate to children)
    SDOChangeSummary aCS = new SDOChangeSummary(aCSRoot, aHelperContext);
    aCSRoot._setChangeSummary(aCS);
    aCS.endLogging();
    aCS.beginLogging();
    aCS.endLogging();
    return aCS;
}
Also used : SDOChangeSummary(org.eclipse.persistence.sdo.SDOChangeSummary)

Example 23 with SDOChangeSummary

use of org.eclipse.persistence.sdo.SDOChangeSummary in project eclipselink by eclipse-ee4j.

the class SDODataObjectGetPathTest method testGetXPathFromAncestorDeletedFromChildToRootInsideListWrapperLoggingOn.

public void testGetXPathFromAncestorDeletedFromChildToRootInsideListWrapperLoggingOn() {
    SDODataObject anItem = (SDODataObject) aRoot5.get("items/item[2]");
    // start logging
    SDOChangeSummary aCS = aRoot5.getChangeSummary();
    aCS.beginLogging();
    assertTrue(aCS.isLogging());
    // delete source object
    // SDODataObject deletedObject = ((SDODataObject)aRoot5.get("items"));
    // detach();
    anItem.delete();
    String aPath = ((SDOMarshalListener) ((SDOXMLHelper) xmlHelper).getXmlMarshaller().getMarshalListener()).getPathFromAncestor(anItem, aRoot5, aRoot5.getChangeSummary());
    // SDODataObject anItemFromPath = (SDODataObject)aRoot5.get(aPath);
    // System.out.println("testGetPathFromAncestorDeletedFromChildToRootLoggingOn: " + aPath);
    assertNotNull(aPath);
    // TODO: no storage of deleted indexed postition - defaults to size() = start of list for now
    // see SDODataObject: index = ((SDODataObject)parent).getList(aChild).size();
    assertEquals("ns0:items/ns0:item[2]", aPath);
}
Also used : SDOChangeSummary(org.eclipse.persistence.sdo.SDOChangeSummary) SDOMarshalListener(org.eclipse.persistence.sdo.helper.SDOMarshalListener) SDOXMLHelper(org.eclipse.persistence.sdo.helper.SDOXMLHelper) SDODataObject(org.eclipse.persistence.sdo.SDODataObject)

Example 24 with SDOChangeSummary

use of org.eclipse.persistence.sdo.SDOChangeSummary in project eclipselink by eclipse-ee4j.

the class SDODataObjectGetPathTest method testGetPathFromAncestorDeletedFromRootToCurrentObjectLoggingOff.

public void testGetPathFromAncestorDeletedFromRootToCurrentObjectLoggingOff() {
    String aPath = ((SDOMarshalListener) ((SDOXMLHelper) xmlHelper).getXmlMarshaller().getMarshalListener()).getPathFromAncestor(aRoot5, aRoot5, aRoot5.getChangeSummary());
    // get changeSummary
    SDOChangeSummary aCS = aRoot5.getChangeSummary();
    assertFalse(aCS.isLogging());
    // delete source object
    aRoot5.delete();
    assertNotNull(aPath);
    assertEquals(SDOConstants.EMPTY_STRING, aPath);
}
Also used : SDOChangeSummary(org.eclipse.persistence.sdo.SDOChangeSummary) SDOMarshalListener(org.eclipse.persistence.sdo.helper.SDOMarshalListener) SDOXMLHelper(org.eclipse.persistence.sdo.helper.SDOXMLHelper)

Example 25 with SDOChangeSummary

use of org.eclipse.persistence.sdo.SDOChangeSummary in project eclipselink by eclipse-ee4j.

the class SDODataObjectGetPathTest method testGetPathFromAncestorDeletedFromContainedToParentLoggingOff.

public void testGetPathFromAncestorDeletedFromContainedToParentLoggingOff() {
    SDODataObject target = (SDODataObject) aRoot5.get("items");
    SDODataObject aSibling = (SDODataObject) aRoot5.get("items/item[2]");
    // get changeSummary
    SDOChangeSummary aCS = aRoot5.getChangeSummary();
    assertFalse(aCS.isLogging());
    // delete source object
    aSibling.delete();
    String aPath = ((SDOMarshalListener) ((SDOXMLHelper) xmlHelper).getXmlMarshaller().getMarshalListener()).getPathFromAncestor(aSibling, target, target.getChangeSummary());
    assertEquals(SDOConstants.SDO_XPATH_INVALID_PATH, aPath);
}
Also used : SDOChangeSummary(org.eclipse.persistence.sdo.SDOChangeSummary) SDOMarshalListener(org.eclipse.persistence.sdo.helper.SDOMarshalListener) SDOXMLHelper(org.eclipse.persistence.sdo.helper.SDOXMLHelper) SDODataObject(org.eclipse.persistence.sdo.SDODataObject)

Aggregations

SDOChangeSummary (org.eclipse.persistence.sdo.SDOChangeSummary)123 SDODataObject (org.eclipse.persistence.sdo.SDODataObject)109 DataObject (commonj.sdo.DataObject)91 ChangeSummary (commonj.sdo.ChangeSummary)66 List (java.util.List)63 ArrayList (java.util.ArrayList)56 SDOSetting (org.eclipse.persistence.sdo.SDOSetting)37 Property (commonj.sdo.Property)25 SDOProperty (org.eclipse.persistence.sdo.SDOProperty)25 ValueStore (org.eclipse.persistence.sdo.ValueStore)17 SDOMarshalListener (org.eclipse.persistence.sdo.helper.SDOMarshalListener)16 SDOXMLHelper (org.eclipse.persistence.sdo.helper.SDOXMLHelper)16 SDOSequence (org.eclipse.persistence.sdo.SDOSequence)9 ListWrapper (org.eclipse.persistence.sdo.helper.ListWrapper)9 SDOType (org.eclipse.persistence.sdo.SDOType)7 Sequence (commonj.sdo.Sequence)6 Iterator (java.util.Iterator)6 Map (java.util.Map)6 HashSet (java.util.HashSet)2 Set (java.util.Set)2