incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eno...@apache.org
Subject svn commit: r462753 - /incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToCorbaBinding.java
Date Wed, 11 Oct 2006 09:53:29 GMT
Author: enolan
Date: Wed Oct 11 02:53:28 2006
New Revision: 462753

URL: http://svn.apache.org/viewvc?view=rev&rev=462753
Log:
Yoko-191 - Fixing test testMultipartTypeMapGeneration in tools.

Modified:
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToCorbaBinding.java

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToCorbaBinding.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToCorbaBinding.java?view=diff&rev=462753&r1=462752&r2=462753
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToCorbaBinding.java
(original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToCorbaBinding.java
Wed Oct 11 02:53:28 2006
@@ -432,7 +432,7 @@
                     XmlSchemaType type = (XmlSchemaType)i.next();
                     boolean anonymous = wsdltypes.isAnonymous(type.getName());
                     corbaTypeImpl = convertSchemaToCorbaType(type, type.getQName(), null,

-                                                             anonymous);
+                                                             anonymous);                
   
                     if (corbaTypeImpl != null) {                         
                         if (corbaTypeImpl.getQName() != null) {
                             corbaTypeImpl.setQName(null);
@@ -474,9 +474,7 @@
                         createQNameCorbaNamespace(corbaTypeImpl.getQName().getLocalPart()
+ "_nil");
                     corbaTypeImpl = createNillableUnion(uname, 
                         checkPrefix(el.getQName()), checkPrefix(corbaTypeImpl.getQName()));
-                } else if (isPrimitive(corbaTypeImpl)) {
-                    corbaTypeImpl = null;
-                }
+                } 
                 if (corbaTypeImpl != null) { 
                     if (corbaTypeImpl.getQName() != null) {
                         corbaTypeImpl.setQName(null);        
@@ -487,14 +485,7 @@
                 }
             }                   
         }
-    }
-    
-    private boolean isPrimitive(CorbaTypeImpl corbaTypeImpl) {               
-        if ((CorbaTypeImpl)CORBAPRIMITIVEMAP.get(corbaTypeImpl.getQName()) != null) {
-            return true;
-        }
-        return false;
-    }
+    }       
     
     private boolean queryBinding(Definition definition, QName bqname) {
         Map bindings = definition.getBindings();
@@ -591,8 +582,8 @@
             CorbaTypeImpl corbaTypeImpl = (CorbaTypeImpl)corbaex;
             corbaTypeImpl.setQName(null);            
             if (!isDuplicate(corbaTypeImpl)) {
-                CorbaTypeImpl dup = isDuplicateException(corbaTypeImpl);
-                if (dup != null) {
+                CorbaTypeImpl dup = isDuplicateException(corbaTypeImpl);               
+                if (dup != null) {                    
                     typeMappingType.getStructOrExceptionOrUnion().remove(dup);
                     typeMappingType.getStructOrExceptionOrUnion().add(corbaTypeImpl);
                 } else {
@@ -660,8 +651,8 @@
                 CorbaTypeImpl memberType = processSequenceType(sequence, defaultName, schemaTypeName);
                 QName typeName = memberType.getQName();
                 if (memberType instanceof Struct) {
-                    memberType.setQName(null);           
-                    if (!isDuplicate(memberType)) {
+                    memberType.setQName(null);                  
+                    if (memberType != null && !isDuplicate(memberType)) {
                         typeMappingType.getStructOrExceptionOrUnion().add(memberType);
                     }                    
                 }
@@ -730,7 +721,7 @@
                     choice.getMaxOccurs(), choice.getMinOccurs(), false);
             
             if (arrayType != null) {
-                arrayType.setQName(null);
+                arrayType.setQName(null);                
                 if (!isDuplicate(arrayType)) {
                     typeMappingType.getStructOrExceptionOrUnion().add(arrayType);
                 }
@@ -756,7 +747,7 @@
             memtype = createNillableUnion(name, elName, 
                                              elemtype.getQName());
             memName = createQNameCorbaNamespace(memtype.getQName().getLocalPart());
-                        
+                                    
             if (memtype != null) {                          
                 memtype.setQName(null);
                 if (!isDuplicate(memtype)) {
@@ -807,7 +798,7 @@
             membertype.setName(arraytype.getName());
             membertype.setQName(arraytype.getQName());
             membertype.setType(arraytype.getType());
-            
+                        
             if (arraytype != null) {                
                 arraytype.setQName(null);
                 if (!isDuplicate(arraytype)) {
@@ -875,6 +866,7 @@
             QName name = createQNameTargetNamespace(type.getQName().getLocalPart() + "Array");
           
             CorbaTypeImpl atype = createArray(name, type.getQName(), type.getQName(),
                                            seq.getMaxOccurs(), seq.getMinOccurs(), false);
+            
             if (atype != null) {
                 atype.setQName(null);               
                 if (!isDuplicate(atype)) {
@@ -955,7 +947,7 @@
                 if (attribute.getSchemaType() != null) {                    
                     attType = convertSchemaToCorbaType(attribute.getSchemaType(), 
                                                        attribute.getQName(), 
-                                              attribute.getSchemaType(), true);
+                                              attribute.getSchemaType(), true);         
         
                     if (attType != null) {
                         QName typeName = attType.getQName();
                         attType.setQName(null);           
@@ -1732,15 +1724,20 @@
         
     
         
-    private boolean isDuplicate(CorbaTypeImpl corbaTypeImpl) {
+    private boolean isDuplicate(CorbaTypeImpl corbaTypeImpl) {        
         String corbaName = corbaTypeImpl.getName();
-        String corbaType = corbaTypeImpl.getType().getLocalPart();
+        QName corbaType = corbaTypeImpl.getType();
+        
+        QName primName = createQNameXmlSchemaNamespace(corbaName);
+        if ((CorbaTypeImpl)CORBAPRIMITIVEMAP.get(primName) != null) {              
+            return true;
+        }        
         if (!typeMappingType.getStructOrExceptionOrUnion().isEmpty()) {
             Iterator i = typeMappingType.getStructOrExceptionOrUnion().iterator();
             while (i.hasNext()) {
                 CorbaTypeImpl type = (CorbaTypeImpl)i.next();
                 if (corbaName.equals(type.getName())
-                                     && corbaType.equals(type.getType().getLocalPart()))
{                    
+                    && corbaType.getLocalPart().equals(type.getType().getLocalPart()))
{
                     if (corbaTypeImpl.getClass().getName()
                         .equals(type.getClass().getName())) {                        
                         return true;



Mime
View raw message