axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r509433 - in /webservices/axis2/trunk/java/modules/adb-codegen: src/org/apache/axis2/schema/SchemaCompiler.java test-resources/testsuite/list.xsd test/org/apache/axis2/schema/list/ListTest.java
Date Tue, 20 Feb 2007 06:10:32 GMT
Author: amilas
Date: Mon Feb 19 22:10:31 2007
New Revision: 509433

URL: http://svn.apache.org/viewvc?view=rev&rev=509433
Log:
Add the support for Annonymous inner simple classes in list type

Modified:
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
    webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/list.xsd
    webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/list/ListTest.java

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java?view=diff&rev=509433&r1=509432&r2=509433
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
Mon Feb 19 22:10:31 2007
@@ -2030,11 +2030,22 @@
                 XmlSchemaSimpleTypeList simpleTypeList = (XmlSchemaSimpleTypeList) content;
                 QName itemTypeQName = simpleTypeList.getItemTypeName();
 
-                if (!isAlreadyProcessed(itemTypeQName)){
-                    XmlSchemaType simpleSchemaType = getType(parentSchema,itemTypeQName);
-                    if (simpleSchemaType instanceof XmlSchemaSimpleType){
-                        processSimpleSchemaType((XmlSchemaSimpleType)simpleSchemaType,null,parentSchema,null);
+                if (itemTypeQName != null){
+                   if (!isAlreadyProcessed(itemTypeQName)){
+                        XmlSchemaType simpleSchemaType = getType(parentSchema,itemTypeQName);
+                        if (simpleSchemaType instanceof XmlSchemaSimpleType){
+                            processSimpleSchemaType((XmlSchemaSimpleType)simpleSchemaType,null,parentSchema,null);
+                        }
                     }
+                } else {
+                    XmlSchemaSimpleType listSimpleType = simpleTypeList.getItemType();
+                    itemTypeQName = listSimpleType.getQName();
+                    if (itemTypeQName == null){
+                        // we create a fake Qname for all these simple types since most propably
they don't have one
+                        itemTypeQName = new QName(parentSimpleTypeQname.getNamespaceURI(),parentSimpleTypeQname.getLocalPart()
+ "_type0");
+                    }
+                    processSimpleSchemaType(listSimpleType,null,parentSchema,itemTypeQName);
+
                 }
 
                 String className = findClassName(itemTypeQName,false);

Modified: webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/list.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/list.xsd?view=diff&rev=509433&r1=509432&r2=509433
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/list.xsd (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/list.xsd Mon
Feb 19 22:10:31 2007
@@ -38,4 +38,17 @@
 
     <xs:element name="SuperTestListStringElement" type="tns:SuperTestListString"/>
 
+    <xs:simpleType name="InnerListSimpleType">
+        <xs:list>
+            <xs:simpleType>
+                <xs:restriction base="xs:string">
+                    <xs:enumeration value="Exist"/>
+                    <xs:enumeration value="Access"/>
+                </xs:restriction>
+            </xs:simpleType>
+        </xs:list>
+    </xs:simpleType>
+
+    <xs:element name="TestInnerListSimpleType" type="tns:InnerListSimpleType"/>
+
 </schema>

Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/list/ListTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/list/ListTest.java?view=diff&rev=509433&r1=509432&r2=509433
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/list/ListTest.java
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/list/ListTest.java
Mon Feb 19 22:10:31 2007
@@ -120,5 +120,30 @@
         }
     }
 
+    public void testInnerSimpleTypes(){
+        TestInnerListSimpleType testInnerListSimpleType = new TestInnerListSimpleType();
+        InnerListSimpleType innerListSimpleType = new InnerListSimpleType();
+        testInnerListSimpleType.setTestInnerListSimpleType(innerListSimpleType);
+        InnerListSimpleType_type0[] list = new InnerListSimpleType_type0[2];
+        list[0] = InnerListSimpleType_type0.Access;
+        list[1] = InnerListSimpleType_type0.Exist;
+
+        innerListSimpleType.setInnerListSimpleType_type0(list);
+
+        OMElement omElement = testInnerListSimpleType.getOMElement(TestInnerListSimpleType.MY_QNAME,
+                OMAbstractFactory.getOMFactory());
+        try {
+            String omElementString = omElement.toStringWithConsume();
+            System.out.println("OM Element ==> " + omElementString);
+            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
+            TestInnerListSimpleType result = TestInnerListSimpleType.Factory.parse(xmlReader);
+            assertEquals(result.getTestInnerListSimpleType().getInnerListSimpleType_type0()[0],InnerListSimpleType_type0.Access);
+            assertEquals(result.getTestInnerListSimpleType().getInnerListSimpleType_type0()[1],InnerListSimpleType_type0.Exist);
+        } catch (Exception e) {
+            assertTrue(false);
+        }
+
+    }
+
 
 }



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


Mime
View raw message