iTwin / imodel-transformer

API for exporting an iModel's parts and also importing them into another iModel
MIT License
3 stars 2 forks source link

Fix element provenance direction in reverse synchronization workflow #88

Closed ViliusRuskys closed 1 year ago

ViliusRuskys commented 1 year ago

forEachTrackedElement method iterates through related (tracked) elements in 2 imodels and invokes a callback on each pair. There are 2 scenarios for iterating through tracked elements during transformer initialization.

  1. Provenance is stored in target: Source ----> Target (prov)
  2. Provenance is stored in source: Source (prov) ----> Target

These 2 scenarios only matter when the provenance is tracked by ExternalSourceAspects since depending on the provenance location the element.id and identifier fields will be switched.

When provenance is tracked by federation guids we don't care where the provenance is, because the callback should always be invoked in the data flow direction and not the provenance direction. Methods that depend on the remap table (e.g. findTargetElementId) will only ever by called with the element id in the sourceDb to get element id in targetDb.