Search in sources :

Example 26 with SDOTypeHelper

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

the class DefineAndGenerateNameCollisionsTestCases method getControlTypes.

@Override
public List<Type> getControlTypes() {
    List<Type> types = new ArrayList<Type>();
    ((SDOTypeHelper) typeHelper).reset();
    DataObject phoneTypeDO = dataFactory.create("commonj.sdo", "Type");
    phoneTypeDO.set("uri", "my.uri");
    phoneTypeDO.set("name", "phoneType");
    phoneTypeDO.set("sequenced", true);
    DataObject areaCodeProp = addProperty(phoneTypeDO, "areaCode", SDOConstants.SDO_STRING);
    DataObject numberProp = addProperty(phoneTypeDO, "number", SDOConstants.SDO_OBJECT);
    numberProp.set("many", true);
    Type phoneType = typeHelper.define(phoneTypeDO);
    ((SDOProperty) phoneType.getProperty("areaCode")).setXsd(true);
    ((SDOProperty) phoneType.getProperty("areaCode")).setContainment(true);
    ((SDOProperty) phoneType.getProperty("areaCode")).setXsdLocalName("areaCode");
    ((SDOProperty) phoneType.getProperty("number")).setXsd(true);
    ((SDOProperty) phoneType.getProperty("number")).setContainment(true);
    ((SDOProperty) phoneType.getProperty("number")).setXsdLocalName("number");
    DataObject personTypeDO = dataFactory.create("commonj.sdo", "Type");
    personTypeDO.set("uri", "my.uri");
    personTypeDO.set("name", "personType");
    personTypeDO.set("sequenced", true);
    addProperty(personTypeDO, "age", SDOConstants.SDO_STRING);
    DataObject nameProp = addProperty(personTypeDO, "name", SDOConstants.SDO_OBJECT);
    nameProp.set("many", true);
    Type personType = typeHelper.define(personTypeDO);
    ((SDOProperty) personType.getProperty("age")).setXsd(true);
    ((SDOProperty) personType.getProperty("age")).setContainment(true);
    ((SDOProperty) personType.getProperty("age")).setXsdLocalName("age");
    ((SDOProperty) personType.getProperty("name")).setXsd(true);
    ((SDOProperty) personType.getProperty("name")).setContainment(true);
    ((SDOProperty) personType.getProperty("name")).setXsdLocalName("name");
    DataObject jobTypeDO = dataFactory.create("commonj.sdo", "Type");
    jobTypeDO.set("uri", "my.uri");
    jobTypeDO.set("name", "jobType");
    jobTypeDO.set("sequenced", true);
    DataObject titleProp = addProperty(jobTypeDO, "title", SDOConstants.SDO_OBJECT);
    titleProp.set("many", true);
    Type jobType = typeHelper.define(jobTypeDO);
    ((SDOProperty) jobType.getProperty("title")).setXsd(true);
    ((SDOProperty) jobType.getProperty("title")).setContainment(true);
    ((SDOProperty) jobType.getProperty("title")).setXsdLocalName("title");
    DataObject contactTypeDO = dataFactory.create("commonj.sdo", "Type");
    contactTypeDO.set("uri", "my.uri");
    contactTypeDO.set("name", "contactType");
    contactTypeDO.set("sequenced", true);
    DataObject streetProp = addProperty(contactTypeDO, "street", SDOConstants.SDO_OBJECT);
    streetProp.set("many", true);
    Type contactType = typeHelper.define(contactTypeDO);
    ((SDOProperty) contactType.getProperty("street")).setXsd(true);
    ((SDOProperty) contactType.getProperty("street")).setContainment(true);
    ((SDOProperty) contactType.getProperty("street")).setXsdLocalName("street");
    DataObject addressTypeDO = dataFactory.create("commonj.sdo", "Type");
    addressTypeDO.set("uri", "my.uri");
    addressTypeDO.set("name", "addressType");
    addressTypeDO.set("sequenced", true);
    List baseTypes = new ArrayList();
    baseTypes.add(contactType);
    addressTypeDO.set("baseType", baseTypes);
    DataObject cityProp = addProperty(addressTypeDO, "city", SDOConstants.SDO_STRING);
    Type addressType = typeHelper.define(addressTypeDO);
    ((SDOProperty) addressType.getProperty("city")).setXsd(true);
    ((SDOProperty) addressType.getProperty("city")).setContainment(true);
    ((SDOProperty) addressType.getProperty("city")).setXsdLocalName("city");
    DataObject cdnAddressTypeDO = dataFactory.create("commonj.sdo", "Type");
    cdnAddressTypeDO.set("uri", "my.uri");
    cdnAddressTypeDO.set("name", "cdnAddressType");
    cdnAddressTypeDO.set("sequenced", true);
    baseTypes = new ArrayList();
    baseTypes.add(addressType);
    cdnAddressTypeDO.set("baseType", baseTypes);
    DataObject postalCodeProp = addProperty(cdnAddressTypeDO, "postalCode", SDOConstants.SDO_STRING);
    Type cdnAddressType = typeHelper.define(cdnAddressTypeDO);
    ((SDOProperty) cdnAddressType.getProperty("postalCode")).setXsd(true);
    ((SDOProperty) cdnAddressType.getProperty("postalCode")).setContainment(true);
    ((SDOProperty) cdnAddressType.getProperty("postalCode")).setXsdLocalName("postalCode");
    types.add(personType);
    types.add(jobType);
    types.add(addressType);
    types.add(contactType);
    types.add(cdnAddressType);
    types.add(phoneType);
    return types;
}
Also used : SDOTypeHelper(org.eclipse.persistence.sdo.helper.SDOTypeHelper) Type(commonj.sdo.Type) DataObject(commonj.sdo.DataObject) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) SDOProperty(org.eclipse.persistence.sdo.SDOProperty)

