Class ThingUtilities

  • java.lang.Object
    • com.thingworx.entities.utils.ThingUtilities
    • 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 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ThingUtilities

        public ThingUtilities()
    • Method Detail

      • 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 from
        properties - - 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 Things
        filter - - how to select the Things for the operation
        operation - - what to do to the Things after filtering