defaultdef.java
来自「数据仓库展示程序」· Java 代码 · 共 1,687 行 · 第 1/5 页
JAVA
1,687 行
/*
// This java file was automatically generated
// from XOM model 'aggregates'
// on Tue Nov 15 11:08:11 PST 2005
// Do not edit this file by hand.
*/
package mondrian.rolap.aggmatcher;
/**
* This is the XML model for defining default aggregate table recognition
* and level/measure mapping.
* Revision is $Id: //open/mondrian/src/main/mondrian/rolap/aggmatcher/DefaultRulesSchema.xml#4 $
* <p>This class was generated from XOM model 'aggregates' on Tue Nov 15 11:08:11 PST 2005
*/
public class DefaultDef {
public static java.lang.Class getXMLDefClass()
{
return DefaultDef.class;
}
public static String[] _elements = {
"AggRules",
"Base",
"CaseMatcher",
"NameMatcher",
"FactCountMatch",
"ForeignKeyMatch",
"TableMatch",
"Mapper",
"Regex",
"RegexMapper",
"Ref",
"LevelMapRef",
"MeasureMapRef",
"FactCountMatchRef",
"ForeignKeyMatchRef",
"TableMatchRef",
"LevelMap",
"MeasureMap",
"AggRule"
};
/**
* The set of "named" rules for matching aggregate tables.
* Only one rule can be applied to a given connection. In
* addition, one rule must be set as the default - this rule
* is always the choice when not selecting by name.
* It is very important that the AggRules validate method is called
* prior to using any of the object.
*/
public static class AggRules extends org.eigenbase.xom.ElementDef
{
public AggRules()
{
}
public AggRules(org.eigenbase.xom.DOMWrapper _def)
throws org.eigenbase.xom.XOMException
{
try {
org.eigenbase.xom.DOMElementParser _parser = new org.eigenbase.xom.DOMElementParser(_def, "", DefaultDef.class);
_parser = _parser;
org.eigenbase.xom.NodeDef[] _tempArray = null;
_tempArray = _tempArray;
tag = (String)_parser.getAttribute("tag", "String", null, null, true);
_tempArray = _parser.getArray(TableMatch.class, 0, 0);
tableMatches = new TableMatch[_tempArray.length];
for(int _i=0; _i<tableMatches.length; _i++)
tableMatches[_i] = (TableMatch)_tempArray[_i];
_tempArray = _parser.getArray(FactCountMatch.class, 0, 0);
factCountMatches = new FactCountMatch[_tempArray.length];
for(int _i=0; _i<factCountMatches.length; _i++)
factCountMatches[_i] = (FactCountMatch)_tempArray[_i];
_tempArray = _parser.getArray(ForeignKeyMatch.class, 0, 0);
foreignKeyMatches = new ForeignKeyMatch[_tempArray.length];
for(int _i=0; _i<foreignKeyMatches.length; _i++)
foreignKeyMatches[_i] = (ForeignKeyMatch)_tempArray[_i];
_tempArray = _parser.getArray(LevelMap.class, 0, 0);
levelMaps = new LevelMap[_tempArray.length];
for(int _i=0; _i<levelMaps.length; _i++)
levelMaps[_i] = (LevelMap)_tempArray[_i];
_tempArray = _parser.getArray(MeasureMap.class, 0, 0);
measureMaps = new MeasureMap[_tempArray.length];
for(int _i=0; _i<measureMaps.length; _i++)
measureMaps[_i] = (MeasureMap)_tempArray[_i];
_tempArray = _parser.getArray(AggRule.class, 1, 0);
aggRules = new AggRule[_tempArray.length];
for(int _i=0; _i<aggRules.length; _i++)
aggRules[_i] = (AggRule)_tempArray[_i];
} catch(org.eigenbase.xom.XOMException _ex) {
throw new org.eigenbase.xom.XOMException("In element '" + getName() + "': " + _ex.getMessage());
}
}
public String tag; // required attribute
/**
* All shared TableMatches.
*/
public TableMatch[] tableMatches; //optional array
/**
* All shared FactCountMatches.
*/
public FactCountMatch[] factCountMatches; //optional array
/**
* All shared ForeignKeyMatches.
*/
public ForeignKeyMatch[] foreignKeyMatches; //optional array
/**
* All shared LevelMap.
*/
public LevelMap[] levelMaps; //optional array
/**
* All shared MeasureMap.
*/
public MeasureMap[] measureMaps; //optional array
/**
* All AggRules (at least one).
* Also, one of them must be marked with default=true.
*/
public AggRule[] aggRules; //min 1
public String getName()
{
return "AggRules";
}
public void display(java.io.PrintWriter _out, int _indent)
{
_out.println(getName());
displayAttribute(_out, "tag", tag, _indent+1);
displayElementArray(_out, "tableMatches", tableMatches, _indent+1);
displayElementArray(_out, "factCountMatches", factCountMatches, _indent+1);
displayElementArray(_out, "foreignKeyMatches", foreignKeyMatches, _indent+1);
displayElementArray(_out, "levelMaps", levelMaps, _indent+1);
displayElementArray(_out, "measureMaps", measureMaps, _indent+1);
displayElementArray(_out, "aggRules", aggRules, _indent+1);
}
public void displayXML(org.eigenbase.xom.XMLOutput _out, int _indent)
{
_out.beginTag("AggRules", new org.eigenbase.xom.XMLAttrVector()
.add("tag", tag)
);
displayXMLElementArray(_out, tableMatches);
displayXMLElementArray(_out, factCountMatches);
displayXMLElementArray(_out, foreignKeyMatches);
displayXMLElementArray(_out, levelMaps);
displayXMLElementArray(_out, measureMaps);
displayXMLElementArray(_out, aggRules);
_out.endTag("AggRules");
}
public boolean displayDiff(org.eigenbase.xom.ElementDef _other, java.io.PrintWriter _out, int _indent)
{
boolean _diff = true;
AggRules _cother = (AggRules)_other;
_diff = _diff && displayAttributeDiff("tag", tag, _cother.tag, _out, _indent+1);
_diff = _diff && displayElementArrayDiff("tableMatches", tableMatches, _cother.tableMatches, _out, _indent+1);
_diff = _diff && displayElementArrayDiff("factCountMatches", factCountMatches, _cother.factCountMatches, _out, _indent+1);
_diff = _diff && displayElementArrayDiff("foreignKeyMatches", foreignKeyMatches, _cother.foreignKeyMatches, _out, _indent+1);
_diff = _diff && displayElementArrayDiff("levelMaps", levelMaps, _cother.levelMaps, _out, _indent+1);
_diff = _diff && displayElementArrayDiff("measureMaps", measureMaps, _cother.measureMaps, _out, _indent+1);
_diff = _diff && displayElementArrayDiff("aggRules", aggRules, _cother.aggRules, _out, _indent+1);
return _diff;
}
// BEGIN pass-through code block ---
private static final org.apache.log4j.Logger LOGGER =
org.apache.log4j.Logger.getLogger(DefaultDef.class);
protected static org.apache.log4j.Logger getLogger() {
return LOGGER;
}
public String getTag() {
return tag;
}
public AggRule getAggRule(String tag) {
for (int i = 0; i < aggRules.length; i++) {
AggRule aggRule = aggRules[i];
if (aggRule.isEnabled() && aggRule.getTag().equals(tag)) {
return aggRule;
}
}
return null;
}
public void validate(final mondrian.recorder.MessageRecorder msgRecorder) {
msgRecorder.pushContextName(getName());
try {
validate(factCountMatches, msgRecorder);
validate(tableMatches, msgRecorder);
validate(levelMaps, msgRecorder);
validate(measureMaps, msgRecorder);
validate(aggRules, msgRecorder);
} finally {
msgRecorder.popContextName();
}
}
private void validate(final Base[] bases,
final mondrian.recorder.MessageRecorder msgRecorder) {
for (int i = 0; i < bases.length; i++) {
Base base = bases[i];
if (base.isEnabled()) {
base.validate(this, msgRecorder);
}
}
}
public boolean hasFactCountMatch(String id) {
return (lookupFactCountMatch(id) != null);
}
public FactCountMatch lookupFactCountMatch(String id) {
return (FactCountMatch) lookupBase(id, factCountMatches);
}
public boolean hasForeignKeyMatch(String id) {
return (lookupForeignKeyMatch(id) != null);
}
public ForeignKeyMatch lookupForeignKeyMatch(String id) {
return (ForeignKeyMatch) lookupBase(id, foreignKeyMatches);
}
public boolean hasTableMatch(String id) {
return (lookupTableMatch(id) != null);
}
public TableMatch lookupTableMatch(String id) {
return (TableMatch) lookupBase(id, tableMatches);
}
public boolean hasLevelMap(String id) {
return (lookupLevelMap(id) != null);
}
public LevelMap lookupLevelMap(String id) {
return (LevelMap) lookupBase(id, levelMaps);
}
public boolean hasMeasureMap(String id) {
return (lookupMeasureMap(id) != null);
}
public MeasureMap lookupMeasureMap(String id) {
return (MeasureMap) lookupBase(id, measureMaps);
}
public boolean hasAggRule(String id) {
return (lookupAggRule(id) != null);
}
public AggRule lookupAggRule(String id) {
return (AggRule) lookupBase(id, aggRules);
}
private Base lookupBase(String tag, Base[] bases) {
for (int i = 0; i < bases.length; i++) {
Base base = bases[i];
if (base.isEnabled() && base.getTag().equals(tag)) {
return base;
}
}
return null;
}
public FactCountMatch[] getFactCountMatches() {
return factCountMatches;
}
public ForeignKeyMatch[] getForeignKeyMatches() {
return foreignKeyMatches;
}
public TableMatch[] getTableMatches() {
return tableMatches;
}
public LevelMap[] getLevelMaps() {
return levelMaps;
}
public MeasureMap[] getMeasureMaps() {
return measureMaps;
}
public AggRule[] getAggRules() {
return aggRules;
}
// END pass-through code block ---
}
/**
* Base is the base class for all of the elements.
* All elements can be enabled or not, have a tag, and
* can be validated.
*/
public static abstract class Base extends org.eigenbase.xom.ElementDef
{
public Base()
{
}
public Base(org.eigenbase.xom.DOMWrapper _def)
throws org.eigenbase.xom.XOMException
{
try {
org.eigenbase.xom.DOMElementParser _parser = new org.eigenbase.xom.DOMElementParser(_def, "", DefaultDef.class);
_parser = _parser;
enabled = (Boolean)_parser.getAttribute("enabled", "Boolean", "true", null, false);
} catch(org.eigenbase.xom.XOMException _ex) {
throw new org.eigenbase.xom.XOMException("In element '" + getName() + "': " + _ex.getMessage());
}
}
public Boolean enabled; // attribute default: true
public String getName()
{
return "Base";
}
public void display(java.io.PrintWriter _out, int _indent)
{
_out.println(getName());
displayAttribute(_out, "enabled", enabled, _indent+1);
}
public void displayXML(org.eigenbase.xom.XMLOutput _out, int _indent)
{
_out.beginTag("(%Base;)", new org.eigenbase.xom.XMLAttrVector()
.add("enabled", enabled)
);
_out.endTag("(%Base;)");
}
public boolean displayDiff(org.eigenbase.xom.ElementDef _other, java.io.PrintWriter _out, int _indent)
{
boolean _diff = true;
Base _cother = (Base)_other;
_diff = _diff && displayAttributeDiff("enabled", enabled, _cother.enabled, _out, _indent+1);
return _diff;
}
// BEGIN pass-through code block ---
public boolean isEnabled() {
return enabled.booleanValue();
}
protected abstract String getTag();
public abstract void validate(final AggRules rules,
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?