cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

ThingShapes and ThingTemplates in an Extension

Newbie

ThingShapes and ThingTemplates in an Extension

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

3 REPLIES 3
Highlighted

Re: ThingShapes and ThingTemplates in an Extension

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

Highlighted

Re: ThingShapes and ThingTemplates in an Extension

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.

Highlighted

Re: ThingShapes and ThingTemplates in an Extension

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 {

...

}

Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum! ______________________________