Managed tag provider, create custom properties of type: Number, Array. Java class to use?

Ignition 8.1.28
In a managed tag provider, I try to create some Custom properties to my exposed tags.

For Boolean, I can do for example:

BasicBoundPropertySet realtimeProperty = new BasicBoundPropertySet();
realtimeProperty.set(new PropertyValue(new BasicProperty("test",Boolean.class),true));
...

ManagedTagProvider ourProvider = this.mapProvider.get(providerName);
ourProvider.configureTag(tagPath,realtimeProperty);

Types in Ignition dropdown: are:

I'm looking for the Java type to use for each one:

  • Number => ???
  • String=> String.class
  • Boolean=> Boolean.class
  • Array=> ???
  • Document => com.inductiveautomation.ignition.common.document.Document.class
  • Dataset => com.inductiveautomation.ignition.common.BasicDataset.class

Moreover, I need to pass the value of those custom properties from a script function.

values for the customs properties will be pass from Ignition to a script function to my module with something like:

protected void configureTagImpl(PyArgumentMap args) {
    List<String> customNames = (List<String>) args.getArg("customNames", null);
    List<String> customTypes = (List<String>) args.getArg("customTypes", null);
    List<Object> customValues = (List<Object>) args.getArg("customValues", null);
...

For Boolean and String, no special conversion are needed but what is the best way to pass "Document" and "Array" from Ignition to the module script function ? in order to use it to feed the value of a tag custom propertie ?

https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.27/com/inductiveautomation/ignition/common/config/PropertyType.html

1 Like

Thanks a lot !

Numeric accept which Java Class ? Double, Integer ?

Double

1 Like

Array use com.inductiveautomation.ignition.common.document.DocumentArray ? or another type ?

Yes, com.inductiveautomation.ignition.common.document.DocumentArray and com.inductiveautomation.ignition.common.document.Document for Document.

1 Like

is there some utilities function to convert some PyDictionary
to com.inductiveautomation.ignition.common.document.Document ?

TypeUtilities.pyToGson will convert from a python object to a JsonObject, and you can create a Document or DocumentElement using various constructors/static methods on the Document classes, e.g:
com.inductiveautomation.ignition.common.document.DocumentElement#fromJson
com.inductiveautomation.ignition.common.document.Document#Document(com.inductiveautomation.ignition.common.gson.JsonObject)

1 Like