|
ReportMill 10 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.reportmill.datasource.RMDataSource
com.reportmill.datasource.RMJDBCDataSourceBasic
com.reportmill.datasource.RMJDBCDataSource
public class RMJDBCDataSource
This datasource uses a relational database to model an entity-relationship diagram. Every table in the database is represented by an RMEntity. Relationships are represented by RMJoin objects. All relationships are evaluated lazily - when a key crosses a relationship, the datasource does a fetch from the database of the new entities. By default, at the topmost level, there is a dataset key for every entity. A statement like "myDatasoure.getDataset().get("MOVIES")" will fetch in all the rows from the MOVIES table. Queries can be done by defining subqueries at the relationship level or by explicitly setting a query string at the datasource level. In order to have relationships between entities in the e-r diagram, the schema needs to have been defined using RMSchema.
Field Summary |
---|
Fields inherited from class com.reportmill.datasource.RMJDBCDataSourceBasic |
---|
_statement |
Constructor Summary | |
---|---|
RMJDBCDataSource()
no-argument constructor (used mostly for archiving) |
|
RMJDBCDataSource(RMJDBCDataSourceBasic other)
Create a new JDBC datasource from a basic jdbc datasource. |
Method Summary | |
---|---|
void |
close()
Overridden to perform an explicit SHUTDOWN operation on the database. |
RMDatum |
createDatum(RMEntity anEntity)
Creates and returns a new datum for a given entity. |
void |
dataAdd(RMDatum aData)
Overrides RMDataSource version to record inserted data. |
void |
dataChange(RMDatum aData)
Notifies datasource that a datum will change. |
void |
dataRemove(RMDatum aData)
Notifies datasource that a datum will be removed. |
void |
deleteRows(java.util.List rows)
Delete all the row data, which are assumed to be from the same entity. |
java.util.List |
fetchEntity(RMEntity e,
java.lang.String whereClause)
Pulls one or more entities out of a single table as a List of Maps |
RMDatum |
fetchJoin(RMJoin join,
RMDatum parent,
java.lang.String key)
Runs a query to fetch data for the relationship. |
int |
generatePrimaryKey(RMEntity e)
Autogenerate a primary key for a new datum. |
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)
Returns the dataset specified by the RMFetch. |
void |
getRelationships(RMSchema schema)
Reads the RMINFO.RELATIONSHIPS table and adds joins to the RMSchema |
RMSchema |
getSchema()
Overridden from RMJDBCDatasource. |
RMDatum |
getUniqueDatum(RMEntity entity,
java.util.Map row,
RMDatum parent,
java.lang.String key)
Returns the one datum for the given row & entity. |
boolean |
hasChanges()
Returns whether or not there are any changes to be saved. |
boolean |
hasInfoSchema()
Returns true if the RMINFO schema is present in the database. |
void |
insertRows(java.util.List rows)
Insert all the row data, which are assumed to be from the same entity, into the table. |
void |
refresh()
Invalidates any cached data. |
void |
releaseUniqueDatum(RMDatum d)
Used when an object is deleted from the database to also remove it from the uniqueing map. |
void |
removeOwnedData(RMDatum aParent)
Figure out which child objects are appropriate to delete when a parent object is deleted. |
void |
runErrorPanel()
Runs an alert panel to display the current error. |
void |
runErrorPanel(java.sql.SQLException e)
Runs the alert panel for exceptions that were caught externally. |
void |
saveChanges()
Push all the dirty objects back to the database. |
void |
setFilterString(java.lang.String datasetName,
java.lang.String filterString)
Assign queries for the top-level entities. |
com.reportmill.archiver.RXElement |
toXML(com.reportmill.archiver.RXArchiver anArchiver)
XML archival |
void |
updateRows(java.util.List rows)
Update all the row data, which are assumed to be from the same entity. |
Methods inherited from class com.reportmill.datasource.RMJDBCDataSourceBasic |
---|
cancelStatement, createResource, equals, executeQuery, fromXML, getConnection, getConnectionURL, getDatabaseSchema, getDatabaseSchema, getDefaultDatasetName, getDriverClassName, getError, getFetchLimit, getPassword, getQuery, getResource, getResourceNames, getTableSchema, getUserName, isConnected, isReadOnly, setConnectionURL, setDefaultDatasetName, setDriverClassName, setError, setFetchLimit, setLogging, setPassword, setQuery, setUserName |
Methods inherited from class com.reportmill.datasource.RMDataSource |
---|
clone, getDataSet, getEntity, getName, getRelation, initFromDataSource, setName, setSchema, toString |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public RMJDBCDataSource()
public RMJDBCDataSource(RMJDBCDataSourceBasic other)
Method Detail |
---|
public RMSchema getSchema()
getSchema
in class RMJDBCDataSourceBasic
public boolean hasInfoSchema()
public void getRelationships(RMSchema schema) throws java.sql.SQLException
java.sql.SQLException
public void runErrorPanel()
public void runErrorPanel(java.sql.SQLException e)
public RMDatum fetchJoin(RMJoin join, RMDatum parent, java.lang.String key)
public java.util.List fetchEntity(RMEntity e, java.lang.String whereClause)
public RMDatum getUniqueDatum(RMEntity entity, java.util.Map row, RMDatum parent, java.lang.String key)
public void releaseUniqueDatum(RMDatum d)
public void dataAdd(RMDatum aData)
dataAdd
in class RMDataSource
public void dataChange(RMDatum aData)
RMDataSource
dataChange
in class RMDataSource
public void dataRemove(RMDatum aData)
RMDataSource
dataRemove
in class RMDataSource
public void removeOwnedData(RMDatum aParent)
public void saveChanges()
saveChanges
in class RMDataSource
public void insertRows(java.util.List rows) throws java.sql.SQLException
java.sql.SQLException
public void updateRows(java.util.List rows) throws java.sql.SQLException, RMJDBCUpdateException
java.sql.SQLException
RMJDBCUpdateException
public void deleteRows(java.util.List rows) throws java.sql.SQLException, RMJDBCUpdateException
java.sql.SQLException
RMJDBCUpdateException
public RMDatum createDatum(RMEntity anEntity)
createDatum
in class RMDataSource
public void refresh()
refresh
in class RMJDBCDataSourceBasic
public boolean hasChanges()
hasChanges
in class RMDataSource
public RMDatum getData()
getData
in class RMDataSource
public void setFilterString(java.lang.String datasetName, java.lang.String filterString)
public java.util.Map getDataset()
getDataset
in class RMJDBCDataSourceBasic
public RMDataSet getDataSet(RMFetch aFetch)
getDataSet
in interface RMBindSource
getDataSet
in class RMDataSource
public int generatePrimaryKey(RMEntity e) throws java.sql.SQLException
java.sql.SQLException
public com.reportmill.archiver.RXElement toXML(com.reportmill.archiver.RXArchiver anArchiver)
toXML
in class RMJDBCDataSourceBasic
public void close()
close
in class RMJDBCDataSourceBasic
|
ReportMill 10 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |