Skip to content

Commit

Permalink
Dataset link simplification - Document change in isInspireSimplifiedL…
Browse files Browse the repository at this point in the history
…ink and simplify valid protocols lists definitions
  • Loading branch information
josegar74 committed Nov 18, 2024
1 parent a518304 commit 6f4c9b3
Showing 1 changed file with 24 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

//Represents a link in a document
@MappedSuperclass
Expand Down Expand Up @@ -83,28 +86,6 @@ public DocumentLink() {

//--

public static List<String> validProtocols = Arrays.asList(new String[]{
"http://www.opengis.net/def/serviceType/ogc/wms".toLowerCase(),
"http://www.opengis.net/def/serviceType/ogc/wmts".toLowerCase(),
"http://www.opengis.net/def/serviceType/ogc/wfs".toLowerCase(),
"https://tools.ietf.org/html/rfc4287".toLowerCase(),
"ATOM Syndication Format".toLowerCase(),
"OGC Web Feature Service".toLowerCase(),
"OGC Web Map Service".toLowerCase(),
"OGC Web Map Tile Service".toLowerCase(),
"OGC:WMS".toLowerCase(),
"wms",
"OGC:WMTS".toLowerCase(),
"wmts",
"OGC:WFS".toLowerCase(),
"wfs",
"atom",
"http://www.opengeospatial.org/standards/wms",
"http://www.opengeospatial.org/standards/wmts",
"http://www.opengeospatial.org/standards/wfs",
"INSPIRE Atom".toLowerCase()
});

public static List<String> validViewProtocols = Arrays.asList(new String[]{
"http://www.opengis.net/def/serviceType/ogc/wms".toLowerCase(),
"http://www.opengis.net/def/serviceType/ogc/wmts".toLowerCase(),
Expand All @@ -131,6 +112,8 @@ public DocumentLink() {
"INSPIRE Atom".toLowerCase()
});

public static List<String> validProtocols = Stream.concat(validViewProtocols.stream(),
validDownloadProtocols.stream()).collect(Collectors.toList());

public static List<String> validAtomProtocols = Arrays.asList(new String[]{
"https://tools.ietf.org/html/rfc4287".toLowerCase(),
Expand All @@ -147,6 +130,7 @@ public DocumentLink() {
});

public boolean isInspireSimplifiedLink() {
// Relax the check to process links with the applicationProfile information
if ((rawURL == null) || (protocol == null))
return false;
if (rawURL.isEmpty() || protocol.isEmpty())
Expand All @@ -158,6 +142,24 @@ public boolean isInspireSimplifiedLink() {
return true;
}

/*public boolean isInspireSimplifiedLink() {
if ((rawURL == null) || (protocol == null) || (applicationProfile == null))
if ((rawURL == null) || (protocol == null))
return false;
if (rawURL.isEmpty() || protocol.isEmpty() || applicationProfile.isEmpty())
if (rawURL.isEmpty() || protocol.isEmpty())
return false;
if (!validProtocols.contains(protocol.toLowerCase()))
return false;
if (!validAppProfiles.contains(applicationProfile.toLowerCase()))
return false;
return true;
}*/



//--

Expand Down

0 comments on commit 6f4c9b3

Please sign in to comment.