public function dropDimensionStorage(DataControllerCallContext $callcontext, DataSourceStructureHandler $datasourceStructureHandler, DatasetMetaData $logicalDataset, $columnName) {
        $lookupDatasetName = StarSchemaNamingConvention::getAttributeRelatedName($logicalDataset->name, $columnName);

        $request = new DatasetStorageRequest($lookupDatasetName);
        LogHelper::log_debug($request);
        $datasourceStructureHandler->dropDatasetStorage($callcontext, $request);

        parent::dropDimensionStorage($callcontext, $datasourceStructureHandler, $logicalDataset, $columnName);
    }
    public static function getNewDatasetName ( $datasetUuid, $datasets ) {
        $logicalDatasetUuid = StarSchemaNamingConvention::findFactsOwner($datasetUuid);

        if (isset($logicalDatasetUuid)) {
            $dataset = GD_DatasetMetaModelLoaderHelper::getDatasetByUUID($datasets, $logicalDatasetUuid);
            return StarSchemaNamingConvention::getFactsRelatedName($dataset->name);
        } else {
            $dataset = GD_DatasetMetaModelLoaderHelper::getDatasetByUUID($datasets,$datasetUuid);
            return $dataset->name;
        }
    }
    public static function getExportDatasetName ( $datasetName, MetaModel $metamodel ) {
        $logicalDatasetName = StarSchemaNamingConvention::findFactsOwner($datasetName);

        if (isset($logicalDatasetName)) {
            $dataset = $metamodel->getDataset($logicalDatasetName);
            return isset($dataset->uuid) ? StarSchemaNamingConvention::getFactsRelatedName($dataset->uuid) : null;
        } else {
            $dataset = $metamodel->getDataset($datasetName);
            return isset($dataset->uuid) ? $dataset->uuid : null;
        }
    }
    protected function submitRecordBatch(RecordMetaData $recordMetaData) {
        $dataManipulationController = data_controller_dml_get_instance();

        $identifierLoader = new StarSchemaLookupIdentifierLoader();
        $identifierLoader->load($this->datasetName, $recordMetaData, $this->recordsHolder);

        $factsDatasetName = StarSchemaNamingConvention::getFactsRelatedName($this->datasetName);

        if ($recordMetaData->findKeyColumns() == NULL) {
            $this->insertedRecordCount += $dataManipulationController->insertDatasetRecordBatch($factsDatasetName, $this->recordsHolder);
        }
        else {
            // even if we truncate the dataset we still need to support several references to the same record
            list($insertedRecordCount, $updatedRecordCount, $deletedRecordCount) =
                $dataManipulationController->insertOrUpdateOrDeleteDatasetRecordBatch($factsDatasetName, $this->recordsHolder);
            $this->insertedRecordCount += $insertedRecordCount;
            $this->updatedRecordCount += $updatedRecordCount;
            $this->deletedRecordCount += $deletedRecordCount;
        }
    }
    protected function prepareColumnMeasures(__CubeUIMetaDataGenerator_CallContext $callcontext, AbstractAttributeUIMetaData $attributeUIMetaData, $referencePath, CubeMetaData $cube, $columnName) {
        if (isset($cube->measures)) {
            foreach ($cube->measures as $measureName => $measure) {
                if (!$measure->isUsed()) {
                    continue;
                }

                // it has been used already
                if ($callcontext->usedMeasureNames[$measureName]) {
                    continue;
                }

                $owners = StarSchemaNamingConvention::preparePossibleOwners4Measure($measureName);
                if (count($owners) != 1) {
                    continue;
                }

                $owner = $owners[0];
                if ($columnName != $owner) {
                    continue;
                }

                $measureUIMetaData = new FactMeasureUIMetaData();
                $measureUIMetaData->name = self::prepareMeasureUIMetaDataName($referencePath, $cube, $measureName);
                $measureUIMetaData->publicName = $measure->publicName;
                $measureUIMetaData->description = $measure->description;
                $measureUIMetaData->type = clone $measure->type;
                $measureUIMetaData->isSelectable = $measure->isUsed();

                // there is a problem with the measure function
                if (isset($measure->functionError)) {
                    $measureUIMetaData->description = $measure->functionError;
                    $measureUIMetaData->type = NULL;
                }

                $attributeUIMetaData->registerElement($measureUIMetaData);

                // marking that the measure as used by this fact
                $callcontext->usedMeasureNames[$measureName] = TRUE;
            }
        }
    }
 protected static function unregisterFactMeasure(CubeMetaData $cube, $columnName, $functionName)
 {
     $measureName = StarSchemaNamingConvention::getFactRelatedMeasureName($columnName, $functionName);
     $measure = $cube->findMeasure($measureName);
     if (isset($measure)) {
         $cube->unregisterMeasure($measureName);
     }
 }
    public function unprepareDimension(MetaModel $metamodel, DatasetMetaData $dataset, $columnName) {
        $datasetName = StarSchemaNamingConvention::getAttributeRelatedName($dataset->name, $columnName);

        $metamodel->unregisterDataset($datasetName);
    }
    public function dropDimensionStorage(DataControllerCallContext $callcontext, DataSourceStructureHandler $datasourceStructureHandler, DatasetMetaData $logicalDataset, $columnName) {
        $datasetName = StarSchemaNamingConvention::getFactsRelatedName($logicalDataset->name);

        $request = new UpdateDatasetStorageRequest($datasetName);
        $request->addOperation(new DropColumnReferenceOperation($columnName));
        LogHelper::log_debug($request);
        $datasourceStructureHandler->updateDatasetStorage($callcontext, $request);

        parent::dropDimensionStorage($callcontext, $datasourceStructureHandler, $logicalDataset, $columnName);
    }