Class MbInstalledStructureDefinitionV2Migration

java.lang.Object
ch.ahdis.matchbox.packages.migrations.MbInstalledStructureDefinitionV2Migration

public class MbInstalledStructureDefinitionV2Migration extends Object
Migrates MB_INSTALLED_STRUCT_DEF rows still at meta version 1 to meta version 2: extracts the document type/category codes (MbInstalledStructureDefinitionEntity.getDocCompTypeCode() / MbInstalledStructureDefinitionEntity.getDocCompCatCode()) for rows that are document-type Bundles, then bumps their metaVersion to MbInstalledStructureDefinitionEntity.CURRENT_META_VERSION.
Author:
Quentin Ligier
  • Constructor Summary

    Constructors
    Constructor
    Description
    MbInstalledStructureDefinitionV2Migration(ca.uhn.fhir.jpa.dao.data.MbInstalledStructureDefinitionRepository installedStructureDefinitionRepository, ca.uhn.fhir.jpa.api.dao.DaoRegistry myDaoRegistry, ca.uhn.fhir.jpa.binary.api.IBinaryStorageSvc myBinaryStorageSvc, ca.uhn.fhir.jpa.dao.data.INpmPackageVersionResourceDao myPackageVersionResourceDao, org.springframework.transaction.PlatformTransactionManager txManager)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    run()
    Deliberately not @Transactional: each page gets its own transaction via pageTxTemplate in migratePage(org.springframework.data.domain.Pageable).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MbInstalledStructureDefinitionV2Migration

      public MbInstalledStructureDefinitionV2Migration(ca.uhn.fhir.jpa.dao.data.MbInstalledStructureDefinitionRepository installedStructureDefinitionRepository, ca.uhn.fhir.jpa.api.dao.DaoRegistry myDaoRegistry, ca.uhn.fhir.jpa.binary.api.IBinaryStorageSvc myBinaryStorageSvc, ca.uhn.fhir.jpa.dao.data.INpmPackageVersionResourceDao myPackageVersionResourceDao, org.springframework.transaction.PlatformTransactionManager txManager)
  • Method Details

    • run

      public void run()
      Deliberately not @Transactional: each page gets its own transaction via pageTxTemplate in migratePage(org.springframework.data.domain.Pageable).

      Every page is (re-)fetched as page 0 of the rows still at PREVIOUS_META_VERSION, rather than advancing through successive offsets: each row that gets migrated leaves that filtered set, so what was "page 1" before this page ran is "page 0" afterward. The number of iterations is capped to the number of pages the original count of version-1 rows would need, so that a handful of rows that can never be saved (e.g. a constraint violation) - which would otherwise keep re-appearing in every "page 0" forever - can't turn this into an infinite loop; they're simply left at PREVIOUS_META_VERSION to be retried on the next startup, same as a bad row is handled in MbInstalledStructureDefinitionV1Migration.