I'm trying to make a config on the gateway to have a tickbox to have a boolean config field per tag provider in a gateway. Essentially I'm trying to create a table with a one-to-one relationship to tag providers and an additional column for configuration.
Following this post, right now the PersistentRecord looks like:
public class TagProvidersConfigRecord extends PersistentRecord {
...
// Reference to tag provider
public static final LongField TagProviderId = new LongField(META, "TagProviderId", SFieldFlags.SPRIMARY_KEY);
public static final ReferenceField<TagProviderSettingsRecord> TagProvider = new ReferenceField<>(META,
TagProviderSettingsRecord.META, "Tag Provider", TagProviderId);
...
}
I think that's all fine, but I can't seem to find any APIs for getting an Id to reference the tag provider.
The closest thing I've found in the javadocs is the PROVIDER_ID property on TagProviderSettingsRecord (inductiveautomation.com) (hence the type in ReferenceField above). This seems like what I need but I can't find a way to get this from the gateway context? I can get the list of tag providers in the gateway setup with List<TagProvider> tagProviders = gatewayContext.getTagManager().getTagProviders();
but I can't find a way to get to the record from there.
If there's a better way to do this, please let me know as well.
Thank you in advance.