jimm.datavision.test.mock.source
Class MockDataSource

java.lang.Object
  extended by jimm.datavision.source.DataSource
      extended by jimm.datavision.test.mock.source.MockDataSource
All Implemented Interfaces:
Writeable
Direct Known Subclasses:
MockAggregateDataSource

public class MockDataSource
extends DataSource


Field Summary
protected  java.util.List columns
           
protected static java.lang.String DATABASE_NAME
           
protected  java.lang.String name
           
protected  java.util.Map tables
           
protected  java.util.List tablesUsedInReport
           
 
Fields inherited from class jimm.datavision.source.DataSource
metadataURL, query, report
 
Constructor Summary
MockDataSource(Report r)
           
 
Method Summary
protected  void addColumn(Table table, java.lang.String name, int type)
           
 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.
 java.util.Iterator columns()
          Returns an iterator over all columns.
protected  void createAggregateTestTable()
           
protected  void createAllCapsTable()
           
protected  void createJobsTable()
           
protected  void createOfficeTable()
           
protected  void doWriteXML(XMLWriter out)
           
 DataCursor execute()
           
 Column findColumn(java.lang.Object id)
          Copied from Database.
protected  Table findTable(java.lang.String tableName)
          Copied from Database and tweaked a bit.
protected  Table findTableWithId(java.lang.String id)
          Copied from Database and tweaked a bit.
 int indexOfSelectable(Selectable sel)
          Returns the index of the specified selectable.
 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
addColumn, alreadyUsedSourceFile, canRunReports, columnsInTablesUsedInReport, containsReferenceTo, getQuery, getReport, getSourceFile, 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

DATABASE_NAME

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

tables

protected java.util.Map tables

tablesUsedInReport

protected java.util.List tablesUsedInReport

columns

protected java.util.List columns

name

protected java.lang.String name
Constructor Detail

MockDataSource

public MockDataSource(Report r)
Method Detail

createOfficeTable

protected void createOfficeTable()

createJobsTable

protected void createJobsTable()

createAggregateTestTable

protected void createAggregateTestTable()

createAllCapsTable

protected void createAllCapsTable()

addColumn

protected void addColumn(Table table,
                         java.lang.String name,
                         int type)

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.

execute

public DataCursor execute()
                   throws java.lang.Exception
Specified by:
execute in class DataSource
Throws:
java.lang.Exception

indexOfSelectable

public int indexOfSelectable(Selectable sel)
Description copied from class: DataSource
Returns the index of the specified selectable.

Overrides:
indexOfSelectable in class DataSource
Parameters:
sel - a selectable

findColumn

public Column findColumn(java.lang.Object id)
Copied from Database.

Specified by:
findColumn in class DataSource
Returns:
a column, or null if no column with the specified id exists

findTable

protected Table findTable(java.lang.String tableName)
Copied from Database and tweaked a bit.


findTableWithId

protected Table findTableWithId(java.lang.String id)
Copied from Database and tweaked a bit.


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

doWriteXML

protected void doWriteXML(XMLWriter out)
Specified by:
doWriteXML in class DataSource