use of org.activityinfo.geoadmin.merge2.model.ReferenceMatch in project activityinfo by bedatadriven.
the class LookupDialog method buildReferenceMatch.
/**
* Build a ReferenceMatch that can be stored as part of the model.
* since this will form part of the model "state" it cannot depend
* on computed values in any way, so we need to map our row indices and SourceKeys
* back to the original ids.
*
* @param candidateIndex the index within the list of candidate target matches (from LookupGraph)
*/
private ReferenceMatch buildReferenceMatch(int candidateIndex) {
ResourceId targetId = tableModel.getTargetInstanceId(candidateIndex);
Map<FieldPath, String> keyMap = new HashMap<>();
java.util.List<FieldProfile> keyFields = lookupTable.getSourceKeyFields();
for (int i = 0; i < keyFields.size(); i++) {
keyMap.put(keyFields.get(i).getPath(), sourceKey.get(i));
}
return new ReferenceMatch(keyMap, targetId);
}
Aggregations