protected function formatColumnNameImpl($uiMetaDataName) {
        $columnName = NULL;

        $formattedUIMetaDataName = parent::formatColumnNameImpl($uiMetaDataName);

        list($elementNameSpace, $elementName) = AbstractDatasetUIMetaDataGenerator::splitElementUIMetaDataName($formattedUIMetaDataName);
        switch ($elementNameSpace) {
            case AbstractAttributeUIMetaData::NAME_SPACE:
                list($dimensionName, $dimensionColumnName) = ParameterNameHelper::split($elementName);
                // TODO do we need to check for resource?
                list(, $columnName) = ReferencePathHelper::splitReference($dimensionName);

                $column = $this->dataset->getColumn($dimensionName);
                if ($column->type->getReferencedDatasetName() != NULL) {
                    // this column should not be used
                    if (isset($dimensionColumnName) && $column->type->getReferencedColumnName() != $dimensionColumnName) {
                        $columnName = NULL;
                    }
                }

                break;
            case AbstractMeasureUIMetaData::NAME_SPACE:
                throw new IllegalArgumentException(t('Measures are not supported by this result formatter'));
        }

        return $columnName;
    }
    public static function getExportColumnName ( $uiMetaDataName, MetaModel $metamodel ) {

        if ( trim($uiMetaDataName) == '' ) {
            $message = t('Empty columnName discovered');
            drupal_set_message($message, 'warning');
            LogHelper::log_warn($message);

            return $uiMetaDataName;
        }


        list($elementNameSpace, $name) = AbstractDatasetUIMetaDataGenerator::splitElementUIMetaDataName($uiMetaDataName);
        switch ( $elementNameSpace ) {

            case AbstractAttributeUIMetaData::NAME_SPACE:
                list($referencedDimensionName, $dimensionColumnName) = ParameterNameHelper::split($name);
                list($datasetName, $dimensionName) = ReferencePathHelper::splitReference($referencedDimensionName);
                if (isset($datasetName)) {
                    $adjustedReferencedDimensionName = ReferencePathHelper::assembleReference(self::getExportDatasetName($datasetName,$metamodel), $dimensionName);
                    $name = ParameterNameHelper::assemble($adjustedReferencedDimensionName, $dimensionColumnName);
                }
                break;

            case AbstractMeasureUIMetaData::NAME_SPACE:
                list($datasetName, $measureName) = ReferencePathHelper::splitReference($name);
                if (isset($datasetName)) {
                    $name = ReferencePathHelper::assembleReference(self::getExportDatasetName($datasetName,$metamodel), $measureName);
                }
                break;

            case FormulaUIMetaData::NAME_SPACE:
                list($datasetName, $formulaName) = ReferencePathHelper::splitReference($name);
                if (isset($datasetName)) {
                    $name = ReferencePathHelper::assembleReference(self::getExportDatasetName($datasetName,$metamodel), $formulaName);
                }
                break;

            default:
                $message = t('Unsupported UI Meta Data name space: @uiMetaDataName', array('@uiMetaDataName' => $uiMetaDataName));
                LogHelper::log_error($message);
                throw new UnsupportedOperationException($message);
        }

        return AbstractDatasetUIMetaDataGenerator::prepareElementUIMetaDataName($elementNameSpace, $name);
    }
    public static function parseUIMetaDataName($defaultDatasetName, $uiMetaDataName, array $options = NULL) {
        $parsedUIMetaDataName = NULL;

        list($elementNameSpace, $name) = AbstractDatasetUIMetaDataGenerator::splitElementUIMetaDataName($uiMetaDataName);
        switch ($elementNameSpace) {
            case AbstractAttributeUIMetaData::NAME_SPACE:
                $parsedUIMetaDataName = new AttributeParsedUIMetaDataName();
                list($parsedUIMetaDataName->name, $parsedUIMetaDataName->columnName) = ParameterNameHelper::split($name);
                list($parsedUIMetaDataName->datasetName) = ReferencePathHelper::splitReference($parsedUIMetaDataName->name);
                break;
            case AbstractMeasureUIMetaData::NAME_SPACE:
                $parsedUIMetaDataName = new MeasureParsedUIMetaDataName();
                $parsedUIMetaDataName->name = $name;
                list($parsedUIMetaDataName->datasetName) = ReferencePathHelper::splitReference($parsedUIMetaDataName->name);
                break;
            case FormulaUIMetaData::NAME_SPACE:
                list($datasetName, $formulaName) = ReferencePathHelper::splitReference($name);

                // looking for formula configuration
                $selectedFormula = NULL;
                if (isset($options[AbstractQueryRequest::OPTION__FORMULA_DEF])) {
                    $formulas = $options[AbstractQueryRequest::OPTION__FORMULA_DEF];
                    foreach ($formulas as $formula) {
                        if ($formula->name == $formulaName) {
                            $selectedFormula = $formula;
                            break;
                        }
                    }
                }
                if (!isset($selectedFormula)) {
                    throw new IllegalStateException(t(
                        'Undefined formula configuration: %formulaName',
                        array('%formulaName' => $name)));
                }

                $parsedUIMetaDataName = isset($selectedFormula->isMeasure) && $selectedFormula->isMeasure
                    ? new FormulaMeasureParsedUIMetaDataName()
                    : new FormulaAttributeParsedUIMetaDataName();
                $parsedUIMetaDataName->name = $name;
                $parsedUIMetaDataName->datasetName = $datasetName;

                break;
            default:
                throw new UnsupportedOperationException(t('Unsupported UI Meta Data name space: %uiMetaDataName', array('%uiMetaDataName' => $uiMetaDataName)));
        }

        if (!isset($parsedUIMetaDataName->datasetName)) {
            $parsedUIMetaDataName->datasetName = $defaultDatasetName;
        }

        return $parsedUIMetaDataName;
    }
    private function detectColumnsWithLevelDefinition ( $uiColumnName ) {

        list($namespace, $columnName) = \AbstractDatasetUIMetaDataGenerator::splitElementUIMetaDataName($uiColumnName);
        if (!isset($namespace)) {
            throw new \IllegalArgumentException(t(
                'Name space has not been defined for the column name: @columnName',
                array('@columnName' => $uiColumnName)));
        }

        $result = null;

        /**
        if ( strpos(trim($uiColumnName),'.date.') !== false ) {
            return null;
        }

        if ( strpos(trim($uiColumnName),'.year.') !== false ) {
            return null;
        }

        if ( strpos(trim($uiColumnName),'.month.') !== false ) {
            return null;
        }

        if ( strpos(trim($uiColumnName),'.quarter.') !== false ) {
            return null;
        }
        **/

        if ($namespace == \AbstractAttributeUIMetaData::NAME_SPACE) {
            $elements = explode(\ParameterNameHelper::DELIMITER__DEFAULT, $columnName);

            list($dimensionReference, $dimensionName) = \ReferencePathHelper::splitReference($elements[0]);
            $levelName = isset($elements[1]) ? $elements[1] : NULL;
            $leafName = isset($elements[2]) ? $elements[2] : NULL;

            if (isset($levelName)) {
                if (isset($leafName) && ($dimensionName != $levelName)) {
                    $result = 'Unsupported level definition in the column name for attribute.';
                }
            }
        } else if ($namespace == \AbstractMeasureUIMetaData::NAME_SPACE) {
            // changing name for distinct count measure
            list($measureReference, $measureName) = \ReferencePathHelper::splitReference($columnName);
            $parts = explode(\StarSchemaNamingConvention::MEASURE_NAME_DELIMITER, $measureName);
            if (isset($parts[2]) && ($parts[2] == \StarSchemaNamingConvention::$MEASURE_NAME_SUFFIX__DISTINCT_COUNT)) {
                if ($parts[0] != $parts[1]) {
                    if ($parts[1] == 'date') {
                        // it is distinct count measure for date dimension
                    }
                    else {
                        $result = 'Unsupported level definition in the column name for attribute\'s distinct count measure';
                    }
                }
            }
        }

        return $result;
    }