ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r581777 - in /webservices/axis2/trunk/java/modules/adb-codegen: src/org/apache/axis2/schema/ src/org/apache/axis2/schema/writer/ test-resources/testsuite/
Date Thu, 04 Oct 2007 05:10:23 GMT
Author: amilas
Date: Wed Oct  3 22:10:21 2007
New Revision: 581777

URL: http://svn.apache.org/viewvc?rev=581777&view=rev
Log:
used the same java name for xml names in inherited properties

Modified:
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/BeanWriterMetaInfoHolder.java
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
    webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/extensions.xsd
    webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/testattribute.xsd

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/BeanWriterMetaInfoHolder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/BeanWriterMetaInfoHolder.java?rev=581777&r1=581776&r2=581777&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/BeanWriterMetaInfoHolder.java
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/BeanWriterMetaInfoHolder.java
Wed Oct  3 22:10:21 2007
@@ -61,6 +61,7 @@
     protected String minInclusiveFacet = null;
 
     protected Map memberTypes = new HashMap();
+    protected Map xmlNameJavaNameMap = new HashMap();
     protected List memberTypesKeys = new ArrayList();
 
     protected QName itemTypeQName;
@@ -862,6 +863,18 @@
 
     public void setHasParticleType(boolean hasParticleType) {
         this.hasParticleType = hasParticleType;
+    }
+
+    public void addXmlNameJavaNameMapping(String xmlName,String javaName){
+        this.xmlNameJavaNameMap.put(xmlName,javaName);
+    }
+
+    public boolean isJavaNameMappingAvailable(String xmlName){
+        return this.xmlNameJavaNameMap.containsKey(xmlName);
+    }
+
+    public String getJavaName(String xmlName){
+        return (String) this.xmlNameJavaNameMap.get(xmlName);
     }
 
 }

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?rev=581777&r1=581776&r2=581777&view=diff
==============================================================================
--- 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
Wed Oct  3 22:10:21 2007
@@ -691,13 +691,20 @@
             XSLTUtils.addAttribute(model, "name", xmlName, property);
             XSLTUtils.addAttribute(model, "nsuri", name.getNamespaceURI(), property);
 
-            String javaName = makeUniqueJavaClassName(propertyNames, xmlName);
-            // in a restriction if this element already there and array status have changed
-            // then we have to generate a new  name for this
-            if (parentMetaInf != null && metainf.isRestriction() && !missingQNames.contains(name)
&&
-                    (parentMetaInf.getArrayStatusForQName(name) && !metainf.getArrayStatusForQName(name)))
{
+            String javaName;
+            if (metainf.isJavaNameMappingAvailable(xmlName)) {
+                javaName = metainf.getJavaName(xmlName);
+            } else {
                 javaName = makeUniqueJavaClassName(propertyNames, xmlName);
+                // in a restriction if this element already there and array status have changed
+                // then we have to generate a new  name for this
+                if (parentMetaInf != null && metainf.isRestriction() && !missingQNames.contains(name)
&&
+                        (parentMetaInf.getArrayStatusForQName(name) && !metainf.getArrayStatusForQName(name)))
{
+                    javaName = makeUniqueJavaClassName(propertyNames, xmlName);
+                }
+                metainf.addXmlNameJavaNameMapping(xmlName,javaName);
             }
+
             XSLTUtils.addAttribute(model, "javaname", javaName, property);
 
             if (parentMetaInf != null && metainf.isRestriction() && missingQNames.contains(name))
{

Modified: webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/extensions.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/extensions.xsd?rev=581777&r1=581776&r2=581777&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/extensions.xsd
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/extensions.xsd
Wed Oct  3 22:10:21 2007
@@ -29,13 +29,11 @@
             <xs:element name="last" type="xs:string"/>
         </xs:sequence>
     </xs:complexType>
-
     <xs:simpleType name="simpleType">
         <xs:restriction base="xs:string">
             <xs:pattern value="[A-Z]*"></xs:pattern>
         </xs:restriction>
     </xs:simpleType>
-
     <xs:simpleType name="baseType">
         <xs:restriction base="xs:string">
             <xs:enumeration value="s1"></xs:enumeration>
@@ -44,7 +42,6 @@
             <xs:enumeration value="s4"></xs:enumeration>
         </xs:restriction>
     </xs:simpleType>
-
     <xs:element name="fullName">
         <xs:complexType>
             <xs:simpleContent>
@@ -56,19 +53,36 @@
             </xs:simpleContent>
         </xs:complexType>
     </xs:element>
-
     <xs:complexType name="ExtendedComplexType">
         <xs:complexContent>
             <xs:extension base="tns:type">
-                  <xs:sequence>
-                      <xs:element name="parentElement1" type="xs:string"></xs:element>
-                      <xs:element name="parentElement2" type="xs:string"></xs:element>
-                  </xs:sequence>
+                <xs:sequence>
+                    <xs:element name="parentElement1" type="xs:string"></xs:element>
+                    <xs:element name="parentElement2" type="xs:string"></xs:element>
+                </xs:sequence>
             </xs:extension>
         </xs:complexContent>
     </xs:complexType>
-
     <xs:element name="TestComplexElement" type="tns:ExtendedComplexType">
-
     </xs:element>
+
+    <xs:complexType name="P2apiAgPatAppt">
+        <xs:complexContent>
+            <xs:extension base="tns:P2apiDataRptGrp">
+                <xs:sequence>
+                    <xs:element minOccurs="0" name="aG_MAX_APPT_DETL_ROW" type="xs:int"/>
+                    <xs:element minOccurs="0" name="apptLst" nillable="true" type="xs:anyType"/>
+                </xs:sequence>
+            </xs:extension>
+        </xs:complexContent>
+    </xs:complexType>
+    <xs:complexType name="P2apiDataRptGrp">
+        <xs:sequence>
+            <xs:element minOccurs="0" name="sORT_ASCENDING" type="xs:int"/>
+            <xs:element minOccurs="0" name="sORT_DESCENDING" type="xs:int"/>
+            <xs:element minOccurs="0" name="SORT_ASCENDING" type="xs:int"/>
+            <xs:element minOccurs="0" name="SORT_DESCENDING" type="xs:int"/>
+        </xs:sequence>
+    </xs:complexType>
+
 </schema>

Modified: webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/testattribute.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/testattribute.xsd?rev=581777&r1=581776&r2=581777&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/testattribute.xsd
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/testattribute.xsd
Wed Oct  3 22:10:21 2007
@@ -53,7 +53,7 @@
     </xs:element>
 
     <xs:element name="TestAttributeReferenceElement" type="tns:TestAttributeReferenceType"/>
-    <xs:attribute   name="TestAttribute1" type="xs:string"/>
+    <xs:attribute name="TestAttribute1" type="xs:string"/>
     <xs:complexType name="TestAttributeReferenceType">
         <xs:sequence>
             <xs:element name="param1" type="xs:string"/>
@@ -61,5 +61,19 @@
         </xs:sequence>
         <xs:attribute use="optional" ref="tns:TestAttribute1"/>
     </xs:complexType>
+
+    <xs:attribute name="Type">
+        <xs:simpleType>
+            <xs:restriction base="xs:string">
+                <xs:pattern value="String|Base64"/>
+            </xs:restriction>
+        </xs:simpleType>
+    </xs:attribute>
+
+    <xs:element name="TestTypeElement">
+        <xs:complexType>
+            <xs:attribute ref="tns:Type"/>
+        </xs:complexType>
+    </xs:element>
 
 </xs:schema>



---------------------------------------------------------------------
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