Skip to content
Snippets Groups Projects
Commit f3b032f5 authored by Martin Vogel's avatar Martin Vogel
Browse files

refactor: use static import (planning#1684))

parent be8f744f
No related branches found
No related tags found
1 merge request!322Fix ARS Validation Scope (planning#1684)
......@@ -31,11 +31,11 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static dev.fitko.fitconnect.api.domain.validation.ValidationResult.error;
import static dev.fitko.fitconnect.api.domain.validation.ValidationResult.ok;
import static java.util.Collections.emptyList;
import static java.util.stream.Collectors.toList;
public class RouteVerifier implements RoutingVerificationService {
......@@ -135,7 +135,7 @@ public class RouteVerifier implements RoutingVerificationService {
final List<RouteService> services = claims.getListClaim("services").stream()
.map(service -> new RouteService((Map<String, List<String>>) service))
.collect(Collectors.toList());
.collect(toList());
final var serviceId = getIdFromIdentifier(requestedServiceIdentifier);
if (services.stream().noneMatch(service -> service.hasMatchingService(serviceId))) {
......@@ -200,8 +200,8 @@ public class RouteVerifier implements RoutingVerificationService {
private final List<String> serviceIds;
protected RouteService(final Map<String, List<String>> service) {
regionIds = service.getOrDefault("gebietIDs", emptyList()).stream().map(RouteVerifier::getIdFromIdentifier).collect(Collectors.toList());
serviceIds = service.getOrDefault("leistungIDs", emptyList()).stream().map(RouteVerifier::getIdFromIdentifier).collect(Collectors.toList());
regionIds = service.getOrDefault("gebietIDs", emptyList()).stream().map(RouteVerifier::getIdFromIdentifier).collect(toList());
serviceIds = service.getOrDefault("leistungIDs", emptyList()).stream().map(RouteVerifier::getIdFromIdentifier).collect(toList());
}
public boolean hasMatchingRegionAndService(final String regionId, final String serviceId) {
......@@ -213,7 +213,7 @@ public class RouteVerifier implements RoutingVerificationService {
}
public boolean hasMatchingService(final String serviceId) {
return serviceIds.stream().anyMatch(serviceId::contains);
return serviceIds.contains(serviceId);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment