Package org.eclipse.xsd

Examples of org.eclipse.xsd.XSDComplexTypeDefinition


          typeRefNodeData.xsdTypeQName = new QName(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001,"boolean",XML_SCHEMA_NAMESPACE_PREFIX);
          typeRefNodeData.xsdType = xsdBooleanType;
        }
      } else if (!reference.getQualifiedName().startsWith("jbprocess")){
        if (reference.getDeclaration().getAnnotation(javax.jws.WebService.class) == null){
          XSDComplexTypeDefinition xsdType = typeXSDComplexTypeMap.get(reference.getDeclaration());
          if (xsdType != null){
            typeRefNodeData.xsdTypeQName = new QName(xsdType.getSchema().getTargetNamespace(),xsdType.getName(),schemaNsPrefixMap.get(xsdType.getSchema().getTargetNamespace()));
            typeRefNodeData.xsdType = xsdType;
          } else {
            //javax.xml.bind.annotation.XmlType xmlTypeAnnotation = reference.getDeclaration().getAnnotation(javax.xml.bind.annotation.XmlType.class);
            jbprocess.annotations.Process processAnnotation = reference.getDeclaration().getAnnotation(jbprocess.annotations.Process.class);
            WebService webServiceAnnotation = reference.getDeclaration().getAnnotation(WebService.class);
View Full Code Here


      CtPackage ctPackage = launcher.getFactory().Package().getOrCreate("com.example");
      CtClass ctClass = launcher.getFactory().Class().create("com.example.TestClass1");
      ctPackage.getTypes().add(ctClass);
      scanner.visitCtPackage(ctPackage)// calls visitCtClass which creates the complex type mapping
     
      XSDComplexTypeDefinition complexType = scanner.typeXSDComplexTypeMap.get(ctClass);
      assertTrue(complexType != null);
      assertTrue(complexType.getName().equals(ctClass.getSimpleName()));
      assertTrue(complexType.getTargetNamespace().equals(ctPackage.getQualifiedName()));
           
    }catch(Exception e){
      System.err.println("Exception: " + e.getMessage());
      assertTrue(false);
    }   
View Full Code Here

      CtTypeReference ctTypeRef = launcher.getFactory().Type().createReference(String.class.getName());
      @SuppressWarnings("unused")
      CtField ctField = launcher.getFactory().Field().create(ctClass, modifiers, ctTypeRef, "myField");
      scanner.visitCtPackage(ctPackage);     
     
      XSDComplexTypeDefinition complexType = scanner.typeXSDComplexTypeMap.get(ctClass);
      XSDParticle parentParticle = (XSDParticle)complexType.getContent();
      XSDModelGroup parentModelGroup = (XSDModelGroup)parentParticle.getContent();
      XSDParticle localElementParticle = (XSDParticle)parentModelGroup.getContents().get(0);
      XSDElementDeclaration elementdecl = (XSDElementDeclaration)localElementParticle.getContent();
      assertTrue(elementdecl.getName().equals("myField"));
      assertTrue(elementdecl.getTargetNamespace().equals(ctPackage.getQualifiedName()));     
View Full Code Here

      //CtClass ctClass = launcher.getFactory().Class().create("com.example.TestClass1");
      CtInterface ctInterface = launcher.getFactory().Interface().create("com.example.TestClass1");
      ctPackage.getTypes().add(ctInterface);
      scanner.visitCtPackage(ctPackage)// calls visitCtInterface which creates the complex type mapping
     
      XSDComplexTypeDefinition complexType = scanner.typeXSDComplexTypeMap.get(ctInterface);
      assertTrue(complexType != null);
      assertTrue(complexType.getName().equals(ctInterface.getSimpleName()));
      assertTrue(complexType.getTargetNamespace().equals(ctPackage.getQualifiedName()));
           
    }catch(Exception e){
      System.err.println("Exception: " + e.getMessage());
      assertTrue(false);
    }     
View Full Code Here

                                              Node parentNode ) throws RepositoryException {
        if (content == null) {
            return;
        }

        XSDComplexTypeDefinition owner = (XSDComplexTypeDefinition)content.eContainer();

        if (content instanceof XSDParticle) {
            processParticle((XSDParticle)content, parentNode);
        } else if (content instanceof XSDSimpleTypeDefinition) {
            Node contentNode = parentNode.addNode(XsdLexicon.SIMPLE_CONTENT, XsdLexicon.SIMPLE_CONTENT);
            processTypeFacets((XSDSimpleTypeDefinition)content, contentNode, owner.getBaseTypeDefinition());
        }

        XSDDerivationMethod method = owner.getDerivationMethod();
        if (method != null) {
            parentNode.setProperty(XsdLexicon.METHOD, method.getLiteral());
        }

        @SuppressWarnings( "unchecked" )
        List<XSDAttributeGroupContent> attributeGroupContents = owner.getAttributeContents();
        if (attributeGroupContents != null) {
            for (XSDAttributeGroupContent attributeGroup : attributeGroupContents) {
                processAttributeGroupContent(attributeGroup, parentNode);
            }
        }
        @SuppressWarnings( "unchecked" )
        List<XSDAttributeUse> attributeUses = owner.getAttributeUses();
        if (attributeUses != null) {
            for (XSDAttributeUse attributeUse : attributeUses) {
                processAttributeUse(attributeUse, parentNode);
            }
        }
        XSDWildcard wildcard = owner.getAttributeWildcard();
        processWildcard(wildcard, parentNode);
        processNonSchemaAttributes(owner, parentNode, IGNORED_ATTRIBUTES_COMPLEX_TYPE_CONTENT);
    }
