axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prest...@apache.org
Subject svn commit: r344141 - /webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java
Date Mon, 14 Nov 2005 15:06:47 GMT
Author: prestonf
Date: Mon Nov 14 07:06:44 2005
New Revision: 344141

URL: http://svn.apache.org/viewcvs?rev=344141&view=rev
Log:
Added some function to Check_Restrictions_<type> method.

Modified:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java?rev=344141&r1=344140&r2=344141&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java
(original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java
Mon Nov 14 07:06:44 2005
@@ -27,6 +27,9 @@
 import java.util.HashSet;
 import java.util.Iterator;
 
+import javax.xml.namespace.QName;
+
+import org.apache.axis.wsdl.symbolTable.BaseType;
 import org.apache.axis.wsdl.wsdl2ws.WrapperFault;
 import org.apache.axis.wsdl.wsdl2ws.CUtils;
 import org.apache.axis.wsdl.wsdl2ws.info.ElementInfo;
@@ -1221,9 +1224,75 @@
         {
             writer.write("int Check_Restrictions_" + classname + "("
                     + classname + " value)\n");
+            
+            //TODO write code to check the restrictions.  FJP - Begun, but untested.
+            
             writer.write("{\n");
-            writer.write("\treturn 0;\n");
-            //TODO write code to check the restrictions
+            
+            if( CUtils.isPointerType( CUtils.getclass4qname( type.getBaseType())))
+            {
+                writer.write( "// String type\n");
+                writer.write( "// Number of " + classname + " elements = " + (type.getEnumerationdata().size()
- 1) + "\n");
+                
+                Iterator i = type.getEnumerationdata().iterator();
+                int iIndex = 0;
+                BaseType baseTypeForArray = (BaseType) i.next();
+                
+                while( i.hasNext())
+                {
+                    if( iIndex == 0)
+                    {
+                        writer.write( "//\tif( ");
+                    }
+                    else
+                    {
+                        writer.write( " ||\n//\t    ");
+                    }
+                    
+                    QName qnElement = (QName) i.next();
+                    
+                    writer.write( "!strcmp( value, " + classname+ "_" + qnElement.getNamespaceURI()
+ ")");
+                    
+                    iIndex++;
+                }
+                
+                writer.write( ")\n//\t{\n");
+                writer.write( "//\t\treturn 1;\n");
+                writer.write( "//\t}\n");
+            }
+            else
+            {
+                writer.write( "// Non-string type\n");
+                writer.write( "// Number of " + classname + " enums = " + (type.getEnumerationdata().size()
- 1) + "\n");
+                
+                Iterator i = type.getEnumerationdata().iterator();
+                int iIndex = 0;
+                BaseType baseTypeForArray = (BaseType) i.next();
+                
+                while( i.hasNext())
+                {
+                    if( iIndex == 0)
+                    {
+                        writer.write( "//\tif( ");
+                    }
+                    else
+                    {
+                        writer.write( " ||\n//\t    ");
+                    }
+                    
+                    QName qnElement = (QName) i.next();
+                    
+                    writer.write( "value == ENUM" + classname.toUpperCase()+ "_" + qnElement.getNamespaceURI());
+                    
+                    iIndex++;
+                }
+                
+                writer.write( ")\n//\t{\n");
+                writer.write( "//\t\treturn 1;\n");
+                writer.write( "//\t}\n");
+            }
+            
+            writer.write( "\n\treturn 0;\n");
             writer.write("}\n");
         }
         catch (IOException e)



Mime
View raw message