Package com.thingworx.migration
Class ExtensionMigratorBase
- java.lang.Object
-
- com.thingworx.migration.ExtensionMigratorBase
-
@ThingworxExtensionApiClass(since={7,1}) public abstract class ExtensionMigratorBase extends java.lang.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 Summary
Constructors Constructor Description ExtensionMigratorBase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description EntityVersion
getFromVersion()
Returns the version that the extension is being migrated from.EntityVersion
getToVersion()
Returns the version that the extension will be migrated to.abstract void
migrate(ImportedEntityCollection imports)
Perform the migration of the extension.void
postMigrate(ImportedEntityCollection imports)
Post-migrate hook to allow subclasses to perform custom logic after themigrate()
has been performed.
-
-
-
Constructor Detail
-
ExtensionMigratorBase
@ThingworxExtensionApiMethod(since={7,1}) public ExtensionMigratorBase()
-
-
Method Detail
-
migrate
@ThingworxExtensionApiMethod(since={7,1}, canOverride=true) public abstract void migrate(ImportedEntityCollection imports) throws java.lang.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:
java.lang.Exception
-
postMigrate
@ThingworxExtensionApiMethod(since={7,1}, canOverride=true) public void postMigrate(ImportedEntityCollection imports) throws java.lang.Exception
Post-migrate hook to allow subclasses to perform custom logic after themigrate()
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:
java.lang.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
-
-