Does anyone know how to go about tying in a custom tag import function for a ManagedTagProvider?
The plan is to make an RPC client function get a json file and root folder from the user and then pass it to the gateway which then interprets the json and creates tags with ManagedTagProvider configure(). This functionality would ideally work for both the tag browser Import Tags
dropdown option in the Designer and also for the system.tag.importTags function. How do I go about making this happen?
This looks like what I want, but I’m not sure how to use it:
ImportTagAction SDK Docs
The ManagedTagProvider does not seem to have an import function to override.
ManagedTagProvider SDK Docs
Thanks
ManagedTag are created in the gateway scope with the ManagedTagProvider class.
Create a New provider and then configure new tags and then update the value and listen for writes if the tags have to be writable.
Your module has to create the managed tags
I do already have the module making tags and writing to them, etc. They are special tags that have different functionality that the module gives them. But I would like for the user to be able to create tags also via tag import. Is this not possible?
in that case, your module has to provide a script function which receive a file.
You’ll have to parse the file and create tag.
Other tags created in the desigenr are not managed tag.
Alright, that seems reasonable. Is it possible for that script function to be called by right clikcing on the tag provider in the designer and clicking Import Tags
like this?
It doesn’t look like there’s any very exposed way to implement your own import code when using ManagedTagProvider
- which would be the only way to really tie it into the UI/scripting functions.
You would need to override importTagsAsync
on the TagProvider
interface, but ManagedTagProvider
(by design) doesn’t actually extend or relate to that base interface. Instead, ManagedTagProviderImpl
creates a package-private ManagedProviderRuntime internalProv
, and that’s what actually implements importTagsAsync
. If you want tight integration with the UI, you’d either have to create your own internalProv
instance (it looks like you could do so by overriding setup()
without calling the super method, but be careful) or implement the whole TagProvider
interface yourself and ditch the ManagedTagProvider
abstraction.
3 Likes