jimm.datavision.source.ncsql
Class NCDatabase

java.lang.Object
  extended by jimm.datavision.source.DataSource
      extended by jimm.datavision.source.ncsql.NCDatabase
All Implemented Interfaces:
Writeable

public class NCDatabase
extends DataSource

An NCDatabase a data source that acts like a SQL database data source but can't run reports. It gets its column descriptions from metadata described in the report XML file.

Author:
Jim Menard, jimm@io.com

Field Summary
protected static java.lang.String ORPHANS_TABLE
           
protected  java.util.TreeMap tables
           
 
Fields inherited from class jimm.datavision.source.DataSource
metadataURL, query, report
 
Constructor Summary
NCDatabase(Report report)
           
 
Method Summary
 void addColumn(Column col)
          This override not only remembers the column but also hands it to the query for cacheing.
 boolean areRecordsSelectable()
          Used to enable/disable the "Select Records" menu item.
 boolean areRecordsSortable()
          Used to enable/disable the "Sort By" menu item.
 boolean canGroupRecords()
          Used to enable/disable the "Group By" menu item.
 boolean canJoinTables()
          Used to enable/disable the "Table Linker" menu item.
 boolean canRunReports()
          Used to enable/disable the "Run" and "Export" menu items.
 java.util.Iterator columns()
          Returns an iterator over all columns.
protected  void doWriteXML(XMLWriter out)
          Writes this database and all its tables as an XML tag.
 DataCursor execute()
           
 Column findColumn(java.lang.Object id)
          Given an id (a column name), returns the column that has that id.
 boolean isConnectionEditable()
          Used to enable/disable the "Connection" menu item.
 boolean isSQLGenerated()
          Used to enable/disable the "SQL Query Text" menu item.
 java.util.Iterator tables()
          Returns an iterator over all tables, or null if the data source does not have tables (for example, a character-separated file data source).
 java.util.Iterator tablesUsedInReport()
          Returns an iterator over all tables actually used in the report, or null if the data source does not have tables (for example, a character-separated file data source).
 
Methods inherited from class jimm.datavision.source.DataSource
alreadyUsedSourceFile, columnsInTablesUsedInReport, containsReferenceTo, getQuery, getReport, getSourceFile, indexOfSelectable, needsSourceFile, readMetadataFrom, reloadColumns, removeSort, reuseSourceFile, setSourceFile, usesSourceFile, writeXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ORPHANS_TABLE

protected static final java.lang.String ORPHANS_TABLE
See Also:
Constant Field Values

tables

protected java.util.TreeMap tables
Constructor Detail

NCDatabase

public NCDatabase(Report report)
Method Detail

canRunReports

public boolean canRunReports()
Description copied from class: DataSource
Used to enable/disable the "Run" and "Export" menu items. Most data sources will enable these, of course.

Overrides:
canRunReports in class DataSource
Returns:
true if the "Run" and "Export" menu items should be enabled.

canJoinTables

public boolean canJoinTables()
Description copied from class: DataSource
Used to enable/disable the "Table Linker" menu item.

Specified by:
canJoinTables in class DataSource
Returns:
true if the "Table Linker" menu item should be enabled.

isSQLGenerated

public boolean isSQLGenerated()
Description copied from class: DataSource
Used to enable/disable the "SQL Query Text" menu item.

Specified by:
isSQLGenerated in class DataSource
Returns:
true if the "SQL Query Text" menu item should be enabled.

isConnectionEditable

public boolean isConnectionEditable()
Description copied from class: DataSource
Used to enable/disable the "Connection" menu item.

Specified by:
isConnectionEditable in class DataSource
Returns:
true if the "Connection" menu item should be enabled.

areRecordsSelectable

public boolean areRecordsSelectable()
Description copied from class: DataSource
Used to enable/disable the "Select Records" menu item.

Specified by:
areRecordsSelectable in class DataSource
Returns:
true if the "Select Records" menu item should be enabled.

areRecordsSortable

public boolean areRecordsSortable()
Description copied from class: DataSource
Used to enable/disable the "Sort By" menu item.

Specified by:
areRecordsSortable in class DataSource
Returns:
true if the "Sort By" menu item should be enabled.

canGroupRecords

public boolean canGroupRecords()
Description copied from class: DataSource
Used to enable/disable the "Group By" menu item.

Specified by:
canGroupRecords in class DataSource
Returns:
true if the "Group By" menu item should be enabled.

addColumn

public void addColumn(Column col)
This override not only remembers the column but also hands it to the query for cacheing.

Overrides:
addColumn in class DataSource
Parameters:
col - a column

findColumn

public Column findColumn(java.lang.Object id)
Given an id (a column name), returns the column that has that id. If no column with the specified id exists, returns null. Uses Table.findColumn.

Specified by:
findColumn in class DataSource
Parameters:
id - a column id
Returns:
a column, or null if no column with the specified id exists
See Also:
Table.findColumn(java.lang.Object)

tables

public java.util.Iterator tables()
Description copied from class: DataSource
Returns an iterator over all tables, or null if the data source does not have tables (for example, a character-separated file data source).

Specified by:
tables in class DataSource
Returns:
a possibly null iterator over all tables

tablesUsedInReport

public java.util.Iterator tablesUsedInReport()
Description copied from class: DataSource
Returns an iterator over all tables actually used in the report, or null if the data source does not have tables (for example, a character-separated file data source).

Specified by:
tablesUsedInReport in class DataSource
Returns:
a possibly null iterator over all tables used in the report

columns

public java.util.Iterator columns()
Description copied from class: DataSource
Returns an iterator over all columns.

Specified by:
columns in class DataSource
Returns:
an iterator over all columns

execute

public DataCursor execute()
Specified by:
execute in class DataSource

doWriteXML

protected void doWriteXML(XMLWriter out)
Writes this database and all its tables as an XML tag.

Specified by:
doWriteXML in class DataSource
Parameters:
out - a writer that knows how to write XML