Class ExtensionPointRecordMigrationStrategy
java.lang.Object
com.inductiveautomation.ignition.gateway.config.migration.ExtensionPointRecordMigrationStrategy
- All Implemented Interfaces:
IdbMigrationStrategy
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Builder forExtensionPointRecordMigrationStrategy
static interface
Nested classes/interfaces inherited from interface com.inductiveautomation.ignition.gateway.config.migration.IdbMigrationStrategy
IdbMigrationStrategy.MigrationResult
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final SFieldString
The field that represents the profile description, on the profile record.protected final SFieldBoolean
The field that represents the enabled state of the profile record.protected final org.slf4j.Logger
protected final SFieldString
The 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 RecordEncodingDelegate
protected final ResourceType
The resource type for the extension point to be migrated toprotected final RecordEncodingDelegate
Fields 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 void
encodeResource
(RecordEncodingContext profileRecordContext, RecordEncodingContext settingsRecordContext, ResourceBuilder builder) protected String
By default, resources will be added toConfigurationManager.CORE
, override this as necessary to change the default behavior.protected String
getName
(PersistentRecord persistentRecord) List<SRecordMeta<? extends SRecordInstance>>
protected boolean
isEnabled
(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.Builder
for anExtensionPointRecordMigrationStrategy
toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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:IdbMigrationStrategy
Migrate records from the internal database to the configuration resource collection. To do this, use the given session to issue anSQuery
to find the records you want to migrate. Then compile a list ofChangeOperation
that will be applied to the config resource collection to add the appropriate resources.- Specified by:
migrate
in interfaceIdbMigrationStrategy
- Parameters:
context
- aMigrationContext
which provides methods for accessing aPersistenceSession
to query the internal DB as well as aConfigurationManager
for 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:
getRecordMetas
in 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 yourGatewayModuleHook
setup() method.
-
newBuilder
Create a newExtensionPointRecordMigrationStrategy.Builder
for anExtensionPointRecordMigrationStrategy
- Parameters:
typeId
- The type identifier for the specific extension point type
-
toString
-