Deleting tags created by ManagedTagProvider

Is it possible to delete tags created by a ManagedTagProvider from within Designer? The tags I have created do not have the option to delete.

No, it’s not.

Is there a recommended way to allow for a module to do cleanup on it’s stale/renamed tags? Or to remove tags outside of the module?

I believe your module can call ManagedTagProvider#removeTag, it’s just not available in the designer.

The idea behind ManagedTagProvider is that these are tags provided by some module or other external system and not the user, which is why you can’t delete them in the designer.

In this case tags may be removed from the external system but the user will want the tag value kept in the system until they are ready to delete it. Could I add an extra boolean parameter to the tag that flags it for deletion so that a user can flag it within designer?

Hmm, try ProviderConfiguration#setAllowTagDeletion.

I’m not super familiar with this system, I may have been wrong about deletions.

Is there an updated api for the 8.0.0 release? I do not see that method in the beta api docs.

http://files.inductiveautomation.com/sdk/javadoc/ignition80/8.0.0-beta/com/inductiveautomation/ignition/gateway/tags/managed/ProviderConfiguration.html#ProviderConfiguration-java.lang.String-

I tried

    config = new ProviderConfiguration(providerName);
    config.setAllowTagDeletion(true);

however my delete option is still grayed out even when i create a new provider.

I found

com.inductiveautomation.ignition.gateway.tags.managed.ManagedTagProvider.setDeletionHandler(DeletionHandler handler)

Which based the on description sounds like what I need but I can not find any docs on DeletionHandler usage.

A DeletionHandler should be optional, based on the code - if it’s not present, it defaults to allowed. If you want to provide one, you just implement the DeletionHandler interface and return a DeletionHandler.DeletionResponse based on each TagPath you are given.

It looks like that should be all you need. How are you applying the config object you created to your ManageedTagProvider?

Without

    provider.setDeletionHandler(new DeletionHandler() {
        public DeletionResponse process(TagPath t) {
            return DeletionResponse.Allowed;
        }
    });

It could not delete anything.

With the deletionHandler, designer is now is allowing deletes.

The setDeletionHandler has this description

Registers a tag deletion handler, which enables user deletion of tags. If null (or never called), users will not be able to delete tags

Which leads me to believe that the default is to not allow deletes.

I still am not finding any of this in the publicly available documentation and I am just piecing it together using my ide tools. Is there a place where DeletionHandler is documented?

Some older javadocs are available here

That DeletionHandler class is actually fairly recent (February), and is not included in those docs.

I think we are publishing Javadoc jars along with the SDK jars for each release though, so your IDE should be able to get the docs automatically.

provider.setDeletionHandler(tagPath -> DeletionHandler.DeletionResponse.Allowed);