Class Entity
java.lang.Object
com.inductiveautomation.rm.base.RMListenerList
com.inductiveautomation.rm.base.RMObject
com.inductiveautomation.snap.data.Entity
- All Implemented Interfaces:
- Archivable,- RMJSONArchiver.GetKeys,- RMKey.Get,- RMPropertyChanger,- PropertyChangeListener,- Cloneable,- EventListener
public class Entity
extends RMObject
implements PropertyChangeListener, RMKey.Get, RMJSONArchiver.GetKeys, Archivable
This class represents an entity for a data source. It has a list of properties, some of which are simple
 attributes and some of which are relationships.
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddProperty(Property aProperty) Adds a given property.voidaddProperty(Property... theProperties) Adds given properties.voidaddProperty(Property aProperty, int anIndex) Adds a given property at given index.clone()Standard clone implementation.voiddelete()Saves this entity from its source.booleanStandard equals method.fromBytes(byte[] theBytes) Returns entity from bytes.fromXML(RXArchiver anArchiver, RXElement anElement) XML unarchival.getAttribute(int anIndex) Returns the attribute at the given index.getAttribute(String aName) Returns the attribute with the given name.intReturns the number of attributes.getAttributeSorted(int anIndex) Returns the attribute at the given index in a sorted attributes list.Returns the key/key-chain to the property(s) that returns best string description of an entity instance.Returns a guess of descriptor key (or the actual one, if set).Returns a named entity using entity resolver.Returns the class that this entity represents.booleanReturns whether entity exists in data source (has been saved and, if so, not deleted).Returns keys to archive JSON.getKeyPathProperty(String aKeyPath) Returns the property with the given name.getKeyValue(String aKey) RMKey.Get implementation to return Property for key.getName()Returns the name of the entity.Returns the list of primary attributes for this entity.Returns the primary key property.Returns the list of properties.getProperty(int anIndex) Returns the property at the given index.getProperty(String aName) Returns the property with the given name.intReturns the number of properties.getRelation(int anIndex) Returns the relation at the given index.getRelation(String aName) Returns the relation for the given key path.intReturns the number of relations in the entity.Returns the list of relations in the entity.getRelationSorted(int anIndex) Returns the relation at the given index in the sorted list of relations.Returns the schema that owns this entity.voidpropertyChange(PropertyChangeEvent anEvent) PropertyChangeListener implementation to forward property changes to entity property change listener.removeProperty(int anIndex) Removes a property at given index.intremoveProperty(Property aProperty) Removes the given property.voidsave()Saves the entity to its source.voidsetDescriptorKey(String aValue) Sets the key/key-chain to the property(s) that returns best string description of an entity instance.voidsetEntityClass(Class aClass) Sets the class that this entity represents.voidsetExists(boolean aFlag) Sets whether entity exists in data source (has been saved and, if so, not deleted).voidSets the name of the entity.voidsetProperties(List<Property> theProps) Sets a list of properties.voidSets the schema that owns this entity.byte[]toBytes()Returns bytes for this entity.toString()Returns a string representation of entity (its name).toXML(RXArchiver anArchiver) XML archival.Methods inherited from class com.inductiveautomation.rm.base.RMObjectaddPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListener, sendPropertyChangeMethods inherited from class com.inductiveautomation.rm.base.RMListenerListaddListener, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListener
- 
Field Details- 
Name_Prop- See Also:
 
- 
Exists_Prop- See Also:
 
 
- 
- 
Constructor Details- 
Entitypublic Entity()Creates an empty entity.
- 
EntityCreates an entity with the given name.
 
- 
- 
Method Details- 
getSchemaReturns the schema that owns this entity.
- 
setSchemaSets the schema that owns this entity.
- 
getEntityReturns a named entity using entity resolver.
- 
getNameReturns the name of the entity.
- 
setNameSets the name of the entity.
- 
getExistspublic boolean getExists()Returns whether entity exists in data source (has been saved and, if so, not deleted).
- 
setExistspublic void setExists(boolean aFlag) Sets whether entity exists in data source (has been saved and, if so, not deleted).
- 
getPropertyCountpublic int getPropertyCount()Returns the number of properties.
- 
getPropertyReturns the property at the given index.
- 
getPropertiesReturns the list of properties.
- 
setPropertiesSets a list of properties.
- 
addPropertyAdds a given property.
- 
addPropertyAdds a given property at given index.
- 
addPropertyAdds given properties.
- 
removePropertyRemoves a property at given index.
- 
removePropertyRemoves the given property.
- 
getPropertyReturns the property with the given name.
- 
getAttributeCountpublic int getAttributeCount()Returns the number of attributes.
- 
getAttributeReturns the attribute at the given index.
- 
getAttributeReturns the attribute with the given name.
- 
getRelationCountpublic int getRelationCount()Returns the number of relations in the entity.
- 
getRelationReturns the relation at the given index.
- 
getRelationsReturns the list of relations in the entity.
- 
getRelationReturns the relation for the given key path.
- 
getAttributeSortedReturns the attribute at the given index in a sorted attributes list.
- 
getRelationSortedReturns the relation at the given index in the sorted list of relations.
- 
getPrimaryReturns the primary key property.
- 
getPrimariesReturns the list of primary attributes for this entity.
- 
getEntityClassReturns the class that this entity represents.
- 
setEntityClassSets the class that this entity represents.
- 
getKeyPathPropertyReturns the property with the given name.
- 
getKeyValueRMKey.Get implementation to return Property for key.- Specified by:
- getKeyValuein interface- RMKey.Get
 
- 
getDescriptorKeyReturns the key/key-chain to the property(s) that returns best string description of an entity instance.
- 
setDescriptorKeySets the key/key-chain to the property(s) that returns best string description of an entity instance.
- 
getDescriptorKeyGuessReturns a guess of descriptor key (or the actual one, if set).
- 
propertyChangePropertyChangeListener implementation to forward property changes to entity property change listener.- Specified by:
- propertyChangein interface- PropertyChangeListener
 
- 
equalsStandard equals method.
- 
cloneStandard clone implementation.- Overrides:
- clonein class- RMListenerList
 
- 
toXMLXML archival.- Specified by:
- toXMLin interface- Archivable
 
- 
fromXMLXML unarchival.- Specified by:
- fromXMLin interface- Archivable
 
- 
toBytes@Nullable public byte[] toBytes()Returns bytes for this entity.
- 
fromBytesReturns entity from bytes.- Throws:
- RMJSONReader.RMJSONException
 
- 
saveSaves the entity to its source.- Throws:
- Exception
 
- 
deleteSaves this entity from its source.- Throws:
- Exception
 
- 
getJSONKeysReturns keys to archive JSON.- Specified by:
- getJSONKeysin interface- RMJSONArchiver.GetKeys
 
- 
toStringReturns a string representation of entity (its name).
 
-