Transforms current message to a data processed event

@param array $metadata
@return WorkflowMessage
434048
public function answerWithDataProcessingCompleted(array $metadata = [])
    {
        $type = MessageNameUtils::getTypePartOfMessageName($this->messageName);

        $metadata = ArrayUtils::merge($this->metadata, $metadata);

        return new self(
            $this->payload,
            MessageNameUtils::getDataProcessedEventName($type),
            $this->target, //Previous target is now the origin of the answer
            $this->origin, //Previous origin is now the target of the answer
            $metadata,
            $this->processTaskListPosition,
            $this->version + 1
        );
    }
744362
public function setMetadata(string $metadata): self
    {
        $this->isValidString($metadata, 1000);

        $this->metadata = $metadata;

        return $this;
    }
7276
protected function prepareForSending(Metadata $metadata)
	{
		$this->calculateGroupingHash($metadata);
		$metadataArr = array_merge($metadata->getTags(), $metadata->getMetadata());

		$this->setReleaseStage($metadata->getStage());
		$this->setProjectRoot($metadata->getAppRootDir());
		$this->setAppVersion($metadata->getAppVersion());

		return $metadataArr;
	}
1100239
public function start($data, array $metadata = [], array $options = [])
    {
        $message_array = ['message' => $this->_serializeMessage($data)];
        if (array_key_exists('flags', $options)) {
            $message_array['flags'] = $options['flags'];
        }
        $this->call->startBatch([
            OP_SEND_INITIAL_METADATA => $metadata,
            OP_SEND_MESSAGE => $message_array,
            OP_SEND_CLOSE_FROM_CLIENT => true,
        ]);
    }
1373098
private function doPutMetadata(EntityMetadata $metadata)
    {
        if (true === $this->hasCache()) {
            $this->cache->putMetadataInCache($metadata);
        }
        $this->setToMemory($metadata);
        return $this;
    }
504020
private function processTransformers(StreamMetaData $metadata): string
    {
        $overallResult = self::RESULT_ABSTAIN;
        if ($this->transformers instanceof Closure) {
            $delayedTransformers = $this->transformers;
            $this->transformers  = $delayedTransformers();
        }
        foreach ($this->transformers as $transformer) {
            $transformationResult = $transformer->transform($metadata);
            if ($overallResult === self::RESULT_ABSTAIN && $transformationResult === self::RESULT_TRANSFORMED) {
                $overallResult = self::RESULT_TRANSFORMED;
            }
            // transformer reported about termination, next transformers will be skipped
            if ($transformationResult === self::RESULT_ABORTED) {
                $overallResult = self::RESULT_ABORTED;
                break;
            }
        }

        return $overallResult;
    }
458572
protected function parseMetadata(array $metadata): void
    {
        if (isset($metadata['arrayGroups'])) {
            foreach ($metadata['arrayGroups'] as $name => $values) {
                if (!isset($this->arrayGroups[$name])) {
                    $this->arrayGroups[$name] = array();
                }
                
                foreach ($values as $locale => $keyName) {
                    $this->arrayGroups[$name][$locale] = $keyName;
                }
            }
        }
    }
890727
public function transform($workflowTransition, array $params = array())
    {
        if (!$workflowTransition instanceof WorkflowTransitionInterface) {
            throw new TransformerParameterTypeException();
        }

        $facade = $this->newFacade();
        $facade->statusFrom = $this->getContext()->transform('status', $workflowTransition->getStatusFrom());
        $facade->statusTo = $this->getContext()->transform('status', $workflowTransition->getStatusTo());

        return $facade;
    }
24239
public function addMetadata(\TechPromux\DynamicQueryBundle\Entity\Metadata $metadata)
    {
        $this->metadatas[] = $metadata;

        return $this;
    }
