Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hi,
I would like to define a thingshape and a thingtemplate in an extension.
I could not figure out how to add / define that shape as an "implemented shape" within the thing template.
Anybody can help me with that ?
Orhan
If you are doing this in the metadata.xml file, I usually just export what I want to create to xml and then take that and add it to the metadata.xml
Hopefully you are using our new Extension Plugin for Eclipse, but even then...we actually have a bug where we forgot to add the ImplementedShapes xml node and UI elements on ThingTemplates in the plugin. So for now, you do need to manually add them to your metadata.xml like Pai Chung mentioned.
Just a note, that we highly discourage handling the metadata.xml directly, hence the creation of the plugin to help maintain and develop extensions easier and faster.
Assuming that you want to do this in Java, there are annotations that you can add to your classes.
In order to define a base ThingTemplate, you can add the @ThingworxBaseTemplateDefinition annotation.
In order to add Implemented ThingShapes, you can add the @ThingworxImplementedShapeDefinitions and @ThingworxImplementedShapeDefinition annotations.
Example:
@ThingworxBaseTemplateDefinition(name="RemoteThing")
@ThingworxImplementedShapeDefinitions(shapes = {
@ThingworxImplementedShapeDefinition(name = "ExampleShape1"),
@ThingworxImplementedShapeDefinition(name = "ExampleShape2")
})
public class ExampleThingTemplate extends Thing {
...
}