You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by am...@apache.org on 2007/05/03 15:56:34 UTC

svn commit: r534864 [2/3] - in /webservices/axis2/trunk/java/modules/adb-codegen: ./ src/org/apache/axis2/schema/ src/org/apache/axis2/schema/template/ src/org/apache/axis2/schema/writer/ test-resources/testsuite/ test/org/apache/axis2/schema/innerChoi...

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl?view=diff&rev=534864&r1=534863&r2=534864
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl Thu May  3 06:56:33 2007
@@ -48,6 +48,8 @@
         <xsl:variable name="extension" select="@extension"/>
         <xsl:variable name="restriction" select="@restriction"/>
         <xsl:variable name="mapperClass" select="@mapperClass"/>
+        <xsl:variable name="particleClass" select="@particleClass"/>
+        <xsl:variable name="hasParticleType" select="@hasParticleType"/>
     <!-- write the class header. this should be done only when unwrapped -->
 
         <xsl:if test="not(not(@unwrapped) or (@skip-write))">
@@ -793,27 +795,36 @@
             </xsl:when>
 
             <xsl:when test="@type or @anon">
-                <!-- For a type write the passed in QName first-->
+                <!-- For a type write the passed in QName first
+                 we create special particle classes for Sequence,Choice and all elements to
+                 handle maxOccurs correctly. So these classes should not write parent Qname-->
 
-                java.lang.String prefix = parentQName.getPrefix();
-                java.lang.String namespace = parentQName.getNamespaceURI();
 
-                if (namespace != null) {
-                    java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
-                    if (writerPrefix != null) {
-                        xmlWriter.writeStartElement(namespace, parentQName.getLocalPart());
-                    } else {
-                        if (prefix == null) {
-                            prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
-                        }
+                java.lang.String prefix = null;
+                java.lang.String namespace = null;
+                <xsl:if test="not($particleClass)">
 
-                        xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace);
-                        xmlWriter.writeNamespace(prefix, namespace);
-                        xmlWriter.setPrefix(prefix, namespace);
+                    prefix = parentQName.getPrefix();
+                    namespace = parentQName.getNamespaceURI();
+
+                    if (namespace != null) {
+                        java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
+                        if (writerPrefix != null) {
+                            xmlWriter.writeStartElement(namespace, parentQName.getLocalPart());
+                        } else {
+                            if (prefix == null) {
+                                prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+                            }
+
+                            xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace);
+                            xmlWriter.writeNamespace(prefix, namespace);
+                            xmlWriter.setPrefix(prefix, namespace);
+                        }
+                    } else {
+                        xmlWriter.writeStartElement(parentQName.getLocalPart());
                     }
-                } else {
-                    xmlWriter.writeStartElement(parentQName.getLocalPart());
-                }
+                </xsl:if>
+
 
                 <!-- write the type attribute if needed -->
                <xsl:if test="$extension">
@@ -915,6 +926,7 @@
 
                     <xsl:variable name="propertyType"><xsl:value-of select="@type"/></xsl:variable>
                     <xsl:variable name="propertyBaseType"><xsl:value-of select="@arrayBaseType"/></xsl:variable>
+                    <xsl:variable name="particleClassType" select="@particleClassType"></xsl:variable>
 
                     <xsl:if test="$min=0 or $choice or (@innerchoice='yes')"> if (<xsl:value-of select="$settingTracker"/>){</xsl:if>
                     <xsl:choose>
@@ -953,89 +965,126 @@
                                     }
                                 </xsl:when>
                                 <xsl:otherwise>
-                                    if (<xsl:value-of select="$varName"/>==null){
-                                         throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
-                                    }
-                                   <xsl:value-of select="$varName"/>.serialize(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>","<xsl:value-of select="$propertyName"/>"),
-                                       factory,xmlWriter);
+                                    <xsl:choose>
+                                        <xsl:when test="$particleClassType">
+                                            if (<xsl:value-of select="$varName"/>==null){
+                                                 throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+                                            }
+                                           <xsl:value-of select="$varName"/>.serialize(null,factory,xmlWriter);
+                                        </xsl:when>
+                                        <xsl:otherwise>
+                                            if (<xsl:value-of select="$varName"/>==null){
+                                                 throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+                                            }
+                                           <xsl:value-of select="$varName"/>.serialize(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>","<xsl:value-of select="$propertyName"/>"),
+                                               factory,xmlWriter);
+                                        </xsl:otherwise>
+                                    </xsl:choose>
                                 </xsl:otherwise>
                             </xsl:choose>
                         </xsl:when>
                         <xsl:when test="@ours and @array and not(@default)">
