Package com.thingworx.migration
Class ExtensionMigratorBase
java.lang.Object
com.thingworx.migration.ExtensionMigratorBase
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
-
Method Summary
Modifier and TypeMethodDescriptionfinal EntityVersion
Returns the version that the extension is being migrated from.final EntityVersion
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 Details
-
ExtensionMigratorBase
-
-
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 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:
Exception
-
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
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
-