Example 27 with SDOTypeHelper

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

the class ContainmentManyTestCases method getSecondChildType.

@Override
public SDOType getSecondChildType() {
    SDOType type = new SDOType("http://testing", "secondChildType");
    type.setOpen(true);
    type.setAbstract(false);
    SDOProperty prop = new SDOProperty(aHelperContext);
    prop.setName("name");
    prop.setType(SDOConstants.SDO_STRING);
    prop.setContainingType(type);
    type.addDeclaredProperty(prop);
    SDOProperty prop2 = new SDOProperty(aHelperContext);
    prop2.setName("child");
    prop2.setMany(true);
    prop2.setType(typeHelper.getType("http://testing", "myRoot"));
    prop2.setContainment(true);
    prop2.setContainingType(type);
    type.addDeclaredProperty(prop2);
    ((SDOTypeHelper) typeHelper).addType(type);
    return type;
}
Also used : SDOTypeHelper(org.eclipse.persistence.sdo.helper.SDOTypeHelper) SDOType(org.eclipse.persistence.sdo.SDOType) SDOProperty(org.eclipse.persistence.sdo.SDOProperty)

Example 28 with SDOTypeHelper

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

the class ContainmentManyTestCases method getFirstChildType.

@Override
public SDOType getFirstChildType() {
    SDOType type = new SDOType("http://testing", "firstChildType");
    type.setOpen(true);
    type.setAbstract(false);
    SDOProperty prop = new SDOProperty(aHelperContext);
    prop.setName("name");
    prop.setType(SDOConstants.SDO_STRING);
    prop.setContainingType(type);
    type.addDeclaredProperty(prop);
    SDOProperty prop2 = new SDOProperty(aHelperContext);
    prop2.setName("child");
    prop2.setMany(true);
    prop2.setType(typeHelper.getType("http://testing", "secondChildType"));
    prop2.setContainment(true);
    prop2.setContainingType(type);
    type.addDeclaredProperty(prop2);
    ((SDOTypeHelper) typeHelper).addType(type);
    return type;
}
Also used : SDOTypeHelper(org.eclipse.persistence.sdo.helper.SDOTypeHelper) SDOType(org.eclipse.persistence.sdo.SDOType) SDOProperty(org.eclipse.persistence.sdo.SDOProperty)

Example 29 with SDOTypeHelper

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

the class ContainmentTestCases method getSecondChildType.

// old version
public SDOType getSecondChildType(boolean old) {
    SDOType type = new SDOType("http://testing", "secondChildType");
    type.setOpen(true);
    type.setAbstract(false);
    SDOProperty prop = new SDOProperty(aHelperContext);
    prop.setName("name");
    prop.setType(SDOConstants.SDO_STRING);
    prop.setContainingType(type);
    type.addDeclaredProperty(prop);
    SDOProperty prop2 = new SDOProperty(aHelperContext);
    prop2.setName("child");
    prop2.setType(typeHelper.getType("http://testing", "myRoot"));
    prop2.setContainment(true);
    prop2.setContainingType(type);
    type.addDeclaredProperty(prop2);
    ((SDOTypeHelper) typeHelper).addType(type);
    return type;
}
Also used : SDOTypeHelper(org.eclipse.persistence.sdo.helper.SDOTypeHelper) SDOType(org.eclipse.persistence.sdo.SDOType) SDOProperty(org.eclipse.persistence.sdo.SDOProperty)

Example 30 with SDOTypeHelper

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

the class SDODataFactoryCreateSimpleTestCases method getSDOType.

private SDOType getSDOType() {
    SDOType type = new SDOType("http://testing", "USAddress");
    type.setAbstract(false);
    type.setInstanceClass(USAddress.class);
    SDOProperty prop = new SDOProperty(aHelperContext);
    prop.setName("name");
    prop.setType(SDOConstants.SDO_STRING);
    prop.setContainingType(type);
    type.addDeclaredProperty(prop);
    SDOProperty prop2 = new SDOProperty(aHelperContext);
    prop2.setName("street");
    prop2.setType(SDOConstants.SDO_STRING);
    prop2.setContainingType(type);
    type.addDeclaredProperty(prop2);
    ((SDOTypeHelper) typeHelper).addType(type);
    return type;
}
Also used : SDOTypeHelper(org.eclipse.persistence.sdo.helper.SDOTypeHelper) 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