ident="ref" doesn't work when the target mapping is abstract
------------------------------------------------------------

                 Key: JIBX-184
                 URL: http://jira.codehaus.org/browse/JIBX-184
             Project: JiBX
          Issue Type: Bug
          Components: core
    Affects Versions: JiBX 1.1.5
            Reporter: Daniel Uribe
            Priority: Critical
         Attachments: jibx.patch

When a value defined as ident="ref" references an abstract mapping, JIBX tries 
to resolve the mapping using the data type for the field, which doesn't work 
for abstract mappings.

Sample mapping fragment with problem:

<mapping name="test" class="testRootClass">
  <structure name="def" map-as="_def" />
  <structure name="ref" map-as="_ref" />
</mapping>

<mapping abstract="true" type-name="_def" class="testDefClass">
  <value name="ID" style="attribute" field="id" ident="def" />
</mapping>

<mapping abstract="true" type-name="_ref" class="testRefClass">
  <value name="REFERENCE" style="attribute" field="reference" usage="optional" 
ident="ref"  />
</mapping>

Sample XML fragment:

<test>
  <def id="1">
  <ref reference="1">
</test>


In the case above, jibx would try to resolve the mapping using the data type of 
the reference field in the testRefClass, which is of type testDefClass. The 
problem is that the hashmap with the mapping uses the name of the abstract 
mapping instead (_def).

----

I would recommend to add another attribute (idref-map-as) to the value element 
to specify the name of the abstract mapping to use when matching the 
ident="ref" to the appropriate mapping that has the ident="def". This includes 
changes to the jibx schema (binding.xsd), as well as changes to the classes 
representing the value element (ValueChild & ValueElement) and the class that 
builds the binding (BindingBuilder).

Find a patch file attached including those proposed changes.
The attached

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to