Examples of XmlSchemaSequence


Examples of org.apache.ws.commons.schema.XmlSchemaSequence

    }

    private static boolean isWrappableSequence(XmlSchemaComplexType type, String namespaceURI,
                                               MessageInfo wrapper, boolean allowRefs) {
        if (type.getParticle() instanceof XmlSchemaSequence) {
            XmlSchemaSequence seq = (XmlSchemaSequence)type.getParticle();
            return buildMessageParts(seq, namespaceURI, wrapper, allowRefs);
        } else if (type.getParticle() == null) {
            if (type.getContentModel() == null) {
                return true;
            }
            if (type.getContentModel().getContent() instanceof XmlSchemaComplexContentExtension) {
                XmlSchemaComplexContentExtension extension = (XmlSchemaComplexContentExtension)type
                    .getContentModel().getContent();
                QName baseTypeName = extension.getBaseTypeName();
                ServiceInfo serviceInfo = wrapper.getOperation().getInterface().getService();
                XmlSchemaType schemaType = serviceInfo.getXmlSchemaCollection().getTypeByQName(baseTypeName);
                if (!(schemaType instanceof XmlSchemaComplexType)
                    || !isWrappableSequence((XmlSchemaComplexType)schemaType, namespaceURI, wrapper,
                                            allowRefs)) {
                    return false;
                }
                            
                if (extension.getParticle() instanceof XmlSchemaSequence) {
                    XmlSchemaSequence seq = (XmlSchemaSequence)extension.getParticle();
                    return buildMessageParts(seq, namespaceURI, wrapper, allowRefs);
               
               
            }
            return true;
View Full Code Here

Examples of org.apache.ws.commons.schema.XmlSchemaSequence

            part.setXmlSchema(el);

            XmlSchemaComplexType ct = new XmlSchemaComplexType(schemaInfo.getSchema(), false);
            el.setSchemaType(ct);
            XmlSchemaSequence seq = new XmlSchemaSequence();
            ct.setParticle(seq);

            Method methods[] = cls.getMethods();
            for (Method m : methods) {
                if (m.getName().startsWith("get")
                    || m.getName().startsWith("is")) {
                    int beginIdx = m.getName().startsWith("get") ? 3 : 2;
                    try {
                        m.getDeclaringClass().getMethod("set" + m.getName().substring(beginIdx),
                                                        m.getReturnType());

                        JAXBBeanInfo beanInfo = getBeanInfo(m.getReturnType());
                        if (beanInfo != null) {
                            el = new XmlSchemaElement(schemaInfo.getSchema(), false);
                            el.setName(m.getName().substring(beginIdx));
                            Iterator<QName> itr = beanInfo.getTypeNames().iterator();
                            if (!itr.hasNext()) {
                                return;
                            }
                            QName typeName = itr.next();
                            el.setSchemaTypeName(typeName);
                        }

                        seq.getItems().add(el);
                    } catch (Exception e) {
                        //not mappable
                    }
                }
            }
View Full Code Here

Examples of org.apache.ws.commons.schema.XmlSchemaSequence

        XmlSchema schema = newXmlSchema("urn:Bean");
        type.writeSchema(schema);

        XmlSchemaComplexType stype = (XmlSchemaComplexType)schema.getTypeByName("bean");
        XmlSchemaSequence seq = (XmlSchemaSequence) stype.getParticle();
        boolean howdy = false;
        boolean bleh = false;

        for (int x = 0; x < seq.getItems().size(); x++) {
            XmlSchemaSequenceMember o = seq.getItems().get(x);
            if (o instanceof XmlSchemaElement) {
                XmlSchemaElement a = (XmlSchemaElement)o;
                if ("bleh".equals(a.getName())) {
                    bleh = true;
                }
View Full Code Here

Examples of org.apache.ws.commons.schema.XmlSchemaSequence

        XmlSchema schema = newXmlSchema("urn:Bean");
        type.writeSchema(schema);

        XmlSchemaComplexType btype = (XmlSchemaComplexType)schema.getTypeByName("bean");
        XmlSchemaSequence seq = (XmlSchemaSequence)btype.getParticle();
        boolean int1ok = false;
        boolean int2ok = false;
        for (int x = 0; x < seq.getItems().size(); x++) {
            XmlSchemaSequenceMember o = seq.getItems().get(x);
            if (o instanceof XmlSchemaElement) {
                XmlSchemaElement oe = (XmlSchemaElement) o;
                if ("int1".equals(oe.getName())) {
                    int1ok = true;
                    assertTrue(oe.isNillable());
View Full Code Here

Examples of org.apache.ws.commons.schema.XmlSchemaSequence

        XmlSchema schema = newXmlSchema("urn:Bean");
        type.writeSchema(schema);

        XmlSchemaComplexType btype = (XmlSchemaComplexType)schema.getTypeByName("BeanWithNillableItem");
        XmlSchemaSequence seq = (XmlSchemaSequence)btype.getParticle();
        boolean itemFound = false;
        boolean itemNotNillableFound = false;
        for (int x = 0; x < seq.getItems().size(); x++) {
            XmlSchemaSequenceMember o = seq.getItems().get(x);
            if (o instanceof XmlSchemaElement) {
                XmlSchemaElement oe = (XmlSchemaElement) o;
                if ("item".equals(oe.getName())) {
                    itemFound = true;
                    assertTrue(oe.isNillable());
View Full Code Here

Examples of org.apache.ws.commons.schema.XmlSchemaSequence

        XmlSchema schema = newXmlSchema("urn:Bean");
        type.writeSchema(schema);

        XmlSchemaComplexType btype = (XmlSchemaComplexType)schema.getTypeByName("IntBean");
        XmlSchemaSequence seq = (XmlSchemaSequence)btype.getParticle();
        boolean int1ok = false;
        for (int x = 0; x < seq.getItems().size(); x++) {
            XmlSchemaSequenceMember o = seq.getItems().get(x);
            if (o instanceof XmlSchemaElement) {
                XmlSchemaElement oe = (XmlSchemaElement) o;
                if ("int1".equals(oe.getName())) {
                    int1ok = true;
                    assertFalse(oe.isNillable());
View Full Code Here

Examples of org.apache.ws.commons.schema.XmlSchemaSequence

        XmlSchema schema = newXmlSchema("urn:Bean");
        type.writeSchema(schema);

        XmlSchemaComplexType btype = (XmlSchemaComplexType)schema.getTypeByName("SimpleBean");
        XmlSchemaSequence seq = (XmlSchemaSequence)btype.getParticle();
        boolean charok = false;

        for (int x = 0; x < seq.getItems().size(); x++) {
            XmlSchemaSequenceMember o = seq.getItems().get(x);
            if (o instanceof XmlSchemaElement) {
                XmlSchemaElement oe = (XmlSchemaElement) o;
                if ("character".equals(oe.getName())) {
                    charok = true;
                    assertNotNull(oe.getSchemaTypeName());
View Full Code Here

Examples of org.apache.ws.commons.schema.XmlSchemaSequence

        XmlSchema schema = newXmlSchema("urn:Bean");
        type.writeSchema(schema);

        XmlSchemaComplexType btype = (XmlSchemaComplexType)schema.getTypeByName("SimpleBean");
        XmlSchemaSequence seq = (XmlSchemaSequence)btype.getParticle();
        boolean littleByteOk = false;
        boolean bigByteOk = false;

        for (int x = 0; x < seq.getItems().size(); x++) {
            XmlSchemaSequenceMember o = seq.getItems().get(x);
            if (o instanceof XmlSchemaElement) {
                XmlSchemaElement oe = (XmlSchemaElement) o;
                if ("littleByte".equals(oe.getName())) {
                    littleByteOk = true;
                    assertNotNull(oe.getSchemaTypeName());
View Full Code Here

Examples of org.apache.ws.commons.schema.XmlSchemaSequence

        XmlSchemaComplexType ct = new XmlSchemaComplexType(schema, true);
        ct.setName(faultTypeName);

        el.setSchemaTypeName(ct.getQName());

        XmlSchemaSequence seq = new XmlSchemaSequence();
        ct.setParticle(seq);
        String namespace = part.getElementQName().getNamespaceURI();
        XmlAccessType accessType = Utils.getXmlAccessType(cls);
//
        for (Field f : Utils.getFields(cls, accessType)) {
            //map field
            Type type = Utils.getFieldType(f);
            //we want to return the right type for collections so if we get null
            //from the return type we check if it's ParameterizedType and get the
            //generic return type.
            if ((type == null) && (f.getGenericType() instanceof ParameterizedType)) {
                type = f.getGenericType();
            }
            if (generateGenericType(type)) {
                buildGenericElements(schema, seq, f);
            } else {
                JAXBBeanInfo beanInfo = getBeanInfo(type);
                if (beanInfo != null) {
                    XmlElement xmlElementAnno = f.getAnnotation(XmlElement.class);
                    addElement(schema, seq, beanInfo, new QName(namespace, f.getName()), isArray(type), xmlElementAnno);
                }
            }
        }
        for (Method m : Utils.getGetters(cls, accessType)) {
            //map method
            Type type = Utils.getMethodReturnType(m);
            // we want to return the right type for collections so if we get null
            // from the return type we check if it's ParameterizedType and get the
            // generic return type.
            if ((type == null) && (m.getGenericReturnType() instanceof ParameterizedType)) {
                type = m.getGenericReturnType();
            }
           
            if (generateGenericType(type)) {
                buildGenericElements(schema, seq, m, type);
            } else {
                JAXBBeanInfo beanInfo = getBeanInfo(type);
                if (beanInfo != null) {
                    int idx = m.getName().startsWith("get") ? 3 : 2;
                    String name = m.getName().substring(idx);
                    name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
                    XmlElement  xmlElementAnno =  m.getAnnotation(XmlElement.class);
                    addElement(schema, seq, beanInfo, new QName(namespace, name), isArray(type), xmlElementAnno);
                }
            }
        }
        // Create element in xsd:sequence for Exception.class
        if (Exception.class.isAssignableFrom(cls)) {
            JAXBBeanInfo beanInfo = getBeanInfo(java.lang.String.class);
            XmlSchemaElement exEle = new XmlSchemaElement(schema, false);
            exEle.setName("message");
            exEle.setSchemaTypeName(getTypeName(beanInfo));
            exEle.setMinOccurs(0);
            seq.getItems().add(exEle);
        }
       
        if (propertyOrder != null) {
            if (propertyOrder.length == seq.getItems().size()) {
                sortItems(seq, propertyOrder);
            } else if (propertyOrder.length > 1
                || (propertyOrder.length == 1 && !propertyOrder[0].isEmpty())) {
                LOG.log(Level.WARNING, "propOrder in @XmlType doesn't define all schema elements :"
                    + Arrays.toString(propertyOrder));
View Full Code Here

Examples of org.apache.ws.commons.schema.XmlSchemaSequence

            seq.getItems().add(newel);
        }
    }
   
    private void buildGenericSeq(XmlSchema schema, XmlSchemaComplexType generics, Class<?> genericsClass) {
        XmlSchemaSequence genericsSeq = new XmlSchemaSequence();
        generics.setParticle(genericsSeq);
        XmlAccessType  accessType = Utils.getXmlAccessType(genericsClass);
       
        for (Field f : Utils.getFields(genericsClass, accessType)) {
            if (f.getGenericType() instanceof TypeVariable) {              
                String genericName = Character.toLowerCase(f.getName().charAt(0)) + f.getName().substring(1);
                XmlSchemaElement genericEle = new XmlSchemaElement(schema, false);
                genericEle.setName(genericName);
                genericEle.setMinOccurs(0);
                JAXBBeanInfo anyBean = getBeanInfo(context, f.getType());
                Iterator<QName> itr = anyBean.getTypeNames().iterator();
                if (!itr.hasNext()) {
                    return;
                }
                QName typeName = itr.next();
                genericEle.setSchemaTypeName(typeName);
                genericsSeq.getItems().add(genericEle);
            }
        }
              
        for (Method genericMethod : Utils.getGetters(genericsClass, accessType)) {
            if (genericMethod.getGenericReturnType() instanceof TypeVariable) {
                int idx = genericMethod.getName().startsWith("get") ? 3 : 2;
                String genericName = genericMethod.getName().substring(idx);
                genericName = Character.toLowerCase(genericName.charAt(0)) + genericName.substring(1);
                XmlSchemaElement genericEle = new XmlSchemaElement(schema, false);
                genericEle.setName(genericName);
                genericEle.setMinOccurs(0);
                JAXBBeanInfo anyBean = getBeanInfo(context, genericMethod.getReturnType());
                Iterator<QName> itr = anyBean.getTypeNames().iterator();
                if (!itr.hasNext()) {
                    return;
                }
                QName typeName = itr.next();
                genericEle.setSchemaTypeName(typeName);
                genericsSeq.getItems().add(genericEle);
            }
           
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.