Author: darran.lofthouse(a)jboss.com
Date: 2007-01-11 10:00:58 -0500 (Thu, 11 Jan 2007)
New Revision: 1927
Modified:
branches/dlofthouse/JBWS-1259/jbossws-core/src/main/java/org/jboss/ws/tools/XSDTypeToJava.java
branches/dlofthouse/JBWS-1259/jbossws-core/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java
branches/dlofthouse/JBWS-1259/jbossws-tests/src/main/java/org/jboss/test/ws/tools/jbws1259/JBWS1259TestCase.java
Log:
JBWS-1259 - Fix the anonymous type naming for element references.
Modified:
branches/dlofthouse/JBWS-1259/jbossws-core/src/main/java/org/jboss/ws/tools/XSDTypeToJava.java
===================================================================
---
branches/dlofthouse/JBWS-1259/jbossws-core/src/main/java/org/jboss/ws/tools/XSDTypeToJava.java 2007-01-11
14:55:27 UTC (rev 1926)
+++
branches/dlofthouse/JBWS-1259/jbossws-core/src/main/java/org/jboss/ws/tools/XSDTypeToJava.java 2007-01-11
15:00:58 UTC (rev 1927)
@@ -563,11 +563,25 @@
if (containingElement == null || containingElement.length() == 0)
containingElement = origType.getName();
- String anonName = containingElement + subname;
+ String anonName;
+ if (elem.getScope() == XSConstants.SCOPE_GLOBAL)
+ {
+ anonName = subname;
+ }
+ else
+ {
+ anonName = containingElement + subname;
+ }
+
anonName = utils.firstLetterUpperCase(anonName);
this.fname = anonName;
- this.createJavaFile((XSComplexTypeDefinition)xstypedef, schema, false);
+ if (!generatedFiles.contains(this.fname))
+ {
+ generatedFiles.add(this.fname);
+ this.createJavaFile((XSComplexTypeDefinition)xstypedef, schema, false);
+ }
+
// Restore the fname
this.fname = tempfname;
// Bypass rest of processing
Modified:
branches/dlofthouse/JBWS-1259/jbossws-core/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java
===================================================================
---
branches/dlofthouse/JBWS-1259/jbossws-core/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java 2007-01-11
14:55:27 UTC (rev 1926)
+++
branches/dlofthouse/JBWS-1259/jbossws-core/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java 2007-01-11
15:00:58 UTC (rev 1927)
@@ -33,6 +33,7 @@
import org.apache.xerces.xs.XSAttributeDeclaration;
import org.apache.xerces.xs.XSAttributeUse;
import org.apache.xerces.xs.XSComplexTypeDefinition;
+import org.apache.xerces.xs.XSConstants;
import org.apache.xerces.xs.XSElementDeclaration;
import org.apache.xerces.xs.XSModelGroup;
import org.apache.xerces.xs.XSObjectList;
@@ -745,8 +746,13 @@
{
XSElementDeclaration xe = (XSElementDeclaration)xsterm;
XSTypeDefinition typeDefinition = xe.getTypeDefinition();
- //XSTypeDefinition xt, String name, String containingElement, JavaWsdlMapping
jwm, boolean skipWrapperArray
- addJavaXMLTypeMap(typeDefinition, xe.getName(), containingElement,
containingType, jwm, !isDocStyle());
+ String tempContainingElement = "";
+ if (xe.getScope() != XSConstants.SCOPE_GLOBAL)
+ {
+ tempContainingElement = containingElement;
+ }
+
+ addJavaXMLTypeMap(typeDefinition, xe.getName(), tempContainingElement,
containingType, jwm, !isDocStyle());
}
}
}
Modified:
branches/dlofthouse/JBWS-1259/jbossws-tests/src/main/java/org/jboss/test/ws/tools/jbws1259/JBWS1259TestCase.java
===================================================================
---
branches/dlofthouse/JBWS-1259/jbossws-tests/src/main/java/org/jboss/test/ws/tools/jbws1259/JBWS1259TestCase.java 2007-01-11
14:55:27 UTC (rev 1926)
+++
branches/dlofthouse/JBWS-1259/jbossws-tests/src/main/java/org/jboss/test/ws/tools/jbws1259/JBWS1259TestCase.java 2007-01-11
15:00:58 UTC (rev 1927)
@@ -37,21 +37,91 @@
public class JBWS1259TestCase extends JBossWSTest
{
+ /**
+ *
+ * <element name='lookupResponse'>
+ * <complexType>
+ * <sequence>
+ * <element name='areaCode' nillable='true'
type='string'/>
+ * <element name='number' nillable='true'
type='string'/>
+ * <element ref='tns:lookupResponse'/>
+ * </sequence>
+ * </complexType>
+ * </element>
+ *
+ */
public void testScenario_A() throws Exception
{
generateScenario("A");
}
+ /**
+ *
+ * <element name='lookupResponse' type='tns:TelephoneNumber'/>
+ *
+ * <complexType name='TelephoneNumber'>
+ * <sequence>
+ * <element name='areaCode' nillable='true'
type='string'/>
+ * <element name='number' nillable='true'
type='string'/>
+ * <element ref='tns:lookupResponse'/>
+ * </sequence>
+ * </complexType>
+ *
+ */
public void testScenario_B() throws Exception
{
generateScenario("B");
}
+ /**
+ *
+ * <element name='lookupResponse' type='tns:TelephoneNumber'/>
+ *
+ * <complexType name='TelephoneNumber'>
+ * <sequence>
+ * <element name='areaCode' nillable='true'
type='string'/>
+ * <element name='number' nillable='true'
type='string'/>
+ * <element ref='tns:comment'/>
+ * </sequence>
+ * </complexType>
+ *
+ * <element name='comment'>
+ * <complexType>
+ * <sequence>
+ * <element name='test' type='string' />
+ * <element ref='tns:comment' />
+ * </sequence>
+ * </complexType>
+ * </element>
+ *
+ */
public void testScenario_C() throws Exception
{
generateScenario("C");
}
+ /**
+ *
+ * <element name='lookupResponse' type='tns:TelephoneNumber'/>
+ *
+ * <complexType name='TelephoneNumber'>
+ * <sequence>
+ * <element name='areaCode' nillable='true'
type='string'/>
+ * <element name='number' nillable='true'
type='string'/>
+ * <element ref='tns:comment'/>
+ * </sequence>
+ * </complexType>
+ *
+ * <element name='comment' type='tns:Comment' />
+ *
+ * <complexType name='Comment'>
+ * <sequence>
+ * <element name='test' type='string' />
+ * <element ref='tns:comment' />
+ * </sequence>
+ * </complexType>
+ *
+ */
public void testScenario_D() throws Exception
{
generateScenario("D");
Show replies by date