Search in sources :

Example 6 with ComplexType

use of org.eclipse.persistence.internal.oxm.schema.model.ComplexType in project eclipselink by eclipse-ee4j.

the class SDOTypesGenerator method processGlobalComplexTypes.

private void processGlobalComplexTypes(Schema schema) {
    Collection<ComplexType> complexTypes = schema.getTopLevelComplexTypes().values();
    if (complexTypes == null) {
        return;
    }
    Iterator<ComplexType> complexTypesIter = complexTypes.iterator();
    while (complexTypesIter.hasNext()) {
        ComplexType complexType = complexTypesIter.next();
        String targetNamespace = schema.getTargetNamespace();
        if (null == targetNamespace) {
            targetNamespace = "";
        }
        processGlobalComplexType(targetNamespace, schema.getDefaultNamespace(), complexType);
    }
}
Also used : ComplexType(org.eclipse.persistence.internal.oxm.schema.model.ComplexType)

Example 7 with ComplexType

use of org.eclipse.persistence.internal.oxm.schema.model.ComplexType in project eclipselink by eclipse-ee4j.

the class SDOTypesGenerator method preprocessGlobalTypes.

private void preprocessGlobalTypes(Schema schema) {
    String targetNamespace = schema.getTargetNamespace();
    // Global Complex Types
    Collection<ComplexType> globalComplexTypes = schema.getTopLevelComplexTypes().values();
    for (ComplexType globalComplexType : globalComplexTypes) {
        QName xsdQName = new QName(targetNamespace, globalComplexType.getName());
        SDOType sdoType = preprocessComplexType(globalComplexType, schema);
        sdoType.setXsdType(xsdQName);
        generatedTypesByXsdQName.put(xsdQName, sdoType);
    }
    // Global Simple Types
    Collection<SimpleType> globalSimpleTypes = schema.getTopLevelSimpleTypes().values();
    for (SimpleType globalSimpleType : globalSimpleTypes) {
        QName xsdQName = new QName(targetNamespace, globalSimpleType.getName());
        SDOType sdoType = preprocessSimpleType(globalSimpleType, schema);
        sdoType.setXsdType(xsdQName);
        generatedTypesByXsdQName.put(xsdQName, sdoType);
    }
}
Also used : SimpleType(org.eclipse.persistence.internal.oxm.schema.model.SimpleType) QName(javax.xml.namespace.QName) SDOType(org.eclipse.persistence.sdo.SDOType) ComplexType(org.eclipse.persistence.internal.oxm.schema.model.ComplexType)

Example 8 with ComplexType

use of org.eclipse.persistence.internal.oxm.schema.model.ComplexType in project eclipselink by eclipse-ee4j.

the class SDOTypesGenerator method processGlobalComplexType.

private void processGlobalComplexType(String targetNamespace, String defaultNamespace, ComplexType complexType) {
    QName qname = new QName(targetNamespace, complexType.getName());
    ComplexType processed = processedComplexTypes.get(qname);
    if (processed == null) {
        processComplexType(targetNamespace, defaultNamespace, complexType.getName(), complexType);
        processedComplexTypes.put(qname, complexType);
    }
}
Also used : QName(javax.xml.namespace.QName) ComplexType(org.eclipse.persistence.internal.oxm.schema.model.ComplexType)

Example 9 with ComplexType

use of org.eclipse.persistence.internal.oxm.schema.model.ComplexType in project eclipselink by eclipse-ee4j.

the class SDOTypesGenerator method processExtension.

