You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by am...@apache.org on 2007/06/13 23:25:06 UTC

svn commit: r547039 - /webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java

Author: amilas
Date: Wed Jun 13 14:25:05 2007
New Revision: 547039

URL: http://svn.apache.org/viewvc?view=rev&rev=547039
Log:
fixed the issue Axis2-2755

Modified:
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java?view=diff&rev=547039&r1=547038&r2=547039
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java Wed Jun 13 14:25:05 2007
@@ -11,13 +11,7 @@
 import org.apache.ws.commons.schema.*;
 
 import javax.xml.namespace.QName;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
+import java.util.*;
 
 /*
 * Copyright 2004,2005 The Apache Software Foundation.
@@ -56,6 +50,10 @@
     private HashMap simpleTypesMap;
     private HashMap changedTypeMap;
 
+    private HashSet changedSimpleTypeSet;
+    private HashSet changedComplexTypeSet;
+    private HashSet changedElementSet;
+
     // this map is necessary to retain the metainformation of types. The reason why these
     // meta info 'bags' would be useful later is to cater for the extensions and restrictions
     // of types
@@ -139,6 +137,10 @@
         processedElementRefMap = new HashMap();
         nillableElementList = new ArrayList();
 
+        changedComplexTypeSet = new HashSet();
+        changedSimpleTypeSet = new HashSet();
+        changedElementSet = new HashSet();
+
         //load the writer and initiliaze the base types
         writer = SchemaPropertyLoader.getBeanWriterInstance();
         writer.init(this.options);
@@ -356,6 +358,26 @@
         if (options.isWrapClasses()) {
             writer.writeBatch();
         }
+
+        // resets the changed types
+        XmlSchemaComplexType xmlSchemaComplexType = null;
+        for (Iterator iter = changedComplexTypeSet.iterator();iter.hasNext();){
+            xmlSchemaComplexType = (XmlSchemaComplexType) iter.next();
+            xmlSchemaComplexType.setName(null);
+        }
+
+        XmlSchemaSimpleType xmlSchemaSimpleType = null;
+        for (Iterator iter = changedSimpleTypeSet.iterator();iter.hasNext();){
+            xmlSchemaSimpleType = (XmlSchemaSimpleType) iter.next();
+            xmlSchemaSimpleType.setName(null);
+        }
+
+        XmlSchemaElement xmlSchemaElement = null;
+        for (Iterator iter = changedElementSet.iterator();iter.hasNext();){
+            xmlSchemaElement = (XmlSchemaElement) iter.next();
+            xmlSchemaElement.setSchemaTypeName(null);
+        }
+
     }
 
     /**
@@ -527,6 +549,7 @@
                     if (schemaType instanceof XmlSchemaComplexType) {
                         //set a name
                         schemaType.setName(generatedTypeName.getLocalPart());
+                        changedComplexTypeSet.add(schemaType);
                         // Must do this up front to support recursive types
                         String fullyQualifiedClassName = writer.makeFullyQualifiedClassName(schemaType.getQName());
                         processedTypemap.put(schemaType.getQName(), fullyQualifiedClassName);
@@ -551,6 +574,7 @@
                     } else if (schemaType instanceof XmlSchemaSimpleType) {
                         //set a name
                         schemaType.setName(generatedTypeName.getLocalPart());
+                        changedSimpleTypeSet.add(schemaType);
                         // Must do this up front to support recursive types
                         String fullyQualifiedClassName = writer.makeFullyQualifiedClassName(schemaType.getQName());
                         processedTypemap.put(schemaType.getQName(), fullyQualifiedClassName);
@@ -572,7 +596,6 @@
                         xsElt.addMetaInfo(
                                 SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY,
                                 className);
-
                     }
                 }
             } else {
@@ -2403,6 +2426,8 @@
                 // we have to set this otherwise the ours attribute would not set properly if refered to this simple
                 // type from any other element
                 xsElt.setSchemaTypeName(fakeQname);
+                changedElementSet.add(xsElt);
+
             } else {
                 fakeQname = qname;
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org