Use an infotable passed as parameter in a java extension
I'm facing some problems when trying to use an infoTable in my extension.
The service is a utility service that is static:
public static void myService(Context cx, Scriptable me, Object[] args, Function func) throws Exception {
InfoTable iTable= (InfoTable) args[0];
...
in the metaData:
<FunctionDefinition description=""
name="myService
<ParameterDefinitions>
<FieldDefinition baseType="INFOTABLE"
aspect.dataShape="keysShape"
aspect.isEntityDataShape="true"
description="the key names" name="keys" ordinal="0" />
</ParameterDefinitions>
<ResultType baseType="NOTHING" name="result"
ordinal="0" />
</FunctionDefinition>
The call from the javascript;
let keys= Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({
infoTableName: "InfoTable",
dataShapeName: "keysShape"
});
keys.AddRow({key:"a string"});
myService(keys);
The problem if at this line:
InfoTable iTable= (InfoTable) args[0];
I get this exception:
Error executing service PrivateInitializeFastQueryCache. Message :: class com.thingworx.dsl.engine.adapters.ThingworxInfoTableAdapter cannot be cast to class com.thingworx.types.InfoTable (com.thingworx.dsl.engine.adapters.ThingworxInfoTableAdapter and com.thingworx.types.InfoTable are in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @4e4efc1b) - See Script Error Log for more details.
Any Idea?