906678
public function fromData(array $metaData): ModuleConfiguration
    {
        $this->validateParameterFormat($metaData);

        $this->validator->validate(
            $metaData[MetaDataProvider::METADATA_FILEPATH],
            $metaData[MetaDataProvider::METADATA_METADATA_VERSION],
            $metaData[MetaDataProvider::METADATA_MODULE_DATA]
        );

        $mappedData = $this->getMappedData(
            $metaData[MetaDataProvider::METADATA_MODULE_DATA],
            $metaData[MetaDataProvider::METADATA_PATH],
            $metaData[MetaDataProvider::METADATA_CHECKSUM]
        );

        $moduleConfiguration = new ModuleConfiguration();
        $moduleConfiguration
            ->setMetaDataCheckSum($mappedData[MetaDataProvider::METADATA_CHECKSUM])
            ->setId($mappedData[MetaDataProvider::METADATA_ID])
            ->setTitle($mappedData[MetaDataProvider::METADATA_TITLE])
            ->setDescription($mappedData[MetaDataProvider::METADATA_DESCRIPTION])
            ->setLang($mappedData[MetaDataProvider::METADATA_LANG])
            ->setThumbnail($mappedData[MetaDataProvider::METADATA_THUMBNAIL])
            ->setAuthor($mappedData[MetaDataProvider::METADATA_AUTHOR])
            ->setUrl($mappedData[MetaDataProvider::METADATA_URL])
            ->setEmail($mappedData[MetaDataProvider::METADATA_EMAIL])
            ->setSettings($mappedData[MetaDataProvider::METADATA_SETTINGS]);

        return $moduleConfiguration;
    }
1330680
protected function onMetaReceived($metaData)
    {
        foreach ($this->params as $copy => $original) {
            $metaData["columns"][$copy] = $metaData["columns"][$original];
            $metaData["columns"][$copy]["type"] = "number";
        }
        return $metaData;
    }
491919
protected function addMetaData($event, array $metaData)
    {
        if (is_array($metaData) && count($metaData)) {
            foreach ($metaData as $key => $metaDatum) {
                $method = 'set' . ucfirst($key);

                if (method_exists($event, $method)) {
                    $event->$method($metaDatum);
                }
            }
        }
    }
482549
public function prepareDataProcessing(TaskListPosition $newTaskListPosition, $target, array $metadata = [])
    {
        $type = MessageNameUtils::getTypePartOfMessageName($this->messageName);

        $metadata = ArrayUtils::merge($this->metadata, $metadata);

        return new self(
            $this->payload,
            MessageNameUtils::getProcessDataCommandName($type),
            $this->target, //Target of the last answer is the origin of the new command
            $target,
            $metadata,
            $newTaskListPosition,
            $this->version + 1
        );
    }
364382
private function sanitizeMetadata(array $metadata)
    {
        array_walk_recursive(
            $metadata,
            function ($value) {
                if (is_object($value) || is_resource($value)) {
                    throw new Exception('Metadata cannot contain objects or resources');
                }
            }
        );

        return $metadata;
    }
1041469
public function getSchemaFromMetadata(array $metadata)
    {
        $entityMetadataSchemaConfig = $this->schemaManager->createSchemaConfig();
        $schema = new Schema([], [], $entityMetadataSchemaConfig);
        $pivotTables = [];

        foreach ($metadata as $entityMetadata) {
            $this->generateTableFromMetadata($schema, $entityMetadata['table']);
            // create version table
            if (! empty($entityMetadata['versionTable'])) {
                $this->generateTableFromMetadata($schema, $entityMetadata['versionTable']);
            }

            foreach ($entityMetadata['relations'] as $relationMetadata) {
                if (! empty($relationMetadata['pivotTable'])) {
                    // create pivot table for many to many relations
                    if (! in_array($relationMetadata['pivotTable']['name'], $pivotTables)) {
                        $this->generateTableFromMetadata($schema, $relationMetadata['pivotTable']);
                    }

                    $pivotTables[] = $relationMetadata['pivotTable']['name'];
                }
            }
        }

        return $schema;
    }
341807
public function merge(ProcessingMetadata $metadata)
    {
        return new self(ArrayUtils::merge($this->metadata->toArray(), $metadata->toArray()));
    }
457240
public function andMetadata(Metadata $metadata): self
    {
        $newMetadata = $this->metadata->merge($metadata);

        return new self($this->id, $this->playhead, $newMetadata, $this->payload, $this->recordedOn);
    }