-                             if (<xsl:value-of select="$varName"/>!=null){
-                                    for (int i = 0;i &lt; <xsl:value-of select="$varName"/>.length;i++){
-                                        if (<xsl:value-of select="$varName"/>[i] != null){
-                                         <xsl:value-of select="$varName"/>[i].serialize(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>","<xsl:value-of select="$propertyName"/>"),
-                                                   factory,xmlWriter);
-                                        } else {
-                                           <xsl:choose>
-                                            <xsl:when test="@nillable">
-                                                    // write null attribute
-                                                    java.lang.String namespace2 = "<xsl:value-of select="$namespace"/>";
-                                                    if (! namespace2.equals("")) {
-                                                        java.lang.String prefix2 = xmlWriter.getPrefix(namespace2);
-
-                                                        if (prefix2 == null) {
-                                                            prefix2 = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
-
-                                                            xmlWriter.writeStartElement(prefix2,"<xsl:value-of select="$propertyName"/>", namespace2);
-                                                            xmlWriter.writeNamespace(prefix2, namespace2);
-                                                            xmlWriter.setPrefix(prefix2, namespace2);
+                             <xsl:choose>
+                                 <xsl:when test="$particleClassType">
+                                     <!-- if it is a particle clase that can only be minOccurs zero or not -->
+                                      if (<xsl:value-of select="$varName"/>!=null){
+                                            for (int i = 0;i &lt; <xsl:value-of select="$varName"/>.length;i++){
+                                                if (<xsl:value-of select="$varName"/>[i] != null){
+                                                 <xsl:value-of select="$varName"/>[i].serialize(null,factory,xmlWriter);
+                                                } else {
+                                                   <xsl:choose>
+                                                    <xsl:when test="$min=0">
+                                                        // we don't have to do any thing since minOccures is zero
+                                                    </xsl:when>
+                                                    <xsl:otherwise>
+                                                           throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+                                                    </xsl:otherwise>
+                                                </xsl:choose>
+                                                }
 
-                                                        } else {
-                                                            xmlWriter.writeStartElement(namespace2,"<xsl:value-of select="$propertyName"/>");
-                                                        }
+                                            }
+                                     } else {
+                                        throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+                                     }
+                                 </xsl:when>
+                                 <xsl:otherwise>
+                                       if (<xsl:value-of select="$varName"/>!=null){
+                                            for (int i = 0;i &lt; <xsl:value-of select="$varName"/>.length;i++){
+                                                if (<xsl:value-of select="$varName"/>[i] != null){
+                                                 <xsl:value-of select="$varName"/>[i].serialize(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>","<xsl:value-of select="$propertyName"/>"),
+                                                           factory,xmlWriter);
+                                                } else {
+                                                   <xsl:choose>
+                                                    <xsl:when test="@nillable">
+                                                            // write null attribute
+                                                            java.lang.String namespace2 = "<xsl:value-of select="$namespace"/>";
+                                                            if (! namespace2.equals("")) {
+                                                                java.lang.String prefix2 = xmlWriter.getPrefix(namespace2);
+
+                                                                if (prefix2 == null) {
+                                                                    prefix2 = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+
+                                                                    xmlWriter.writeStartElement(prefix2,"<xsl:value-of select="$propertyName"/>", namespace2);
+                                                                    xmlWriter.writeNamespace(prefix2, namespace2);
+                                                                    xmlWriter.setPrefix(prefix2, namespace2);
 
-                                                    } else {
-                                                        xmlWriter.writeStartElement("<xsl:value-of select="$propertyName"/>");
-                                                    }
+                                                                } else {
+                                                                    xmlWriter.writeStartElement(namespace2,"<xsl:value-of select="$propertyName"/>");
+                                                                }
 
-                                                   // write the nil attribute
-                                                   writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter);
-                                                   xmlWriter.writeEndElement();
-                                            </xsl:when>
-                                            <xsl:when test="$min=0">
-                                                // we don't have to do any thing since minOccures is zero
-                                            </xsl:when>
-                                            <xsl:otherwise>
-                                                   throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
-                                            </xsl:otherwise>
-                                        </xsl:choose>
-                                        }
+                                                            } else {
+                                                                xmlWriter.writeStartElement("<xsl:value-of select="$propertyName"/>");
+                                                            }
 
-                                    }
-                             } else {
-                                <xsl:choose>
-                                <xsl:when test="@nillable">
-                                        // write null attribute
-                                        java.lang.String namespace2 = "<xsl:value-of select="$namespace"/>";
-                                        if (! namespace2.equals("")) {
-                                            java.lang.String prefix2 = xmlWriter.getPrefix(namespace2);
+                                                           // write the nil attribute
+                                                           writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter);
+                                                           xmlWriter.writeEndElement();
+                                                    </xsl:when>
+                                                    <xsl:when test="$min=0">
+                                                        // we don't have to do any thing since minOccures is zero
+                                                    </xsl:when>
+                                                    <xsl:otherwise>
+                                                           throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+                                                    </xsl:otherwise>
+                                                </xsl:choose>
+                                                }
 
-                                            if (prefix2 == null) {
-                                                prefix2 = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+                                            }
+                                     } else {
+                                        <xsl:choose>
+                                        <xsl:when test="@nillable">
+                                                // write null attribute
+                                                java.lang.String namespace2 = "<xsl:value-of select="$namespace"/>";
+                                                if (! namespace2.equals("")) {
+                                                    java.lang.String prefix2 = xmlWriter.getPrefix(namespace2);
+
+                                                    if (prefix2 == null) {
+                                                        prefix2 = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+
+                                                        xmlWriter.writeStartElement(prefix2,"<xsl:value-of select="$propertyName"/>", namespace2);
+                                                        xmlWriter.writeNamespace(prefix2, namespace2);
+                                                        xmlWriter.setPrefix(prefix2, namespace2);
 
-                                                xmlWriter.writeStartElement(prefix2,"<xsl:value-of select="$propertyName"/>", namespace2);
-                                                xmlWriter.writeNamespace(prefix2, namespace2);
-                                                xmlWriter.setPrefix(prefix2, namespace2);
+                                                    } else {
+                                                        xmlWriter.writeStartElement(namespace2,"<xsl:value-of select="$propertyName"/>");
+                                                    }
 
-                                            } else {
-                                                xmlWriter.writeStartElement(namespace2,"<xsl:value-of select="$propertyName"/>");
-                                            }
+                                                } else {
+                                                    xmlWriter.writeStartElement("<xsl:value-of select="$propertyName"/>");
+                                                }
 
-                                        } else {
-                                            xmlWriter.writeStartElement("<xsl:value-of select="$propertyName"/>");
-                                        }
+                                               // write the nil attribute
+                                               writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter);
+                                               xmlWriter.writeEndElement();
+                                        </xsl:when>
+                                        <xsl:otherwise>
+                                               throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+                                        </xsl:otherwise>
+                                    </xsl:choose>
+                                    }
+                                 </xsl:otherwise>
+                             </xsl:choose>
 
-                                       // write the nil attribute
-                                       writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter);
-                                       xmlWriter.writeEndElement();
-                                </xsl:when>
-                                <xsl:otherwise>
-                                       throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
-                                </xsl:otherwise>
-                            </xsl:choose>
-                            }
                         </xsl:when>
 
                         <xsl:when test="@default and @array">
@@ -1478,7 +1527,9 @@
 
                 </xsl:for-each>
                    <!-- write the end element for the type-->
-               xmlWriter.writeEndElement();
+               <xsl:if test="not($particleClass)">
+                    xmlWriter.writeEndElement();
+               </xsl:if>
             <!-- end of when for type & anon -->
             </xsl:when>
 
@@ -2445,7 +2496,7 @@
                 </xsl:for-each>
 
 
-                <xsl:if test="($isType or $anon) and not($simple)">
+                <xsl:if test="($isType or $anon) and not($simple) and not($particleClass)">
                     <!-- Skip the outer start element in order to process the subelements. -->
                     reader.next();
                 </xsl:if>
@@ -2459,7 +2510,7 @@
                 </xsl:for-each>
 
                 <xsl:if test="property[not(@attribute)]">
