Getting notify/subscribing to ThingTemplate/ThingShape/Thing save at design time
I want to create a data table which will have ThingTemplateName and ThingTemplatePropertyName columns as Primary key with extra few columns like: Score, Scale, Rate etc.
I would like to provide extra aspects to each property in ThingTemplate since we are limited to built-in aspects/characteristics of a property (like: name, description, baseType, pushType etc).
I will have a mashup where an admin can add extra metadata information about properties and I need to syncronize this DataTable with changes to ThingTemplates's properties.
I will initially start creating a ThingTemplate with x number of properties. I will then press Save. I want a service to intercept that save action and call a service that will fill out DataTable with ThingTemplate name and a property name. So I will have x number of rows in DataTable like:
ThingTemplateName, ThingTemplatePropertyName, Score, Scale, Rate etc.
I want to subscribe to "first" and any subsequent save actions (Pressing Save after some changes are done like adding a new property, changing its type, removing a property etc) at design time so I can run a service that will syncronize ThingTemplate name and ThingTemplate property names with ThingTemplateName and ThingTemplatePropertyName columns of DataTable..
Later I want to combine the template's properties with these custom ones and provide this metadata for the agent to dynamically initialize itself.
Score, Scale, Rate will be used in agent VirtualThing side logic when updating Remote Properties.
Re: Getting notify/subscribing to ThingTemplate/ThingShape/Thing save at design time
As per my observation and understanding, any save changes on ThingTemplate or ThingShapes cannot be intercepted. They can be only done on "Things". Consider ThingShapes and and Templates similar to a 'class' in any OOP and Thing as an object to that class. So as objects have memory allocated to them and not classes and similarly constructors and destructors work on objects and not on classes although they can be defined in a class.
In Thingworx we have Thingstart event to intercept if a thing is created or saved or enabled/disabled.
So as soon as we create a thing with that particular template, programatically or manually, a thingstart event is fired for that thing, which can be considered as notification to save a thing.
Also I would like to understand why would you like to operate on 'Shapes' and 'Templates', where as only Things are the 'real' operable entities. And if you make any changes in the Templates or Shapes they are automatically reflected in the already existing Things using these Templates/Shapes, we just need to restart that thing.
Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum!