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,- java.beans.PropertyChangeListener,- java.lang.Cloneable,- java.util.EventListener
 
 public class Entity extends RMObject implements java.beans.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 Modifier and Type Field Description static java.lang.StringExists_Propstatic java.lang.StringName_Prop
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddProperty(Property aProperty)Adds a given property.voidaddProperty(Property... theProperties)Adds given properties.voidaddProperty(Property aProperty, int anIndex)Adds a given property at given index.Entityclone()Standard clone implementation.voiddelete()Saves this entity from its source.booleanequals(java.lang.Object anObj)Standard equals method.EntityfromBytes(byte[] theBytes)Returns entity from bytes.EntityfromXML(RXArchiver anArchiver, RXElement anElement)XML unarchival.PropertygetAttribute(int anIndex)Returns the attribute at the given index.PropertygetAttribute(java.lang.String aName)Returns the attribute with the given name.intgetAttributeCount()Returns the number of attributes.PropertygetAttributeSorted(int anIndex)Returns the attribute at the given index in a sorted attributes list.java.lang.StringgetDescriptorKey()Returns the key/key-chain to the property(s) that returns best string description of an entity instance.java.lang.StringgetDescriptorKeyGuess()Returns a guess of descriptor key (or the actual one, if set).EntitygetEntity(java.lang.String aName)Returns a named entity using entity resolver.java.lang.ClassgetEntityClass()Returns the class that this entity represents.booleangetExists()Returns whether entity exists in data source (has been saved and, if so, not deleted).java.util.List<java.lang.String>getJSONKeys()Returns keys to archive JSON.PropertygetKeyPathProperty(java.lang.String aKeyPath)Returns the property with the given name.java.lang.ObjectgetKeyValue(java.lang.String aKey)RMKey.Get implementation to return Property for key.java.lang.StringgetName()Returns the name of the entity.java.util.List<Property>getPrimaries()Returns the list of primary attributes for this entity.PropertygetPrimary()Returns the primary key property.java.util.List<Property>getProperties()Returns the list of properties.PropertygetProperty(int anIndex)Returns the property at the given index.PropertygetProperty(java.lang.String aName)Returns the property with the given name.intgetPropertyCount()Returns the number of properties.PropertygetRelation(int anIndex)Returns the relation at the given index.PropertygetRelation(java.lang.String aName)Returns the relation for the given key path.intgetRelationCount()Returns the number of relations in the entity.java.util.List<Property>getRelations()Returns the list of relations in the entity.PropertygetRelationSorted(int anIndex)Returns the relation at the given index in the sorted list of relations.SchemagetSchema()Returns the schema that owns this entity.voidpropertyChange(java.beans.PropertyChangeEvent anEvent)PropertyChangeListener implementation to forward property changes to entity property change listener.java.lang.ObjectremoveProperty(int anIndex)Removes a property at given index.intremoveProperty(Property aProperty)Removes the given property.voidsave()Saves the entity to its source.voidsetDescriptorKey(java.lang.String aValue)Sets the key/key-chain to the property(s) that returns best string description of an entity instance.voidsetEntityClass(java.lang.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).voidsetName(java.lang.String aName)Sets the name of the entity.voidsetProperties(java.util.List<Property> theProps)Sets a list of properties.voidsetSchema(Schema aSchema)Sets the schema that owns this entity.byte[]toBytes()Returns bytes for this entity.java.lang.StringtoString()Returns a string representation of entity (its name).RXElementtoXML(RXArchiver anArchiver)XML archival.- 
Methods inherited from class com.inductiveautomation.rm.base.RMObjectaddPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListener, sendPropertyChange
 - 
Methods inherited from class com.inductiveautomation.rm.base.RMListenerListaddListener, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListener
 
- 
 
- 
- 
- 
Field Detail- 
Name_Proppublic static final java.lang.String Name_Prop - See Also:
- Constant Field Values
 
 - 
Exists_Proppublic static final java.lang.String Exists_Prop - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getSchemapublic Schema getSchema() Returns the schema that owns this entity.
 - 
setSchemapublic void setSchema(Schema aSchema) Sets the schema that owns this entity.
 - 
getEntitypublic Entity getEntity(java.lang.String aName) Returns a named entity using entity resolver.
 - 
getNamepublic java.lang.String getName() Returns the name of the entity.
 - 
setNamepublic void setName(java.lang.String aName) Sets 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.
 - 
getPropertypublic Property getProperty(int anIndex) Returns the property at the given index.
 - 
