Package net.sf.wsdl2jibx.compiler.event

Examples of net.sf.wsdl2jibx.compiler.event.ElementEvent


  /**
   *
   * @param el
   */
  protected void processElement(XmlSchemaElement el) {
    ElementEvent eEvent = createNewElementEvent(el);
   
    if(el.getSchemaTypeName()==null && el.getRefName()==null && eEvent.isComplexType()) {
      // if the complexType is declared inside element, we process it later
      complexTypeList.add(eEvent.getSchemaType());
    }

    // si le type utilis� est un wrapper de tableau
    if(eEvent.isArrayWrapper()) {
      usedWrapperArraysList.add(eEvent.getSchemaType().getQName().toString());
      XmlSchemaObject targetObj = XmlSchemaUtils.getWrappedObject((XmlSchemaComplexType)eEvent.getSchemaType());
     
      if(targetObj instanceof XmlSchemaElement) {
        eEvent.setWrappedEvent(createNewElementEvent((XmlSchemaElement)targetObj));
       
      } else if(targetObj instanceof XmlSchemaChoice) {
        log.debug("Found wrapper of choice");
        ChoiceEvent cEvent = createNewChoiceEvent((XmlSchemaChoice)targetObj);
        cEvent.setWrapped(true);
        cEvent.setNs(eEvent.getNs());
        cEvent.setName(eEvent.getName());
        cEvent.setNillable(eEvent.isNillable());
        handler.foundElementsInChoice(cEvent);
        return;
       
      } else {
        throw new RuntimeException(ClassUtils.simpleClassName(targetObj.getClass())+" not supported");
View Full Code Here


   *
   * @param el
   * @return
   */
  private ElementEvent createNewElementEvent(XmlSchemaElement el) {
    ElementEvent event = new ElementEvent();
   
    if(el.getRefName()!=null)
      fixElementRef(el);
   
    event.setName(el.getName());
    event.setTypeQName(XmlSchemaUtils.geTypeQName(el));
    event.setNs(event.getTypeQName().getNamespaceURI());
    event.setSchemaType(el.getSchemaType());
    event.setJavaQName(JavaSourceUtils.toJavaQName(event.getTypeQName()));
    event.setComplexType(event.getSchemaType() instanceof XmlSchemaComplexType);
    event.setArrayWrapper(false);
    event.setOptional(el.getMinOccurs()==0);
    event.setNillable(el.isNillable());
    event.setMultiple(el.getMaxOccurs()>1);
   
    if(event.isComplexType() && options.isUnwrapArrays())
      event.setArrayWrapper(XmlSchemaUtils.isArrayWrapper((XmlSchemaComplexType)event.getSchemaType()));
   
    return event;
  }
View Full Code Here

   
    for(Iterator it=choice.getItems().getIterator();it.hasNext();) {
      XmlSchemaObject obj = (XmlSchemaObject)it.next();
      if(obj instanceof XmlSchemaElement) {
        XmlSchemaElement el = (XmlSchemaElement)obj;
        ElementEvent eEvent = createNewElementEvent(el);
       
        if(el.getSchemaTypeName()==null && el.getRefName()==null && eEvent.isComplexType()) {
          // if the complexType is declared inside element, we process it later
          complexTypeList.add(eEvent.getSchemaType());
        }
       
        schemaTypes.add(eEvent.getSchemaType());
        elementEvents.add(eEvent);
       
      } else {
        throw new RuntimeException(ClassUtils.simpleClassName(obj.getClass())+" not supported in choice");
      }
View Full Code Here

      }
      /*
       *
       */
    } else if(event.isArrayWrapper()) {
      ElementEvent wrap = event.getWrappedEvent();
      if(wrap.isComplexType()) {
        jibx.addCollection(event.getName(), event.getName(), event.isNillable());
        if(!options.isListAsPlainArray() && !wrap.getJavaQName().isPrimitive()) {
          jibx.getCurrentCollection().setCreateType(options.getListImplementation());
        }
        jibx.addStructureToCollection(wrap.getName(), null, event.getNs(),
            nsContext.getTypeNS(wrap.getTypeQName()),
            wrap.isNillable(), wrap.isOptional());
        if(wrap.isNillable()) jibx.getCurrentStructure().setType(wrap.getJavaQName().toString());
        addNamespace(event.getNs(), "none");

      } else {
        jibx.addCollection(event.getName(), event.getName(), event.isNillable());
        jibx.addValueToCollection(wrap.getName(), null, event.getTypeQName().getNamespaceURI(),
            wrap.getJavaQName().toString(), wrap.isNillable(), wrap.isOptional());
        addNamespace(event.getNs(), "none");
      }
      /*
       *
       */
 
View Full Code Here

  public void foundElementsInChoice(ChoiceEvent cEvent) {
    if(cEvent.isMultiple()) {
      jibx.addCollection(cEvent.isWrapped()?cEvent.getName():null, cEvent.getName(), cEvent.isNillable());

      for(int i=0;i<cEvent.getElementEvents().size();i++) {
        ElementEvent eEvent = (ElementEvent)cEvent.getElementEvents().get(i);
       
        if(eEvent.isComplexType()) {
          jibx.addStructureToCollection(eEvent.getName(), null, cEvent.getNs(),
            nsContext.getTypeNS(eEvent.getTypeQName()), eEvent.isNillable(), eEvent.isOptional());
          if(cEvent.isNillable()) jibx.getCurrentStructure().setType(eEvent.getJavaQName().toString());
          addNamespace(cEvent.getNs(), "none");
        } else {
          jibx.addValueToCollection(eEvent.getName(), null, cEvent.getNs(),
            eEvent.getJavaQName().toString(), eEvent.isNillable(), eEvent.isOptional());
          addNamespace(cEvent.getNs(), "none");
        }
      }
     
    } else {
     
      jibx.addStructure(null, cEvent.getName(), null, cEvent.isNillable(), cEvent.isOptional());
      jibx.getCurrentStructure().setChoice(true);
      jibx.getCurrentStructure().setOrdered(Boolean.FALSE.toString());
     
      for(int i=0;i<cEvent.getElementEvents().size();i++) {
        ElementEvent eEvent = (ElementEvent)cEvent.getElementEvents().get(i);
        JibxStructure struct = jibx.addStructureToStructure(eEvent.getName(), null,
          nsContext.getTypeNS(eEvent.getTypeQName()), eEvent.isNillable(), eEvent.isOptional());
       
        struct.setNs(eEvent.getTypeQName().getNamespaceURI());

        if(cEvent.isNillable()) struct.setType(eEvent.getJavaQName().toString());
      }

    }
  }
View Full Code Here

TOP

Related Classes of net.sf.wsdl2jibx.compiler.event.ElementEvent

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.