Skip to content
Snippets Groups Projects
Commit 2a520d9d authored by Jesper Zedlitz's avatar Jesper Zedlitz
Browse files

Code formatiert, Logging bei Lizenzen verringert

parent b5a691f8
No related branches found
No related tags found
No related merge requests found
Pipeline #690 passed
......@@ -25,10 +25,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
......@@ -46,11 +46,11 @@ public class MDMetadata2Dataset {
static IRIFactory factory = IRIFactory.iriImplementation();
private final Model model;
private final Map<String, String> keywordMapping = new HashMap<>();
private final Map<String, JSONObject> url2license = new HashMap<>();
Map<String, String[]> themeMapping = new HashMap<>();
boolean ignoreInvalidMapping = true;
private CswInterface cswInterface;
private BridgeSettings settings;
private final Map<String, JSONObject> url2license = new HashMap<>();
public MDMetadata2Dataset(Model model, CswInterface cswInterface, BridgeSettings bridgeSettings) {
this(model);
......@@ -563,7 +563,7 @@ public class MDMetadata2Dataset {
if (license != null && license.has("uri")) {
resource.addProperty(DCTerms.license, model.createResource(license.getString("uri")));
} else {
log.info("Unknown license: {}", licenseURL);
log.debug("Unknown license: {}", licenseURL);
handleUnknownLicense(resource, licenseInformation.getString("id"));
}
}
......@@ -574,14 +574,10 @@ public class MDMetadata2Dataset {
}
private void handleUnknownLicense(Resource resource, String licenseId) {
try {
licenseId = URLEncoder.encode(licenseId, "UTF-8")
licenseId = URLEncoder.encode(licenseId, StandardCharsets.UTF_8)
.replaceAll("%2F", "/"); // Replace the encoded slash with the original slash
resource.addProperty(DCTerms.license, model.createResource("http://dcat-ap.de/def/licenses/" + licenseId));
log.info("Falling back to: {}", licenseId);
} catch (UnsupportedEncodingException e) {
log.info("Unable to encode licenseId: {}", e);
}
log.debug("Falling back to: {}", licenseId);
}
private Resource guessFormat(String url) {
......@@ -936,7 +932,6 @@ public class MDMetadata2Dataset {
}
private boolean isMultiFormatDataset(Element metadata) {
final List<Node> formatElements = metadata.selectNodes("gmd:distributionInfo/*/gmd:distributionFormat");
return formatElements.size() > 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment