Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi,
I always have a question, why the BaseTemplate cannot be replaced while the ThingShape can be removed or added freely ?
I can understand that , for certain kind of ThingTemplate, for example: DatabaseThing, it cannot be replaced ,otherwise the codes of SQL Query/Command are lost . But for the most of the things derived from GenericThing, why the platform doesn't allow to change the BaseTemplate ?
Regards,
Sean
Solved! Go to Solution.
Hi @seanccc
First of all, the Thing Shape is not required whereas the Base Template is. We intended Thing Templates to provide the foundation for the thing with all the needed libraries, etc. If those elements were to change, it could result in underlying issues to your application. Thing Shapes were meant to provide functionality that can be shared across any number of templates.
For example, if you were a manufacturer of refrigerators, you would have a base template for each refrigerator model. But some features would be optional, such as an icemaker. This functionality would be provided by the Thing Shape and applied to only those models with the icemaker installed. Therefore, removing the thing shape in that case if the icemaker were removed would make sense. But removing the base template could result in a number of design issues.
To help you in your design, we have a couple of videos that may be helpful:
Expert Session: Designing the Data Model in ThingWorx
Expert Session: Developing the Data Model in ThingWorx
Please let us know if you have further questions.
Regards.
--Sharon
HI @seanccc
Changing the base template would completely change the thing which could have other implications. If you're using your own base template, you could make the needed changes there, but it's best to delete the existing thing and create a new one to prevent the possibility of other issues.
Can you provide more detail around your use case? What is the scenario that exists requiring you to make this type of change.
Regards.
--Sharon
For example, I created a thing and set its BaseTemplate as RemoteThing firstly, later I realized that the thing need file transfer as well, so I want to change it to RemoteThingWithFileTransfer. Another example, I want to rename a ThingTemplate , it's used by 20 things. I have to delete and re-create the 20 things to apply the new ThingTemplate.
If changing the base template would completely change the thing which could have other implications, then the same is true for changing the thing shape, expecially for the customized ThingShapes developed by Java SDK , while it's allowed in the platform. The only difference I can see between ThingTemplate and ThingShape is that ThingTemplate is inheritable and ThingShape is not. Is the inheritance the root cause that make BaseTemplate not modifiable ?
Regards,
Sean
Hi @seanccc
First of all, the Thing Shape is not required whereas the Base Template is. We intended Thing Templates to provide the foundation for the thing with all the needed libraries, etc. If those elements were to change, it could result in underlying issues to your application. Thing Shapes were meant to provide functionality that can be shared across any number of templates.
For example, if you were a manufacturer of refrigerators, you would have a base template for each refrigerator model. But some features would be optional, such as an icemaker. This functionality would be provided by the Thing Shape and applied to only those models with the icemaker installed. Therefore, removing the thing shape in that case if the icemaker were removed would make sense. But removing the base template could result in a number of design issues.
To help you in your design, we have a couple of videos that may be helpful:
Expert Session: Designing the Data Model in ThingWorx
Expert Session: Developing the Data Model in ThingWorx
Please let us know if you have further questions.
Regards.
--Sharon
Hi @seanccc.
If you feel your question has been answered, please mark the appropriate response as the Accepted Solution for the benefit of others with the same question.
Regards.
--Sharon