Package com.eviware.soapui.impl.wadl.inference.schema

Examples of com.eviware.soapui.impl.wadl.inference.schema.Particle$Factory


    completed = xml.getCompleted();
    particles = new LinkedHashMap<QName, Particle>(); // LinkedHashMap
    // preserves order.
    for( ParticleConfig particleXml : xml.getParticleList() )
    {
      Particle p = Particle.Factory.parse( particleXml, schema );
      // TODO: Fix namespace!
      particles.put( p.getName(), p );
    }
    comesBefore = new HashMap<QName, List<QName>>();
    for( ComesBefore item : xml.getComesBeforeList() )
    {
      List<QName> others = new ArrayList<QName>();
View Full Code Here


      seen.put( item, 0 );
    for( QName item : sequence )
      seen.put( item, seen.get( item ) + 1 );
    for( Map.Entry<QName, Integer> entry : seen.entrySet() )
    {
      Particle particle = particles.get( entry.getKey() );
      if( Integer.parseInt( particle.getAttribute( "minOccurs" ) ) > entry.getValue() )
      {
        if( context.getHandler().callback( ConflictHandler.Event.MODIFICATION, ConflictHandler.Type.ELEMENT,
            entry.getKey(), context.getPath(), "Element occurs less times than required." ) )
        {
          particle.setAttribute( "minOccurs", entry.getValue().toString() );
        }
        else
          throw new XmlException( "Element '" + entry.getKey().getLocalPart()
              + "' required at least minOccurs times!" );
      }
      if( !particle.getAttribute( "maxOccurs" ).equals( "unbounded" )
          && Integer.parseInt( particle.getAttribute( "maxOccurs" ) ) < entry.getValue() )
      {
        if( context.getHandler().callback( ConflictHandler.Event.MODIFICATION, ConflictHandler.Type.TYPE,
            new QName( schema.getNamespace(), context.getAttribute( "typeName" ) ), context.getPath(),
            "Element occurs more times than allowed." ) )
        {
          particle.setAttribute( "maxOccurs", entry.getValue().toString() );
        }
        else
          throw new XmlException( "Element '" + entry.getKey().getLocalPart()
              + "' must not occur more than maxOccurs times!" );
      }
View Full Code Here

        if( context.getHandler().callback( ConflictHandler.Event.CREATION, ConflictHandler.Type.ELEMENT, item,
            context.getPath() + "/" + item.getLocalPart(), "Element has undeclared child element." ) )
        {
          if( item.getNamespaceURI().equals( schema.getNamespace() ) )
          {
            Particle element = Particle.Factory.newElementInstance( schema, item.getLocalPart() );
            if( completed )
              element.setAttribute( "minOccurs", "0" );
            particles.put( item, element );
          }
          else
          {
            Schema otherSchema = context.getSchemaSystem().getSchemaForNamespace( item.getNamespaceURI() );
            schema.putPrefixForNamespace( item.getPrefix(), item.getNamespaceURI() );
            if( otherSchema == null )
            {
              otherSchema = context.getSchemaSystem().newSchema( item.getNamespaceURI() );
            }
            Particle ref = otherSchema.getParticle( item.getLocalPart() );
            if( ref == null )
            {
              ref = otherSchema.newElement( item.getLocalPart() );
            }
            if( completed )
              ref.setAttribute( "minOccurs", "0" );
            particles.put( item, Particle.Factory.newReferenceInstance( schema, ref ) );
          }
        }
        else
          return false;
View Full Code Here

    mixed = xml.getMixed();
    content = Content.Factory.parse( xml.getContent(), schema );
    attributes = new HashMap<QName, Particle>();
    for( ParticleConfig item : xml.getAttributeList() )
    {
      Particle p = Particle.Factory.parse( item, schema );
      attributes.put( new QName( "", p.getName().getLocalPart() ), p );
    }
    schema.addType( this );
  }
View Full Code Here

            schema.putPrefixForNamespace( qname.getPrefix(), qname.getNamespaceURI() );
            if( otherSchema == null )
            {
              otherSchema = context.getSchemaSystem().newSchema( qname.getNamespaceURI() );
            }
            Particle ref = otherSchema.getParticle( qname.getLocalPart() );
            if( ref == null )
            {
              ref = otherSchema.newAttribute( qname.getLocalPart() );
            }
            if( completed )
              ref.setAttribute( "use", "optional" );
            Particle newAttribute = Particle.Factory.newReferenceInstance( schema, ref );
            attributes.put( qname, newAttribute );
            newAttribute.validate( context );
          }
        }
        else
          throw new XmlException( "Illegal attribute!" );
        seen.add( qname );
