Search in sources :

Example 31 with SDOTypeHelper

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

the class LoadAndSaveWithDataObjectDataTypeTestCases method registerTypes.

@Override
protected void registerTypes() {
    ((SDOTypeHelper) typeHelper).reset();
    SDOType dataObjectType = (SDOType) typeHelper.getType(SDOConstants.SDO_URL, SDOConstants.DATAOBJECT);
    SDOType propertyType = (SDOType) typeHelper.getType(SDOConstants.SDO_URL, SDOConstants.PROPERTY);
    SDOProperty xmlDataTypeProperty = (SDOProperty) typeHelper.getOpenContentProperty(SDOConstants.SDOXML_URL, SDOConstants.SDOXML_DATATYPE);
    SDOProperty xmlSchemaTypeProperty = (SDOProperty) typeHelper.getOpenContentProperty(SDOConstants.ORACLE_SDO_URL, SDOConstants.XML_SCHEMA_TYPE_NAME);
    DataObject myChildTypeDO = dataFactory.create("commonj.sdo", "Type");
    myChildTypeDO.set("uri", "http://www.example.org");
    myChildTypeDO.set("name", "childType");
    addProperty(myChildTypeDO, "name", SDOConstants.SDO_STRING, false, false, true);
    Type childType = typeHelper.define(myChildTypeDO);
    ((SDOProperty) childType.getProperty("name")).setXsd(true);
    ((SDOProperty) childType.getProperty("name")).setXsdLocalName("name");
    DataObject myRootTypeDO = dataFactory.create("commonj.sdo", "Type");
    myRootTypeDO.set("uri", "http://www.example.org");
    myRootTypeDO.set("name", "rootType");
    DataObject test1Prop = addProperty(myRootTypeDO, "test1", SDOConstants.SDO_INTOBJECT, false, false, true);
    DataObject test2Prop = addProperty(myRootTypeDO, "test2", SDOConstants.SDO_BOOLEANOBJECT, false, false, true);
    test2Prop.set(xmlDataTypeProperty, SDOConstants.SDO_BOOLEANOBJECT);
    DataObject test3Prop = addProperty(myRootTypeDO, "test3", SDOConstants.SDO_DATE, false, false, true);
    DataObject test4Prop = addProperty(myRootTypeDO, "test4", SDOConstants.SDO_DATETIME, false, false, true);
    DataObject test5Prop = addProperty(myRootTypeDO, "test5", SDOConstants.SDO_SHORT, false, false, true);
    test5Prop.set(xmlDataTypeProperty, SDOConstants.SDO_SHORTOBJECT);
    DataObject test6Prop = addProperty(myRootTypeDO, "test6", dataObjectType, true, false, true);
    test6Prop.set(xmlDataTypeProperty, dataObjectType);
    DataObject test7Prop = addProperty(myRootTypeDO, "test7", childType, true, false, true);
    test7Prop.set(xmlSchemaTypeProperty, childType);
    test7Prop.set(xmlDataTypeProperty, dataObjectType);
    Type myRootType = typeHelper.define(myRootTypeDO);
    ((SDOType) myRootType).setXsd(true);
    ((SDOType) myRootType).setXsdLocalName("rootType");
    ((SDOProperty) myRootType.getProperty("test1")).setXsd(true);
    ((SDOProperty) myRootType.getProperty("test1")).setXsdLocalName("test1");
    ((SDOProperty) myRootType.getProperty("test2")).setXsd(true);
    ((SDOProperty) myRootType.getProperty("test2")).setXsdLocalName("test2");
    ((SDOProperty) myRootType.getProperty("test3")).setXsd(true);
    ((SDOProperty) myRootType.getProperty("test3")).setXsdLocalName("test3");
    ((SDOProperty) myRootType.getProperty("test4")).setXsd(true);
    ((SDOProperty) myRootType.getProperty("test4")).setXsdLocalName("test4");
    ((SDOProperty) myRootType.getProperty("test5")).setXsd(true);
    ((SDOProperty) myRootType.getProperty("test5")).setXsdLocalName("test5");
    ((SDOProperty) myRootType.getProperty("test6")).setXsd(true);
    ((SDOProperty) myRootType.getProperty("test6")).setXsdLocalName("test6");
    ((SDOProperty) myRootType.getProperty("test7")).setXsd(true);
    ((SDOProperty) myRootType.getProperty("test7")).setXsdLocalName("test7");
    DataObject propDO = dataFactory.create(propertyType);
    propDO.set("name", getControlRootName());
    propDO.set("type", myRootType);
    typeHelper.defineOpenContentProperty(getControlRootURI(), propDO);
}
Also used : SDOTypeHelper(org.eclipse.persistence.sdo.helper.SDOTypeHelper) SDOType(org.eclipse.persistence.sdo.SDOType) Type(commonj.sdo.Type) DataObject(commonj.sdo.DataObject) SDOType(org.eclipse.persistence.sdo.SDOType) SDOProperty(org.eclipse.persistence.sdo.SDOProperty)

Aggregations

SDOTypeHelper (org.eclipse.persistence.sdo.helper.SDOTypeHelper)31 SDOProperty (org.eclipse.persistence.sdo.SDOProperty)17 SDOType (org.eclipse.persistence.sdo.SDOType)17 DataObject (commonj.sdo.DataObject)13 Type (commonj.sdo.Type)9 ArrayList (java.util.ArrayList)9 List (java.util.List)7 QName (javax.xml.namespace.QName)3 SequencedObject (org.eclipse.persistence.oxm.sequenced.SequencedObject)3 SDOXMLHelper (org.eclipse.persistence.sdo.helper.SDOXMLHelper)3 SDOXSDHelper (org.eclipse.persistence.sdo.helper.SDOXSDHelper)3 Collection (java.util.Collection)2 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)2 NamespaceResolver (org.eclipse.persistence.oxm.NamespaceResolver)2 XMLDescriptor (org.eclipse.persistence.oxm.XMLDescriptor)2 XMLField (org.eclipse.persistence.oxm.XMLField)2 XMLMarshaller (org.eclipse.persistence.oxm.XMLMarshaller)2 XMLRoot (org.eclipse.persistence.oxm.XMLRoot)2 XMLDirectMapping (org.eclipse.persistence.oxm.mappings.XMLDirectMapping)2 SDODataObject (org.eclipse.persistence.sdo.SDODataObject)2