From 81909c7737fa4314654a9c2e41d9067de847dc44 Mon Sep 17 00:00:00 2001 From: Giuseppe Nespolino Date: Fri, 3 Nov 2023 17:43:11 +0100 Subject: [PATCH] Fix: #37. Support asset/ folders. (#78) --- build.gradle | 2 +- .../dependency-check/dependency-check-known-issues.xml | 3 +++ .../ndc/harvester/AgencyRepositoryService.java | 6 +++++- .../gov/innovazione/ndc/harvester/SemanticAssetType.java | 9 +++++++-- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 8319f52d..92a56a5b 100644 --- a/build.gradle +++ b/build.gradle @@ -65,7 +65,7 @@ dependencies { implementation 'io.swagger:swagger-annotations:1.5.20' implementation 'org.mapstruct:mapstruct:1.4.2.Final' - runtimeOnly 'mysql:mysql-connector-java:8.0.33' + runtimeOnly 'com.mysql:mysql-connector-j:8.2.0' compileOnly 'org.projectlombok:lombok' testCompileOnly 'org.projectlombok:lombok' diff --git a/config/dependency-check/dependency-check-known-issues.xml b/config/dependency-check/dependency-check-known-issues.xml index 7546f4fa..09f6ac88 100644 --- a/config/dependency-check/dependency-check-known-issues.xml +++ b/config/dependency-check/dependency-check-known-issues.xml @@ -13,4 +13,7 @@ CVE-2023-4759 + + CVE-2023-45960 + diff --git a/src/main/java/it/gov/innovazione/ndc/harvester/AgencyRepositoryService.java b/src/main/java/it/gov/innovazione/ndc/harvester/AgencyRepositoryService.java index a3acafd7..2ba33d65 100644 --- a/src/main/java/it/gov/innovazione/ndc/harvester/AgencyRepositoryService.java +++ b/src/main/java/it/gov/innovazione/ndc/harvester/AgencyRepositoryService.java @@ -80,7 +80,11 @@ private

List

findPaths(Path clonedRepo, Semanti Path assetRootPath = Path.of(clonedRepo.toString(), type.getFolderName()); if (!fileUtils.folderExists(assetRootPath)) { log.warn("No {} folder found in {}", type.getDescription(), clonedRepo); - return List.of(); + + assetRootPath = Path.of(clonedRepo.toString(), type.getLegacyFolderName()); + if (!fileUtils.folderExists(assetRootPath)) { + return List.of(); + } } return createSemanticAssetPaths(assetRootPath, scanner, type.isIgnoringObsoleteVersions()); diff --git a/src/main/java/it/gov/innovazione/ndc/harvester/SemanticAssetType.java b/src/main/java/it/gov/innovazione/ndc/harvester/SemanticAssetType.java index 6a46aa49..b1fcc29f 100644 --- a/src/main/java/it/gov/innovazione/ndc/harvester/SemanticAssetType.java +++ b/src/main/java/it/gov/innovazione/ndc/harvester/SemanticAssetType.java @@ -5,27 +5,32 @@ @Getter public enum SemanticAssetType { ONTOLOGY("ontology", + "assets/ontologies", "Ontologie", "http://www.w3.org/2002/07/owl#Ontology", true), CONTROLLED_VOCABULARY("controlled vocabulary", + "assets/vocabularies", "VocabolariControllati", "http://dati.gov.it/onto/dcatapit#Dataset", false), SCHEMA("schema", + "assets/schemas", "Schema", "http://dati.gov.it/onto/dcatapit#Dataset", false); private final String description; private final String folderName; + private final String legacyFolderName; private final String typeIri; private final boolean isIgnoringObsoleteVersions; - SemanticAssetType(String description, String folderName, String typeIri, - boolean isIgnoringObsoleteVersions) { + SemanticAssetType(String description, String folderName, String legacyFolderName, + String typeIri, boolean isIgnoringObsoleteVersions) { this.description = description; this.folderName = folderName; + this.legacyFolderName = legacyFolderName; this.typeIri = typeIri; this.isIgnoringObsoleteVersions = isIgnoringObsoleteVersions; }