* be always the last.
* So we need to parse backwards because than more prominent
* things will overwrite and win!
*/
for(int i=activeMappings.size()-1;i>=0;i--){
FieldMapping mapping = activeMappings.get(i);
if(mapping.usesWildcard() //if wildcard
&& !mapping.ignoreField() && //and not ignore
mapping.getFilter() != null && //and a filter is present
mapping.getFilter().getType() == ConstraintType.text){ //and of type text
//set the global text filter.
//NOTE: the active mappings are sorted in that way, that
// the most specific one is set last
globalFilter = (TextConstraint)mapping.getFilter();
}
for(String targetField : mapping.getMappings()){
if(mapping.ignoreField()){
targetFields.remove(targetField);
} else {
targetFields.add(targetField);
}
}
}
// log.info(" o targets: "+targetFields);
// log.info(" o global text filter: "+globalFilter);
if(globalFilter != null){
globalFiltered = new HashSet<Object>(values);
//parse false ass third argument, because we need not to filter
//non-Text values for wildcard filter!
processFilter(globalFilter, globalFiltered,false);
}
//now process the mappings
for(FieldMapping mapping : activeMappings){
if(!mapping.ignoreField() &&
!Collections.disjoint(targetFields, mapping.getMappings())){
processMapping(mapping, valueFactory, field, values,globalFiltered, targetFields, target);
// } else if(!mapping.ignoreField()) {
// log.info(String.format(" << ignore mapping %s ",mapping));
// } else {
// log.info(String.format(" << %s ",mapping));