Search in sources :

Example 61 with XMLSchemaClassPathReference

use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.

the class XMLHelperProject 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:xml");
    xmlDescriptor.setNamespaceResolver(namespaceResolver);
    XMLDirectMapping nameMapping = new XMLDirectMapping();
    nameMapping.setAttributeName("name");
    nameMapping.setXPath("tns:name/text()");
    xmlDescriptor.addMapping(nameMapping);
    return xmlDescriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) NamespaceResolver(org.eclipse.persistence.oxm.NamespaceResolver) XMLSchemaClassPathReference(org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference)

Example 62 with XMLSchemaClassPathReference

use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.

the class ChangeSummaryProject method getChild1Descriptor.

private XMLDescriptor getChild1Descriptor() {
    XMLDescriptor xmlDescriptor = new XMLDescriptor();
    xmlDescriptor.setJavaClass(Child1.class);
    xmlDescriptor.addPrimaryKeyFieldName("@id");
    NamespaceResolver namespaceResolver = new NamespaceResolver();
    namespaceResolver.put("tns", "urn:changesummary");
    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);
    XMLCollectionReferenceMapping child2CollectionMapping = new XMLCollectionReferenceMapping();
    child2CollectionMapping.setReferenceClass(Child2.class);
    child2CollectionMapping.setAttributeName("child2Collection");
    child2CollectionMapping.addSourceToTargetKeyFieldAssociation("tns:child2/text()", "@id");
    xmlDescriptor.addMapping(child2CollectionMapping);
    return xmlDescriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) XMLCollectionReferenceMapping(org.eclipse.persistence.oxm.mappings.XMLCollectionReferenceMapping) NamespaceResolver(org.eclipse.persistence.oxm.NamespaceResolver) XMLSchemaClassPathReference(org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference)

Example 63 with XMLSchemaClassPathReference

use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.

the class ChangeSummaryProject 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");
    schemaReference.setType(XMLSchemaReference.COMPLEX_TYPE);
    xmlDescriptor.setSchemaReference(schemaReference);
    NamespaceResolver namespaceResolver = new NamespaceResolver();
    namespaceResolver.put("tns", "urn:changesummary");
    xmlDescriptor.setNamespaceResolver(namespaceResolver);
    XMLDirectMapping idMapping = new XMLDirectMapping();
    idMapping.setAttributeName("id");
    idMapping.setXPath("@id");
    xmlDescriptor.addMapping(idMapping);
    XMLDirectMapping nameMapping = new XMLDirectMapping();
    nameMapping.setAttributeName("name");
    nameMapping.setXPath("tns:name/text()");
    xmlDescriptor.addMapping(nameMapping);
    XMLCompositeObjectMapping child1Mapping = new XMLCompositeObjectMapping();
    child1Mapping.setAttributeName("child1");
    child1Mapping.setXPath("tns:child1");
    child1Mapping.setReferenceClass(Child1.class);
    xmlDescriptor.addMapping(child1Mapping);
    XMLCompositeDirectCollectionMapping simpleListMapping = new XMLCompositeDirectCollectionMapping();
    simpleListMapping.setAttributeName("simpleList");
    simpleListMapping.setXPath("tns:simple-list/text()");
    xmlDescriptor.addMapping(simpleListMapping);
    XMLCompositeCollectionMapping child2Mapping = new XMLCompositeCollectionMapping();
    child2Mapping.setAttributeName("child2");
    child2Mapping.setXPath("tns:child2");
    child2Mapping.setReferenceClass(Child2.class);
    child2Mapping.getContainerPolicy().setContainerClass(ArrayList.class);
    xmlDescriptor.addMapping(child2Mapping);
    return xmlDescriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) XMLCompositeCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping) NamespaceResolver(org.eclipse.persistence.oxm.NamespaceResolver) XMLCompositeDirectCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping) XMLSchemaClassPathReference(org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference) XMLCompositeObjectMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeObjectMapping)

Example 64 with XMLSchemaClassPathReference

use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.

the class MappingsProject method getChild1Descriptor.

