Search in sources :

Example 1 with FactLink

use of mondrian.olap.MondrianDef.FactLink in project collect by openforis.

the class Mondrian4SchemaGenerator method createDimensionLink.

private DimensionLink createDimensionLink(Dimension dimension, AttributeDefinition attrDef) {
    DimensionLink dimensionLink;
    if (attrDef instanceof CodeAttributeDefinition) {
        CodeAttributeDefinition codeAttrDef = (CodeAttributeDefinition) attrDef;
        if (codeAttrDef.isMultiple()) {
            dimensionLink = new NoLink();
        } else if (codeAttrDef.getList().isExternal()) {
            dimensionLink = new FactLink();
        } else {
            dimensionLink = new ForeignKeyLink();
            DataTable dataTable = rdbSchema.getDataTable(attrDef.getParentEntityDefinition());
            CodeValueFKColumn fkColumn = dataTable.getForeignKeyCodeColumn((CodeAttributeDefinition) attrDef);
            ((ForeignKeyLink) dimensionLink).foreignKeyColumn = fkColumn.getName();
        }
    } else {
        dimensionLink = new FactLink();
    }
    dimensionLink.dimension = dimension.name;
    return dimensionLink;
}
Also used : NoLink(mondrian.olap.MondrianDef.NoLink) DataTable(org.openforis.collect.relational.model.DataTable) FactLink(mondrian.olap.MondrianDef.FactLink) CodeAttributeDefinition(org.openforis.idm.metamodel.CodeAttributeDefinition) ForeignKeyLink(mondrian.olap.MondrianDef.ForeignKeyLink) CodeValueFKColumn(org.openforis.collect.relational.model.CodeValueFKColumn) DimensionLink(mondrian.olap.MondrianDef.DimensionLink)

Aggregations

DimensionLink (mondrian.olap.MondrianDef.DimensionLink)1 FactLink (mondrian.olap.MondrianDef.FactLink)1 ForeignKeyLink (mondrian.olap.MondrianDef.ForeignKeyLink)1 NoLink (mondrian.olap.MondrianDef.NoLink)1 CodeValueFKColumn (org.openforis.collect.relational.model.CodeValueFKColumn)1 DataTable (org.openforis.collect.relational.model.DataTable)1 CodeAttributeDefinition (org.openforis.idm.metamodel.CodeAttributeDefinition)1