Class ExtensionMigratorBase

java.lang.Object
com.thingworx.migration.ExtensionMigratorBase

@ThingworxExtensionApiClass(since={7,1}) public abstract class ExtensionMigratorBase extends Object
Abstract class to facilitate migration of extensions from one version of the extension to the next. Extension developers create subclasses of this class and include the class in their extension jar. The class name and package are set in the 'migratorClass' attribute of the ExtensionPackage XML in their extension metadata.
  • Constructor Details

  • Method Details

    • migrate

      @ThingworxExtensionApiMethod(since={7,1}, canOverride=true) public abstract void migrate(ImportedEntityCollection imports) throws Exception


      Perform the migration of the extension. It is called before entities are imported and must be implemented by the subclass in order to execute during an import. This will get called once for each subclass.
      Parameters:
      imports - The collection of entities to be migrated. Once migrate() is complete, these entities will be imported.
      Throws:
      Exception
    • postMigrate

      @ThingworxExtensionApiMethod(since={7,1}, canOverride=true) public void postMigrate(ImportedEntityCollection imports) throws Exception


      Post-migrate hook to allow subclasses to perform custom logic after the migrate() has been performed. Typically, this would be the location for any type of cleanup work to be done. This is an optional hook to implement and is called once for each subclass.
      Parameters:
      imports - The collection of entities that have been migrated and imported.
      Throws:
      Exception
    • getFromVersion

      @ThingworxExtensionApiMethod(since={7,1}) public final EntityVersion getFromVersion()


      Returns the version that the extension is being migrated from. Cannot be overridden by subclasses. The version returned is the same as the version of the imported extension with the same name.
      Returns:
      EntityVersion
    • getToVersion

      @ThingworxExtensionApiMethod(since={7,1}) public final EntityVersion getToVersion()


      Returns the version that the extension will be migrated to. Cannot be overridden by subclasses. The version returned is the same as the version of the extension that the migrator is packaged with.
      Returns:
      EntityVersion