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 ch...@apache.org on 2006/09/28 13:06:15 UTC

svn commit: r450804 - in /webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema: ExtensionUtility.java writer/JavaBeanWriter.java

Author: chinthaka
Date: Thu Sep 28 04:06:15 2006
New Revision: 450804

URL: http://svn.apache.org/viewvc?view=rev&rev=450804
Log:
- This should fix the xs:any problem. When I was looking at the code, I didn't get maxOccurs > 1 case working. Fixed it. 
- Added a commented System.out statement to JavaBeanWriter as we wanna see the output xml models, most of the times, when we are debugging.

Modified:
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java?view=diff&rev=450804&r1=450803&r2=450804
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java Thu Sep 28 04:06:15 2006
@@ -218,7 +218,7 @@
                     XmlSchemaType eltSchemaType = xmlSchemaElement.getSchemaType();
                     if (eltSchemaType != null) {
                         //there is a schema type object.We can utilize that
-                        populateClassName(eltSchemaType, mapper, opName, xmlSchemaElement.getName());
+                        populateClassName(eltSchemaType, mapper, opName, xmlSchemaElement);
                     } else if (xmlSchemaElement.getSchemaTypeName() != null) {
                         //there is no schema type object but there is a
                         //schema type QName.  Use that Qname to look up the
@@ -226,7 +226,7 @@
                         eltSchemaType = findSchemaType(schemaMap,
                                 xmlSchemaElement.getSchemaTypeName());
                         if (eltSchemaType != null) {
-                            populateClassName(eltSchemaType, mapper, opName, xmlSchemaElement.getName());
+                            populateClassName(eltSchemaType, mapper, opName, xmlSchemaElement);
                         }
                     }
                 } else if (item instanceof XmlSchemaAny) {
@@ -236,7 +236,12 @@
                     QName partQName = WSDLUtil.getPartQName(opName,
                             WSDLConstants.INPUT_PART_QNAME_SUFFIX,
                             Constants.ANY_ELEMENT_FIELD_NAME);
-                    mapper.addTypeMappingName(partQName, "org.apache.axiom.om.OMElement");
+
+                    if (((XmlSchemaAny) item).getMaxOccurs() > 1) {
+                        mapper.addTypeMappingName(partQName, "org.apache.axiom.om.OMElement[]");
+                    } else {
+                        mapper.addTypeMappingName(partQName, "org.apache.axiom.om.OMElement");
+                    }
                 }
 
             }
@@ -252,7 +257,9 @@
     private static void populateClassName(XmlSchemaType eltSchemaType,
                                           TypeMapper typeMap,
                                           String opName,
-                                          String partName) {
+                                          XmlSchemaElement xmlSchemaElement) {
+
+        boolean isArray = xmlSchemaElement.getMaxOccurs() > 1;
 
         Map metaInfoMap = eltSchemaType.getMetaInfoMap();
 
@@ -260,9 +267,13 @@
             String className = (String) metaInfoMap.
                     get(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY);
 
+            if (isArray && !className.endsWith("[]")) {
+                className += "[]";
+            }
+
             QName partQName = WSDLUtil.getPartQName(opName,
                     WSDLConstants.INPUT_PART_QNAME_SUFFIX,
-                    partName);
+                    xmlSchemaElement.getName());
             typeMap.addTypeMappingName(partQName, className);
             if (Boolean.TRUE.equals(
                     metaInfoMap.get(SchemaConstants.
@@ -386,7 +397,7 @@
         if (configuration.isGenerateAll()) {
             options.setGenerateAll(true);
         }
-        
+
         if (configuration.isBackwordCompatibilityMode()) {
             options.setBackwordCompatibilityMode(true);
         }

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=450804&r1=450803&r2=450804
==============================================================================
--- 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 Sep 28 04:06:15 2006
@@ -489,6 +489,9 @@
         // populate all the information
         populateInfo(metainf, model, rootElt, propertyNames, typeMap, false);
 
+        //////////////////////////////////////////////////////////
+//        System.out.println(DOM2Writer.nodeToString(rootElt));
+        ////////////////////////////////////////////////////////////
 
         return rootElt;
     }



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