* Export Dataset * * @param int $datasetId * @return DataDownloadResponse * @throws Exception */
(int $datasetId)
| 273 | * @throws Exception |
| 274 | */ |
| 275 | public function export(int $datasetId) { |
| 276 | $result = array(); |
| 277 | $result['dataset'] = $this->DatasetMapper->read($datasetId); |
| 278 | $result['dataload'] = $this->DataloadMapper->read($datasetId); |
| 279 | $result['threshold'] = $this->ThresholdService->read($datasetId); |
| 280 | $result['favorite'] = ''; |
| 281 | |
| 282 | if ($result['dataset']['type'] === DatasourceController::DATASET_TYPE_INTERNAL_DB) { |
| 283 | if (($result['dataset']['storage_mode'] ?? 'legacy') === 'flexible_shared') { |
| 284 | $result['flexible'] = $this->FlexibleStorageService->exportDataset($datasetId); |
| 285 | } else { |
| 286 | $result['data'] = $this->StorageMapper->read($datasetId); |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | unset($result['dataset']['id'], $result['dataset']['user_id'], $result['dataset']['user_id'], $result['dataset']['parent']); |
| 291 | $data = json_encode($result); |
| 292 | return new DataDownloadResponse($data, $result['dataset']['name'] . '.export.txt', 'text/plain; charset=utf-8'); |
| 293 | } |
| 294 | |
| 295 | /** |
| 296 | * Update the context chat provider |
nothing calls this directly
no test coverage detected