ReportMill 11 API

com.reportmill.datasource
Class RMEntity

java.lang.Object
  extended by com.reportmill.base.RMObject
      extended by com.reportmill.datasource.RMEntity
All Implemented Interfaces:
com.reportmill.base.RMPropertyChanger, java.lang.Cloneable

public class RMEntity
extends com.reportmill.base.RMObject

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.


Constructor Summary
RMEntity()
          Creates an empty entity.
RMEntity(java.lang.String name)
          Creates an entity with the given name.
 
Method Summary
 void addProperty(RMProperty aProperty)
          Adds a given property.
 void addProperty(RMProperty aProperty, int anIndex)
          Adds a given property at given index.
 RMEntity clone()
          Standard clone implementation.
 boolean equals(java.lang.Object anObj)
          Standard equals method.
 RMEntity fromXML(com.reportmill.archiver.RXArchiver anArchiver, com.reportmill.archiver.RXElement anElement, java.lang.Object anOwner)
          XML unarchival.
 RMProperty getAttribute(int anIndex)
          Returns the attribute at the given index.
 RMProperty getAttribute(java.lang.String aName)
          Returns the attribute with the given name.
 int getAttributeCount()
          Returns the number of attributes.
 RMProperty getAttributeSorted(int anIndex)
          Returns the attribute at the given index in a sorted attributes list.
 java.lang.String getDescriptorKey()
          Returns the key/key-chain to the property(s) that returns best string description of an entity instance.
 java.lang.String getDescriptorKeyGuess()
          Returns a guess of descriptor key (or the actual one, if set).
 java.lang.String getName()
          Returns the name of the entity.
 java.util.List<? extends RMProperty> getPrimaries()
          Returns the list of primary attributes for this entity.
 java.util.List<? extends RMProperty> getProperties()
          Returns the list of properties.
 RMProperty getProperty(int anIndex)
          Returns the property at the given index.
 RMProperty getProperty(RMKeyChain aKeyChain)
          Returns the property for the keychain evaluated from this entity.
 RMProperty getProperty(java.lang.String aName)
          Returns the property with the given name.
 int getPropertyCount()
          Returns the number of properties.
 RMProperty getRelation(int anIndex)
          Returns the relation at the given index.
 RMProperty getRelation(java.lang.String aKeyPath)
          Returns the relation for the given key path.
 int getRelationCount()
          Returns the number of relations in the entity.
 RMEntity getRelationEntity(java.lang.String aKeyPath)
          Returns the relation entity for the key path evaluated from this entity.
 java.util.List<RMProperty> getRelations()
          Returns the list of relations in the entity.
 RMProperty getRelationSorted(int anIndex)
          Returns the relation at the given index in the sorted list of relations.
 RMSchema getSchema()
          Returns the schema that owns this entity.
 void mergeEntity(RMEntity anEntity)
          Merges an entity with this entity.
 java.lang.Object removeProperty(int anIndex)
          Removes a property at given index.
 int removeProperty(RMProperty aProperty)
          Removes the given property.
 void setDescriptorKey(java.lang.String aValue)
          Sets the key/key-chain to the property(s) that returns best string description of an entity instance.
 void setName(java.lang.String aName)
          Sets the name of the entity.
 void setSchema(RMSchema aSchema)
          Sets the schema that owns this entity.
 java.lang.String toString()
          Returns a string representation of entity (its name).
 com.reportmill.archiver.RXElement toXML(com.reportmill.archiver.RXArchiver anArchiver, java.lang.Object anOwner)
          XML archival.
 
Methods inherited from class com.reportmill.base.RMObject
addListener, addPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, getListener, getListenerCount, getListeners, isFirePropertyChangeEnabled, isUndoing, removeListener, removePropertyChangeListener, setFirePropertyChangeEnabled, setUndoing
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RMEntity

public RMEntity()
Creates an empty entity.


RMEntity

public RMEntity(java.lang.String name)
Creates an entity with the given name.

Method Detail

getSchema

public RMSchema getSchema()
Returns the schema that owns this entity.


setSchema

public void setSchema(RMSchema aSchema)
Sets the schema that owns this entity.


getName

public java.lang.String getName()
Returns the name of the entity.


setName

public void setName(java.lang.String aName)
Sets the name of the entity.


getPropertyCount

public int getPropertyCount()
Returns the number of properties.


getProperty

public RMProperty getProperty(int anIndex)
Returns the property at the given index.


getProperties

public java.util.List<? extends RMProperty> getProperties()
Returns the list of properties.


addProperty

public void addProperty(RMProperty aProperty)
Adds a given property.


addProperty

public void addProperty(RMProperty aProperty,
                        int anIndex)
Adds a given property at given index.


removeProperty

public java.lang.Object removeProperty(int anIndex)
Removes a property at given index.


removeProperty

public int removeProperty(RMProperty aProperty)
Removes the given property.


getProperty

public RMProperty getProperty(java.lang.String aName)
Returns the property with the given name.


getProperty

public RMProperty getProperty(RMKeyChain aKeyChain)
Returns the property for the keychain evaluated from this entity.


getAttributeCount

public int getAttributeCount()
Returns the number of attributes.


getAttribute

public RMProperty getAttribute(int anIndex)
Returns the attribute at the given index.


getAttribute

public RMProperty getAttribute(java.lang.String aName)
Returns the attribute with the given name.


getRelationCount

public int getRelationCount()
Returns the number of relations in the entity.


getRelation

public RMProperty getRelation(int anIndex)
Returns the relation at the given index.


getRelations

public java.util.List<RMProperty> getRelations()
Returns the list of relations in the entity.


getRelation

public RMProperty getRelation(java.lang.String aKeyPath)
Returns the relation for the given key path.


getRelationEntity

public RMEntity getRelationEntity(java.lang.String aKeyPath)
Returns the relation entity for the key path evaluated from this entity.


getAttributeSorted

public RMProperty getAttributeSorted(int anIndex)
Returns the attribute at the given index in a sorted attributes list.


getRelationSorted

public RMProperty getRelationSorted(int anIndex)
Returns the relation at the given index in the sorted list of relations.


getPrimaries

public java.util.List<? extends RMProperty> getPrimaries()
Returns the list of primary attributes for this entity.


getDescriptorKey

public java.lang.String getDescriptorKey()
Returns the key/key-chain to the property(s) that returns best string description of an entity instance.


setDescriptorKey

public void setDescriptorKey(java.lang.String aValue)
Sets the key/key-chain to the property(s) that returns best string description of an entity instance.


getDescriptorKeyGuess

public java.lang.String getDescriptorKeyGuess()
Returns a guess of descriptor key (or the actual one, if set).


mergeEntity

public void mergeEntity(RMEntity anEntity)
Merges an entity with this entity.


equals

public boolean equals(java.lang.Object anObj)
Standard equals method.

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Returns a string representation of entity (its name).

Overrides:
toString in class java.lang.Object

clone

public RMEntity clone()
Standard clone implementation.

Overrides:
clone in class com.reportmill.base.RMObject

toXML

public com.reportmill.archiver.RXElement toXML(com.reportmill.archiver.RXArchiver anArchiver,
                                               java.lang.Object anOwner)
XML archival.


fromXML

public RMEntity fromXML(com.reportmill.archiver.RXArchiver anArchiver,
                        com.reportmill.archiver.RXElement anElement,
                        java.lang.Object anOwner)
XML unarchival.


ReportMill 11 API