-                <xsl:if test="$unordered">   <!-- Properties can be in any order -->
+                <xsl:if test="$unordered and not($particleClass)">   <!-- Properties can be in any order -->
                 while(!reader.isEndElement()) {
                     if (reader.isStartElement() <xsl:if test="$simple"> || reader.hasText()</xsl:if>){
                 </xsl:if>
@@ -2481,11 +2532,12 @@
                             <xsl:variable name="basePropertyType"><xsl:value-of select="@arrayBaseType"/></xsl:variable>
                             <xsl:variable name="namespace"><xsl:value-of select="@nsuri"/></xsl:variable>
                             <xsl:variable name="min"><xsl:value-of select="@minOccurs"/></xsl:variable>
+                            <xsl:variable name="particleClassType" select="@particleClassType"></xsl:variable>
 
                             <xsl:variable name="propQName">new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>","<xsl:value-of select="$propertyName"/>")</xsl:variable>
 
                            <xsl:choose>
-                                <xsl:when test="$unordered">  <!-- One property per iteration if unordered -->
+                                <xsl:when test="$unordered and not($choice and $hasParticleType)">  <!-- One property per iteration if unordered -->
                                     <xsl:if test="position()>1">
                                         else
                                     </xsl:if>
@@ -2502,7 +2554,12 @@
                                    if (reader.isStartElement()){
                                 </xsl:when>
                                 <xsl:otherwise>
-                                    if (reader.isStartElement() <xsl:if test="$simple"> || reader.hasText()</xsl:if> <xsl:if test="not($simple)">&amp;&amp; <xsl:value-of select="$propQName"/>.equals(reader.getName())</xsl:if>){
+                                    <xsl:if test="$particleClassType and ($choice or ($min=0))">
+                                        <!-- since we can not validate the parser before going to next class
+                                         we have to sollow an excpetions : todo find a better solsution-->
+                                         try{
+                                    </xsl:if>
+                                    if (reader.isStartElement() <xsl:if test="$simple"> || reader.hasText()</xsl:if> <xsl:if test="not($simple) and not($particleClassType)">&amp;&amp; <xsl:value-of select="$propQName"/>.equals(reader.getName())</xsl:if>){
                                 </xsl:otherwise>
                             </xsl:choose>
 
@@ -2515,58 +2572,85 @@
                                     <xsl:variable name="basePropertyType"><xsl:value-of select="@arrayBaseType"/></xsl:variable>
                                     <xsl:choose>
                                         <xsl:when test="@ours">
-                                             <xsl:if test="@nillable">
-                                              nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
-                                              if ("true".equals(nillableValue) || "1".equals(nillableValue)){
-                                                  <xsl:value-of select="$listName"/>.add(null);
-                                                  reader.next();
-                                              } else {
-                                            </xsl:if>
-                                                <xsl:value-of select="$listName"/>.add(<xsl:value-of select="$basePropertyType"/>.Factory.parse(reader));
-                                            <xsl:if test="@nillable">}</xsl:if>
-                                            //loop until we find a start element that is not part of this array
-                                            boolean <xsl:value-of select="$loopBoolName"/> = false;
-                                            while(!<xsl:value-of select="$loopBoolName"/>){
-                                                // We should be at the end element, but make sure
-                                                while (!reader.isEndElement())
-                                                    reader.next();
-                                                // Step out of this element
-                                                reader.next();
-                                                // Step to next element event.
-                                                while (!reader.isStartElement() &amp;&amp; !reader.isEndElement())
-                                                    reader.next();
-                                                if (reader.isEndElement()){
-                                                    //two continuous end elements means we are exiting the xml structure
-                                                    <xsl:value-of select="$loopBoolName"/> = true;
-                                                } else {
-                                                    if (<xsl:value-of select="$propQName"/>.equals(reader.getName())){
-                                                        <xsl:if test="@nillable">
+                                             <xsl:choose>
+                                                 <xsl:when test="$particleClassType">
+                                                        <xsl:value-of select="$listName"/>.add(<xsl:value-of select="$basePropertyType"/>.Factory.parse(reader));
+                                                        //loop until we find a start element that is not part of this array
+                                                        boolean <xsl:value-of select="$loopBoolName"/> = false;
+                                                        while(!<xsl:value-of select="$loopBoolName"/>){
+
+                                                            // Step to next element event.
+                                                            while (!reader.isStartElement() &amp;&amp; !reader.isEndElement())
+                                                                reader.next();
+                                                            if (reader.isEndElement()){
+                                                                //two continuous end elements means we are exiting the xml structure
+                                                                <xsl:value-of select="$loopBoolName"/> = true;
+                                                            } else {
+                                                                <xsl:value-of select="$listName"/>.add(<xsl:value-of select="$basePropertyType"/>.Factory.parse(reader));
+                                                            }
+                                                        }
+                                                        // call the converter utility  to convert and set the array
+                                                        object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
+                                                            org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
+                                                                <xsl:value-of select="$basePropertyType"/>.class,
+                                                                <xsl:value-of select="$listName"/>));
+
+                                                 </xsl:when>
+                                                 <xsl:otherwise>
+                                                      <xsl:if test="@nillable">
                                                           nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
                                                           if ("true".equals(nillableValue) || "1".equals(nillableValue)){
                                                               <xsl:value-of select="$listName"/>.add(null);
                                                               reader.next();
                                                           } else {
                                                         </xsl:if>
-                                                        <xsl:value-of select="$listName"/>.add(<xsl:value-of select="$basePropertyType"/>.Factory.parse(reader));
+                                                            <xsl:value-of select="$listName"/>.add(<xsl:value-of select="$basePropertyType"/>.Factory.parse(reader));
                                                         <xsl:if test="@nillable">}</xsl:if>
-                                                    }else{
-                                                        <xsl:value-of select="$loopBoolName"/> = true;
-                                                    }
-                                                }
-                                            }
-                                            // call the converter utility  to convert and set the array
-                                            <xsl:choose>
-                                                <xsl:when test="$basePropertyType='java.lang.String'">
-                                                    object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
-                                                        <xsl:value-of select="$listName"/>.toArray(new <xsl:value-of select="$basePropertyType"/>[<xsl:value-of select="$listName"/>.size()]));
-                                                </xsl:when>
-                                                <xsl:otherwise>
-                                            object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
-                                                org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
-                                                    <xsl:value-of select="$basePropertyType"/>.class,
-                                                    <xsl:value-of select="$listName"/>));
-                                                </xsl:otherwise>
-                                            </xsl:choose>
+                                                        //loop until we find a start element that is not part of this array
+                                                        boolean <xsl:value-of select="$loopBoolName"/> = false;
+                                                        while(!<xsl:value-of select="$loopBoolName"/>){
+                                                            // We should be at the end element, but make sure
+                                                            while (!reader.isEndElement())
+                                                                reader.next();
+                                                            // Step out of this element
+                                                            reader.next();
+                                                            // Step to next element event.
+                                                            while (!reader.isStartElement() &amp;&amp; !reader.isEndElement())
+                                                                reader.next();
+                                                            if (reader.isEndElement()){
+                                                                //two continuous end elements means we are exiting the xml structure
+                                                                <xsl:value-of select="$loopBoolName"/> = true;
+                                                            } else {
+                                                                if (<xsl:value-of select="$propQName"/>.equals(reader.getName())){
+                                                                    <xsl:if test="@nillable">
+                                                                      nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
+                                                                      if ("true".equals(nillableValue) || "1".equals(nillableValue)){
+                                                                          <xsl:value-of select="$listName"/>.add(null);
+                                                                          reader.next();
+                                                                      } else {
+                                                                    </xsl:if>
+                                                                    <xsl:value-of select="$listName"/>.add(<xsl:value-of select="$basePropertyType"/>.Factory.parse(reader));
+                                                                    <xsl:if test="@nillable">}</xsl:if>
+                                                                }else{
+                                                                    <xsl:value-of select="$loopBoolName"/> = true;
+                                                                }
+                                                            }
+                                                        }
+                                                        // call the converter utility  to convert and set the array
+                                                        <xsl:choose>
+                                                            <xsl:when test="$basePropertyType='java.lang.String'">
+                                                                object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
+                                                                    <xsl:value-of select="$listName"/>.toArray(new <xsl:value-of select="$basePropertyType"/>[<xsl:value-of select="$listName"/>.size()]));
+                                                            </xsl:when>
+                                                            <xsl:otherwise>
+                                                        object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
+                                                            org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
+                                                                <xsl:value-of select="$basePropertyType"/>.class,
+                                                                <xsl:value-of select="$listName"/>));
+                                                            </xsl:otherwise>
+                                                        </xsl:choose>
+                                                 </xsl:otherwise>
+                                             </xsl:choose>
                                         </xsl:when>
                                         <!-- End of Array handling of ADB classes -->
 
@@ -2947,7 +3031,7 @@
                                       }else{
                                     </xsl:if>
                                         object.set<xsl:value-of select="$javaName"/>(<xsl:value-of select="$propertyType"/>.Factory.parse(reader));
-                                    <xsl:if test="$isType or $anon">  <!-- This is a subelement property to be consumed -->
+                                    <xsl:if test="($isType or $anon) and not($particleClassType)">  <!-- This is a subelement property to be consumed -->
                                         reader.next();
                                     </xsl:if>
                                     <xsl:if test="@nillable">}</xsl:if>