getPropertiespublic java.util.List<Property> getProperties() Returns the list of properties.
 - 
setPropertiespublic void setProperties(java.util.List<Property> theProps) Sets a list of properties.
 - 
addPropertypublic void addProperty(Property aProperty) Adds a given property.
 - 
addPropertypublic void addProperty(Property aProperty, int anIndex) Adds a given property at given index.
 - 
addPropertypublic void addProperty(Property... theProperties) Adds given properties.
 - 
removePropertypublic java.lang.Object removeProperty(int anIndex) Removes a property at given index.
 - 
removePropertypublic int removeProperty(Property aProperty) Removes the given property.
 - 
getPropertypublic Property getProperty(java.lang.String aName) Returns the property with the given name.
 - 
getAttributeCountpublic int getAttributeCount() Returns the number of attributes.
 - 
getAttributepublic Property getAttribute(int anIndex) Returns the attribute at the given index.
 - 
getAttributepublic Property getAttribute(java.lang.String aName) Returns the attribute with the given name.
 - 
getRelationCountpublic int getRelationCount() Returns the number of relations in the entity.
 - 
getRelationpublic Property getRelation(int anIndex) Returns the relation at the given index.
 - 
getRelationspublic java.util.List<Property> getRelations() Returns the list of relations in the entity.
 - 
getRelationpublic Property getRelation(java.lang.String aName) Returns the relation for the given key path.
 - 
getAttributeSortedpublic Property getAttributeSorted(int anIndex) Returns the attribute at the given index in a sorted attributes list.
 - 
getRelationSortedpublic Property getRelationSorted(int anIndex) Returns the relation at the given index in the sorted list of relations.
 - 
getPrimarypublic Property getPrimary() Returns the primary key property.
 - 
getPrimariespublic java.util.List<Property> getPrimaries() Returns the list of primary attributes for this entity.
 - 
getEntityClasspublic java.lang.Class getEntityClass() Returns the class that this entity represents.
 - 
setEntityClasspublic void setEntityClass(java.lang.Class aClass) Sets the class that this entity represents.
 - 
getKeyPathPropertypublic Property getKeyPathProperty(java.lang.String aKeyPath) Returns the property with the given name.
 - 
getKeyValuepublic java.lang.Object getKeyValue(java.lang.String aKey) RMKey.Get implementation to return Property for key.- Specified by:
- getKeyValuein interface- RMKey.Get
 
 - 
getDescriptorKeypublic java.lang.String getDescriptorKey() Returns the key/key-chain to the property(s) that returns best string description of an entity instance.
 - 
setDescriptorKeypublic void setDescriptorKey(java.lang.String aValue) Sets the key/key-chain to the property(s) that returns best string description of an entity instance.
 - 
getDescriptorKeyGuesspublic java.lang.String getDescriptorKeyGuess() Returns a guess of descriptor key (or the actual one, if set).
 - 
propertyChangepublic void propertyChange(java.beans.PropertyChangeEvent anEvent) PropertyChangeListener implementation to forward property changes to entity property change listener.- Specified by:
- propertyChangein interface- java.beans.PropertyChangeListener
 
 - 
equalspublic boolean equals(java.lang.Object anObj) Standard equals method.- Overrides:
- equalsin class- java.lang.Object
 
 - 
clonepublic Entity clone() Standard clone implementation.- Overrides:
- clonein class- RMListenerList
 
 - 
toXMLpublic RXElement toXML(RXArchiver anArchiver) XML archival.- Specified by:
- toXMLin interface- Archivable
 
 - 
fromXMLpublic Entity fromXML(RXArchiver anArchiver, RXElement anElement) XML unarchival.- Specified by:
- fromXMLin interface- Archivable
 
 - 
toBytes@Nullable public byte[] toBytes() Returns bytes for this entity.
 - 
fromBytespublic Entity fromBytes(byte[] theBytes) throws RMJSONReader.RMJSONException Returns entity from bytes.- Throws:
- RMJSONReader.RMJSONException
 
 - 
savepublic void save() throws java.lang.ExceptionSaves the entity to its source.- Throws:
- java.lang.Exception
 
 - 
deletepublic void delete() throws java.lang.ExceptionSaves this entity from its source.- Throws:
- java.lang.Exception
 
 - 
getJSONKeyspublic java.util.List<java.lang.String> getJSONKeys() Returns keys to archive JSON.- Specified by:
- getJSONKeysin interface- RMJSONArchiver.GetKeys
 
 
- 
 
-