Skip navigation links
Thingworx Platform API
8.5.0
com.thingworx.entities.utils

Class EntityUtilities

  • java.lang.Object
    • com.thingworx.entities.utils.EntityUtilities
    • Constructor Detail

      • EntityUtilities

        public EntityUtilities()
    • Method Detail

      • exists

        @ThingworxExtensionApiMethod(since={6,6})
        public static boolean exists(java.lang.String name,
                                                                               RelationshipTypes.ThingworxRelationshipTypes type)


        Tests to see if the specified entity of the given type exists.

        This method is subject to the permissions assigned to the current user's security context.

        Parameters:
        name - the name of the entity to detect
        type - the type of the entity
        Returns:
        true if the entity exists, false if it does not or if the current user does not have the necessary visibility privileges
      • findEntity

        @ThingworxExtensionApiMethod(since={6,6})
        public static RootEntity findEntity(java.lang.String name,
                                                                                      RelationshipTypes.ThingworxRelationshipTypes type)


        Find an entity of a particular type, and check visibility permissions. If the user in the current context does not have visibility permission to view the entity, this method will return null. For example, to find a Thing named "MyThing", do: findEntity("MyThing", ThingworxRelationshipTypes.Thing)
        Parameters:
        name - - String name of the entity
        type - - ThingworxRelationshipType of the entity
        Returns:
        RootEntity matching the type and name if found and visible, otherwise null
      • findEntityDirect

        @ThingworxExtensionApiMethod(since={6,6})
        public static RootEntity findEntityDirect(java.lang.String name,
                                                                                            RelationshipTypes.ThingworxRelationshipTypes type)


        Find an entity of a particular type, ignoring visibility permissions. This method bypasses the visibility check for the user in the current context, and will return the entity, if found, even if the user does not have visibility permission to view the entity. For example, to find a Thing named "MyThing", do: findEntityDirect("MyThing", ThingworxRelationshipTypes.Thing)
        Parameters:
        name - - String name of the entity
        type - - ThingworxRelationshipType of the entity
        Returns:
        RootEntity matching the type and name if found, otherwise null
      • operateOnEntities

        @ThingworxExtensionApiMethod(since={7,2})
        public void operateOnEntities(RelationshipTypes.ThingworxRelationshipTypes type,
                                                                                java.util.function.Predicate<RootEntity> filter,
                                                                                java.util.function.Consumer<RootEntity> operation)


        Perform an operation on the set of entities of a particular type after filtering the entities. Visibility will be added to the filter.
        Parameters:
        type - - the type of entity collection for the operation
        filter - - how to select the entities for the operation
        operation - - what to do to each entity after filtering
      • operateOnEntitiesDirect

        @ThingworxExtensionApiMethod(since={7,2})
        public void operateOnEntitiesDirect(RelationshipTypes.ThingworxRelationshipTypes type,
                                                                                      java.util.function.Predicate<RootEntity> filter,
                                                                                      java.util.function.Consumer<RootEntity> operation)


        Perform an operation on the set of entities of a particular type after filtering the entities. Visibility is not checked.
        Parameters:
        type - - the type of entity collection for the operation
        filter - - how to select the entities for the operation
        operation - - what to do to each entity after filtering