Search in sources :

Example 16 with SimpleType

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

the class SDOTypesGenerator method processGlobalSimpleTypes.

private void processGlobalSimpleTypes(Schema schema) {
    Collection<SimpleType> simpleTypes = schema.getTopLevelSimpleTypes().values();
    if (simpleTypes == null) {
        return;
    }
    Iterator<SimpleType> simpleTypesIter = simpleTypes.iterator();
    while (simpleTypesIter.hasNext()) {
        SimpleType simpleType = simpleTypesIter.next();
        String targetNamespace = schema.getTargetNamespace();
        if (null == targetNamespace) {
            targetNamespace = "";
        }
        processGlobalSimpleType(targetNamespace, schema.getDefaultNamespace(), simpleType);
    }
}
Also used : SimpleType(org.eclipse.persistence.internal.oxm.schema.model.SimpleType)

Example 17 with SimpleType

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

the class SDOTypesGenerator method processAttribute.

private SDOType processAttribute(String targetNamespace, String defaultNamespace, SDOType owningType, Attribute attribute, boolean isGlobal) {
    SimpleType simpleType = attribute.getSimpleType();
    if (simpleType != null) {
        SDOType propertyType = processSimpleType(targetNamespace, defaultNamespace, attribute.getName(), simpleType);
        processSimpleAttribute(targetNamespace, defaultNamespace, owningType, attribute, isGlobal, rootSchema.isAttributeFormDefault(), propertyType);
        propertyType.setXsdLocalName(attribute.getName());
        propertyType.setXsd(true);
        return propertyType;
    } else {
        processSimpleAttribute(targetNamespace, defaultNamespace, owningType, attribute, isGlobal, rootSchema.isAttributeFormDefault() || isGlobal, null);
        return null;
    }
}
Also used : SimpleType(org.eclipse.persistence.internal.oxm.schema.model.SimpleType) SDOType(org.eclipse.persistence.sdo.SDOType)

Example 18 with SimpleType

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

the class SDOTypesGenerator method processBaseType.

private Type processBaseType(String targetNamespace, String defaultNamespace, SDOType owningType, String qualifiedName, boolean simpleContentExtension, Restriction restriction) {
    if (qualifiedName == null) {
        return null;
    }
    SDOType baseType = getSDOTypeForName(targetNamespace, defaultNamespace, qualifiedName);
    QName baseQName = getQNameForString(defaultNamespace, qualifiedName);
    if (!baseType.isFinalized() && baseQName.getNamespaceURI().equals(targetNamespace)) {
        if (baseType.isDataType()) {
            SimpleType baseSimpleType = rootSchema.getTopLevelSimpleTypes().get(baseQName.getLocalPart());
            processGlobalSimpleType(targetNamespace, defaultNamespace, baseSimpleType);
        } else {
            ComplexType baseComplexType = rootSchema.getTopLevelComplexTypes().get(baseQName.getLocalPart());
            processGlobalComplexType(targetNamespace, defaultNamespace, baseComplexType);
        }
    }
    // Java instance class is int
    if (baseQName.equals(XMLConstants.INTEGER_QNAME) || baseQName.equals(SDOConstants.POSITIVEINTEGER_QNAME) || baseQName.equals(SDOConstants.NEGATIVEINTEGER_QNAME) || baseQName.equals(SDOConstants.NONPOSITIVEINTEGER_QNAME) || baseQName.equals(SDOConstants.NONNEGATIVEINTEGER_QNAME) || baseQName.equals(XMLConstants.LONG_QNAME) || baseQName.equals(SDOConstants.UNSIGNEDLONG_QNAME)) {
        boolean alreadySet = false;
        String value = restriction.getMaxInclusive();
        if (value != null) {
            if (Integer.parseInt(value) <= Integer.MAX_VALUE) {
                baseType = getTypeForXSDQName(XMLConstants.INT_QNAME);
                alreadySet = true;
            }
        }
        // if maxInclusive was processed, no need to handle maxExclusive
        if (!alreadySet) {
            value = restriction.getMaxExclusive();
            if (value != null) {
                if (Integer.parseInt(value) < Integer.MAX_VALUE) {
                    baseType = getTypeForXSDQName(XMLConstants.INT_QNAME);
                }
            }
        }
    }
    processBaseType(baseType, targetNamespace, defaultNamespace, owningType, qualifiedName, simpleContentExtension);
    return baseType;
}
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)

Aggregations

SimpleType (org.eclipse.persistence.internal.oxm.schema.model.SimpleType)18 QName (javax.xml.namespace.QName)10 ComplexType (org.eclipse.persistence.internal.oxm.schema.model.ComplexType)6 Element (org.eclipse.persistence.internal.oxm.schema.model.Element)6 ArrayList (java.util.ArrayList)5 SDOType (org.eclipse.persistence.sdo.SDOType)5 List (java.util.List)4 Attribute (org.eclipse.persistence.internal.oxm.schema.model.Attribute)4 Restriction (org.eclipse.persistence.internal.oxm.schema.model.Restriction)4 AnyAttribute (org.eclipse.persistence.internal.oxm.schema.model.AnyAttribute)3 Property (commonj.sdo.Property)2 XPathFragment (org.eclipse.persistence.internal.oxm.XPathFragment)2 Extension (org.eclipse.persistence.internal.oxm.schema.model.Extension)2 Schema (org.eclipse.persistence.internal.oxm.schema.model.Schema)2 SimpleContent (org.eclipse.persistence.internal.oxm.schema.model.SimpleContent)2 TypeDefParticle (org.eclipse.persistence.internal.oxm.schema.model.TypeDefParticle)2 JavaClass (org.eclipse.persistence.jaxb.javamodel.JavaClass)2 XmlVirtualAccessMethodsSchema (org.eclipse.persistence.jaxb.xmlmodel.XmlVirtualAccessMethodsSchema)2 SDOProperty (org.eclipse.persistence.sdo.SDOProperty)2 XmlSchemaType (jakarta.xml.bind.annotation.XmlSchemaType)1