Package mondrian.rolap.aggmatcher
Class ExplicitRules.TableDef
- java.lang.Object
-
- mondrian.rolap.aggmatcher.ExplicitRules.TableDef
-
- Direct Known Subclasses:
ExplicitRules.NameTableDef
,ExplicitRules.PatternTableDef
- Enclosing class:
- ExplicitRules
public abstract static class ExplicitRules.TableDef extends java.lang.Object
This is the base class for the exact name based and name pattern based aggregate table mapping definitions. It contains the mappings for the fact count column, optional ignore columns, foreign key mappings, measure column mappings and level column mappings.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
ExplicitRules.TableDef.Level
This class is used to map from a Level's symbolic name, [Time].[Year] to the aggregate table's column name, TIME_YEAR.(package private) class
ExplicitRules.TableDef.Measure
This class is used to map from a measure's symbolic name, [Measures].[Unit Sales] to the aggregate table's column name, UNIT_SALES_SUM.
-
Field Summary
Fields Modifier and Type Field Description protected ExplicitRules.Group
aggGroup
protected int
approxRowCount
protected java.lang.String
factCountName
protected int
id
protected boolean
ignoreCase
protected java.util.List<java.lang.String>
ignoreColumnNames
-
Constructor Summary
Constructors Modifier Constructor Description protected
TableDef(boolean ignoreCase, ExplicitRules.Group aggGroup)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
add(ExplicitRules.TableDef.Level level)
Adds a Level.protected void
add(ExplicitRules.TableDef.Measure measure)
Adds a Measure.protected void
addFK(MondrianDef.AggForeignKey fk)
Add foreign key mapping entry (maps from fact table foreign key column name to aggregate table foreign key column name).protected void
addIgnoreColumnName(java.lang.String ignoreName)
Adds the name of an aggregate table column that is to be ignored.static void
addLevelTo(ExplicitRules.TableDef tableDef, java.lang.String name, java.lang.String columnName, boolean collapsed, java.lang.String ordinalColumn, java.lang.String captionColumn, MondrianDef.AggLevelProperty[] properties)
static void
addMeasureTo(ExplicitRules.TableDef tableDef, java.lang.String name, java.lang.String column)
boolean
columnsOK(RolapStar star, JdbcSchema.Table dbFactTable, JdbcSchema.Table dbTable, MessageRecorder msgRecorder)
Checks that ALL of the columns in the dbTable have a mapping in the tableDef.ExplicitRules.Group
getAggGroup()
Get the Group with which is a part.protected java.lang.String
getAggregateFK(java.lang.String baseFK)
Get the name of the aggregate table's foreign key column that matches the base fact table's foreign key column or return null.int
getApproxRowCount()
Returns an approximate number of rows in this table.(package private) RolapCube
getCube()
Get the RolapCube associated with this mapping.protected Recognizer.Matcher
getFactCountMatcher()
Get Matcher for the fact count column.protected java.lang.String
getFactCountName()
Get the name of the fact count column.protected java.util.Iterator<java.lang.String>
getIgnoreColumnNames()
Get an Iterator over all ignore column name entries.protected Recognizer.Matcher
getIgnoreMatcher()
Get Matcher for ignore columns.java.util.List<ExplicitRules.TableDef.Level>
getLevels()
Gets all level mappings.java.util.List<ExplicitRules.TableDef.Measure>
getMeasures()
Gets all level mappings.RolapStar
getStar()
Get the RolapStar associated with this cube.boolean
isIgnoreCase()
Return true if this name/pattern matching ignores case.(package private) static ExplicitRules.TableDef
make(MondrianDef.AggTable aggTable, ExplicitRules.Group group)
Given a MondrianDef.AggTable instance create a TableDef instance which is either a NameTableDef or PatternTableDef.abstract boolean
matches(java.lang.String tableName)
Does the TableDef match a table with name tableName.void
print(java.io.PrintWriter pw, java.lang.String prefix)
protected void
setFactCountName(java.lang.String factCountName)
Set the name of the fact count column.java.lang.String
toString()
void
validate(MessageRecorder msgRecorder)
Validate the Levels and Measures, also make sure each definition is different, both name and column.
-
-
-
Field Detail
-
id
protected final int id
-
ignoreCase
protected final boolean ignoreCase
-
aggGroup
protected final ExplicitRules.Group aggGroup
-
factCountName
protected java.lang.String factCountName
-
ignoreColumnNames
protected java.util.List<java.lang.String> ignoreColumnNames
-
approxRowCount
protected int approxRowCount
-
-
Constructor Detail
-
TableDef
protected TableDef(boolean ignoreCase, ExplicitRules.Group aggGroup)
-
-
Method Detail
-
make
static ExplicitRules.TableDef make(MondrianDef.AggTable aggTable, ExplicitRules.Group group)
Given a MondrianDef.AggTable instance create a TableDef instance which is either a NameTableDef or PatternTableDef.
-
addLevelTo
public static void addLevelTo(ExplicitRules.TableDef tableDef, java.lang.String name, java.lang.String columnName, boolean collapsed, java.lang.String ordinalColumn, java.lang.String captionColumn, MondrianDef.AggLevelProperty[] properties)
-
addMeasureTo
public static void addMeasureTo(ExplicitRules.TableDef tableDef, java.lang.String name, java.lang.String column)
-
getApproxRowCount
public int getApproxRowCount()
Returns an approximate number of rows in this table. A negative value indicates that no estimate is available.- Returns:
- An estimated row count, or a negative value if no row count approximation was available.
-
isIgnoreCase
public boolean isIgnoreCase()
Return true if this name/pattern matching ignores case.
-
getStar
public RolapStar getStar()
Get the RolapStar associated with this cube.
-
getAggGroup
public ExplicitRules.Group getAggGroup()
Get the Group with which is a part.
-
getFactCountName
protected java.lang.String getFactCountName()
Get the name of the fact count column.
-
setFactCountName
protected void setFactCountName(java.lang.String factCountName)
Set the name of the fact count column.
-
getIgnoreColumnNames
protected java.util.Iterator<java.lang.String> getIgnoreColumnNames()
Get an Iterator over all ignore column name entries.
-
getLevels
public java.util.List<ExplicitRules.TableDef.Level> getLevels()
Gets all level mappings.
-
getMeasures
public java.util.List<ExplicitRules.TableDef.Measure> getMeasures()
Gets all level mappings.
-
getIgnoreMatcher
protected Recognizer.Matcher getIgnoreMatcher()
Get Matcher for ignore columns.
-
getFactCountMatcher
protected Recognizer.Matcher getFactCountMatcher()
Get Matcher for the fact count column.
-
getCube
RolapCube getCube()
Get the RolapCube associated with this mapping.
-
columnsOK
public boolean columnsOK(RolapStar star, JdbcSchema.Table dbFactTable, JdbcSchema.Table dbTable, MessageRecorder msgRecorder)
Checks that ALL of the columns in the dbTable have a mapping in the tableDef.It is an error if there is a column that does not have a mapping.
-
addIgnoreColumnName
protected void addIgnoreColumnName(java.lang.String ignoreName)
Adds the name of an aggregate table column that is to be ignored.
-
addFK
protected void addFK(MondrianDef.AggForeignKey fk)
Add foreign key mapping entry (maps from fact table foreign key column name to aggregate table foreign key column name).
-
getAggregateFK
protected java.lang.String getAggregateFK(java.lang.String baseFK)
Get the name of the aggregate table's foreign key column that matches the base fact table's foreign key column or return null.
-
add
protected void add(ExplicitRules.TableDef.Level level)
Adds a Level.
-
add
protected void add(ExplicitRules.TableDef.Measure measure)
Adds a Measure.
-
matches
public abstract boolean matches(java.lang.String tableName)
Does the TableDef match a table with name tableName.
-
validate
public void validate(MessageRecorder msgRecorder)
Validate the Levels and Measures, also make sure each definition is different, both name and column.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
print
public void print(java.io.PrintWriter pw, java.lang.String prefix)
-
-