ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r391825 - /webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/ParamWriter.java
Date Wed, 05 Apr 2006 21:53:09 GMT
Author: nadiramra
Date: Wed Apr  5 14:53:07 2006
New Revision: 391825

URL: http://svn.apache.org/viewcvs?rev=391825&view=rev
Log:
Format code so more readable - align braces, etc.

Modified:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/ParamWriter.java

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/ParamWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/ParamWriter.java?rev=391825&r1=391824&r2=391825&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/ParamWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/ParamWriter.java Wed Apr
 5 14:53:07 2006
@@ -53,8 +53,7 @@
     /* Type of this param */
     protected Type type;
 
-    public ParamWriter(WebServiceContext wscontext, Type type)
-        throws WrapperFault
+    public ParamWriter(WebServiceContext wscontext, Type type) throws WrapperFault
     {
         super(WrapperUtils.getLanguageTypeName4Type(type));
         this.wscontext = wscontext;
@@ -67,24 +66,22 @@
         try
         {
             writer.write("/*\n");
-			writer.write(" * Copyright 2003-2006 The Apache Software Foundation.\n\n");
-			writer.write(" *\n");
-			writer.write(" * Licensed under the Apache License, Version 2.0 (the \"License\");\n");
-			writer.write(" * you may not use this file except in compliance with the License.\n");
-			writer.write(" * You may obtain a copy of the License at\n");
-			writer.write(" *\n");
-			writer.write(" *\t\thttp://www.apache.org/licenses/LICENSE-2.0\n");
-			writer.write(" *\n");
-			writer.write(" * Unless required by applicable law or agreed to in writing, software\n");
-			writer.write(" * distributed under the License is distributed on an \"AS IS\" BASIS,\n");
-			writer.write(" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
-			writer.write(" * See the License for the specific language governing permissions and\n");
-			writer.write(" * limitations under the License.\n");
-			writer.write(" *\n");
+            writer.write(" * Copyright 2003-2006 The Apache Software Foundation.\n\n");
+            writer.write(" *\n");
+            writer.write(" * Licensed under the Apache License, Version 2.0 (the \"License\");\n");
+            writer.write(" * you may not use this file except in compliance with the License.\n");
+            writer.write(" * You may obtain a copy of the License at\n");
+            writer.write(" *\n");
+            writer.write(" *\t\thttp://www.apache.org/licenses/LICENSE-2.0\n");
+            writer.write(" *\n");
+            writer.write(" * Unless required by applicable law or agreed to in writing, software\n");
+            writer.write(" * distributed under the License is distributed on an \"AS IS\"
BASIS,\n");
+            writer.write(" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied.\n");
+            writer.write(" * See the License for the specific language governing permissions
and\n");
+            writer.write(" * limitations under the License.\n");
+            writer.write(" *\n");
             writer.write(" * This file was auto-generated by the Axis C++ Web Service Generator
(WSDL2Ws)\n");
-            writer.write(" * This file contains functions to manipulate complex type "
-                    + this.classname
-                    + "\n");
+            writer.write(" * This file contains functions to manipulate complex type " +
this.classname + "\n");
             writer.write(" */\n\n");
         }
         catch (IOException e)
@@ -97,19 +94,16 @@
     /* genarate the attribs array */
     private void populateAttribList() throws WrapperFault
     {
-    	
-    	ElementInfo elemi = type.getExtensionBaseType();
+        ElementInfo elemi = type.getExtensionBaseType();
         if (elemi != null)
         {
             extensionBaseAttrib = new AttributeInfo(this.classname);
             extensionBaseAttrib.setParamName(elemi.getName().getLocalPart());
-            extensionBaseAttrib.setTypeName(
-                CUtils.getclass4qname(elemi.getType().getName()));
+            extensionBaseAttrib.setTypeName(CUtils.getclass4qname(elemi.getType().getName()));
             extensionBaseAttrib.setType(elemi.getType());
             extensionBaseAttrib.setElementName(elemi.getName());
-            
-            
         }
+        
         ArrayList attribfeilds = new ArrayList();
         ArrayList elementfeilds = new ArrayList();
 
@@ -118,11 +112,13 @@
         {
             attribfeilds.add(names.next());
         }
+        
         names = type.getElementnames();
         while (names.hasNext())
         {
             elementfeilds.add(names.next());
         }
+        
         int intAttrFieldSz = attribfeilds.size();
         attributeParamCount = intAttrFieldSz;
         int intEleFieldSz = elementfeilds.size();
@@ -131,21 +127,17 @@
         {
             this.attribs[i] = new AttributeInfo(this.classname);
             this.attribs[i].setParamName((String) attribfeilds.get(i));
-            Type attribType =
-                type.getTypForAttribName(this.attribs[i].getParamName());
+            Type attribType = type.getTypForAttribName(this.attribs[i].getParamName());
             if (CUtils.isSimpleType(attribType.getName()))
-                this.attribs[i].setTypeName(
-                    CUtils.getclass4qname(attribType.getName()));
+                this.attribs[i].setTypeName(CUtils.getclass4qname(attribType.getName()));
             else
             {
-                this.attribs[i].setTypeName(
-                    attribType.getLanguageSpecificName());
+                this.attribs[i].setTypeName(attribType.getLanguageSpecificName());
                 this.attribs[i].setSimpleType(false);
             }
             this.attribs[i].setType(attribType);
             this.attribs[i].setAttribute(true);
             this.attribs[i].setElementName(attribType.getName());
-            
                         
             //TODO this is wrong. correct immediately. this will cause attributes serialized
incorrectly
             //TODO : how to find whether this attribute is optional or not ?
@@ -154,75 +146,55 @@
         for (int i = intAttrFieldSz; i < intAttrFieldSz + intEleFieldSz; i++)
         {
             this.attribs[i] = new AttributeInfo(this.classname);
-            this.attribs[i].setParamName(
-                (String) elementfeilds.get(i - attributeParamCount));
-            ElementInfo elem =
-                type.getElementForElementName(this.attribs[i].getParamName());
+            this.attribs[i].setParamName((String) elementfeilds.get(i - attributeParamCount));
+            ElementInfo elem = type.getElementForElementName(this.attribs[i].getParamName());
             Type elementType = elem.getType();
             if (CUtils.isAnyType(elementType.getName()))
-            {
                 this.attribs[i].setAnyType(true);
-            }
+
             if (CUtils.isSimpleType(elementType.getName()))
-                this.attribs[i].setTypeName(
-                    CUtils.getclass4qname(elementType.getName()));
+                this.attribs[i].setTypeName(CUtils.getclass4qname(elementType.getName()));
             else
             {
-                this.attribs[i].setTypeName(
-                    elementType.getLanguageSpecificName());
+                this.attribs[i].setTypeName(elementType.getLanguageSpecificName());
                 this.attribs[i].setSimpleType(false);
             }
+            
             this.attribs[i].setType(elementType);
             this.attribs[i].setElementName(elem.getName());
-            //Dushshantha:
-            //setting the choice element availability.
             this.attribs[i].setChoiceElement(elem.getChoiceElement());
-                                   
-            //..................................................
-            
-            //Chinthana:
-            //setting the all element availability.
             this.attribs[i].setAllElement(elem.getAllElement());
-            //04/05/2005..................................................
-            
-            //Dushshantha:
-            //states whether the atribute is namespace qualified
-            this.attribs[i].setNsQualified(elem.getNsQualified());
-            
-            //setting the minoccures
+            this.attribs[i].setNsQualified(elem.getNsQualified());            
             this.attribs[i].setMinOccurs(elem.getMinOccurs());
-            //12/05/2005..................................................
-
-            
             
             if (elementType.isArray())
-            { //soap encoding arrays.
+            { 
                 Type arrayType = WrapperUtils.getArrayType(elementType);
+                
                 //get contained type
                 this.attribs[i].setArray(true);
                 if (CUtils.isSimpleType(arrayType.getName()))
                 {
-                    this.attribs[i].setTypeName(
-                        CUtils.getclass4qname(arrayType.getName()));
+                    this.attribs[i].setTypeName(CUtils.getclass4qname(arrayType.getName()));
                     this.attribs[i].setSimpleType(true);
                 }
                 else
                 {
-                    this.attribs[i].setTypeName(
-                        arrayType.getLanguageSpecificName());
+                    this.attribs[i].setTypeName(arrayType.getLanguageSpecificName());
                     this.attribs[i].setSimpleType(false);
                 }
+                
                 this.attribs[i].setType(arrayType);
-                //set contained type as type
             }
-            else
-                if (elem.getMaxOccurs() > 1)
-                {
-                    //arrays but the same type as was set above
-                    this.attribs[i].setArray(true);
-                }
+            else if (elem.getMaxOccurs() > 1)
+            {
+                //arrays but the same type as was set above
+                this.attribs[i].setArray(true);
+            }
+            
             if (elem.getMinOccurs() == 0)
                 this.attribs[i].setOptional(true);
+            
             this.attribs[i].setNillable(elem.getNillable());
         }
     }
@@ -234,58 +206,34 @@
         {
             if (attrib.isSimpleType())
             {
-                /**
-                 * Dushshantha:
-                 * if the element is a choice element,
-                 * it should be defined as a pointer to an array.
-                 * Chinthana: Same changes will need for the 'all' element
-                 */
-            	
-            	if(attrib.getChoiceElement() || attrib.getAllElement())
-                	return CUtils.getBasicArrayNameforType(attrib.getTypeName())+"*";
+                //  if the element is a choice or all element, define as ptr to array
+                if(attrib.getChoiceElement() || attrib.getAllElement())
+                    return CUtils.getBasicArrayNameforType(attrib.getTypeName())+"*";
                 else
-                	return CUtils.getBasicArrayNameforType(attrib.getTypeName());
+                    return CUtils.getBasicArrayNameforType(attrib.getTypeName());
             }
             else
-            {
                 return CUtils.getCmplxArrayNameforType(attrib.getSchemaName());
-            }
         }
+        else if (!(attrib.isSimpleType() || attrib.getType().isSimpleType()))
+            return attrib.getTypeName() + "*";
         else
         {
-            if (!(attrib.isSimpleType() || attrib.getType().isSimpleType()))
-            {
-                return attrib.getTypeName() + "*";
-            }
-            else
+            //  if the element is a choice or all element, define as ptr
+            if(attrib.getChoiceElement() || attrib.getAllElement())
             {
-            /**
-             * Dushshantha:
-             * If a simple type attribute is a choice element,
-             * it should be defined as a pointer
-             * Chinthana: Same changes will need for the 'all' element
-             */
-            	if(attrib.getChoiceElement() || attrib.getAllElement())
-            	{
-            		String typename = attrib.getTypeName();
-            		if (CUtils.isPointerType(typename))
-            			return attrib.getTypeName();
-            		else
-            			return attrib.getTypeName() + "*";
-            		
-            	}
-                       	
-            	if (attrib.isAttribute() && attrib.isOptional())
-                { 
-            		
-            		//variables corresponding to optional attributes are pointer types
-                    return attrib.getTypeName() + "*";
-                }
-                else
-                {
+                String typename = attrib.getTypeName();
+                if (CUtils.isPointerType(typename))
                     return attrib.getTypeName();
-                }
+                else
+                    return attrib.getTypeName() + "*";
             }
+
+            // variables corresponding to optional attributes are pointer types
+            if (attrib.isAttribute() && attrib.isOptional())
+                return attrib.getTypeName() + "*";
+            else
+                return attrib.getTypeName();
         }
     }
 
@@ -296,32 +244,16 @@
         if (attrib.isArray())
         {
             if (attrib.isSimpleType())
-            {
                 return CUtils.getBasicArrayNameforType(attrib.getTypeName());
-            }
             else
-            {
                 return CUtils.getCmplxArrayNameforType(attrib.getSchemaName());
-            }
         }
+        else if (!attrib.isSimpleType())
+            return attrib.getTypeName() + "*";
+        else if (attrib.isAttribute() && attrib.isOptional())
+            return attrib.getTypeName() + "*";
         else
-        {
-            if (!attrib.isSimpleType())
-            {
-                return attrib.getTypeName() + "*";
-            }
-            else
-            {
-                if (attrib.isAttribute() && attrib.isOptional())
-                { //variables corresponding to optional attributes are pointer types
-                    return attrib.getTypeName() + "*";
-                }
-                else
-                {
-                    return attrib.getTypeName();
-                }
-            }
-        }
+            return attrib.getTypeName();
     }
 
     protected boolean isElementNillable(int index)
@@ -333,16 +265,12 @@
             if (attribs[index].isSimpleType())
             {
                 if (!CUtils.isPointerType(attribs[index].getTypeName()))
-                {
                     bNillable = attribs[index].isNillable();
-                }
             }
             else if (attribs[index].getType().isSimpleType())
             {
                 if (!CUtils.isPointerType(CUtils.getclass4qname(attribs[index].getType().getBaseType())))
-                {
                     bNillable = attribs[index].isNillable();
-                }
             }
         }
         return bNillable;
@@ -357,16 +285,12 @@
             if (attribs[index].isSimpleType())
             {
                 if (!CUtils.isPointerType(attribs[index].getTypeName()))
-                {
                     bOptional = attribs[index].isOptional();
-                }
             }
             else if (attribs[index].getType().isSimpleType())
             {
                 if (!CUtils.isPointerType(CUtils.getclass4qname(attribs[index].getType().getBaseType())))
-                {
                     bOptional = attribs[index].isOptional();
-                }
             }
         }
         return bOptional;



Mime
View raw message