* get own report details * * @param int $reportId * @return array * @throws Exception */
(int $reportId, $replace = true)
| 137 | * @throws Exception |
| 138 | */ |
| 139 | public function read(int $reportId, $replace = true) { |
| 140 | $ownReport = $this->ReportMapper->readOwn($reportId); |
| 141 | if (!empty($ownReport)) { |
| 142 | if ((int)$ownReport['type'] === DatasourceController::DATASET_TYPE_INTERNAL_DB) { |
| 143 | if ((int)$ownReport['dataset'] <= 0 |
| 144 | || empty($this->DatasetService->readOwn((int)$ownReport['dataset']))) { |
| 145 | return []; |
| 146 | } |
| 147 | } else if ((int)$ownReport['dataset'] !== 0) { |
| 148 | return []; |
| 149 | } |
| 150 | } |
| 151 | if (!empty($ownReport)) { |
| 152 | $ownReport['permissions'] = \OCP\Constants::PERMISSION_UPDATE; |
| 153 | if ($replace) $ownReport = $this->VariableService->replaceTextVariables($ownReport); |
| 154 | |
| 155 | if ($ownReport['type'] === DatasourceController::DATASET_TYPE_INTERNAL_DB && $ownReport['dataset'] !== 0) { |
| 156 | $dataset = $this->DatasetService->readOwn($ownReport['dataset']); |
| 157 | $ownReport['storageMode'] = $dataset['storageMode'] ?? 'legacy'; |
| 158 | $ownReport['schemaVersion'] = (int)($dataset['schemaVersion'] ?? 0); |
| 159 | if ($ownReport['storageMode'] === 'flexible_shared') { |
| 160 | $ownReport['columns'] = $dataset['columns'] ?? []; |
| 161 | } else { |
| 162 | $ownReport['dimension1'] = $dataset['dimension1']; |
| 163 | $ownReport['dimension2'] = $dataset['dimension2']; |
| 164 | $ownReport['value'] = $dataset['value']; |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | } |
| 169 | return $ownReport; |
| 170 | } |
| 171 | |
| 172 | /** Return only an owned report with an owned internal dataset. */ |
| 173 | public function readOwnDatasetReport(int $reportId): array { |
no test coverage detected