Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1025,8 +1025,15 @@ public function importArchiMate(): JSONResponse
], 400);
}

// Call the ArchiMate service with file data instead of File object
$result = $this->archiMateService->importArchiMateFileFromPath($options);
// OPTIMIZATION: Use optimized method if available or if explicitly requested
$useOptimized = $this->request->getParam('useOptimized', 'true') === 'true';
if ($useOptimized && method_exists($this->archiMateService, 'importArchiMateFileFromPathOptimized')) {
$this->logger->info('Using OPTIMIZED ArchiMate import method');
$result = $this->archiMateService->importArchiMateFileFromPathOptimized($options);
} else {
$this->logger->info('Using STANDARD ArchiMate import method');
$result = $this->archiMateService->importArchiMateFileFromPath($options);
}

return new JSONResponse($result);

Expand Down
26 changes: 23 additions & 3 deletions lib/Service/SettingsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -913,22 +913,42 @@ public function loadSettings(bool $force = false): array

// Get the current app version dynamically
$currentAppVersion = $this->appManager->getAppVersion(\OCA\SoftwareCatalog\AppInfo\Application::APP_ID);


// Log the import attempt for debugging
$this->logger->info('SettingsService: Attempting to import softwarecatalogus_register.json', [
'force' => $force,
'app_id' => \OCA\SoftwareCatalog\AppInfo\Application::APP_ID,
'current_version' => $currentAppVersion,
'data_size' => strlen(json_encode($softwareCatalogSettings))
]);

$importResult = $configurationService->importFromJson(
data: $softwareCatalogSettings,
owner: null,
appId: \OCA\SoftwareCatalog\AppInfo\Application::APP_ID,
version: $currentAppVersion,
force: $force
);


$this->logger->info('SettingsService: Import completed successfully', [
'import_result' => $importResult
]);

$results['softwarecatalog_imported'] = true;
$results['import_result'] = $importResult;
} catch (\Exception $e) {
$results['softwarecatalog_import_error'] = $e->getMessage();
$this->logger->error('Failed to import softwarecatalog settings: ' . $e->getMessage(), [
'exception' => $e
'exception' => $e,
'trace' => $e->getTraceAsString(),
'force_flag' => $force,
'app_id' => \OCA\SoftwareCatalog\AppInfo\Application::APP_ID
]);

// In force mode, we want to surface import errors more prominently
if ($force) {
throw new \RuntimeException('Force import failed: ' . $e->getMessage(), 0, $e);
}
}
}
}
Expand Down
26 changes: 24 additions & 2 deletions lib/Settings/softwarecatalogus_register.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,30 @@
"version": "0.0.2",
"summary": "",
"icon": null,
"required": [],
"properties": [],
"required": [
"naam"
],
"properties": {
"naam": {
"description": "Naam van de sector",
"type": "string",
"required": true,
"visible": true,
"order": 1,
"facetable": false,
"title": "Naam",
"maxLength": 200
},
"beschrijving": {
"description": "Beschrijving van de sector",
"type": "string",
"visible": true,
"order": 2,
"facetable": false,
"title": "Beschrijving",
"maxLength": 1000
}
},
"archive": [],
"source": "",
"hardValidation": false,
Expand Down
Loading