Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-9178

Apache Camel is not able to read map-id in Dozer mapping xml but does not throw any error

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.12.0, 2.14.0
    • Fix Version/s: 2.15.4, 2.16.1, 2.17.0
    • Component/s: camel-dozer
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      I used camel dozer and configured with a mapping.xml for dozer mapping.
      Camel fails to do Dozer mapping for the elements mapped with map-id but does not throw any error.

      In camel context file define DozerTypeConverterLoader and DozerBeanMapper as follows:

      <bean id="dozerConverterLoader"
      class="org.apache.camel.converter.dozer.DozerTypeConverterLoader" />
      <!-- use bean mapping configuration -->
      <bean id="mapper" class="org.dozer.DozerBeanMapper">
      <property name="mappingFiles">
      <list>
      <value>dozer/mapping.xml</value>
      </list>
      </property>
      </bean>

      where mapping.xml is the file where the dozer mappings should be defined.

      Example:
      In camel-context camel will look for the mapping for conversion to PortInNotification as defined in the dozer/mapping.xml
      <setBody id="setBodyNPOCIn">
      <simple resultType="x.y.NPOCType">${body.getNPOOrNPOCOrNPOR.get(0)}</simple>
      </setBody>

      <convertBodyTo type="a.b.v1.PortInNotification" id="convertToNPOCPortIn" />

      In mapping.xml:

      <mapping map-id="mapNPOCtoPortIn">
      <class-a>a.b.v1.PortInNotification</class-a>
      <class-b>x.y.NPOCType</class-b>

      <field>
      <a>requestID.id</a>
      <b>requestId</b>
      </field>
      <field>
      <a>referenceID.id</a>
      <b>referenceId</b>

      </field>

      </mapping>

      Camel-dozer is not able to trace this mapping,however it does not throw any error and simply returns an object of type PortInNotification with null attributes.
      On removal of map-id attribute it is able to correctly lookup the mapping of PortInNotification from the mapping.xml

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                davsclaus Claus Ibsen
                Reporter:
                madhumita12 MADHUMITA
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: