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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations