Search in sources :

Example 26 with SDODataObject

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

the class SDODataObjectGetDataObjectConversionWithPathTest method testGetDataObjectConversionFromDefinedPropertyWithPath.

// purpose: opencontent properties
public void testGetDataObjectConversionFromDefinedPropertyWithPath() {
    SDOType dataObjectType = (SDOType) typeHelper.getType(SDOConstants.SDO_URL, SDOConstants.DATAOBJECT);
    // dataObject's type add boolean property
    type_b.setOpen(true);
    SDOProperty property = new SDOProperty(aHelperContext);
    property.setName("openTest");
    property.setType(dataObjectType);
    SDODataObject b = new SDODataObject();
    // add it to instance list
    dataObject_b.setDataObject(property, b);
    assertEquals(b, dataObject_a.getDataObject("PName-a/openTest"));
}
Also used : SDOType(org.eclipse.persistence.sdo.SDOType) SDOProperty(org.eclipse.persistence.sdo.SDOProperty) SDODataObject(org.eclipse.persistence.sdo.SDODataObject)

Example 27 with SDODataObject

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

the class SDODataObjectGetPathTest method testGetXPathFromAncestorDeletedFromChildToAncestorInsideListWrapperLoggingOn.

public void testGetXPathFromAncestorDeletedFromChildToAncestorInsideListWrapperLoggingOn() {
    SDODataObject anItem = (SDODataObject) aRoot5.get("billTo/phone[1]");
    // start logging
    SDOChangeSummary aCS = aRoot5.getChangeSummary();
    aCS.beginLogging();
    assertTrue(aCS.isLogging());
    // delete source object
    SDODataObject deletedObjectParent = ((SDODataObject) aRoot5.get("billTo"));
    // detach();
    deletedObjectParent.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:billTo/ns0:phone[1]", 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 28 with SDODataObject

use of org.eclipse.persistence.sdo.SDODataObject 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 29 with SDODataObject

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

the class SDODataObjectGetPathTest method testGetPathForInternalNonIsManyObject.

public void testGetPathForInternalNonIsManyObject() {
    SDODataObject anItem = (SDODataObject) aRoot5.get("shipTo");
    String aPath = anItem._getPath();
    assertNotNull(aPath);
    assertEquals("shipTo", aPath);
}
Also used : SDODataObject(org.eclipse.persistence.sdo.SDODataObject)

Example 30 with SDODataObject

use of org.eclipse.persistence.sdo.SDODataObject 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)

Aggregations

SDODataObject (org.eclipse.persistence.sdo.SDODataObject)301 DataObject (commonj.sdo.DataObject)118 SDOProperty (org.eclipse.persistence.sdo.SDOProperty)99 ArrayList (java.util.ArrayList)79 ListWrapper (org.eclipse.persistence.sdo.helper.ListWrapper)76 SDOType (org.eclipse.persistence.sdo.SDOType)70 List (java.util.List)65 SDOChangeSummary (org.eclipse.persistence.sdo.SDOChangeSummary)64 Property (commonj.sdo.Property)52 SDOSequence (org.eclipse.persistence.sdo.SDOSequence)51 ValueStore (org.eclipse.persistence.sdo.ValueStore)22 SDOXMLHelper (org.eclipse.persistence.sdo.helper.SDOXMLHelper)21 ChangeSummary (commonj.sdo.ChangeSummary)20 SDOMarshalListener (org.eclipse.persistence.sdo.helper.SDOMarshalListener)20 Iterator (java.util.Iterator)18 Type (commonj.sdo.Type)9 XMLDocument (commonj.sdo.helper.XMLDocument)6 FileInputStream (java.io.FileInputStream)6 IOException (java.io.IOException)5 Map (java.util.Map)5