private XMLDescriptor getChild1Descriptor() {
    XMLDescriptor xmlDescriptor = new XMLDescriptor();
    xmlDescriptor.setJavaClass(Child1.class);
    xmlDescriptor.addPrimaryKeyFieldName("@id");
    NamespaceResolver namespaceResolver = new NamespaceResolver();
    namespaceResolver.put("tns", "urn:mappings");
    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);
    XMLCollectionReferenceMapping child2CollectionMapping = new XMLCollectionReferenceMapping();
    child2CollectionMapping.setReferenceClass(Child2.class);
    child2CollectionMapping.setAttributeName("child2Collection");
    child2CollectionMapping.addSourceToTargetKeyFieldAssociation("tns:child2/text()", "@id");
    xmlDescriptor.addMapping(child2CollectionMapping);
    return xmlDescriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) XMLCollectionReferenceMapping(org.eclipse.persistence.oxm.mappings.XMLCollectionReferenceMapping) NamespaceResolver(org.eclipse.persistence.oxm.NamespaceResolver) XMLSchemaClassPathReference(org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference)

Example 65 with XMLSchemaClassPathReference

use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.

the class MappingsProject 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");
    schemaReference.setType(XMLSchemaReference.COMPLEX_TYPE);
    xmlDescriptor.setSchemaReference(schemaReference);
    NamespaceResolver namespaceResolver = new NamespaceResolver();
    namespaceResolver.put("tns", "urn:mappings");
    xmlDescriptor.setNamespaceResolver(namespaceResolver);
    XMLDirectMapping idMapping = new XMLDirectMapping();
    idMapping.setAttributeName("id");
    idMapping.setXPath("@id");
    xmlDescriptor.addMapping(idMapping);
    XMLDirectMapping nameMapping = new XMLDirectMapping();
    nameMapping.setAttributeName("name");
    nameMapping.setXPath("tns:name/text()");
    xmlDescriptor.addMapping(nameMapping);
    XMLCompositeObjectMapping child1Mapping = new XMLCompositeObjectMapping();
    child1Mapping.setAttributeName("child1");
    child1Mapping.setXPath("tns:child1");
    child1Mapping.setReferenceClass(Child1.class);
    xmlDescriptor.addMapping(child1Mapping);
    XMLCompositeDirectCollectionMapping simpleListMapping = new XMLCompositeDirectCollectionMapping();
    simpleListMapping.setAttributeName("simpleList");
    simpleListMapping.setXPath("tns:simple-list/text()");
    xmlDescriptor.addMapping(simpleListMapping);
    XMLCompositeCollectionMapping child2Mapping = new XMLCompositeCollectionMapping();
    child2Mapping.setAttributeName("child2");
    child2Mapping.setXPath("tns:child2");
    child2Mapping.setReferenceClass(Child2.class);
    child2Mapping.getContainerPolicy().setContainerClass(ArrayList.class);
    xmlDescriptor.addMapping(child2Mapping);
    return xmlDescriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) XMLCompositeCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping) NamespaceResolver(org.eclipse.persistence.oxm.NamespaceResolver) XMLCompositeDirectCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping) XMLSchemaClassPathReference(org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference) XMLCompositeObjectMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeObjectMapping)

Aggregations

XMLSchemaClassPathReference (org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference)71 XMLDescriptor (org.eclipse.persistence.oxm.XMLDescriptor)69 XMLDirectMapping (org.eclipse.persistence.oxm.mappings.XMLDirectMapping)52 NamespaceResolver (org.eclipse.persistence.oxm.NamespaceResolver)36 QName (javax.xml.namespace.QName)13 XMLCompositeCollectionMapping (org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping)9 XMLCompositeObjectMapping (org.eclipse.persistence.oxm.mappings.XMLCompositeObjectMapping)9 XMLField (org.eclipse.persistence.oxm.XMLField)8 XMLObjectReferenceMapping (org.eclipse.persistence.oxm.mappings.XMLObjectReferenceMapping)6 XMLSchemaReference (org.eclipse.persistence.oxm.schema.XMLSchemaReference)5 XMLCollectionReferenceMapping (org.eclipse.persistence.oxm.mappings.XMLCollectionReferenceMapping)4 XMLCompositeDirectCollectionMapping (org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping)2 XmlValue (jakarta.xml.bind.annotation.XmlValue)1 XMLAnyCollectionMapping (org.eclipse.persistence.oxm.mappings.XMLAnyCollectionMapping)1 XMLTransformationMapping (org.eclipse.persistence.oxm.mappings.XMLTransformationMapping)1