[
https://jira.jboss.org/browse/JBIDE-6748?page=com.atlassian.jira.plugin.s...
]
Robert (Bob) Brodt commented on JBIDE-6748:
-------------------------------------------
OK, I think I have a fix for this. It involves extending the
org.eclipse.wst.xml.ui.internal.wizards.NewXMLGenerator, a subclass of which is defined in
org.eclipse.bpel.ui.properties.VariablePartAssignCategory where the XML literal generation
for message/variable initialization happens. This class ("MyNewXMLGenerator")
can be enhanced so that it generates the correct values for <choice> elements and
text nodes, but I have found that a couple of minor enhancements are necessary in
org.eclipse.wst.xsd.contentmodel.internal.XSDImpl (a 3,000+ line class :-O)
It looks like by setting the right build policy in the DOMContentBuilder, it will generate
all the right XML bits needed for proper initialization of a BPEL message/variable. The
only problem I have run across (and this MAY be a bug in
XSDImpl#getEnumeratedValuesForType()) is that the DOMContentBuilder always returns the
first value in the enumerated value list, which in the example Jeff provided would be
"receivePolicyQuote". So, the generated XML literal looks like this:
<pol:policyQuote
xmlns:pol="http://www.example.org/policyQuote"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<pol:calculatePolicyQuote>
<pol:requestDate>2001-01-01</pol:requestDate>
<pol:task>receivePolicyQuote</pol:task>
<pol:policyQuoteInfo>
<pol:policyType/>
<pol:vehicleYear/>
<pol:driverName/>
<pol:ssn/>
<pol:dlNumber/>
<pol:age/>
<pol:numberOfAccidents/>
<pol:numberOfTickets/>
<pol:creditScore/>
<pol:price/>
</pol:policyQuoteInfo>
</pol:calculatePolicyQuote>
</pol:policyQuote>
Note the <pol:task>receivePolicyQuote</pol:task> element should be
<pol:task>calculatePolicyQuote</pol:task> because that's the only
enumeration value defined in the CalculatePolicyQuoteType definition (see the
policyQuoteRequest.xsd schema for its definition). What's happening is that
XSDImpl#getEnumeratedValuesForType() is collecting the enumeration values for the base
type of CalculatePolicyQuoteType (which is policyQuote which is defined as a
<choice>, like this:
<xs:choice minOccurs="1" maxOccurs="1">
<xs:element name="receivePolicyQuote"
type="pol:ReceivePolicyQuoteType"/>
<xs:element name="createPolicyQuote"
type="pol:CreatePolicyQuoteType"/>
<xs:element name="deletePolicyQuote"
type="pol:DeletePolicyQuoteType"/>
<xs:element name="getPolicyQuote"
type="pol:GetPolicyQuoteType"/>
<xs:element name="calculatePolicyQuote"
type="pol:CalculatePolicyQuoteType"/>
</xs:choice>
Each of the choices contains a TaskType element (the <pol:task> in the sample above)
and each of those has a different enumeration value; "receivePolicyQuote" for
the first, choice, "createPolicyQuote" for the second and so on. What
XSDImpl#getEnumeratedValuesForType() should really do is return only the enumeration
values for the given type (in this case "calculatePolicyQuote"). I could get
around this (bug?) if only I could get the XSD type for the element currently being built,
but alas this is unavailable from the DataTypeImpl inner class defined in XSDImpl.
I'll submit a change request to the wtp project and attach the bugzilla to this JIRA.
Enhance Assign Activity Initializer to support complex message types
that include choice elements
-------------------------------------------------------------------------------------------------
Key: JBIDE-6748
URL:
https://jira.jboss.org/browse/JBIDE-6748
Project: Tools (JBoss Tools)
Issue Type: Feature Request
Components: bpel
Affects Versions: 3.2.0.M1
Environment: Mac with Eclipse 3.6 and JBoss Tools 3.2.0.M1
Reporter: Jeff DeLong
Assignee: Robert (Bob) Brodt
Fix For: 3.2.0.Beta2
Original Estimate: 0 minutes
Remaining Estimate: 0 minutes
Enhance Assign Activity Initializer to support complex message types that include choice
elements. See RIFTSAW-249 for more details.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira