IModelTransformer Class

Beta  

Base class used to transform a source iModel into a different target iModel.

see iModel Transformation and Data Exchange, IModelExporter, IModelImporter

Extends

Extended by

Methods

Name Description
constructor(source: IModelDb | IModelExporter, target: IModelDb | IModelImporter, options?: IModelTransformOptions): IModelTransformer Construct a new IModelTransformer  
detectElementDeletes(): Promise<void> Detect Element deletes using ExternalSourceAspects in the target iModel and a brute force comparison against Elements in the source iModel.  
detectRelationshipDeletes(): Promise<void> Detect Relationship deletes using ExternalSourceAspects in the target iModel and a brute force comparison against relationships in the source iModel.  
dispose(): void Dispose any native resources associated with this IModelTransformer.  
getAdditionalStateJson(): any Protected You may override this to store arbitrary json state in a transformer state dump, useful for some resumptions  
hasElementChanged(sourceElement: Element, targetElementId: string): boolean Protected Returns true if a change within sourceElement is detected.  
initFromExternalSourceAspects(args?: InitFromExternalSourceAspectsArgs): void | Promise<void> Initialize the source to target Element mapping from ExternalSourceAspects in the target iModel. Deprecated  
initialize(args?: InitFromExternalSourceAspectsArgs): Promise<void> Initialize prerequisites of processing, you must initialize with an InitFromExternalSourceAspectsArgs if you  
loadAdditionalStateJson(_additionalState: any): void Protected You may override this to load arbitrary json state in a transformer state dump, useful for some resumptions  
loadStateFromDb(db: SQLiteDb): void Protected Load the state of the active transformation from an open SQLiteDb  
onDeleteElement(sourceElementId: string): void Override of IModelExportHandler.onDeleteElement that is called when IModelExporter detects that an Element has been deleted from the source iModel.  
onDeleteModel(sourceModelId: string): void Override of IModelExportHandler.onDeleteModel that is called when IModelExporter detects that a Model has been deleted from the source iModel.  
onDeleteRelationship(sourceRelInstanceId: string): void Override of IModelExportHandler.onDeleteRelationship that is called when IModelExporter detects that a Relationship has been deleted from the source iModel.  
onExportCodeSpec(sourceCodeSpec: CodeSpec): void Override of IModelExportHandler.onExportCodeSpec that imports a CodeSpec into the target iModel when it is exported from the source iModel.  
onExportElement(sourceElement: Element): void Override of IModelExportHandler.onExportElement that imports an element into the target iModel when it is exported from the source iModel.  
onExportElementMultiAspects(sourceAspects: ElementMultiAspect[]): void Override of IModelExportHandler.onExportElementMultiAspects that imports ElementMultiAspects into the target iModel when they are exported from the source iModel.  
onExportElementUniqueAspect(sourceAspect: ElementUniqueAspect): void Override of IModelExportHandler.onExportElementUniqueAspect that imports an ElementUniqueAspect into the target iModel when it is exported from the source iModel.  
onExportFont(font: FontProps, _isUpdate: undefined | boolean): void Override of IModelExportHandler.onExportFont that imports a font into the target iModel when it is exported from the source iModel.  
onExportModel(sourceModel: Model): void Override of IModelExportHandler.onExportModel that is called when a Model should be exported from the source iModel.  
onExportRelationship(sourceRelationship: Relationship): void Override of IModelExportHandler.onExportRelationship that imports a relationship into the target iModel when it is exported from the source iModel.  
onExportSchema(schema: Schema): Promise<void | ExportSchemaResult> Override of IModelExportHandler.onExportSchema that serializes a schema to disk for IModelTransformer.processSchemas to import into  
onTransformElement(sourceElement: Element): ElementProps Transform the specified sourceElement into ElementProps for the target iModel.  
onTransformElementAspect(sourceElementAspect: ElementAspect, _targetElementId: string): ElementAspectProps Protected Transform the specified sourceElementAspect into ElementAspectProps for the target iModel.  
onTransformModel(sourceModel: Model, targetModeledElementId: string): ModelProps Transform the specified sourceModel into ModelProps for the target iModel.  
onTransformRelationship(sourceRelationship: Relationship): RelationshipProps Protected Transform the specified sourceRelationship into RelationshipProps for the target iModel.  
processAll(): Promise<void> Export everything from the source iModel and import the transformed entities into the target iModel.  
processChanges(accessToken: string, startChangesetId?: string): Promise<void> Export changes from the source iModel and import the transformed entities into the target iModel.  
processChildElements(sourceElementId: string): Promise<void> Import child elements into the target IModelDb  
processCodeSpec(codeSpecName: string): Promise<void> Cause a single CodeSpec to be exported from the source iModel and imported into the target iModel.  
processCodeSpecs(): Promise<void> Cause all CodeSpecs to be exported from the source iModel and imported into the target iModel.  
processDeferredElements(_numRetries: number = 3): Promise<void> Import elements that were deferred in a prior pass. Deprecated  
processElement(sourceElementId: string): Promise<void> Cause the specified Element and its child Elements (if applicable) to be exported from the source iModel and imported into the target iModel.  
processFonts(): Promise<void> Cause all fonts to be exported from the source iModel and imported into the target iModel.  
processModel(sourceModeledElementId: string): Promise<void> Cause the model container, contents, and sub-models to be exported from the source iModel and imported into the target iModel.  
processModelContents(sourceModelId: string, targetModelId: string, elementClassFullName: string = Element.classFullName): Promise<void> Cause the model contents to be exported from the source iModel and imported into the target iModel.  
processRelationships(baseRelClassFullName: string): Promise<void> Imports all relationships that subclass from the specified base class.  
processSchemas(): Promise<void> Cause all schemas to be exported from the source iModel and imported into the target iModel.  
processSubject(sourceSubjectId: string, targetSubjectId: string): Promise<void> Recursively import all Elements and sub-Models that descend from the specified Subject  
saveStateToDb(db: SQLiteDb): void Protected Save the state of the active transformation to an open SQLiteDb  
saveStateToFile(nativeStatePath: string): void Save the state of the active transformation to a file path, if a file at the path already exists, it will be overwritten  
shouldExportCodeSpec(_sourceCodeSpec: CodeSpec): boolean Override of IModelExportHandler.shouldExportCodeSpec that is called to determine if a CodeSpec should be exported from the source iModel.  
shouldExportElement(_sourceElement: Element): boolean Override of IModelExportHandler.shouldExportElement that is called to determine if an element should be exported from the source iModel.  
shouldExportRelationship(_sourceRelationship: Relationship): boolean Override of IModelExportHandler.shouldExportRelationship that is called to determine if a Relationship should be exported.  
shouldExportSchema(schemaKey: SchemaKey): boolean Override of IModelExportHandler.shouldExportSchema that is called to determine if a schema should be exported  
skipElement(_sourceElement: Element): void Protected   Deprecated  
resumeTransformation<SubClass extends (...a: any[]) => IModelTransformer>(this: SubClass, statePath: string, ...constructorArgs: ConstructorParameters<SubClass>): InstanceType<SubClass> Static Return a new transformer instance with the same remappings state as saved from a previous IModelTransformer.saveStateToFile call.  

Inherited methods

Name Inherited from Description
onProgress(): Promise<void> IModelExportHandler This method is called when IModelExporter has made incremental progress based on the IModelExporter.progressInterval setting.
shouldExportElementAspect(_aspect: ElementAspect): boolean IModelExportHandler If true is returned, then the ElementAspect will be exported.

Properties

Name Type Description
_partiallyCommittedEntities Protected <PartiallyCommittedEntity> map of partially committed entities to their partial commit progress  
_pendingReferences Protected PendingReferenceMap<PartiallyCommittedEntity> map of (unprocessed element, referencing processed element) pairs to the partially committed element that needs the reference resolved  
_schemaExportDir Protected string The directory where schemas will be exported, a random temporary directory  
context Readonly IModelCloneContext The IModelTransformContext for this IModelTransformer.  
exporter Readonly IModelExporter The IModelExporter that will export from the source iModel.  
importer Readonly IModelImporter The IModelImporter that will import into the target iModel.  
provenanceDb Accessor ReadOnly IModelDb Return the IModelDb where IModelTransformer will store its provenance.  
provenanceElementAspectClasses Accessor StaticReadOnly undefined[] The element aspect classes that are considered to define provenance in the iModel  
provenanceElementClasses Accessor StaticReadOnly undefined[] The element classes that are considered to define provenance in the iModel  
sourceDb Readonly IModelDb The normally read-only source iModel.  
targetDb Readonly IModelDb The read/write target iModel.  
targetScopeElementId Accessor ReadOnly string The Id of the Element in the target iModel that represents the source repository as a whole and scopes its ExternalSourceAspect instances.  

Defined in

Last Updated: 20 June, 2023