Eclipse Extension - Base Type Conversion
Hi All,
How can i convert string to thing name or thing template name to access entity services within eclipse?
How can i define a thing template name as like Base Types?
Thanks.
Hi All,
How can i convert string to thing name or thing template name to access entity services within eclipse?
How can i define a thing template name as like Base Types?
Thanks.
Hi,
I posted above a general rule, so you can apply it to any use case.
Answering directly, you can do the following (please keep in mind, that I implemented this code on Extension SDK 8.0.0, on other SDK version it can be slightly different):
ThingTemplate genericTemplate = (ThingTemplate) EntityUtilities.findEntity(entityName, ThingworxRelationshipTypes.ThingTemplate);
InfoTable implementingThings = genericTemplate.GetImplementingThings();
implementingThings.getRows().stream().forEach(row -> {
Thing t = ThingUtilities.findThing(row.getStringValue("name"));
_logger.warn("Thing based on GenericThing: " + t.getName());
});
Please also be aware, that the above code is just a snippet, example.
If you consider my answer correct, please mark it as such, so other can refer.
BR,
Jakub.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.