3 Replies Latest reply on Mar 8, 2016 11:27 AM by thearonh RSS
    orhand Explorer

    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

      • Re: ThingShapes and ThingTemplates in an Extension
        pchung Collaborator

        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

        • Re: ThingShapes and ThingTemplates in an Extension
          brue Apprentice

          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.

          • Re: ThingShapes and ThingTemplates in an Extension
            thearonh Apprentice

            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 {

            ...

            }