ReportMill 11 API

com.reportmill.datasource
Class RMDataSource

java.lang.Object
  extended by com.reportmill.base.RMObject
      extended by com.reportmill.datasource.RMDataSource
All Implemented Interfaces:
com.reportmill.base.RMPropertyChanger, java.lang.Cloneable
Direct Known Subclasses:
RMJDBCDataSource, RMXMLDataSource

public abstract class RMDataSource
extends com.reportmill.base.RMObject

This class is used as a proxy for objects passed to document's generateReport() method. It provides schema information of the object graph (in the form of RMEntity and RMProperty objects) and it provides sample data (probably in the form of Java Collections and core types: List, Map, String, Number, Date).


Constructor Summary
RMDataSource()
          Creates a plain datasource.
 
Method Summary
 void close()
          Tells the datasource to close.
 java.lang.Object createObject(RMEntity anEntity)
          Creates and returns a new object for a given entity.
 boolean equals(java.lang.Object anObj)
          Standard equals implementation.
 java.lang.Object fromXML(com.reportmill.archiver.RXArchiver anArchiver, com.reportmill.archiver.RXElement anElement, java.lang.Object anOwner)
          XML unarchival.
abstract  java.util.Map getDataset()
          Returns a sample dataset of objects associated with the datasource.
 java.util.List getDataset(RMFetch aFetch)
          Gets the dataset for an entity.
 java.util.List getDataset(java.lang.String aKey)
          Returns the named dataset from this datasource.
 RMEntity getEntity(java.lang.String aKeyPath)
          Returns the entity at the given key path.
 java.lang.String getError()
          Returns the last error encountered when loading a datasource.
 java.lang.String getName()
          Returns the name for the datasource.
abstract  RMSchema getSchema()
          Returns the schema of represented datasource as a hierarchy of RMEntity and RMProperty objects.
 boolean hasChanges()
          Returns whether or not there are any changes to be saved.
 boolean isReadOnly()
          Returns whether datasource is read-only.
 void refresh()
          Invalidates any cached data.
 void setName(java.lang.String aName)
          Sets the name for the datasource.
 java.lang.String toString()
          Returns a string representation of the datasource (just 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, clone, 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

RMDataSource

public RMDataSource()
Creates a plain datasource.

Method Detail

getName

public java.lang.String getName()
Returns the name for the datasource.


setName

public void setName(java.lang.String aName)
Sets the name for the datasource.


getSchema

public abstract RMSchema getSchema()
Returns the schema of represented datasource as a hierarchy of RMEntity and RMProperty objects.


getDataset

public abstract java.util.Map getDataset()
Returns a sample dataset of objects associated with the datasource.


getDataset

public java.util.List getDataset(java.lang.String aKey)
Returns the named dataset from this datasource.


getDataset

public java.util.List getDataset(RMFetch aFetch)
Gets the dataset for an entity.


createObject

public java.lang.Object createObject(RMEntity anEntity)
Creates and returns a new object for a given entity.


refresh

public void refresh()
Invalidates any cached data.


hasChanges

public boolean hasChanges()
Returns whether or not there are any changes to be saved.


close

public void close()
Tells the datasource to close.


getError

public java.lang.String getError()
Returns the last error encountered when loading a datasource.


getEntity

public RMEntity getEntity(java.lang.String aKeyPath)
Returns the entity at the given key path.


isReadOnly

public boolean isReadOnly()
Returns whether datasource is read-only.


equals

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

Overrides:
equals in class java.lang.Object

toXML

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


fromXML

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


toString

public java.lang.String toString()
Returns a string representation of the datasource (just its name).

Overrides:
toString in class java.lang.Object

ReportMill 11 API