use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class OppositeProject method getChild2Descriptor.
private XMLDescriptor getChild2Descriptor() {
XMLDescriptor xmlDescriptor = new XMLDescriptor();
xmlDescriptor.setJavaClass(Child2.class);
xmlDescriptor.addPrimaryKeyFieldName("@id");
XMLSchemaClassPathReference schemaReference = new XMLSchemaClassPathReference();
schemaReference.setSchemaContext("/tns:child2");
schemaReference.setType(XMLSchemaReference.COMPLEX_TYPE);
xmlDescriptor.setSchemaReference(schemaReference);
NamespaceResolver namespaceResolver = new NamespaceResolver();
namespaceResolver.put("tns", "urn:opposite");
xmlDescriptor.setNamespaceResolver(namespaceResolver);
XMLDirectMapping idMapping = new XMLDirectMapping();
idMapping.setAttributeName("id");
idMapping.setXPath("@id");
xmlDescriptor.addMapping(idMapping);
XMLObjectReferenceMapping child1Mapping = new XMLObjectReferenceMapping();
child1Mapping.setReferenceClass(Child1.class);
child1Mapping.setAttributeName("child1");
child1Mapping.addSourceToTargetKeyFieldAssociation("tns:child1/text()", "@id");
xmlDescriptor.addMapping(child1Mapping);
return xmlDescriptor;
}
use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class IdentityProject method getRootDescriptor.
private XMLDescriptor getRootDescriptor() {
XMLDescriptor xmlDescriptor = new XMLDescriptor();
xmlDescriptor.setJavaClass(Root.class);
xmlDescriptor.setDefaultRootElement("tns:root");
XMLSchemaClassPathReference schemaReference = new XMLSchemaClassPathReference();
schemaReference.setSchemaContext("/tns:root-type");
schemaReference.setType(XMLSchemaReference.COMPLEX_TYPE);
xmlDescriptor.setSchemaReference(schemaReference);
NamespaceResolver namespaceResolver = new NamespaceResolver();
namespaceResolver.put("tns", "urn:identity");
xmlDescriptor.setNamespaceResolver(namespaceResolver);
XMLDirectMapping nameMapping = new XMLDirectMapping();
nameMapping.setAttributeName("name");
nameMapping.setXPath("tns:name/text()");
return xmlDescriptor;
}
use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class CopyHelperProject method getChild1Descriptor.
private XMLDescriptor getChild1Descriptor() {
XMLDescriptor xmlDescriptor = new XMLDescriptor();
xmlDescriptor.setJavaClass(Child1.class);
xmlDescriptor.addPrimaryKeyFieldName("@id");
NamespaceResolver namespaceResolver = new NamespaceResolver();
namespaceResolver.put("tns", "urn:copy");
xmlDescriptor.setNamespaceResolver(namespaceResolver);
XMLSchemaClassPathReference schemaReference = new XMLSchemaClassPathReference();
schemaReference.setSchemaContext("/tns:child1");
schemaReference.setType(XMLSchemaReference.COMPLEX_TYPE);
xmlDescriptor.setSchemaReference(schemaReference);
XMLDirectMapping idMapping = new XMLDirectMapping();
idMapping.setAttributeName("id");
idMapping.setXPath("@id");
xmlDescriptor.addMapping(idMapping);
XMLObjectReferenceMapping child2Mapping = new XMLObjectReferenceMapping();
child2Mapping.setReferenceClass(Child2.class);
child2Mapping.setAttributeName("child2");
child2Mapping.addSourceToTargetKeyFieldAssociation("tns:child2/text()", "@id");
xmlDescriptor.addMapping(child2Mapping);
XMLCollectionReferenceMapping child2CollectionMapping = new XMLCollectionReferenceMapping();
child2CollectionMapping.setReferenceClass(Child2.class);
child2CollectionMapping.setAttributeName("child2Collection");
child2CollectionMapping.addSourceToTargetKeyFieldAssociation("tns:child2collection/text()", "@id");
xmlDescriptor.addMapping(child2CollectionMapping);
return xmlDescriptor;
}
use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class CopyHelperProject method getChild2Descriptor.
private XMLDescriptor getChild2Descriptor() {
XMLDescriptor xmlDescriptor = new XMLDescriptor();
xmlDescriptor.setJavaClass(Child2.class);
xmlDescriptor.setDefaultRootElement("tns:child2");
xmlDescriptor.addPrimaryKeyFieldName("@id");
XMLSchemaClassPathReference schemaReference = new XMLSchemaClassPathReference();
schemaReference.setSchemaContext("/tns:child2");
schemaReference.setType(XMLSchemaReference.ELEMENT);
xmlDescriptor.setSchemaReference(schemaReference);
NamespaceResolver namespaceResolver = new NamespaceResolver();
namespaceResolver.put("tns", "urn:copy");
xmlDescriptor.setNamespaceResolver(namespaceResolver);
XMLDirectMapping idMapping = new XMLDirectMapping();
idMapping.setAttributeName("id");
idMapping.setXPath("@id");
xmlDescriptor.addMapping(idMapping);
XMLObjectReferenceMapping child1Mapping = new XMLObjectReferenceMapping();
child1Mapping.setReferenceClass(Child1.class);
child1Mapping.setAttributeName("child1");
child1Mapping.addSourceToTargetKeyFieldAssociation("tns:child1/text()", "@id");
xmlDescriptor.addMapping(child1Mapping);
return xmlDescriptor;
}
use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class CopyHelperProject method getRootDescriptor.
private XMLDescriptor getRootDescriptor() {
XMLDescriptor xmlDescriptor = new XMLDescriptor();
xmlDescriptor.setJavaClass(Root.class);
XMLSchemaClassPathReference schemaReference = new XMLSchemaClassPathReference();
schemaReference.setSchemaContext("/tns:root");
schemaReference.setType(XMLSchemaReference.COMPLEX_TYPE);
xmlDescriptor.setSchemaReference(schemaReference);
NamespaceResolver namespaceResolver = new NamespaceResolver();
namespaceResolver.put("tns", "urn:copy");
xmlDescriptor.setNamespaceResolver(namespaceResolver);
XMLCompositeObjectMapping child1Mapping = new XMLCompositeObjectMapping();
child1Mapping.setAttributeName("child1");
child1Mapping.setXPath("tns:child1");
xmlDescriptor.addMapping(child1Mapping);
XMLCompositeObjectMapping child2Mapping = new XMLCompositeObjectMapping();
child2Mapping.setAttributeName("child2");
child2Mapping.setXPath("tns:child2");
xmlDescriptor.addMapping(child2Mapping);
return xmlDescriptor;
}
Aggregations