Object Mappers
Object Mappers are a core component of AirSync that manage and track the relationships between objects imported from external systems and their corresponding entities in DevRev. Think of Object Mappers as a comprehensive lookup table that maintains the synchronization state between external and DevRev objects.
Each sync mapper record contains external system identifiers, corresponding DevRev entity IDs, sync unit scope, operational status, and additional metadata. This bidirectional mapping system enables AirSync to efficiently track which external objects have been synchronized and locate their DevRev counterparts during ongoing operations. Object Mappers are available through the adapter object as adapter.mappers
in your AirSync snap-in functions.
When to use Object Mappers
Object Mappers are essential in several AirSync scenarios:
During data extraction and relationship management - Check if sync mapper records already exist to avoid duplicates, find related DevRev entities for nested objects like comments and attachments, and link child objects to their parent entities.
During loading operations - Locate IDs of objects in external system for DevRev entities when pushing data back to external systems and maintain consistency between systems.
Object Mapper methods
Get by DevRev ID
Use getByTargetId
when you have a DevRev entity ID and need to find the corresponding ID of an object in external system:
Get by external ID
Use getByExternalId
when you have an ID of an object in external system and need to find the corresponding DevRev entity:
Create new sync mapper record
Use create
to establish a new sync mapper record between external and DevRev entities. Create a mapper only when you are persisting a new link (for example, right after creating the external object in reverse sync), not for read-only extraction. This prevents duplicates in subsequent syncs by enabling lookups in both directions.
Update existing sync mapper record
Use update
to modify an existing sync mapper record: