Author: lresende
Date: Fri Nov 16 19:24:43 2007
New Revision: 595903

URL: http://svn.apache.org/viewvc?rev=595903&view=rev
Log:
TUSCANY-1142 - Reusing axis calculated isWrapped flag

Modified:
    
incubator/tuscany/java/sca/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java

Modified: 
incubator/tuscany/java/sca/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java?rev=595903&r1=595902&r2=595903&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java
 (original)
+++ 
incubator/tuscany/java/sca/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java
 Fri Nov 16 19:24:43 2007
@@ -28,7 +28,6 @@
 
 import org.apache.axis2.description.AxisMessage;
 import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.WSDL2Constants;
 import org.apache.axis2.util.FileWriter;
 import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
@@ -37,7 +36,6 @@
 import org.apache.axis2.wsdl.databinding.TypeMapper;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-
 /**
  * Overrides the Axis2 JavaEmitter to generate unwrapped methods.
  */
@@ -68,6 +66,10 @@
             List typeMappings;
             if (wrapped) {
                 typeMappings = typeMappingEntry.getPropertyClassNames();
+                if(typeMappings == null) {
+                    typeMappings = new ArrayList();
+                    typeMappings.add(typeMappingEntry.getClassName());
+                }
             } else {
                 typeMappings = new ArrayList();
                 typeMappings.add(typeMappingEntry.getClassName());
@@ -126,59 +128,12 @@
         return parameterElementList;
     }
 
-    protected boolean isWrapped(AxisOperation operation) {
-        boolean wrapped = false;
-
-        if (isInputPresentForMEP(operation.getMessageExchangePattern())) {
-            QName qname = 
operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE).getElementQName();
-            if (qname != null && 
qname.getLocalPart().equals(operation.getName().getLocalPart())) {
-
-                //
-                // Maybe we should be more strict than this but there's no 
point
-                // in ruling out named
-                // complex types.
-                //
-                // wrapped = true;
-
-                // *
-                SDODataBindingTypeMappingEntry typeMappingEntry =
-                    
(SDODataBindingTypeMappingEntry)this.typeMapper.getTypeMappingObject(qname);
-                if (typeMappingEntry.isAnonymous()) {
-                    wrapped = true;
-                }
-                // */
-            }
-        }
-
-        return wrapped;
-    }
-
-    private boolean isInputPresentForMEP(String MEP) {
-        // TODO: verify if thi is still correct with Axis2 1.2
-        return WSDL2Constants.MEP_URI_IN_ONLY.equals(MEP) || 
WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP)
-            || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP)
-            || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP)
-            || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP)
-            || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)
-            ||
-
-            WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_ONLY.equals(MEP)
-            || 
WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP)
-            || 
WSDLConstants.WSDL20_2006Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP)
-            || 
WSDLConstants.WSDL20_2006Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP)
-            || 
WSDLConstants.WSDL20_2006Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP)
-            || WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OUT.equals(MEP)
-            ||
-
-            WSDLConstants.WSDL_MESSAGE_DIRECTION_IN.endsWith(MEP);
-    }
-
     @Override
     protected Element getInputElement(Document doc, AxisOperation operation, 
List headerParameterQNameList) {
         return getElement(doc,
                           "input",
                           
operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE),
-                          isWrapped(operation),
+                          
operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE).isWrapped(),
                           headerParameterQNameList);
     }
 
@@ -187,7 +142,7 @@
         return getElement(doc,
                           "output",
                           
operation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE),
-                          isWrapped(operation),
+                          
operation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE).isWrapped(),
                           headerParameterQNameList);
     }
 
@@ -234,6 +189,7 @@
 
 //      JIRA TUSCANY-1561 Port to Axis2 1.3                
 //        writeClass(interfaceModel, interfaceWriter);
+
         writeFile(interfaceModel, interfaceWriter);
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to