Details
Description
In the mapping file we can specify a mapping function to apply to a field. This allows for semi-complex mappings to be handled easily. However, the current calls in XMLPS result in the mappings being applied in reverse order (relative from the "expected" direction).
Consider the following mapping that modifies the example config mentioned in the XMLPS Quick Start Guide [1]. Instead of returning the id as a number we want it as either the string "first" or "second".
<field type="dynamic" name="id" dbname="product_id"> <translate> <func class="org.apache.oodt.xmlps.mapping.funcs.ReplaceFunc" orig="1" with="first" /> <func class="org.apache.oodt.xmlps.mapping.funcs.ReplaceFunc" orig="2" with="second" /> </translate> </field>
My initial impression is that we're mapping the original value (1 or 2) to the new "with" values (first or second). With the current implementation this is not the case. We're actually mapping "first" to 1 and "second" to 2.
I propose that we change the implementation so the attributes are easier to understand.
[1] https://cwiki.apache.org/confluence/display/OODT/XMLPS+Quick+Start+Guide