private void processExtension(String targetNamespace, String defaultNamespace, SDOType owningType, Extension extension, boolean simpleContent) {
    if (extension != null) {
        String qualifiedType = extension.getBaseType();
        SDOType baseType = getSDOTypeForName(targetNamespace, defaultNamespace, qualifiedType);
        QName baseQName = getQNameForString(defaultNamespace, qualifiedType);
        if (baseType != null) {
            if (!baseType.isFinalized() && baseQName.getNamespaceURI().equals(targetNamespace)) {
                if (baseType.isDataType()) {
                    SimpleType baseSimpleType = rootSchema.getTopLevelSimpleTypes().get(baseQName.getLocalPart());
                    if (baseSimpleType != null) {
                        processGlobalSimpleType(targetNamespace, defaultNamespace, baseSimpleType);
                    }
                } else {
                    ComplexType baseComplexType = rootSchema.getTopLevelComplexTypes().get(baseQName.getLocalPart());
                    if (baseComplexType != null) {
                        processGlobalComplexType(targetNamespace, defaultNamespace, baseComplexType);
                    }
                }
            }
            owningType.setOpen(owningType.isOpen() || baseType.isOpen());
        }
        if (qualifiedType != null) {
            processBaseType(baseType, targetNamespace, defaultNamespace, owningType, qualifiedType, simpleContent);
        }
        if (extension.getChoice() != null) {
            processChoice(targetNamespace, defaultNamespace, owningType, extension.getChoice(), false);
        } else if (extension.getSequence() != null) {
            processSequence(targetNamespace, defaultNamespace, owningType, extension.getSequence(), false);
        } else if (extension.getAll() != null) {
        }
        processOrderedAttributes(targetNamespace, defaultNamespace, owningType, extension.getOrderedAttributes());
    }
}
Also used : SimpleType(org.eclipse.persistence.internal.oxm.schema.model.SimpleType) QName(javax.xml.namespace.QName) SDOType(org.eclipse.persistence.sdo.SDOType) ComplexType(org.eclipse.persistence.internal.oxm.schema.model.ComplexType)

Example 10 with ComplexType

use of org.eclipse.persistence.internal.oxm.schema.model.ComplexType in project eclipselink by eclipse-ee4j.

the class Util method addSimpleXMLFormat.

/*
      <?xml version="1.0" encoding="UTF-8"?>
      <xsd:schema
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        >
        <xsd:complexType name="simple-xml-format">
          <xsd:sequence>
            <xsd:any minOccurs="0"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:schema>
    */
public static void addSimpleXMLFormat(Schema schema) {
    ComplexType anyType = new ComplexType();
    anyType.setName(DEFAULT_SIMPLE_XML_FORMAT_TAG);
    Sequence anySequence = new Sequence();
    Any any = new Any();
    any.setMinOccurs("0");
    anySequence.addAny(any);
    anyType.setSequence(anySequence);
    schema.addTopLevelComplexTypes(anyType);
}
Also used : Sequence(org.eclipse.persistence.internal.oxm.schema.model.Sequence) ComplexType(org.eclipse.persistence.internal.oxm.schema.model.ComplexType) Any(org.eclipse.persistence.internal.oxm.schema.model.Any)

Aggregations

ComplexType (org.eclipse.persistence.internal.oxm.schema.model.ComplexType)29 Element (org.eclipse.persistence.internal.oxm.schema.model.Element)14 Schema (org.eclipse.persistence.internal.oxm.schema.model.Schema)13 QName (javax.xml.namespace.QName)12 Sequence (org.eclipse.persistence.internal.oxm.schema.model.Sequence)9 TypeDefParticle (org.eclipse.persistence.internal.oxm.schema.model.TypeDefParticle)7 XmlVirtualAccessMethodsSchema (org.eclipse.persistence.jaxb.xmlmodel.XmlVirtualAccessMethodsSchema)7 SimpleType (org.eclipse.persistence.internal.oxm.schema.model.SimpleType)6 SDOType (org.eclipse.persistence.sdo.SDOType)5 XPathFragment (org.eclipse.persistence.internal.oxm.XPathFragment)4 SchemaModelProject (org.eclipse.persistence.internal.oxm.schema.SchemaModelProject)4 Extension (org.eclipse.persistence.internal.oxm.schema.model.Extension)4 JavaClass (org.eclipse.persistence.jaxb.javamodel.JavaClass)4 NamespaceResolver (org.eclipse.persistence.oxm.NamespaceResolver)4 XMLContext (org.eclipse.persistence.oxm.XMLContext)4 XMLDescriptor (org.eclipse.persistence.oxm.XMLDescriptor)4 StringReader (java.io.StringReader)3 StringWriter (java.io.StringWriter)3 ArrayList (java.util.ArrayList)3 Map (java.util.Map)3