Class ExtensionPointRecordMigrationStrategy
java.lang.Object
com.inductiveautomation.ignition.gateway.config.migration.ExtensionPointRecordMigrationStrategy
- All Implemented Interfaces:
IdbMigrationStrategy
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder forExtensionPointRecordMigrationStrategystatic interfaceNested classes/interfaces inherited from interface com.inductiveautomation.ignition.gateway.config.migration.IdbMigrationStrategy
IdbMigrationStrategy.MigrationResult -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final SFieldStringThe field that represents the profile description, on the profile record.protected final SFieldBooleanThe field that represents the enabled state of the profile record.protected final org.slf4j.Loggerprotected final SFieldStringThe field that represents the profile name, on the profile record.protected final RecordMeta<? extends PersistentRecord>The record meta for the profile record - the "parent" settings record for the extension pointprotected final RecordEncodingDelegateprotected final ResourceTypeThe resource type for the extension point to be migrated toprotected final RecordEncodingDelegateFields inherited from interface com.inductiveautomation.ignition.gateway.config.migration.IdbMigrationStrategy
MIGRATION_ACTOR -
Constructor Summary
ConstructorsConstructorDescriptionExtensionPointRecordMigrationStrategy(String typeId, RecordMeta<? extends PersistentRecord> profileMeta, RecordMeta<? extends PersistentRecord> settingsMeta, SFieldString nameField, SFieldString descriptionField, SFieldBoolean enabledField, SFieldBoolean migratedField, SFieldString typeField, SFieldReference<?> settingsRecordForeignKey, ResourceType resourceType, RecordEncodingDelegate profileRecordEncoder, RecordEncodingDelegate settingsRecordEncoder, Predicate<PersistentRecord> profilePredicate, ExtensionPointRecordMigrationStrategy.ResourceMigrationAugmenter resourceMigrationAugmenter) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidencodeResource(RecordEncodingContext profileRecordContext, RecordEncodingContext settingsRecordContext, ResourceBuilder builder) protected StringBy default, resources will be added toConfigurationManager.CORE, override this as necessary to change the default behavior.protected StringgetName(PersistentRecord persistentRecord) List<SRecordMeta<? extends SRecordInstance>>@NotNull StringA human-readable name for this migration strategy to use in the migration log.protected booleanisEnabled(PersistentRecord persistentRecord) migrate(MigrationContext context) Migrate records from the internal database to the configuration resource collection.protected Optional<ChangeOperation>migrate(MigrationContext context, PersistentRecord profileRecord, PersistentRecord settingsRecord) newBuilder(String typeId) Create a newExtensionPointRecordMigrationStrategy.Builderfor anExtensionPointRecordMigrationStrategyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.inductiveautomation.ignition.gateway.config.migration.IdbMigrationStrategy
getTableNames
-
Field Details
-
log
protected final org.slf4j.Logger log -
profileMeta
The record meta for the profile record - the "parent" settings record for the extension point -
resourceType
The resource type for the extension point to be migrated to -
nameField
The field that represents the profile name, on the profile record. -
descriptionField
The field that represents the profile description, on the profile record. Will be used for the resource's documentation field. -
enabledField
The field that represents the enabled state of the profile record. -
profileRecordEncoder
-
settingsRecordEncoder
-
-
Constructor Details
-
ExtensionPointRecordMigrationStrategy
public ExtensionPointRecordMigrationStrategy(String typeId, RecordMeta<? extends PersistentRecord> profileMeta, @Nullable RecordMeta<? extends PersistentRecord> settingsMeta, SFieldString nameField, @Nullable SFieldString descriptionField, @Nullable SFieldBoolean enabledField, SFieldBoolean migratedField, SFieldString typeField, @Nullable SFieldReference<?> settingsRecordForeignKey, ResourceType resourceType, RecordEncodingDelegate profileRecordEncoder, @Nullable RecordEncodingDelegate settingsRecordEncoder, Predicate<PersistentRecord> profilePredicate, @Nullable ExtensionPointRecordMigrationStrategy.ResourceMigrationAugmenter resourceMigrationAugmenter)
-
-
Method Details
-
migrate
public IdbMigrationStrategy.MigrationResult migrate(MigrationContext context) throws MigrationException Description copied from interface:IdbMigrationStrategyMigrate records from the internal database to the configuration resource collection. To do this, use the given session to issue anSQueryto find the records you want to migrate. Then compile a list ofChangeOperationthat will be applied to the config resource collection to add the appropriate resources.- Specified by:
migratein interfaceIdbMigrationStrategy- Parameters:
context- aMigrationContextwhich provides methods for accessing aPersistenceSessionto query the internal DB as well as aConfigurationManagerfor accessing the new config resource APIs- Returns:
- A list of change operations that will be applied to the config resource collection.
- Throws:
MigrationException- If an error occurs during migration.
-
migrate
protected Optional<ChangeOperation> migrate(MigrationContext context, PersistentRecord profileRecord, @Nullable PersistentRecord settingsRecord) -
encodeResource
protected void encodeResource(RecordEncodingContext profileRecordContext, @Nullable RecordEncodingContext settingsRecordContext, ResourceBuilder builder) -
getName
-
isEnabled
-
getCollectionName
By default, resources will be added toConfigurationManager.CORE, override this as necessary to change the default behavior. -
getRecordMetas
- Specified by:
getRecordMetasin interfaceIdbMigrationStrategy- Returns:
- The record metas that this strategy migrates, if any. If this strategy does not migrate records, return
an empty list. Also note that any record metas returned here will automatically be applied to the
SchemaUpdater.updatePersistentRecords(Iterable), so you do not need to do this again in yourGatewayModuleHooksetup() method.
-
newBuilder
Create a newExtensionPointRecordMigrationStrategy.Builderfor anExtensionPointRecordMigrationStrategy- Parameters:
typeId- The type identifier for the specific extension point type
-
getStrategyName
Description copied from interface:IdbMigrationStrategyA human-readable name for this migration strategy to use in the migration log.- Specified by:
getStrategyNamein interfaceIdbMigrationStrategy
-