@@ -3174,26 +3258,35 @@
                                     throw new java.lang.RuntimeException("Unexpected subelement " + reader.getLocalName());
                                 }
                             </xsl:if>
+                            <xsl:if test="$particleClassType and ($choice or ($min=0))">
+                                <!-- since we can not validate the parser before going to next class
+                                 we have to sollow an excpetions : todo find a better solsution-->
+                                 } catch (java.lang.Exception e) {}
+                            </xsl:if>
                         </xsl:for-each>
 
                         <xsl:if test="$ordered">  <!-- pick up trailing cruft after final property before outer endElement and verify no trailing properties -->
                             while (!reader.isStartElement() &amp;&amp; !reader.isEndElement())
                                 reader.next();
-                            if (reader.isStartElement())
+                            <xsl:if test="not($particleClass)">
+                                if (reader.isStartElement())
                                 // A start element we are not expecting indicates a trailing invalid property
                                 throw new java.lang.RuntimeException("Unexpected subelement " + reader.getLocalName());
+                            </xsl:if>
                         </xsl:if>
 
                         <xsl:if test="property[not(@attribute)]">  <!-- this if is needed to skip all this when there are no propoerties-->
-                        <xsl:if test="$unordered">
-                          <xsl:if test="not(property/enumFacet)">
+                        <xsl:if test="$unordered and not($particleClass)">
+                          <xsl:if test="not(property/enumFacet) and not($choice and $hasParticleType)">
                              else{
                                         // A start element we are not expecting indicates an invalid parameter was passed
                                         throw new java.lang.RuntimeException("Unexpected subelement " + reader.getLocalName());
                              }
                           </xsl:if>
-                             } else reader.next();  <!-- At neither a start nor an end element, skip it -->
-                            }  // end of while loop
+                             } else {
+                                reader.next();
+                             }  <!-- At neither a start nor an end element, skip it -->
+                           }  // end of while loop
                         </xsl:if>
                         </xsl:if>
 

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/BeanWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/BeanWriter.java?view=diff&rev=534864&r1=534863&r2=534864
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/BeanWriter.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/BeanWriter.java Thu May  3 06:56:33 2007
@@ -69,7 +69,7 @@
      * @return Returns String.
      * @throws SchemaCompilationException
      */
-    public String write(XmlSchemaComplexType complexType, Map typeMap, BeanWriterMetaInfoHolder metainf)
+    public String write(QName qname, Map typeMap, BeanWriterMetaInfoHolder metainf)
             throws SchemaCompilationException;
 
     /**

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/CStructWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/CStructWriter.java?view=diff&rev=534864&r1=534863&r2=534864
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/CStructWriter.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/CStructWriter.java Thu May  3 06:56:33 2007
@@ -181,12 +181,11 @@
      *
      * @see org.apache.axis2.schema.writer.BeanWriter
      */
