protected function serialize(AbstractQueryRequest $request) {
        $parameters = NULL;

        // serializing columns names to sort result
        if (isset($request->sortingConfigurations)) {
            $sortColumns = NULL;
            foreach ($request->sortingConfigurations as $sortingConfiguration) {
                $sortColumns[] = ColumnBasedComparator_AbstractSortingConfiguration::assembleDirectionalColumnName(
                    $sortingConfiguration->getColumnName(), $sortingConfiguration->isSortAscending);
            }
            ArrayHelper::merge(
                $parameters,
                $this->serializeValue(
                    DataQueryControllerUIParameterNames::SORT,
                    DataQueryControllerUIRequestPreparer::prepareSortColumns($sortColumns)));
        }
        // serializing record offset
        if (isset($request->startWith) && ($request->startWith > 0)) {
            $parameters[DataQueryControllerUIParameterNames::OFFSET] = $request->startWith;
        }
        // serializing record limit
        if (isset($request->limit)) {
            $parameters[DataQueryControllerUIParameterNames::LIMIT] = $request->limit;
        }

        return $parameters;
    }
    protected function selectBoundary4CubeRequest(DataControllerCallContext $callcontext, AbstractCubeQueryRequest $request, $datasetName, $columnName) {
        $isSortAscending = $this->isSortAscending();

        $resultColumnName = NULL;

        // preparing new cube meta data
        $expressionRequest = new CubeQueryRequest($request->getCubeName());
        // needs to be called before any additional methods are called
        $expressionRequest->addOptions($request->options);

        // copying ONLY some query objects (excluding at least a reference to this operator)
        // -- dimension queries
        $dimensionQueries = $request->findDimensionQueries();
        if (isset($dimensionQueries)) {
            foreach ($dimensionQueries as $query) {
                foreach ($query->columns as $queryColumn) {
                    foreach ($queryColumn->values as $value) {
                        if ($this->shouldValueBeSkipped($value)) {
                            continue;
                        }

                        // updating request configuration for the value supported by this class
                        if ($this->operatorHandler === $value) {
                            $resultColumnName = ParameterNameHelper::assemble($query->name, $queryColumn->name);

                            // returning only observing column of the dimension
                            $expressionRequest->addDimensionColumn(0, $query->name, $queryColumn->name);
                            // ... and excluding NULL values from evaluation
                            $expressionRequest->addDimensionColumnQueryValue(
                                $query->name, $queryColumn->name,
                                OperatorFactory::getInstance()->initiateHandler(NotEqualOperatorHandler::OPERATOR__NAME, NULL));
                            // sorting data
                            $expressionRequest->addOrderByColumn(
                                ColumnBasedComparator_AbstractSortingConfiguration::assembleDirectionalColumnName($resultColumnName, $isSortAscending));
                        }
                        else {
                            $expressionRequest->addDimensionColumnQueryValue($query->name, $queryColumn->name, $value);
                        }
                    }
                }
            }
        }
        // -- facts dataset column queries
        $factsDatasetColumnQueries = $request->findFactsDatasetColumnQueries();
        if (isset($factsDatasetColumnQueries)) {
            foreach ($factsDatasetColumnQueries as $query) {
                $values = NULL;
                foreach ($query->values as $value) {
                    if ($this->shouldValueBeSkipped($value)) {
                        continue;
                    }
                    if ($this->operatorHandler === $value) {
                        $metamodel = data_controller_get_metamodel();
                        $cube = $metamodel->getCube($expressionRequest->getCubeName());

                        // finding dimension associated with this fact column
                        $selectedDimension = NULL;
                        if (isset($cube->dimensions)) {
                            foreach ($cube->dimensions as $dimension) {
                                if ($dimension->attributeColumnName == $query->name) {
                                    $selectedDimension = $dimension;

                                    break;
                                }
                            }
                        }
                        if (!isset($selectedDimension)) {
                            throw new IllegalArgumentException(t(
                                'Boundary-related operator cannot be applied to the facts dataset column: %columnName',
                                array('%columnName' => $query->name)));
                        }

                        $resultColumnName = ParameterNameHelper::assemble($selectedDimension->name);

                        // returning only observing column from facts dataset
                        $expressionRequest->addDimension(0, $selectedDimension->name);
                        // ... and excluding NULL values from evaluation
                        $expressionRequest->addFactsDatasetColumnQueryValue(
                            $query->name,
                            OperatorFactory::getInstance()->initiateHandler(NotEqualOperatorHandler::OPERATOR__NAME, NULL));
                        // sorting data
                        $expressionRequest->addOrderByColumn(
                            ColumnBasedComparator_AbstractSortingConfiguration::assembleDirectionalColumnName($resultColumnName, $isSortAscending));
                    }
                    else {
                        $values[] = $value;
                    }
                }
                if (isset($values)) {
                    $expressionRequest->addFactsDatasetColumnQueryValues($query->name, $values);
                }
            }
        }

        // -- measure queries
        $measureQueries = $request->findMeasureQueries();
        if (isset($measureQueries)) {
            foreach ($measureQueries as $query) {
                foreach ($query->values as $value) {
                    if ($this->shouldValueBeSkipped($value)) {
                        throw new IllegalArgumentException(t('Boundary-related operator cannot be applied to measures'));
                    }
                }
                $expressionRequest->queries[] = clone $query;
            }
        }

        // limiting response to one record
        $expressionRequest->setPagination(1, 0);

        return $this->processCubeExpressionRequest($callcontext, $expressionRequest, $resultColumnName);
    }
 public function addOrderByColumn($directionalColumnName) {
     list($columnName, $isSortAscending) = ColumnBasedComparator_AbstractSortingConfiguration::parseDirectionalColumnName($directionalColumnName);
     $this->addSortingConfiguration($this->initiateSortingConfiguration($columnName, $isSortAscending));
 }
 public function __construct($rootName, $leafName, $isSortAscending) {
     parent::__construct($isSortAscending);
     $this->rootName = $rootName;
     $this->leafName = $leafName;
 }
 public function __construct($columnName, $isSortAscending = TRUE) {
     parent::__construct($isSortAscending);
     $this->columnName = $columnName;
 }
    protected static function mapOrderBy(array $parsedUIMetaDataNames, array $columnMappings, array $orderBy = NULL, $isMeasureMapped) {
        $mappedOrderBy = NULL;

        if (isset($orderBy)) {
            foreach ($orderBy as $key => $directionalColumnName) {
                list($columnName, $isSortAscending) = ColumnBasedComparator_AbstractSortingConfiguration::parseDirectionalColumnName($directionalColumnName);
                $parsedUIMetaDataName = $parsedUIMetaDataNames[$columnName];

                if (self::isColumnMappable($parsedUIMetaDataName, TRUE, $isMeasureMapped)) {
                    $mappedOrderBy[$key] = ColumnBasedComparator_AbstractSortingConfiguration::assembleDirectionalColumnName($columnMappings[$columnName], $isSortAscending);
                }
            }
        }

        return $mappedOrderBy;
    }