Thing Shapes
Thing Shapes provide a set of characteristics represented as properties, services, events, and subscriptions that are shared across a group of physical assets. A Thing Shape is best used for composition to describe relationships between objects in your model. Thing Shapes promote reuse of contained properties and business logic that can be inherited by one or more Thing Templates. In ThingWorx, the model allows a Thing Template to implement one or more Thing Shapes, similar to a class definition in C++ that has multiple inheritance. You can override business logic in the inherited services from the Thing Shape if you explicitly define the service to allow override in the parent object definition.
When you make a change to the Thing Shape, the change is propagated to the Thing Templates and Things that implement that Thing Shape, simplifying the model maintenance.
A use case for a Thing Shape is if you have multiple product lines using the same ERP system. Consider a company that has two business units: one makes residential lawn tractors, and the other makes commercial agricultural equipment. The lawn tractors and agricultural equipment do not have common data or behaviors. However, they are both ERP assets that can be tracked. Both have information on the customer and on the service ticket system in the same CRM system. To implement these interfaces as a physical asset only once, you can insert business logic in a Thing Shape. For example, you can implement a way to get relevant data from an ERP system into an ERP Connector Thing, represented as a Thing Shape. The ERP Connector Thing can have configuration data that knows how to reach the ERP system (for example, an IP address), how to authenticate against it (for example, using a technical user), and how to handle request responses. You should implement the request response functionality using services in the ERP Connector Thing. Then you can define specific functions to get request data from a Thing Shape for the application. The Thing Shape should have basic data represented as properties (such as Location and ERP Asset ID), services that get asset specific data (such as Get My Open Work Orders, Get My Work Order History, and Get My Customer Entitlements). Then, Thing Templates for both lawn tractors and agricultural equipment can inherit capabilities from the Thing Shape and have access to ERP data through the encapsulated business logic in the Thing Shape.
Creating Thing Shapes with an Extension
Thing Shapes created with an extension are similar to those created in ThingWorx Composer. They are base templates that are used to create Things with the same properties, configuration parameters, services, and so forth. The difference between creating them in Composer and inside an extension framework is the language used for the services and visibility of those services.
Composer Template:
Uses JavaScript for services
Source code is visible
Extension SDK Template:
Uses Java for services
Source code is not visible
Was this helpful?