@ThingworxExtensionApiClass(since={6,6}, canInstantiate=true) public final class ThingUtilities extends java.lang.Object
Constructor and Description |
---|
ThingUtilities() |
Modifier and Type | Method and 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 filtering |
static 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. |
@ThingworxExtensionApiMethod(since={6,6}) public static Thing findThing(java.lang.String thingName)
@ThingworxExtensionApiMethod(since={7,2,0}) public static java.util.Map<java.lang.String,IPrimitiveType> getInitializedProperties(Thing thing) throws java.lang.Exception
thing
- - The Thing to pull the property values fromjava.lang.Exception
@ThingworxExtensionApiMethod(since={7,2,0}) public static void setInitializedProperties(Thing thing, java.util.Map<java.lang.String,IPrimitiveType> properties) throws java.lang.Exception
thing
- - The Thing to pull the property values fromproperties
- - A map of property names and their IPrimitiveType valuesjava.lang.Exception
@ThingworxExtensionApiMethod(since={7,2}) public static void operateOnImplementingThings(EntityReference entityReference, java.util.function.Predicate<Thing> filter, java.util.function.Consumer<Thing> operation)
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