Package org.eclipse.xsd

Examples of org.eclipse.xsd.XSDModelGroup


    private void handleSDOSequence(Type datatype, XSDComplexTypeDefinition complexType)
    {
        if ( datatype.isSequenced()     )
        {
            complexType.setMixed(true);
            XSDModelGroup choice = xsdFactory.createXSDModelGroup();
            choice.setCompositor(XSDCompositor.CHOICE_LITERAL);
            XSDParticle aParticle = xsdFactory.createXSDParticle();
            aParticle.setContent(choice);
            aParticle.setMaxOccurs(-1);
            complexType.setContent(aParticle);
        }
        else
        {
            //hack to handle group property as choice
            /*if ( getPropertyStartsWithName(datatype.getDeclaredProperties(), GROUP).size() > 0 )
            {
                XmlSchemaChoice choice = new XmlSchemaChoice();
                choice.setMaxOccurs(Long.MAX_VALUE);
                complexType.setParticle(choice);
            }
            else*/
            {
                XSDModelGroup sequence = xsdFactory.createXSDModelGroup();
                sequence.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
                XSDParticle aParticle = xsdFactory.createXSDParticle();
                aParticle.setContent(sequence);
                complexType.setContent(aParticle);
            }
        }
View Full Code Here


        complexType.setDerivationMethod(XSDDerivationMethod.EXTENSION_LITERAL);
        complexType.setBaseTypeDefinition(
            schema.resolveComplexTypeDefinition(GML.NAMESPACE, "AbstractFeatureType"));

        XSDModelGroup group = factory.createXSDModelGroup();
        group.setCompositor(XSDCompositor.SEQUENCE_LITERAL);

        List attributes = featureType.getAttributeDescriptors();
       
        for (int i = 0; i < attributes.size(); i++) {
            AttributeDescriptor attribute = (AttributeDescriptor) attributes.get(i);
            if ( filterAttributeType( attribute ) ) {
                continue;
            }
           
          
            XSDElementDeclaration element = factory.createXSDElementDeclaration();
            element.setName(attribute.getLocalName());
            element.setNillable(attribute.isNillable());

           
            Class binding = attribute.getType().getBinding();
            Name typeName = findTypeName(binding);

            if (typeName == null) {
                throw new NullPointerException("Could not find a type for property: "
                    + attribute.getName() + " of type: " + binding.getName());
            }

            XSDTypeDefinition type = index.getTypeDefinition( new QName( typeName.getNamespaceURI(), typeName.getLocalPart() ) );
            if ( type == null ) {
                throw new IllegalStateException( "Could not find type: " + typeName );
            }
            //XSDTypeDefinition type = schema.resolveTypeDefinition(typeName.getNamespaceURI(),
            //        typeName.getLocalPart());
            element.setTypeDefinition(type);

            XSDParticle particle = factory.createXSDParticle();
            particle.setMinOccurs(attribute.getMinOccurs());
            particle.setMaxOccurs(attribute.getMaxOccurs());
            particle.setContent(element);
            group.getContents().add(particle);
        }

        XSDParticle particle = factory.createXSDParticle();
        particle.setContent(group);
View Full Code Here

        xsdComplexType.setDerivationMethod(XSDDerivationMethod.EXTENSION_LITERAL);
        xsdComplexType.setBaseTypeDefinition(schema.resolveComplexTypeDefinition(gmlNamespace,
                baseType));

        XSDModelGroup group = factory.createXSDModelGroup();
        group.setCompositor(XSDCompositor.SEQUENCE_LITERAL);

        for (PropertyDescriptor pd : complexType.getDescriptors()) {
            if (pd instanceof AttributeDescriptor) {
                AttributeDescriptor attribute = (AttributeDescriptor) pd;

                if ( filterAttributeType( attribute ) ) {
                    continue;
                }

                XSDElementDeclaration element = factory.createXSDElementDeclaration();
                element.setName(attribute.getLocalName());
                element.setNillable(attribute.isNillable());

                Name typeName = attribute.getType().getName();
                // skip if it's XS.AnyType. It's not added to XS.Profile, because
                // a lot of types extend XS.AnyType causing it to be the returned
                // binding.. I could make it so that it checks against all profiles
                // but would that slow things down? At the moment, it returns the
                // first matching one, so it doesn't go through all profiles.
                if (!(typeName.getLocalPart().equals(XS.ANYTYPE.getLocalPart()) && typeName
                        .getNamespaceURI().equals(XS.NAMESPACE))) {
                    if (attribute.getType() instanceof ComplexType) {
                        // If non-simple complex property not in schema, recurse.
                        // Note that abstract types will of course not be resolved; these must be
                        // configured at global level, so they can be found by the
                        // encoder.
                        if (schema.resolveTypeDefinition(typeName.getNamespaceURI(), typeName
                                .getLocalPart()) == null) {
                            buildComplexSchemaContent((ComplexType) attribute.getType(), schema,
                                    factory);
                        }
                    } else {
                        Class binding = attribute.getType().getBinding();
                        typeName = findTypeName(binding);
                        if (typeName == null) {
                            throw new NullPointerException("Could not find a type for property: "
                                    + attribute.getName() + " of type: " + binding.getName());

                        }
                    }
                }

                XSDTypeDefinition type = schema.resolveTypeDefinition(typeName.getNamespaceURI(),
                        typeName.getLocalPart());
                element.setTypeDefinition(type);

                XSDParticle particle = factory.createXSDParticle();
                particle.setMinOccurs(attribute.getMinOccurs());
                particle.setMaxOccurs(attribute.getMaxOccurs());
                particle.setContent(element);
                group.getContents().add(particle);
            }
        }

        XSDParticle particle = factory.createXSDParticle();
        particle.setContent(group);
View Full Code Here

    private void handleSDOSequence(Type datatype, XSDComplexTypeDefinition complexType)
    {
        if ( datatype.isSequenced()     )
        {
            complexType.setMixed(true);
            XSDModelGroup choice = xsdFactory.createXSDModelGroup();
            choice.setCompositor(XSDCompositor.CHOICE_LITERAL);
            XSDParticle aParticle = xsdFactory.createXSDParticle();
            aParticle.setContent(choice);
            aParticle.setMaxOccurs(-1);
            complexType.setContent(aParticle);
        }
        else
        {
            //hack to handle group property as choice
            /*if ( getPropertyStartsWithName(datatype.getDeclaredProperties(), GROUP).size() > 0 )
            {
                XmlSchemaChoice choice = new XmlSchemaChoice();
                choice.setMaxOccurs(Long.MAX_VALUE);
                complexType.setParticle(choice);
            }
            else*/
            {
                XSDModelGroup sequence = xsdFactory.createXSDModelGroup();
                sequence.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
                XSDParticle aParticle = xsdFactory.createXSDParticle();
                aParticle.setContent(sequence);
                complexType.setContent(aParticle);
            }
        }
View Full Code Here

          String name = getEcoreAttribute(xsdParticle, "name");
          if (xsdTerm instanceof XSDModelGroup)
          {
            if (!isRestriction)
            {
              XSDModelGroup xsdModelGroup = (XSDModelGroup)xsdTerm;
              if (name == null)
              {
                name = getEcoreAttribute(xsdParticle, "featureMap");
                if (name == null)
                {
                  name = getEcoreAttribute(xsdModelGroup, "name");
                  if (name == null)
                  {
                    name = getEcoreAttribute(xsdModelGroup, "featureMap");
                    if (name == null)
                    {
                      if (xsdModelGroup.getContainer() instanceof XSDModelGroupDefinition)
                      {
                        XSDModelGroupDefinition xsdModelGroupDefinition = (XSDModelGroupDefinition)xsdModelGroup.getContainer();
                        name =  getEcoreAttribute(xsdModelGroupDefinition, "name");
                        if (name == null)
                        {
                          name = validName(xsdModelGroupDefinition.getName(), true);
                        }
View Full Code Here

          String name = getEcoreAttribute(xsdParticle, "name");
          if (xsdTerm instanceof XSDModelGroup)
          {
            if (!isRestriction)
            {
              XSDModelGroup xsdModelGroup = (XSDModelGroup)xsdTerm;
              if (name == null)
              {
                name = getEcoreAttribute(xsdParticle, "featureMap");
                if (name == null)
                {
                  name = getEcoreAttribute(xsdModelGroup, "name");
                  if (name == null)
                  {
                    name = getEcoreAttribute(xsdModelGroup, "featureMap");
                    if (name == null)
                    {
                      if (xsdModelGroup.getContainer() instanceof XSDModelGroupDefinition)
                      {
                        XSDModelGroupDefinition xsdModelGroupDefinition = (XSDModelGroupDefinition)xsdModelGroup.getContainer();
                        name =  getEcoreAttribute(xsdModelGroupDefinition, "name");
                        if (name == null)
                        {
                          name = validName(xsdModelGroupDefinition.getName(), true);
                        }
View Full Code Here

      }
    }
    if (parentType.getContent() != null && parentType.getContent() instanceof XSDParticle){
      XSDParticle parentParticle = (XSDParticle)parentType.getContent();
      if (parentParticle.getContent() != null && parentParticle.getContent() instanceof XSDModelGroup){
        XSDModelGroup parentModelGroup = (XSDModelGroup)parentParticle.getContent();
        XSDParticle localElementParticle = XSDFactory.eINSTANCE.createXSDParticle();
        XSDElementDeclaration el = XSDFactory.eINSTANCE.createXSDElementDeclaration();
        localElementParticle.setContent(el);
        if (setTargetNamespace)
          el.setTargetNamespace(targetNamespace);
        if (!fieldType.getTargetNamespace().equals(parentType.getSchema().getTargetNamespace())){
          XSDSchema parentSchema = parentType.getSchema();
          XSDSchema fieldSchema = fieldType.getSchema();
         
          HashSet<XSDSchema> dependencies = schemaDependencies.get(parentSchema);
          if (fieldSchema != null){
            if (!dependencies.contains(fieldSchema) && !fieldSchema.getTargetNamespace().equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001)){
              dependencies.add(fieldSchema);
            }
          }
        }
        el.setName(elementName);
        el.setTypeDefinition(fieldType);       
        parentModelGroup.getContents().add(localElementParticle);
        complexTypePropMap.get(parentType).add(el);
        return el;
      }
    }
    return null;
View Full Code Here

          Part part = (Part)operation.getOutput().getMessage().getPart("parameters");
 
          XSDElementDeclaration parentElement = part.getElementDeclaration();
          XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition)parentElement.getType();       
          XSDParticle parentParticle = (XSDParticle)complexType.getContent();           
          XSDModelGroup parentModelGroup = (XSDModelGroup)parentParticle.getContent();       
         
          XSDElementDeclaration el = XSDFactory.eINSTANCE.createXSDElementDeclaration();
          el.setName(resultName);
          el.setTypeDefinition(xsdType);
         
          XSDParticle localElementParticle = XSDFactory.eINSTANCE.createXSDParticle();
          localElementParticle.setContent(el);                 
         
          parentModelGroup.getContents().add(localElementParticle);
          wsdlDocLitWrapResultMap.put(operation, el);
         
          XSDSchema schema = xsdType.getSchema();
          if (schema != null && !schema.getTargetNamespace().equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001)){
            Vector<XSDSchema> dependencies = wsdlDependencies.get(operation.getEnclosingDefinition());
View Full Code Here

        complexType = XSDFactory.eINSTANCE.createXSDComplexTypeDefinition();
        complexType.setTargetNamespace(schema.getTargetNamespace());
        complexType.setName(ctSimpleType.getSimpleName());
       
        XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle();
        XSDModelGroup modelGroup = XSDFactory.eINSTANCE.createXSDModelGroup();
        modelGroup.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
        particle.setContent(modelGroup);   
        complexType.setContent(particle);
        try {
          schema.getContents().add(complexType);
        }catch(Exception e){
View Full Code Here

         
          XSDElementDeclaration parentElement = part.getElementDeclaration();
          XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition)parentElement.getType();
         
          XSDParticle parentParticle = (XSDParticle)complexType.getContent();           
          XSDModelGroup parentModelGroup = (XSDModelGroup)parentParticle.getContent();
          XSDParticle localElementParticle = XSDFactory.eINSTANCE.createXSDParticle();
          XSDElementDeclaration el = XSDFactory.eINSTANCE.createXSDElementDeclaration();
          localElementParticle.setContent(el);
          el.setName(paramName);
          el.setTypeDefinition(xsdType);         
          parentModelGroup.getContents().add(localElementParticle);
          if (wsdlDocLitParamElemMap.get(operation) == null)
            wsdlDocLitParamElemMap.put(operation, new LinkedList<XSDElementDeclaration>());
          wsdlDocLitParamElemMap.get(operation).add(el);
          wsdlDocLitWrapParamMap.put(parameter, el);
        }
View Full Code Here

TOP

Related Classes of org.eclipse.xsd.XSDModelGroup

Copyright © 2018 www.massapicom. 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.