Author: darran.lofthouse(a)jboss.com
Date: 2007-01-04 06:05:31 -0500 (Thu, 04 Jan 2007)
New Revision: 1781
Modified:
branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/WSDLToJava.java
branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/helpers/ReturnTypeUnwrapper.java
Log:
JBWS-1260 - Abort generation for some scenarios not currently supported.
Modified: branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/WSDLToJava.java
===================================================================
---
branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/WSDLToJava.java 2007-01-03
18:45:35 UTC (rev 1780)
+++
branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/WSDLToJava.java 2007-01-04
11:05:31 UTC (rev 1781)
@@ -391,10 +391,8 @@
XSComplexTypeDefinition wrapper = (XSComplexTypeDefinition)xt;
boolean hasAttributes = wrapper.getAttributeUses().getLength() > 0;
-
if (hasAttributes)
throw new WSException("Can not unwrap, complex type contains
attributes.");
- // TODO DAL - Add same check for unwrapping response.
boolean unwrappedElement = false;
Modified:
branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/helpers/ReturnTypeUnwrapper.java
===================================================================
---
branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/helpers/ReturnTypeUnwrapper.java 2007-01-03
18:45:35 UTC (rev 1780)
+++
branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/helpers/ReturnTypeUnwrapper.java 2007-01-04
11:05:31 UTC (rev 1781)
@@ -24,18 +24,15 @@
import javax.xml.namespace.QName;
import org.apache.xerces.xs.XSAttributeDeclaration;
-import org.apache.xerces.xs.XSAttributeUse;
import org.apache.xerces.xs.XSComplexTypeDefinition;
import org.apache.xerces.xs.XSElementDeclaration;
import org.apache.xerces.xs.XSModelGroup;
-import org.apache.xerces.xs.XSObject;
import org.apache.xerces.xs.XSObjectList;
import org.apache.xerces.xs.XSParticle;
import org.apache.xerces.xs.XSTerm;
import org.apache.xerces.xs.XSTypeDefinition;
import org.jboss.ws.WSException;
import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutput;
-import org.jboss.ws.metadata.wsdl.WSDLUtils;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
/**
@@ -80,10 +77,11 @@
XSComplexTypeDefinition wrapper = (XSComplexTypeDefinition)xt;
- boolean unwrappedAttribute = false;
- boolean unwrappedElement = false;
+ boolean hasAttributes = wrapper.getAttributeUses().getLength() > 0;
+ if (hasAttributes)
+ throw new WSException("Can not unwrap, complex type contains
attributes.");
- unwrappedAttribute = unwrapAttributeUses(wrapper.getAttributeUses());
+ boolean unwrapped = false;
XSParticle particle = wrapper.getParticle();
if (particle != null)
@@ -95,11 +93,10 @@
XSModelGroup group = (XSModelGroup)term;
- unwrappedElement = unwrapModelGroup(group);
+ unwrapped = unwrapModelGroup(group);
}
- // We can only say we unwrapped if we only unwrapped one.
- return unwrappedAttribute ^ unwrappedElement;
+ return unwrapped;
}
private boolean unwrapModelGroup(XSModelGroup group)
@@ -126,23 +123,12 @@
}
}
-
- return unwrappedElement != null;
- }
-
- private boolean unwrapAttributeUses(XSObjectList attributeUses)
- {
- if (attributeUses.getLength() == 1)
+ else
{
- XSObject object = attributeUses.item(0);
- if (object instanceof XSAttributeUse)
- {
- XSAttributeUse attributeUse = (XSAttributeUse)object;
- unwrappedAttribute = attributeUse.getAttrDeclaration();
- }
+ throw new WSException("Unable to unwrap model group with multiple
particles.");
}
- return unwrappedAttribute != null;
+ return unwrappedElement != null;
}
}
Show replies by date