ReportMill 10 API

com.reportmill.datasource
Class RMDataSource

java.lang.Object
  extended by com.reportmill.datasource.RMDataSource
All Implemented Interfaces:
RMBindSource, java.lang.Cloneable
Direct Known Subclasses:
RMJDBCDataSourceBasic, RMXMLDataSource

public class RMDataSource
extends java.lang.Object
implements java.lang.Cloneable, RMBindSource

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
 java.lang.Object clone()
          Standard clone implementation.
 RMDatum createDatum(RMEntity anEntity)
          Creates and returns a new datum for a given entity.
 RMResource createResource(java.lang.String aName, java.lang.Object theBytes)
          Creates a new resource for given name and bytes.
 void dataAdd(RMDatum aData)
          Notifies datasource that a datum will be added.
 void dataChange(RMDatum aData)
          Notifies datasource that a datum will change.
 void dataRemove(RMDatum aData)
          Notifies datasource that a datum will be removed.
 boolean equals(java.lang.Object anObj)
          Standard equals implementation.
 java.lang.Object fromXML(com.reportmill.archiver.RXArchiver anArchiver, com.reportmill.archiver.RXElement anElement)
          XML unarchival.
 RMDatum getData()
          Returns the datasource default dataset as a datum.
 java.util.Map getDataset()
          Returns a sample dataset of objects associated with the datasource.
 RMDataSet getDataSet(RMFetch aFetch)
          Gets the dataset for an entity.
 RMDataSet 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.
 RMProperty getRelation(java.lang.String aKeyPath)
          Returns the relation at the given key path.
 RMResource getResource(java.lang.String aName)
          Returns the resource for a given name.
 java.lang.String[] getResourceNames(java.lang.String aType)
          Returns the resource names for a given type (extension).
 RMSchema getSchema()
          Returns the schema of represented datasource as a heirarchy of RMEntity and RMProperty objects.
 boolean hasChanges()
          Returns whether or not there are any changes to be saved.
 void initFromDataSource(RMDataSource aDataSource)
          Initializes this datasource from given datasource.
 boolean isReadOnly()
          Returns whether datasource is read-only.
 void refresh()
          Invalidates any cached data.
 void saveChanges()
          Tells the datasource to save changes.
 void setName(java.lang.String aName)
          Sets the name for the datasource.
 void setSchema(RMSchema aSchema)
          Sets the schema of represented datasource as a heirarchy of RMEntity and RMProperty objects.
 java.lang.String toString()
          Returns a string representation of the datasource (just its name).
 com.reportmill.archiver.RXElement toXML(com.reportmill.archiver.RXArchiver anArchiver)
          XML archival.
 
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 RMSchema getSchema()
Returns the schema of represented datasource as a heirarchy of RMEntity and RMProperty objects.


setSchema

public void setSchema(RMSchema aSchema)
Sets the schema of represented datasource as a heirarchy of RMEntity and RMProperty objects.


getDataset

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


getData

public RMDatum getData()
Returns the datasource default dataset as a datum.


getDataSet

public RMDataSet getDataSet(java.lang.String aKey)
Returns the named dataset from this datasource.

Specified by:
getDataSet in interface RMBindSource

getDataSet

public RMDataSet getDataSet(RMFetch aFetch)
Gets the dataset for an entity.

Specified by:
getDataSet in interface RMBindSource

dataChange

public void dataChange(RMDatum aData)
Notifies datasource that a datum will change.


dataAdd

public void dataAdd(RMDatum aData)
Notifies datasource that a datum will be added.


dataRemove

public void dataRemove(RMDatum aData)
Notifies datasource that a datum will be removed.


saveChanges

public void saveChanges()
Tells the datasource to save changes.


hasChanges

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


createDatum

public RMDatum createDatum(RMEntity anEntity)
Creates and returns a new datum for a given entity.


refresh

public void refresh()
Invalidates any cached data.


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.


getRelation

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


getResourceNames

public java.lang.String[] getResourceNames(java.lang.String aType)
Returns the resource names for a given type (extension).


createResource

public RMResource createResource(java.lang.String aName,
                                 java.lang.Object theBytes)
Creates a new resource for given name and bytes.


getResource

public RMResource getResource(java.lang.String aName)
Returns the resource for a given name.


isReadOnly

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


initFromDataSource

public void initFromDataSource(RMDataSource aDataSource)
Initializes this datasource from given datasource.


equals

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

Overrides:
equals in class java.lang.Object

clone

public java.lang.Object clone()
Standard clone implementation.

Overrides:
clone in class java.lang.Object

toXML

public com.reportmill.archiver.RXElement toXML(com.reportmill.archiver.RXArchiver anArchiver)
XML archival.


fromXML

public java.lang.Object fromXML(com.reportmill.archiver.RXArchiver anArchiver,
                                com.reportmill.archiver.RXElement anElement)
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 10 API