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 java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ThingUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Thing
findThing(java.lang.String thingName)
static java.util.Map<java.lang.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 void
operateOnImplementingThings(EntityReference entityReference, java.util.function.Predicate<Thing> filter, java.util.function.Consumer<Thing> operation)
Perform an operation on each Thing implementing a ThingShape or ThingTemplate after filteringstatic void
setInitializedProperties(Thing thing, java.util.Map<java.lang.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.
-
-
-
Method Detail
-
findThing
@ThingworxExtensionApiMethod(since={6,6}) public static Thing findThing(java.lang.String thingName)
-
getInitializedProperties
@ThingworxExtensionApiMethod(since={7,2,0}) public static java.util.Map<java.lang.String,IPrimitiveType> getInitializedProperties(Thing thing) throws java.lang.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:
java.lang.Exception
-
setInitializedProperties
@ThingworxExtensionApiMethod(since={7,2,0}) public static void setInitializedProperties(Thing thing, java.util.Map<java.lang.String,IPrimitiveType> properties) throws java.lang.Exception
This 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:
java.lang.Exception
-
operateOnImplementingThings
@ThingworxExtensionApiMethod(since={7,2}) public static void operateOnImplementingThings(EntityReference entityReference, java.util.function.Predicate<Thing> filter, java.util.function.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
-
-