Kettle plugin doesn't support mapping lookup nodes with wildcards
Description
Environment
None
Activity
Show:
Tim Anderson February 6, 2021 at 8:56 AM
This is now supported by specifying the desired lookup archetype in the value.
E.g., for the act.customerAppointment reason node:
Map To = <act.customerAppointment>reason
Value = <lookup.visitReason>$value
The $value refers to the value of the input field.
Who's Looking?
The act.customerAppointment archetype reason node is specified as:
<node name="reason" path="/reason" type="java.lang.String" minCardinality="0"> <assertion name="lookup"> <property name="type" value="lookup"/> <property name="source" value="lookup.visitReason*"/> <errorMessage>Invalid Visit Reason</errorMessage> </assertion> </node>
Given a mapping:
REASON <act.customerAppointment>reason <lookup.visitReason>$value
The Kettle plugin fails to load the row with the error:
07 Apr 2017 10:17:49,844 ERROR LoaderPlugin,Appointments.0 (Thread-18):229 - Failed to process row 1: Archetype not found: lookup.visitReason* org.openvpms.etl.load.LoaderException: Archetype not found: lookup.visitReason* at org.openvpms.etl.load.LookupHandler.commit(LookupHandler.java:208) at org.openvpms.etl.load.Loader.load(Loader.java:119) at org.openvpms.etl.kettle.LoaderAdapter.load(LoaderAdapter.java:110) at org.openvpms.etl.kettle.LoaderPlugin.processRow(LoaderPlugin.java:118) at org.openvpms.etl.kettle.LoaderPlugin.run(LoaderPlugin.java:187)
The workaround is to change the assertion to remove the wildcard i.e.:
<node name="reason" path="/reason" type="java.lang.String" minCardinality="0"> <assertion name="lookup"> <property name="type" value="lookup"/> <property name="source" value="lookup.visitReason"/> <errorMessage>Invalid Visit Reason</errorMessage> </assertion> </node>