Package com.thingworx.entities
Class EntityReference
- java.lang.Object
-
- com.thingworx.entities.EntityReference
-
- All Implemented Interfaces:
java.lang.Comparable<EntityReference>
- Direct Known Subclasses:
SecurityContext
@ThingworxExtensionApiClass(since={6,6}, canInstantiate=true) public class EntityReference extends java.lang.Object implements java.lang.Comparable<EntityReference>
A class meant to be a slimmed down way of passing around a reference to an Entity. It contains the minimal amount of information needed to look up the Entity if inflation is necessary. This class should be used when passing around the fully inflated Entity Instance is not necessary.
-
-
Constructor Summary
Constructors Constructor Description EntityReference()
EntityReference(RootEntity entity)
EntityReference(java.lang.String name, short code)
EntityReference(java.lang.String name, RelationshipTypes.ThingworxRelationshipTypes type)
EntityReference(java.lang.String name, java.lang.String type)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(EntityReference that)
static EntityReference
findByName(java.lang.String name, RelationshipTypes.ThingworxRelationshipTypes type)
java.lang.String
getDescription()
java.lang.String
getEntityName()
java.lang.String
getName()
RootEntity
getReference()
Returns the entity object referenced by the name and type.java.lang.String
getSubEntityName()
RelationshipTypes.ThingworxRelationshipTypes
getType()
boolean
matches(EntityReference entityReference)
java.lang.String
toString()
-
-
-
Constructor Detail
-
EntityReference
@ThingworxExtensionApiMethod(since={6,6}) public EntityReference()
-
EntityReference
@ThingworxExtensionApiMethod(since={6,6}) public EntityReference(RootEntity entity)
-
EntityReference
@ThingworxExtensionApiMethod(since={6,6}) public EntityReference(java.lang.String name, RelationshipTypes.ThingworxRelationshipTypes type)
-
EntityReference
@ThingworxExtensionApiMethod(since={6,6}) public EntityReference(java.lang.String name, short code)
-
EntityReference
@ThingworxExtensionApiMethod(since={6,6}) public EntityReference(java.lang.String name, java.lang.String type)
-
-
Method Detail
-
getType
@ThingworxExtensionApiMethod(since={6,6}) public RelationshipTypes.ThingworxRelationshipTypes getType()
-
getName
@ThingworxExtensionApiMethod(since={6,6}) public java.lang.String getName()
-
getReference
@ThingworxExtensionApiMethod(since={6,6}) public RootEntity getReference()
Returns the entity object referenced by the name and type. Visibility permissions to the entity will be checked.- Returns:
- the referenced RootEntity or null if the entity does not exist or the current user does not have visibility to that entity.
-
getEntityName
@ThingworxExtensionApiMethod(since={6,6}) public java.lang.String getEntityName()
-
getSubEntityName
@ThingworxExtensionApiMethod(since={6,6}) public java.lang.String getSubEntityName()
Get the sub entity from the full name set in thisEntityReference
. Organizations names are typically found to have the organizational unit appended on the end.- Returns:
- the sub entity name, or null if one was not found
-
getDescription
@ThingworxExtensionApiMethod(since={6,6}) public java.lang.String getDescription()
-
findByName
@ThingworxExtensionApiMethod(since={6,6}) public static EntityReference findByName(java.lang.String name, RelationshipTypes.ThingworxRelationshipTypes type) throws java.lang.Exception
- Throws:
java.lang.Exception
- If an error occurs
-
matches
@ThingworxExtensionApiMethod(since={6,6}) public boolean matches(EntityReference entityReference)
-
toString
@ThingworxExtensionApiMethod(since={6,6}) public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
compareTo
@ThingworxExtensionApiMethod(since={7,4}) public int compareTo(EntityReference that)
- Specified by:
compareTo
in interfacejava.lang.Comparable<EntityReference>
-
-