JiBX

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

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Critical Critical
  • Resolution: Unresolved
  • Affects Version/s: JiBX 1.1.5
  • Fix Version/s: None
  • Component/s: core
  • Labels:
    None
  • Patch Submitted:
    Yes
  • Number of attachments :
    1

Description

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

Activity

There are no comments yet on this issue.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: