Example #1
0
 public function buildQuery(QueryContext $context)
 {
     $name = FlagStructure::normalizeName($this->name);
     $flag = $context->getFlag($name);
     if (!$flag) {
         throw new QueryException(sprintf('Flag "%s" does not exist', $this->name));
     }
     return ['term' => [$flag->getIndexField() => $this->set]];
 }
Example #2
0
 /**
  * @param \databox[] $databoxes
  * @return self
  */
 public static function createFromDataboxes(array $databoxes)
 {
     $fields = [];
     $flags = [];
     foreach ($databoxes as $databox) {
         foreach ($databox->get_meta_structure() as $fieldStructure) {
             $fields[] = Field::createFromLegacyField($fieldStructure);
         }
         foreach ($databox->getStatusStructure() as $status) {
             $flags[] = Flag::createFromLegacyStatus($status);
         }
     }
     return new self($fields, $flags, MetadataHelper::createTags());
 }
 private function getFlagsKey(\appbox $appbox)
 {
     $flags = [];
     foreach ($appbox->get_databoxes() as $databox) {
         $databoxId = $databox->get_sbas_id();
         $statusStructure = $databox->getStatusStructure();
         foreach ($statusStructure as $bit => $status) {
             $flags[$databoxId][$bit] = Flag::normalizeName($status['labelon']);
         }
     }
     return $flags;
 }