use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class ObjectPersistenceRuntimeXMLProject_11_1_1 method buildProjectDescriptor.
@Override
protected ClassDescriptor buildProjectDescriptor() {
XMLDescriptor descriptor = (XMLDescriptor) super.buildProjectDescriptor();
descriptor.setSchemaReference(new XMLSchemaClassPathReference(SCHEMA_DIR + TOPLINK_11_SCHEMA));
XMLDirectMapping defaultTemporalMutableMapping = new XMLDirectMapping();
defaultTemporalMutableMapping.setAttributeName("defaultTemporalMutable");
defaultTemporalMutableMapping.setSetMethodName("setDefaultTemporalMutable");
defaultTemporalMutableMapping.setGetMethodName("getDefaultTemporalMutable");
defaultTemporalMutableMapping.setXPath(getSecondaryNamespaceXPath() + "default-temporal-mutable/text()");
defaultTemporalMutableMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(defaultTemporalMutableMapping);
return descriptor;
}
use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class ObjectPersistenceRuntimeXMLProject method buildProjectDescriptor.
protected ClassDescriptor buildProjectDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Project.class);
descriptor.setDefaultRootElement(getPrimaryNamespaceXPath() + "object-persistence");
descriptor.setSchemaReference(new XMLSchemaClassPathReference(SCHEMA_DIR + TOPLINK_10_SCHEMA));
XMLTransformationMapping versionMapping = new XMLTransformationMapping();
versionMapping.addFieldTransformer("@version", getConstantTransformerForProjectVersionMapping());
descriptor.addMapping(versionMapping);
XMLDirectMapping nameMapping = new XMLDirectMapping();
nameMapping.setAttributeName("name");
nameMapping.setSetMethodName("setName");
nameMapping.setGetMethodName("getName");
nameMapping.setXPath(getSecondaryNamespaceXPath() + "name/text()");
descriptor.addMapping(nameMapping);
XMLCompositeCollectionMapping descriptorsMapping = new XMLCompositeCollectionMapping();
descriptorsMapping.useCollectionClass(NonSynchronizedVector.class);
descriptorsMapping.setAttributeName("descriptors");
descriptorsMapping.setSetMethodName("setOrderedDescriptors");
descriptorsMapping.setGetMethodName("getOrderedDescriptors");
descriptorsMapping.setReferenceClass(ClassDescriptor.class);
descriptorsMapping.setXPath(getSecondaryNamespaceXPath() + "class-mapping-descriptors/" + getSecondaryNamespaceXPath() + "class-mapping-descriptor");
descriptor.addMapping(descriptorsMapping);
XMLCompositeObjectMapping loginMapping = new XMLCompositeObjectMapping();
loginMapping.setSetMethodName("setDatasourceLogin");
loginMapping.setGetMethodName("getDatasourceLogin");
loginMapping.setAttributeName("login");
loginMapping.setReferenceClass(DatasourceLogin.class);
loginMapping.setXPath(getPrimaryNamespaceXPath() + "login");
descriptor.addMapping(loginMapping);
return descriptor;
}
use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class ObjectPersistenceRuntimeXMLProject method buildDatabaseFieldDescriptor.
protected ClassDescriptor buildDatabaseFieldDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(DatabaseField.class);
descriptor.setDefaultRootElement("field");
descriptor.getInheritancePolicy().setClassIndicatorField(new XMLField("@xsi:type"));
descriptor.getInheritancePolicy().addClassIndicator(DatabaseField.class, getSecondaryNamespaceXPath() + "column");
descriptor.getInheritancePolicy().addClassIndicator(XMLField.class, getPrimaryNamespaceXPath() + "node");
descriptor.getInheritancePolicy().addClassIndicator(XMLUnionField.class, getPrimaryNamespaceXPath() + "union-node");
XMLSchemaReference reference = new XMLSchemaClassPathReference();
reference.setSchemaContext("/" + getSecondaryNamespaceXPath() + "column");
descriptor.setSchemaReference(reference);
XMLDirectMapping tableMapping = new XMLDirectMapping();
tableMapping.setAttributeName("table");
tableMapping.setGetMethodName("getTableName");
tableMapping.setSetMethodName("setTableName");
tableMapping.setXPath("@table");
tableMapping.setNullValue("");
descriptor.addMapping(tableMapping);
XMLDirectMapping nameMapping = new XMLDirectMapping();
nameMapping.setAttributeName("name");
nameMapping.setGetMethodName("getName");
nameMapping.setSetMethodName("setName");
nameMapping.setXPath("@name");
nameMapping.getNullPolicy().setNullRepresentedByEmptyNode(false);
descriptor.addMapping(nameMapping);
return descriptor;
}
use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class ExtraNamespacesBug6004272Project method getManagerDescriptor.
private XMLDescriptor getManagerDescriptor() {
XMLDescriptor xmlDescriptor = new XMLDescriptor();
xmlDescriptor.setJavaClass(Manager.class);
xmlDescriptor.setDefaultRootElement("ns3:manager");
xmlDescriptor.getInheritancePolicy().setParentClass(Employee.class);
XMLDirectMapping titleMapping = new XMLDirectMapping();
titleMapping.setAttributeName("title");
titleMapping.setXPath("ns3:title/text()");
xmlDescriptor.addMapping(titleMapping);
XMLSchemaClassPathReference ref = new XMLSchemaClassPathReference();
ref.setSchemaContext("/ns2:manager-type");
ref.setType(XMLSchemaClassPathReference.COMPLEX_TYPE);
xmlDescriptor.setSchemaReference(ref);
NamespaceResolver nsResolver = new NamespaceResolver();
nsResolver.put("ns3", "http://www.example.com/ns3");
nsResolver.put("ns2", "http://www.example.com/ns2");
nsResolver.put("ns4", "http://www.example.com/ns4");
nsResolver.put("ns7", "http://www.example.com/ns7");
nsResolver.put("xsi", "http://www.w3.org/2001/XMLSchema-instance");
xmlDescriptor.setNamespaceResolver(nsResolver);
return xmlDescriptor;
}
use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class ExtraNamespacesBug6004272Project method getTeamDescriptor.
private XMLDescriptor getTeamDescriptor() {
XMLDescriptor xmlDescriptor = new XMLDescriptor();
xmlDescriptor.setJavaClass(Team.class);
xmlDescriptor.setDefaultRootElement("ns4:team");
XMLDirectMapping nameMapping = new XMLDirectMapping();
nameMapping.setAttributeName("teamName");
nameMapping.setXPath("ns4:teamName/text()");
xmlDescriptor.addMapping(nameMapping);
XMLAnyObjectMapping teamLeaderMapping = new XMLAnyObjectMapping();
teamLeaderMapping.setAttributeName("teamLeader");
teamLeaderMapping.setXPath("ns5:leader");
xmlDescriptor.addMapping(teamLeaderMapping);
XMLCompositeCollectionMapping empsMapping = new XMLCompositeCollectionMapping();
empsMapping.setAttributeName("employees");
empsMapping.setXPath("ns6:emp");
// no reference class
xmlDescriptor.addMapping(empsMapping);
XMLSchemaClassPathReference ref = new XMLSchemaClassPathReference();
ref.setSchemaContext("/ns4:team");
ref.setType(XMLSchemaClassPathReference.COMPLEX_TYPE);
xmlDescriptor.setSchemaReference(ref);
NamespaceResolver nsResolver = new NamespaceResolver();
nsResolver.put("ns4", "http://www.example.com/ns4");
nsResolver.put("ns5", "http://www.example.com/ns5");
nsResolver.put("ns6", "http://www.example.com/ns6");
// nsResolver.put("ns2", "http://www.example.com/ns2");
xmlDescriptor.setNamespaceResolver(nsResolver);
return xmlDescriptor;
}
Aggregations