@ThingworxExtensionApiClass(since={6,6}, canInstantiate=true) public final class EntityUtilities extends java.lang.Object
Constructor and Description |
---|
EntityUtilities() |
Modifier and Type | Method and Description |
---|---|
static boolean |
exists(java.lang.String name,
RelationshipTypes.ThingworxRelationshipTypes type)
|
static RootEntity |
findEntity(java.lang.String name,
RelationshipTypes.ThingworxRelationshipTypes type)
Find an entity of a particular type, and check visibility permissions. |
static RootEntity |
findEntityDirect(java.lang.String name,
RelationshipTypes.ThingworxRelationshipTypes type)
Find an entity of a particular type, ignoring visibility permissions. |
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. |
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. |
static void |
validateEntityName(java.lang.String name) |
@ThingworxExtensionApiMethod(since={6,6}) public static void validateEntityName(java.lang.String name) throws InvalidRequestException
InvalidRequestException
- If an error occurs@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.
name
- the name of the entity to detecttype
- the type of the entitytrue
if the entity exists, false
if it does not or if the current user does not have the necessary visibility
privileges@ThingworxExtensionApiMethod(since={6,6}) public static RootEntity findEntity(java.lang.String name, RelationshipTypes.ThingworxRelationshipTypes type)
name
- - String name of the entitytype
- - ThingworxRelationshipType of the entity@ThingworxExtensionApiMethod(since={6,6}) public static RootEntity findEntityDirect(java.lang.String name, RelationshipTypes.ThingworxRelationshipTypes type)
name
- - String name of the entitytype
- - ThingworxRelationshipType of the entity@ThingworxExtensionApiMethod(since={7,2}) public void operateOnEntities(RelationshipTypes.ThingworxRelationshipTypes type, java.util.function.Predicate<RootEntity> filter, java.util.function.Consumer<RootEntity> operation)
type
- - the type of entity collection for the operationfilter
- - how to select the entities for the operationoperation
- - what to do to each entity after filtering@ThingworxExtensionApiMethod(since={7,2}) public void operateOnEntitiesDirect(RelationshipTypes.ThingworxRelationshipTypes type, java.util.function.Predicate<RootEntity> filter, java.util.function.Consumer<RootEntity> operation)
type
- - the type of entity collection for the operationfilter
- - how to select the entities for the operationoperation
- - what to do to each entity after filtering