Package com.thingworx.entities.utils
Class ThingUtilities
java.lang.Object
com.thingworx.entities.utils.ThingUtilities
@ThingworxExtensionApiClass(since={6,6},
canInstantiate=true)
public final class ThingUtilities
extends Object
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Thingstatic Map<String, IPrimitiveType> getInitializedProperties(Thing thing) This API will retrieve the Thing's property values by parsing an XML or JSON structure stored in Thing.initialValues Object which is set by Thing.fromXML() and Thing.fromJSON() during an import.static voidoperateOnImplementingThings(EntityReference entityReference, Predicate<Thing> filter, Consumer<Thing> operation) Perform an operation on each Thing implementing a ThingShape or ThingTemplate after filteringstatic voidsetInitializedProperties(Thing thing, Map<String, IPrimitiveType> properties) This API will set the Thing's property values by translating the provided map to an XML structure and store into Thing.initialValues Object.
-
Constructor Details
-
ThingUtilities
public ThingUtilities()Initializes this instace with default values.
-
-
Method Details
-
findThing
-
getInitializedProperties
@ThingworxExtensionApiMethod(since={7,2,0}) public static Map<String,IPrimitiveType> getInitializedProperties(Thing thing) throws Exception This API will retrieve the Thing's property values by parsing an XML or JSON structure stored in Thing.initialValues Object which is set by Thing.fromXML() and Thing.fromJSON() during an import. This API is designed to be used during the import and extension entity migration process only. Outside of that process, use the standard getProperty*() APIs on the Thing entities themselves (see the IPropertyProvider interface) to get property information.- Parameters:
thing- - The Thing to pull the property values from- Returns:
- A map of property names and their IPrimitiveType values
- Throws:
Exception
-
setInitializedProperties
@ThingworxExtensionApiMethod(since={7,2,0}) public static void setInitializedProperties(Thing thing, Map<String, IPrimitiveType> properties) throws ExceptionThis API will set the Thing's property values by translating the provided map to an XML structure and store into Thing.initialValues Object. This API is designed to be used during the import and extension entity migration process only. Outside of that process, use the standard setProperty*() APIs on the Thing entities themselves (see the IPropertyProvider interface) to get property information.- Parameters:
thing- - The Thing to pull the property values fromproperties- - A map of property names and their IPrimitiveType values- Throws:
Exception
-
operateOnImplementingThings
@ThingworxExtensionApiMethod(since={7,2}) public static void operateOnImplementingThings(EntityReference entityReference, Predicate<Thing> filter, Consumer<Thing> operation) Perform an operation on each Thing implementing a ThingShape or ThingTemplate after filtering- Parameters:
entityReference- - The ThingShape or ThingTemplate implemented by the Thingsfilter- - how to select the Things for the operationoperation- - what to do to the Things after filtering
-