View Full Code Here

    return s.toString();
  }

  private Particle newAttribute( QName qname )
  {
    Particle p = Particle.Factory.newAttributeInstance( schema, qname.getLocalPart() );
    attributes.put( qname, p );
    if( completed )
      p.setAttribute( "use", "optional" );
    return p;
  }
View Full Code Here

        this.schema = schema;
        completed = xml.getCompleted();
        particles = new LinkedHashMap<QName, Particle>(); // LinkedHashMap
        // preserves order.
        for (ParticleConfig particleXml : xml.getParticleList()) {
            Particle p = Particle.Factory.parse(particleXml, schema);
            // TODO: Fix namespace!
            particles.put(p.getName(), p);
        }
        comesBefore = new HashMap<QName, List<QName>>();
        for (ComesBefore item : xml.getComesBeforeList()) {
            List<QName> others = new ArrayList<QName>();
            for (QName item2 : item.getOtherList()) {
View Full Code Here

        }
        for (QName item : sequence) {
            seen.put(item, seen.get(item) + 1);
        }
        for (Map.Entry<QName, Integer> entry : seen.entrySet()) {
            Particle particle = particles.get(entry.getKey());
            if (Integer.parseInt(particle.getAttribute("minOccurs")) > entry.getValue()) {
                if (context.getHandler().callback(ConflictHandler.Event.MODIFICATION, ConflictHandler.Type.ELEMENT,
                        entry.getKey(), context.getPath(), "Element occurs less times than required.")) {
                    particle.setAttribute("minOccurs", entry.getValue().toString());
                } else {
                    throw new XmlException("Element '" + entry.getKey().getLocalPart()
                            + "' required at least minOccurs times!");
                }
            }
            if (!particle.getAttribute("maxOccurs").equals("unbounded")
                    && Integer.parseInt(particle.getAttribute("maxOccurs")) < entry.getValue()) {
                if (context.getHandler().callback(ConflictHandler.Event.MODIFICATION, ConflictHandler.Type.TYPE,
                        new QName(schema.getNamespace(), context.getAttribute("typeName")), context.getPath(),
                        "Element occurs more times than allowed.")) {
                    particle.setAttribute("maxOccurs", entry.getValue().toString());
                } else {
                    throw new XmlException("Element '" + entry.getKey().getLocalPart()
                            + "' must not occur more than maxOccurs times!");
                }
            }
View Full Code Here

        for (QName item : sequence) {
            if (!particles.containsKey(item)) {
                if (context.getHandler().callback(ConflictHandler.Event.CREATION, ConflictHandler.Type.ELEMENT, item,
                        context.getPath() + "/" + item.getLocalPart(), "Element has undeclared child element.")) {
                    if (item.getNamespaceURI().equals(schema.getNamespace())) {
                        Particle element = Particle.Factory.newElementInstance(schema, item.getLocalPart());
                        if (completed) {
                            element.setAttribute("minOccurs", "0");
                        }
                        particles.put(item, element);
                    } else {
                        Schema otherSchema = context.getSchemaSystem().getSchemaForNamespace(item.getNamespaceURI());
                        schema.putPrefixForNamespace(item.getPrefix(), item.getNamespaceURI());
                        if (otherSchema == null) {
                            otherSchema = context.getSchemaSystem().newSchema(item.getNamespaceURI());
                        }
                        Particle ref = otherSchema.getParticle(item.getLocalPart());
                        if (ref == null) {
                            ref = otherSchema.newElement(item.getLocalPart());
                        }
                        if (completed) {
                            ref.setAttribute("minOccurs", "0");
                        }
                        particles.put(item, Particle.Factory.newReferenceInstance(schema, ref));
                    }
                } else {
                    return false;
View Full Code Here

        completed = xml.getCompleted();
        mixed = xml.getMixed();
        content = Content.Factory.parse(xml.getContent(), schema);
        attributes = new HashMap<QName, Particle>();
        for (ParticleConfig item : xml.getAttributeList()) {
            Particle p = Particle.Factory.parse(item, schema);
            attributes.put(new QName("", p.getName().getLocalPart()), p);
        }
        schema.addType(this);
    }
View Full Code Here

TOP

Related Classes of com.eviware.soapui.impl.wadl.inference.schema.Particle$Factory

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.