Skip to content
Snippets Groups Projects
Verified Commit 9f321aa5 authored by Jesper Zedlitz's avatar Jesper Zedlitz
Browse files

Serien ohne Download und Dienst können ignoriert werden

parent 992a6117
No related branches found
No related tags found
1 merge request!23Resolve "Serien ohne Distributionen ignorieren"
Pipeline #818 passed
......@@ -40,6 +40,7 @@ Jede Brücke benötigt mindestens zwei Informationen:
| `BRIDGE_x_FIX_MISSING_TEMPORAL` | pro Brücke | ist hier eine 1 gesetzt, wird bei fehlender zeitlicher Coverage das Veröffentlichungsdatum als Startdatum verwendet |
| `BRIDGE_x_FILTER_OPENDATA` | pro Brücke | ist hier eine 1 gesetzt, wird bei jeder Suche automatisch die Filterbedingung `Subject=opendata` eingefügt |
| `BRIDGE_x_SORT_RESULTS` | pro Brücke | ist hier 0 oder `false` gesetzt, wird beim `GetRecords`-Aufruf keine Sortierung angefordert |
| `BRIDGE_x_IGNORE_SERIES_WITHOUT_DISTRIBUTION` | pro Brücke | ist hier 1 oder `true` gesetzt, werden Serien, die keinen Download oder gekoppelten Dienst haben, ignoriert und nicht mit in die Ausgabe geschrieben |
| `BRIDGE_PORT` | global | Nummer des TCP-Ports, auf dem das Programm hören soll |
| `BRIDGE_BASE_URL` | global | Adresse unter der die CSW2DCAT von außen erreichbar sein wird |
| `BRIDGE_VERBOSE_LOGGING` | global | (existierendes) Verzeichnis, in das alle Antworten des CSW und alle als Ausgaben erzeugten DCAT-AP.de-Dokumente geschrieben werden |
......
......@@ -31,4 +31,11 @@ public class BridgeSettings {
boolean findWMSinInfo = false;
boolean sortResults = true;
/**
* A geo series might not have a download option (which is totally valid). If this option is set to <code>true</code>
* these series will be ignored.
*/
boolean ignoreSeriesWithoutDistribution = false;
}
......@@ -935,7 +935,13 @@ public class MDMetadata2Dataset {
}
}
}
}
if (settings.ignoreSeriesWithoutDistribution && !dataset.hasProperty(DCAT.distribution)) {
// Geo series might not have a download option or a couple service (which is totally valid). If configured,
// this kind of series will be ignored.
dataset.removeProperties();
return null;
}
return dataset;
......
......@@ -89,6 +89,7 @@ public class Server implements HttpHandler {
settings.addMissingTemporalStart = BooleanUtils.toBoolean(System.getenv("BRIDGE" + prefix + "_FIX_MISSING_TEMPORAL"));
settings.filterOpenData = BooleanUtils.toBoolean(System.getenv("BRIDGE" + prefix + "_FILTER_OPENDATA"));
settings.authorization = StringUtils.defaultString(System.getenv("BRIDGE" + prefix + "_AUTHORIZATION"));
settings.ignoreSeriesWithoutDistribution = BooleanUtils.toBoolean(System.getenv("BRIDGE" + prefix + "_IGNORE_SERIES_WITHOUT_DISTRIBUTION"));
if (System.getenv("BRIDGE" + prefix + "_SORT_RESULTS") != null) {
settings.sortResults = BooleanUtils.toBoolean(System.getenv("BRIDGE" + prefix + "_SORT_RESULTS"));
......
......@@ -1388,4 +1388,18 @@ public class MDMetadata2DatasetTests {
assertEquals(FILE_TYPE_SHP, distribution.getProperty(DCTerms.format).getResource());
}
/**
* This geo series does not have a download option (which is totally valid). If the configuration "skip
* series without distribution" is set this series will be ignored.
*/
@Test
public void convert_SeriesWithoutDistribution() throws DocumentException, IOException {
final Document inputDocument = saxReader.read(getClass().getResourceAsStream("/d3c6c074-4d69-4b1f-9efb-dbd9644f82c0.xml"));
service.getSettings().ignoreSeriesWithoutDistribution = true;
final Resource result = service.convert(inputDocument);
assertNull(result);
}
}
......@@ -107,6 +107,8 @@ public class ServerTests {
environmentVariables.set("BRIDGE_2_FILTER_OPENDATA", "true");
environmentVariables.set("BRIDGE_2_SORT_RESULTS", "false");
environmentVariables.set("BRIDGE_2_TYPE_INCLUDE", "dataset,series");
environmentVariables.set("BRIDGE_2_IGNORE_SERIES_WITHOUT_DISTRIBUTION", "true");
environmentVariables.set("BRIDGE_3_URL", "http://localhost:8083/csw");
environmentVariables.set("BRIDGE_3_SORT_RESULTS", "1");
......@@ -129,6 +131,9 @@ public class ServerTests {
assertTrue(settings1.sortResults);
assertFalse(settings2.sortResults);
assertTrue(settings3.sortResults);
assertFalse(settings1.ignoreSeriesWithoutDistribution);
assertTrue(settings2.ignoreSeriesWithoutDistribution);
assertFalse(settings1.ignoreSeriesWithoutDistribution);
assertNotNull(settings1.typeExclude);
assertEquals(3, settings1.typeExclude.length);
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment