protected function selectBoundary4CubeRequest(DataControllerCallContext $callcontext, CubeQueryRequest $request, $datasetName, $columnName)
 {
     $isSortAscending = $this->isSortAscending();
     $resultColumnName = NULL;
     // preparing new cube meta data
     $expressionRequest = new CubeQueryRequest($request->getCubeName());
     // 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->values as $propertyValue) {
                 foreach ($propertyValue->values as $value) {
                     if ($value->isSubsetBased()) {
                         // skipping other instances which are based on subset of data if their weight is greater than of this operator
                         if (isset($value->weight) && $value->weight > $this->operatorHandler->weight) {
                             continue;
                         }
                     }
                     // updating request configuration for the value supported by this class
                     if ($this->operatorHandler === $value) {
                         $resultColumnName = ParameterHelper::assembleParameterName($query->dimensionName, $query->levelName, $propertyValue->name);
                         // returning only observing property of the dimension level
                         $expressionRequest->addDimensionLevelProperty(0, $query->dimensionName, $query->levelName, $propertyValue->name);
                         // ... and excluding NULL values from evaluation
                         $expressionRequest->addDimensionLevelPropertyQueryValue($query->dimensionName, $query->levelName, $propertyValue->name, data_controller_get_operator_factory_instance()->initiateHandler(NotEqualOperatorHandler::$OPERATOR__NAME, NULL));
                         // sorting data
                         $expressionRequest->addOrderByColumn(PropertyBasedComparator_DefaultSortingConfiguration::assembleDirectionalPropertyName($resultColumnName, $isSortAscending));
                     } else {
                         $expressionRequest->addDimensionLevelPropertyQueryValue($query->dimensionName, $query->levelName, $propertyValue->name, $value);
                     }
                 }
             }
         }
     }
     // -- source dataset property queries
     $sourceDatasetPropertyQueries = $request->findSourceDatasetPropertyQueries();
     if (isset($sourceDatasetPropertyQueries)) {
         foreach ($sourceDatasetPropertyQueries as $query) {
             foreach ($query->values as $value) {
                 if ($value->isSubsetBased()) {
                     throw new UnsupportedOperationException(t('Boundary-related operator cannot filter cube source dataset property values yet'));
                 }
             }
             $expressionRequest->queries[] = clone $query;
         }
     }
     // -- measure queries
     $measureQueries = $request->findMeasureQueries();
     if (isset($measureQueries)) {
         foreach ($measureQueries as $query) {
             foreach ($query->values as $value) {
                 if ($value->isSubsetBased()) {
                     throw new UnsupportedOperationException(t('Boundary-related operator cannot filter measure values yet'));
                 }
             }
             $expressionRequest->queries[] = clone $query;
         }
     }
     // limiting response to one record
     $expressionRequest->setPagination(1, 0);
     return $this->processCubeExpressionRequest($callcontext, $expressionRequest, $resultColumnName);
 }
Esempio n. 2
0
 public function importMeasureQueriesFrom(CubeQueryRequest $sourceQueryRequest)
 {
     $sourceMeasureQueries = $sourceQueryRequest->findMeasureQueries();
     if (isset($sourceMeasureQueries)) {
         foreach ($sourceMeasureQueries as $sourceMeasureQuery) {
             $this->importMeasureQueryFrom($sourceMeasureQuery);
         }
     }
 }