View Full Code Here

        QName name = new QName(targetNs, featureName);
        XSDElementDeclaration elementDeclaration = Schemas.getElementDeclaration(schema, name);
        assertNotNull(elementDeclaration);
       

        XSDComplexTypeDefinition type = (XSDComplexTypeDefinition) elementDeclaration.getType();
       
        assertEquals("PrimitiveGeoFeatureType", type.getName());
        assertEquals(targetNs, type.getTargetNamespace());
    }
View Full Code Here

        XSDSimpleTypeDefinition type = null;

        if (instance.getTypeDefinition() instanceof XSDSimpleTypeDefinition) {
            type = (XSDSimpleTypeDefinition) instance.getTypeDefinition();
        } else {
            XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition) instance
                .getTypeDefinition();

            if (complexType.getContentType() instanceof XSDSimpleTypeDefinition) {
                type = (XSDSimpleTypeDefinition) complexType.getContentType();
            }
        }

        String text = instance.getText();
View Full Code Here

            dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
        } catch (ParserConfigurationException e) {
            throw new RuntimeException( e );
        }
       
        XSDComplexTypeDefinition type = f.createXSDComplexTypeDefinition();
        type.setTargetNamespace( featureType.getName().getNamespaceURI() );
        type.setName( featureType.getTypeName() + "Type" );
        type.setDerivationMethod(XSDDerivationMethod.EXTENSION_LITERAL);
        type.setBaseTypeDefinition(schemaIndex.getTypeDefinition( gml.qName("AbstractFeatureType") ) );
               
        XSDModelGroup group = f.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 ( toFilter.contains( attribute.getLocalName() ) ) {
                continue;
            }
          
            XSDElementDeclaration element = f.createXSDElementDeclaration();
            element.setName(attribute.getLocalName());
            element.setNillable(attribute.isNillable());

            //check for geometry
            if ( attribute instanceof GeometryDescriptor ) {
                Class binding = attribute.getType().getBinding();
                if ( Point.class.isAssignableFrom( binding ) ) {
                    element.setTypeDefinition( schemaIndex.getTypeDefinition(gml.qName("PointPropertyType")));
                }
                else if ( LineString.class.isAssignableFrom( binding ) ) {
                    element.setTypeDefinition( schemaIndex.getTypeDefinition(gml.qName("LineStringPropertyType")));
                }
                else if ( Polygon.class.isAssignableFrom( binding) ) {
                    element.setTypeDefinition( schemaIndex.getTypeDefinition(gml.qName("PolygonPropertyType")));
                }
                else if ( MultiPoint.class.isAssignableFrom( binding ) ) {
                    element.setTypeDefinition( schemaIndex.getTypeDefinition(gml.qName("MultiPointPropertyType")));
                }
                else if ( MultiLineString.class.isAssignableFrom( binding ) ) {
                    element.setTypeDefinition( schemaIndex.getTypeDefinition(gml.qName("MultiLineStringPropertyType")));
                }
                else if ( MultiPolygon.class.isAssignableFrom( binding) ) {
                    element.setTypeDefinition( schemaIndex.getTypeDefinition(gml.qName("MultiPolygonPropertyType")));
                }
                else {
                    element.setTypeDefinition( schemaIndex.getTypeDefinition(gml.qName("GeometryPropertyType")));
                }
            }
            else {
                //TODO: do a proper mapping
                element.setTypeDefinition(schemaIndex.getTypeDefinition(XS.STRING));
            }
           

            XSDParticle particle = f.createXSDParticle();
            particle.setMinOccurs(attribute.getMinOccurs());
            particle.setMaxOccurs(attribute.getMaxOccurs());
            particle.setContent(element);
            particle.setElement( dom.createElementNS( XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "element" ) );
           
            group.getContents().add(particle);
        }

        XSDParticle particle = f.createXSDParticle();
        particle.setContent(group);
        particle.setElement( dom.createElementNS( XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "sequence") );
        type.setContent(particle);
        return type;
    }
View Full Code Here

                    //simple types dont have children
                    if (type instanceof XSDSimpleTypeDefinition) {
                        return true;
                    }

                    XSDComplexTypeDefinition cType = (XSDComplexTypeDefinition) type;

                    ElementVisitor visitor = new ElementVisitor() {
                            public void visit(XSDParticle particle) {
                                XSDElementDeclaration element = (XSDElementDeclaration) particle
                                    .getContent();
View Full Code Here

                // simple types doesn't have children
                if (type instanceof XSDSimpleTypeDefinition) {
                    return true;
                }

                XSDComplexTypeDefinition cType = (XSDComplexTypeDefinition) type;

                ElementVisitor visitor = new ElementVisitor() {
                    public void visit(XSDParticle particle) {
                        XSDWildcard element = (XSDWildcard) particle.getContent();
View Full Code Here

TOP

Related Classes of org.eclipse.xsd.XSDComplexTypeDefinition

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.