-    public String write(XmlSchemaComplexType complexType, Map typeMap, BeanWriterMetaInfoHolder metainf)
+    public String write(QName qName, Map typeMap, BeanWriterMetaInfoHolder metainf)
             throws SchemaCompilationException {
 
         try {
             //determine the package for this type.
-            QName qName = complexType.getQName();
             return process(qName, metainf, typeMap, false);
 
         } catch (SchemaCompilationException e) {

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java?view=diff&rev=534864&r1=534863&r2=534864
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java Thu May  3 06:56:33 2007
@@ -9,7 +9,6 @@
 import org.apache.axis2.util.*;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.ws.commons.schema.XmlSchemaComplexType;
 import org.apache.ws.commons.schema.XmlSchemaElement;
 import org.apache.ws.commons.schema.XmlSchemaSimpleType;
 import org.apache.axiom.om.OMElement;
@@ -227,13 +226,12 @@
      * @see BeanWriter#write(org.apache.ws.commons.schema.XmlSchemaComplexType,
      *      java.util.Map, org.apache.axis2.schema.BeanWriterMetaInfoHolder)
      */
-    public String write(XmlSchemaComplexType complexType, Map typeMap,
+    public String write(QName qName, Map typeMap,
                         BeanWriterMetaInfoHolder metainf)
             throws SchemaCompilationException {
 
         try {
             // determine the package for this type.
-            QName qName = complexType.getQName();
             return process(qName, metainf, typeMap, false);
 
         } catch (SchemaCompilationException e) {
@@ -244,6 +242,8 @@
 
     }
 
+
+
     /**
      * @throws Exception
      * @see BeanWriter#writeBatch()
@@ -476,8 +476,7 @@
         XSLTUtils.addAttribute(model, "name", className, rootElt);
         XSLTUtils.addAttribute(model, "originalName", originalName, rootElt);
         XSLTUtils.addAttribute(model, "package", packageName, rootElt);
-        XSLTUtils
-                .addAttribute(model, "nsuri", qName.getNamespaceURI(), rootElt);
+        XSLTUtils.addAttribute(model, "nsuri", qName.getNamespaceURI(), rootElt);
         XSLTUtils.addAttribute(model, "nsprefix", isSuppressPrefixesMode ? "" : getPrefixForURI(qName
                 .getNamespaceURI(), qName.getPrefix()), rootElt);
 
@@ -534,6 +533,14 @@
             XSLTUtils.addAttribute(model, "nillable", "yes", rootElt);
         }
 
+        if (metainf.isParticleClass()) {
+            XSLTUtils.addAttribute(model, "particleClass", "yes", rootElt);
+        }
+
+        if (metainf.isHasParticleType()){
+            XSLTUtils.addAttribute(model, "hasParticleType", "yes", rootElt);
+        }
+
         // populate all the information
         populateInfo(metainf, model, rootElt, propertyNames, typeMap, false);
 
@@ -715,6 +722,11 @@
 
                 XSLTUtils.addAttribute(model, "restricted", "yes", property);
                 XSLTUtils.addAttribute(model, "occuranceChanged", "yes", property);
+            }
+
+            // set the is particle class
+            if (metainf.getParticleTypeStatusForQName(name)){
+                XSLTUtils.addAttribute(model, "particleClassType", "yes", property);
             }
 
             // what happed if this contain attributes

Added: webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/innerParticles.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/innerParticles.xsd?view=auto&rev=534864
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/innerParticles.xsd (added)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/innerParticles.xsd Thu May  3 06:56:33 2007
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema targetNamespace="http://mynamespace.com/testinnerparticle"
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            xmlns:test1="http://mynamespace.com/testinnerparticle"
+            elementFormDefault="qualified" attributeFormDefault="unqualified"
+            version="1.0">
+    <xsd:element name="TestInnerParticle1">
+        <xsd:complexType>
+            <xsd:sequence>
+                <xsd:element name="param1" type="xsd:string"/>
+                <xsd:sequence>
+                    <xsd:element name="param2" type="xsd:string"/>
+                    <xsd:element name="param3" type="xsd:string"/>
+                </xsd:sequence>
+                <xsd:element name="param4" type="xsd:string"/>
+            </xsd:sequence>
+        </xsd:complexType>
+    </xsd:element>
+    <xsd:element name="TestInnerParticle2">
+        <xsd:complexType>
+            <xsd:sequence>
+                <xsd:element name="param1" type="xsd:string"/>
+                <xsd:choice>
+                    <xsd:element name="param2" type="xsd:string"/>
+                    <xsd:element name="param3" type="xsd:string"/>
+                </xsd:choice>
+                <xsd:element name="param4" type="xsd:string"/>
+            </xsd:sequence>
+        </xsd:complexType>
+    </xsd:element>
+    <xsd:element name="TestInnerParticle3">
+        <xsd:complexType>
+            <xsd:choice>
+                <xsd:element name="param1" type="xsd:string"/>
+                <xsd:choice>
+                    <xsd:element name="param2" type="xsd:string"/>
+                    <xsd:element name="param3" type="xsd:string"/>
+                </xsd:choice>
+                <xsd:element name="param4" type="xsd:string"/>
+            </xsd:choice>
+        </xsd:complexType>
+    </xsd:element>
+    <xsd:element name="TestInnerParticle4">
+        <xsd:complexType>
+            <xsd:choice>
+                <xsd:element name="param1" type="xsd:string"/>
+                <xsd:sequence>
+                    <xsd:element name="param2" type="xsd:string"/>
+                    <xsd:element name="param3" type="xsd:string"/>
+                </xsd:sequence>
+                <xsd:element name="param4" type="xsd:string"/>
+            </xsd:choice>
+        </xsd:complexType>
+    </xsd:element>
+    
+    <xsd:element name="TestInnerParticle5">
+        <xsd:complexType>
+            <xsd:sequence>
+                <xsd:element name="param1" type="xsd:string"/>
+                <xsd:sequence>
+                    <xsd:element name="param2" type="xsd:string"/>
+                    <xsd:element name="param3" type="xsd:string"/>
+                    <xsd:sequence>
+                        <xsd:element name="param4" type="xsd:string"/>
+                        <xsd:element name="param5" type="xsd:string"/>
+                    </xsd:sequence>
+                </xsd:sequence>
+                <xsd:element name="param6" type="xsd:string"/>
+            </xsd:sequence>
+        </xsd:complexType>
+    </xsd:element>
+</xsd:schema>
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/particalMaxOccures.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/particalMaxOccures.xsd?view=auto&rev=534864
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/particalMaxOccures.xsd (added)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/particalMaxOccures.xsd Thu May  3 06:56:33 2007
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema targetNamespace="http://mynamespace.com/testparticlemaxoccurs"
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            xmlns:tns="http://mynamespace.com/testparticlemaxoccurs"
+            elementFormDefault="qualified" attributeFormDefault="unqualified"
+            version="1.0">
+
+    <xsd:element name="TestParticalSequenceMaxOccurs" type="tns:TestParticalSequenceMaxOccursType"/>
+    <xsd:complexType name="TestParticalSequenceMaxOccursType">
+        <xsd:sequence>
+            <xsd:element name="parm1" type="xsd:string"/>
+            <xsd:element name="parm2" type="xsd:string"/>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:element name="TestParticalSequenceMaxOccurs1" type="tns:TestParticalSequenceMaxOccursType1"/>
+    <xsd:complexType name="TestParticalSequenceMaxOccursType1">
+        <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+            <xsd:element name="parm1" type="xsd:string"/>
+            <xsd:element name="parm2" type="xsd:string"/>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:element name="TestParticalSequenceMaxOccurs2" type="tns:TestParticalSequenceMaxOccursType2"/>
+    <xsd:complexType name="TestParticalSequenceMaxOccursType2">
+        <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+            <xsd:element minOccurs="0" maxOccurs="unbounded" name="parm1" type="xsd:string"/>
+            <xsd:element minOccurs="0" maxOccurs="unbounded" name="parm2" type="xsd:string"/>
+        </xsd:sequence>
+    </xsd:complexType>
+    <xsd:element name="TestParticalSequenceMaxOccurs3" type="tns:TestParticalSequenceMaxOccursType3"/>
+    <xsd:complexType name="TestParticalSequenceMaxOccursType3">
+        <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+            <xsd:element nillable="true" maxOccurs="unbounded" name="parm1" type="xsd:string"/>
+            <xsd:element nillable="true" maxOccurs="unbounded" name="parm2" type="xsd:string"/>
+        </xsd:sequence>
+    </xsd:complexType>
+    <xsd:element name="TestParticalSequenceMaxOccurs4" type="tns:TestParticalSequenceMaxOccursType4"/>
+    <xsd:complexType name="TestParticalSequenceMaxOccursType4">
+        <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+            <xsd:element nillable="true" name="parm1" type="tns:TestCustomType"/>
+            <xsd:element nillable="true" name="parm2" type="xsd:string"/>
+            <xsd:element nillable="true" name="parm3" type="tns:TestCustomType"/>
+        </xsd:sequence>
+    </xsd:complexType>
+    <xsd:element name="TestParticalSequenceMaxOccurs5" type="tns:TestParticalSequenceMaxOccursType5"/>
+    <xsd:complexType name="TestParticalSequenceMaxOccursType5">
+        <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+            <xsd:element maxOccurs="unbounded" name="parm1" type="tns:TestCustomType"/>
+            <xsd:element nillable="true" name="parm2" type="xsd:string"/>
+            <xsd:element maxOccurs="unbounded" name="parm3" type="tns:TestCustomType"/>
+        </xsd:sequence>
+    </xsd:complexType>
+    <xsd:element name="TestParticalSequenceMaxOccurs6" type="tns:TestParticalSequenceMaxOccursType6"/>
+    <xsd:complexType name="TestParticalSequenceMaxOccursType6">
+        <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+            <xsd:element name="parm1" type="xsd:string"/>
+            <xsd:element name="parm2" type="xsd:string"/>
+        </xsd:sequence>
+        <xsd:attribute type="xsd:string" use="optional" name="attribute1"/>
+        <xsd:attribute type="xsd:string" use="optional" name="attribute2"/>
+    </xsd:complexType>
+    <xsd:element name="TestParticalChoiceMaxOccurs" type="tns:TestParticalChoiceMaxOccursType"/>
+    <xsd:complexType name="TestParticalChoiceMaxOccursType">
+        <xsd:choice>
+            <xsd:element name="parm1" type="xsd:string"/>
+            <xsd:element name="parm2" type="xsd:string"/>
+        </xsd:choice>
+    </xsd:complexType>
+    <xsd:element name="TestParticalChoiceMaxOccurs1" type="tns:TestParticalChoiceMaxOccursType1"/>
+    <xsd:complexType name="TestParticalChoiceMaxOccursType1">
+        <xsd:choice minOccurs="0" maxOccurs="unbounded">
+            <xsd:element name="parm1" type="xsd:string"/>
+            <xsd:element name="parm2" type="xsd:string"/>
+        </xsd:choice>
+    </xsd:complexType>
+    <xsd:element name="TestParticalChoiceMaxOccurs2" type="tns:TestParticalChoiceMaxOccursType2"/>
+    <xsd:complexType name="TestParticalChoiceMaxOccursType2">
+        <xsd:choice minOccurs="0" maxOccurs="unbounded">
+            <xsd:element minOccurs="0" maxOccurs="unbounded" name="parm1" type="xsd:string"/>
+            <xsd:element minOccurs="0" maxOccurs="unbounded" name="parm2" type="xsd:string"/>
+        </xsd:choice>
+    </xsd:complexType>
+    <xsd:element name="TestParticalChoiceMaxOccurs3" type="tns:TestParticalChoiceMaxOccursType3"/>
+    <xsd:complexType name="TestParticalChoiceMaxOccursType3">
+        <xsd:choice minOccurs="0" maxOccurs="unbounded">
+            <xsd:element nillable="true" maxOccurs="unbounded" name="parm1" type="xsd:string"/>
+            <xsd:element nillable="true" maxOccurs="unbounded" name="parm2" type="xsd:string"/>
+        </xsd:choice>
+    </xsd:complexType>
+    <xsd:element name="TestParticalChoiceMaxOccurs4" type="tns:TestParticalChoiceMaxOccursType4"/>
+    <xsd:complexType name="TestParticalChoiceMaxOccursType4">
+        <xsd:choice minOccurs="0" maxOccurs="unbounded">
+            <xsd:element nillable="true" name="parm1" type="tns:TestCustomType"/>
+            <xsd:element nillable="true" name="parm2" type="xsd:string"/>
+            <xsd:element nillable="true" name="parm3" type="tns:TestCustomType"/>
+        </xsd:choice>
+    </xsd:complexType>
+    <xsd:element name="TestParticalChoiceMaxOccurs5" type="tns:TestParticalChoiceMaxOccursType5"/>
+    <xsd:complexType name="TestParticalChoiceMaxOccursType5">
+        <xsd:choice minOccurs="0" maxOccurs="unbounded">
+            <xsd:element maxOccurs="unbounded" name="parm1" type="tns:TestCustomType"/>
+            <xsd:element nillable="true" name="parm2" type="xsd:string"/>
+            <xsd:element maxOccurs="unbounded" name="parm3" type="tns:TestCustomType"/>
+        </xsd:choice>
+    </xsd:complexType>
+    <xsd:element name="TestParticalChoiceMaxOccurs6" type="tns:TestParticalChoiceMaxOccursType6"/>
+    <xsd:complexType name="TestParticalChoiceMaxOccursType6">
+        <xsd:choice minOccurs="0" maxOccurs="unbounded">
+            <xsd:element name="parm1" type="xsd:string"/>
+            <xsd:element name="parm2" type="xsd:string"/>
+        </xsd:choice>
+        <xsd:attribute type="xsd:string" use="optional" name="attribute1"/>
+        <xsd:attribute type="xsd:string" use="optional" name="attribute2"/>
+    </xsd:complexType>
+    <xsd:complexType name="TestCustomType">
+        <xsd:sequence>
+            <xsd:element nillable="true" name="param1" type="xsd:string"/>
+            <xsd:element maxOccurs="unbounded" name="param2" type="xsd:string"/>
+            <xsd:element minOccurs="0" name="param3" type="xsd:string"/>
+        </xsd:sequence>
+    </xsd:complexType>
+
+
+</xsd:schema>
\ No newline at end of file

Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerChoice/InnerChoiceTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerChoice/InnerChoiceTest.java?view=diff&rev=534864&r1=534863&r2=534864
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerChoice/InnerChoiceTest.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerChoice/InnerChoiceTest.java Thu May  3 06:56:33 2007
@@ -19,21 +19,25 @@
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.util.StAXUtils;
-import test.axis2.apache.org.TestInnerSequence1;
-import test.axis2.apache.org.TestInnerSequence2;
-import test.axis2.apache.org.TestInnerSequence3;
+import test.axis2.apache.org.*;
 
 import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
 import java.io.ByteArrayInputStream;
 
+import com.mynamespace.testinnerparticle.TestInnerParticle1Sequence_type0;
+
 public class InnerChoiceTest extends TestCase {
 
     public void testInnerChoice1() {
         TestInnerSequence1 testSequence = new TestInnerSequence1();
         testSequence.setSequence1("test sequence");
         testSequence.setSequence2(3);
-        testSequence.setChoice1("test choice");
-        testSequence.setChoice2(5);
+
+        TestInnerSequence1Choice_type2 testInnerSequence1Choice_type2 = new TestInnerSequence1Choice_type2();
+        testInnerSequence1Choice_type2.setChoice1("test choice");
+        testInnerSequence1Choice_type2.setChoice2(5);
+        testSequence.setTestInnerSequence1Choice_type2(testInnerSequence1Choice_type2);
 
         OMElement omElement = testSequence.getOMElement(TestInnerSequence1.MY_QNAME,
                 OMAbstractFactory.getSOAP12Factory());
@@ -44,7 +48,14 @@
             TestInnerSequence1 result = TestInnerSequence1.Factory.parse(xmlReader);
             assertEquals(result.getSequence1(), "test sequence");
             assertEquals(result.getSequence2(), 3);
-            assertEquals(result.getChoice2(), 5);
+            assertEquals(result.getTestInnerSequence1Choice_type2().getChoice2(), 5);
+
+            // writtig result back
+            XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(System.out);
+            result.serialize(new javax.xml.namespace.QName("org.apache.axis2.test", "TestInnerSequence1", "foo")
+                    , OMAbstractFactory.getSOAP11Factory(), xmlStreamWriter);
+            xmlStreamWriter.flush();
+
         } catch (Exception e) {
             fail();
         }
@@ -54,7 +65,9 @@
         TestInnerSequence2 testSequence = new TestInnerSequence2();
         testSequence.setSequence1("sequence");
         testSequence.setSequence2(3);
-        testSequence.setChoice1(new String[]{"choice1", "choice2"});
+        TestInnerSequence2Choice_type1 testInnerSequence2Choice_type1 = new TestInnerSequence2Choice_type1();
+        testInnerSequence2Choice_type1.setChoice1(new String[]{"choice1", "choice2"});
+        testSequence.setTestInnerSequence2Choice_type1(testInnerSequence2Choice_type1);
 
         OMElement omElement = testSequence.getOMElement(TestInnerSequence2.MY_QNAME,
                 OMAbstractFactory.getSOAP12Factory());
@@ -65,7 +78,7 @@
             TestInnerSequence2 result = TestInnerSequence2.Factory.parse(xmlReader);
             assertEquals(result.getSequence1(), "sequence");
             assertEquals(result.getSequence2(), 3);
-            assertTrue(isEqual(result.getChoice1(), new String[]{"choice1", "choice2"}));
+            assertTrue(isEqual(result.getTestInnerSequence2Choice_type1().getChoice1(), new String[]{"choice1", "choice2"}));
         } catch (Exception e) {
             fail();
         }
@@ -75,7 +88,9 @@
         TestInnerSequence2 testSequence = new TestInnerSequence2();
         testSequence.setSequence1("sequence");
         testSequence.setSequence2(3);
-        testSequence.setChoice2(new int[]{2, 4});
+        TestInnerSequence2Choice_type1 testInnerSequence2Choice_type1 = new TestInnerSequence2Choice_type1();
+        testInnerSequence2Choice_type1.setChoice2(new int[]{2, 4});
+        testSequence.setTestInnerSequence2Choice_type1(testInnerSequence2Choice_type1);
 
         OMElement omElement = testSequence.getOMElement(TestInnerSequence2.MY_QNAME,
                 OMAbstractFactory.getSOAP12Factory());
@@ -86,7 +101,7 @@
             TestInnerSequence2 result = TestInnerSequence2.Factory.parse(xmlReader);
             assertEquals(result.getSequence1(), "sequence");
             assertEquals(result.getSequence2(), 3);
-            assertTrue(isEqual(result.getChoice2(), new int[]{2, 4}));
+            assertTrue(isEqual(result.getTestInnerSequence2Choice_type1().getChoice2(), new int[]{2, 4}));
         } catch (Exception e) {
             fail();
         }
@@ -96,7 +111,9 @@
         TestInnerSequence3 testSequence = new TestInnerSequence3();
         testSequence.setSequence1("sequence");
         testSequence.setSequence2(3);
-        testSequence.setChoice1(new String[]{"choice1",null, "choice2"});
+        TestInnerSequence3Choice_type0 testInnerSequence3Choice_type0 = new TestInnerSequence3Choice_type0();
+        testInnerSequence3Choice_type0.setChoice1(new String[]{"choice1", null, "choice2"});
+        testSequence.setTestInnerSequence3Choice_type0(testInnerSequence3Choice_type0);
 
         OMElement omElement = testSequence.getOMElement(TestInnerSequence3.MY_QNAME,
                 OMAbstractFactory.getSOAP12Factory());
@@ -107,32 +124,35 @@
             TestInnerSequence3 result = TestInnerSequence3.Factory.parse(xmlReader);
             assertEquals(result.getSequence1(), "sequence");
             assertEquals(result.getSequence2(), 3);
-            assertTrue(isEqual(result.getChoice1(), new String[]{"choice1",null, "choice2"}));
+            assertTrue(isEqual(result.getTestInnerSequence3Choice_type0().getChoice1(), new String[]{"choice1", null, "choice2"}));
         } catch (Exception e) {
             fail();
         }
     }
 
     public void testInnerChoice32() {
-            TestInnerSequence3 testSequence = new TestInnerSequence3();
-            testSequence.setSequence1("sequence");
-            testSequence.setSequence2(3);
-            testSequence.setChoice2(new int[]{2,Integer.MIN_VALUE,6});
-
-            OMElement omElement = testSequence.getOMElement(TestInnerSequence3.MY_QNAME,
-                    OMAbstractFactory.getSOAP12Factory());
-            try {
-                String omElementString = omElement.toStringWithConsume();
-                System.out.println("OMelement ==> " + omElementString);
-                XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
-                TestInnerSequence3 result = TestInnerSequence3.Factory.parse(xmlReader);
-                assertEquals(result.getSequence1(), "sequence");
-                assertEquals(result.getSequence2(), 3);
-                assertTrue(isEqual(result.getChoice2(), new int[]{2,Integer.MIN_VALUE,6}));
-            } catch (Exception e) {
-                fail();
-            }
+        TestInnerSequence3 testSequence = new TestInnerSequence3();
+        testSequence.setSequence1("sequence");
+        testSequence.setSequence2(3);
+        TestInnerSequence3Choice_type0 testInnerSequence3Choice_type0 = new TestInnerSequence3Choice_type0();
+        testInnerSequence3Choice_type0.setChoice2(new int[]{2, Integer.MIN_VALUE, 6});
+        testSequence.setTestInnerSequence3Choice_type0(testInnerSequence3Choice_type0);
+
+
+        OMElement omElement = testSequence.getOMElement(TestInnerSequence3.MY_QNAME,
+                OMAbstractFactory.getSOAP12Factory());
+        try {
+            String omElementString = omElement.toStringWithConsume();
+            System.out.println("OMelement ==> " + omElementString);
+            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
+            TestInnerSequence3 result = TestInnerSequence3.Factory.parse(xmlReader);
+            assertEquals(result.getSequence1(), "sequence");
+            assertEquals(result.getSequence2(), 3);
+            assertTrue(isEqual(result.getTestInnerSequence3Choice_type0().getChoice2(), new int[]{2, Integer.MIN_VALUE, 6}));
+        } catch (Exception e) {
+            fail();
         }
+    }
 
 
     private boolean isEqual(String[] test1, String[] test2) {

Added: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerparticles/InnerParticlesTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerparticles/InnerParticlesTest.java?view=auto&rev=534864
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerparticles/InnerParticlesTest.java (added)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerparticles/InnerParticlesTest.java Thu May  3 06:56:33 2007
@@ -0,0 +1,273 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.schema.innerparticles;
+
+import com.mynamespace.testinnerparticle.*;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.util.StAXUtils;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import java.io.ByteArrayInputStream;
+
+
+public class InnerParticlesTest extends TestCase {
+
+    public void testInnerParticle1() {
+
+        TestInnerParticle1 testInnerParticle1 = new TestInnerParticle1();
+        testInnerParticle1.setParam1("Param1");
+        TestInnerParticle1Sequence_type0 testInnerParticle1Sequence_type0 = new TestInnerParticle1Sequence_type0();
+        testInnerParticle1Sequence_type0.setParam2("Param2");
+        testInnerParticle1Sequence_type0.setParam3("Param3");
+        testInnerParticle1.setTestInnerParticle1Sequence_type0(testInnerParticle1Sequence_type0);
+        testInnerParticle1.setParam4("Param4");
+
+        OMElement omElement = testInnerParticle1.getOMElement(TestInnerParticle1.MY_QNAME, OMAbstractFactory.getOMFactory());
+        try {
+            String omElementString = omElement.toStringWithConsume();
+            System.out.println("OM String ==> " + omElementString);
+            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
+            TestInnerParticle1 result = TestInnerParticle1.Factory.parse(xmlReader);
+            assertEquals(result.getParam1(), "Param1");
+            assertEquals(result.getTestInnerParticle1Sequence_type0().getParam2(), "Param2");
+            assertEquals(result.getTestInnerParticle1Sequence_type0().getParam3(), "Param3");
+            assertEquals(result.getParam4(), "Param4");
+        } catch (XMLStreamException e) {
+            fail();
+        } catch (Exception e) {
+            fail();
+        }
+
+    }
+
+    public void testInnerParticle2() {
+
+        TestInnerParticle2 testInnerParticle2 = new TestInnerParticle2();
+        testInnerParticle2.setParam1("Param1");
+        TestInnerParticle2Choice_type5 testInnerParticle2Choice_type1 = new TestInnerParticle2Choice_type5();
+        testInnerParticle2Choice_type1.setParam2("Param2");
+        testInnerParticle2Choice_type1.setParam3("Param3");
+        testInnerParticle2.setTestInnerParticle2Choice_type5(testInnerParticle2Choice_type1);
+        testInnerParticle2.setParam4("Param4");
+
+        OMElement omElement =
+                testInnerParticle2.getOMElement(TestInnerParticle2.MY_QNAME, OMAbstractFactory.getOMFactory());
+        try {
+            String omElementString = omElement.toStringWithConsume();
+            System.out.println("OM String ==> " + omElementString);
+            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
+            TestInnerParticle2 result = TestInnerParticle2.Factory.parse(xmlReader);
+            assertEquals(result.getParam1(), "Param1");
+            assertEquals(result.getTestInnerParticle2Choice_type5().getParam3(), "Param3");
+            assertEquals(result.getParam4(), "Param4");
+        } catch (XMLStreamException e) {
+            fail();
+        } catch (Exception e) {
+            fail();
+        }
+
+    }
+
+    public void testInnerParticle31() {
+
+        TestInnerParticle3 testInnerParticle3 = new TestInnerParticle3();
+        testInnerParticle3.setParam1("Param1");
+
+        OMElement omElement =
+                testInnerParticle3.getOMElement(TestInnerParticle3.MY_QNAME, OMAbstractFactory.getOMFactory());
+        try {
+            String omElementString = omElement.toStringWithConsume();
+            System.out.println("OM String ==> " + omElementString);
+            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
+            TestInnerParticle3 result = TestInnerParticle3.Factory.parse(xmlReader);
+            assertEquals(result.getParam1(), "Param1");
+        } catch (XMLStreamException e) {
+            fail();
+        } catch (Exception e) {
+            fail();
+        }
+
+    }
+
+    public void testInnerParticle32() {
+
+        TestInnerParticle3 testInnerParticle3 = new TestInnerParticle3();
+        TestInnerParticle3Choice_type1 testInnerParticle3Choice_type1 = new TestInnerParticle3Choice_type1();
+        testInnerParticle3Choice_type1.setParam2("Param2");
+        testInnerParticle3Choice_type1.setParam3("Param3");
+        testInnerParticle3.setTestInnerParticle3Choice_type1(testInnerParticle3Choice_type1);
+
+        OMElement omElement =
+                testInnerParticle3.getOMElement(TestInnerParticle3.MY_QNAME, OMAbstractFactory.getOMFactory());
+        try {
+            String omElementString = omElement.toStringWithConsume();
+            System.out.println("OM String ==> " + omElementString);
+            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
+            TestInnerParticle3 result = TestInnerParticle3.Factory.parse(xmlReader);
+            assertEquals(result.getTestInnerParticle3Choice_type1().getParam3(), "Param3");
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+            fail();
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+
+    }
+
+    public void testInnerParticle33() {
+
+        TestInnerParticle3 testInnerParticle3 = new TestInnerParticle3();
+        testInnerParticle3.setParam1("Param1");
+        TestInnerParticle3Choice_type1 testInnerParticle3Choice_type1 = new TestInnerParticle3Choice_type1();
+        testInnerParticle3Choice_type1.setParam2("Param2");
+        testInnerParticle3Choice_type1.setParam3("Param3");
+        testInnerParticle3.setTestInnerParticle3Choice_type1(testInnerParticle3Choice_type1);
+        testInnerParticle3.setParam4("Param4");
+
+        OMElement omElement =
+                testInnerParticle3.getOMElement(TestInnerParticle3.MY_QNAME, OMAbstractFactory.getOMFactory());
+        try {
+            String omElementString = omElement.toStringWithConsume();
+            System.out.println("OM String ==> " + omElementString);
+            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
+            TestInnerParticle3 result = TestInnerParticle3.Factory.parse(xmlReader);
+            assertEquals(result.getParam4(), "Param4");
+        } catch (XMLStreamException e) {
+            fail();
+        } catch (Exception e) {
+            fail();
+        }
+
+    }
+
+    public void testInnerParticle41() {
+
+        TestInnerParticle4 testInnerParticle4 = new TestInnerParticle4();
+        testInnerParticle4.setParam1("Param1");
+
+        OMElement omElement =
+                testInnerParticle4.getOMElement(TestInnerParticle4.MY_QNAME, OMAbstractFactory.getOMFactory());
+        try {
+            String omElementString = omElement.toStringWithConsume();
+            System.out.println("OM String ==> " + omElementString);
+            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
+            TestInnerParticle4 result = TestInnerParticle4.Factory.parse(xmlReader);
+            assertEquals(result.getParam1(), "Param1");
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+            fail();
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+
+    }
+
+    public void testInnerParticle42() {
+
+        TestInnerParticle4 testInnerParticle4 = new TestInnerParticle4();
+        TestInnerParticle4Sequence_type2 testInnerParticle4Sequence_type2 = new TestInnerParticle4Sequence_type2();
+        testInnerParticle4Sequence_type2.setParam2("Param2");
+        testInnerParticle4Sequence_type2.setParam3("Param3");
+        testInnerParticle4.setTestInnerParticle4Sequence_type2(testInnerParticle4Sequence_type2);
+
+        OMElement omElement =
+                testInnerParticle4.getOMElement(TestInnerParticle4.MY_QNAME, OMAbstractFactory.getOMFactory());
+        try {
+            String omElementString = omElement.toStringWithConsume();
+            System.out.println("OM String ==> " + omElementString);
+            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
+            TestInnerParticle4 result = TestInnerParticle4.Factory.parse(xmlReader);
+            assertEquals(result.getTestInnerParticle4Sequence_type2().getParam2(), "Param2");
+            assertEquals(result.getTestInnerParticle4Sequence_type2().getParam3(), "Param3");
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+            fail();
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+
+    }
+
+    public void testInnerParticle43() {
+
+        TestInnerParticle4 testInnerParticle4 = new TestInnerParticle4();
+        testInnerParticle4.setParam4("Param4");
+
+        OMElement omElement =
+                testInnerParticle4.getOMElement(TestInnerParticle4.MY_QNAME, OMAbstractFactory.getOMFactory());
+        try {
+            String omElementString = omElement.toStringWithConsume();
+            System.out.println("OM String ==> " + omElementString);
+            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
+            TestInnerParticle4 result = TestInnerParticle4.Factory.parse(xmlReader);
+            assertEquals(result.getParam4(), "Param4");
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+            fail();
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+
+    }
+
+    public void testInnerParticle5() {
+
+        TestInnerParticle5 testInnerParticle5 = new TestInnerParticle5();
+        testInnerParticle5.setParam1("Param1");
+        TestInnerParticle5Sequence_type4 testInnerParticle2Choice_type1 = new TestInnerParticle5Sequence_type4();
+        testInnerParticle2Choice_type1.setParam2("Param2");
+        testInnerParticle2Choice_type1.setParam3("Param3");
+
+        TestInnerParticle5Sequence_type3 testInnerParticle5Sequence_type3 = new TestInnerParticle5Sequence_type3();
+        testInnerParticle5Sequence_type3.setParam4("Param4");
+        testInnerParticle5Sequence_type3.setParam5("Param5");
+
+        testInnerParticle2Choice_type1.setTestInnerParticle5Sequence_type3(testInnerParticle5Sequence_type3);
+        testInnerParticle5.setTestInnerParticle5Sequence_type4(testInnerParticle2Choice_type1);
+        testInnerParticle5.setParam6("Param6");
+
+        OMElement omElement =
+                testInnerParticle5.getOMElement(TestInnerParticle5.MY_QNAME, OMAbstractFactory.getOMFactory());
+        try {
+            String omElementString = omElement.toStringWithConsume();
+            System.out.println("OM String ==> " + omElementString);
+            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
+            TestInnerParticle5 result = TestInnerParticle5.Factory.parse(xmlReader);
+            assertEquals(result.getParam1(), "Param1");
+            assertEquals(result.getTestInnerParticle5Sequence_type4().getParam2(), "Param2");
+            assertEquals(result.getTestInnerParticle5Sequence_type4().getParam3(), "Param3");
+            assertEquals(result.getTestInnerParticle5Sequence_type4().getTestInnerParticle5Sequence_type3().getParam4(), "Param4");
+            assertEquals(result.getTestInnerParticle5Sequence_type4().getTestInnerParticle5Sequence_type3().getParam5(), "Param5");
+            assertEquals(result.getParam6(), "Param6");
+        } catch (XMLStreamException e) {
+            fail();
+        } catch (Exception e) {
+            fail();
+        }
+
+    }
+
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org