Skip to content
Snippets Groups Projects
Commit 81551fec authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6522 refactor deprecated old bayernid type

parent baee1727
No related branches found
No related tags found
No related merge requests found
......@@ -25,10 +25,10 @@ package de.ozgcloud.nachrichten.postfach;
import java.time.ZonedDateTime;
import java.util.Collection;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Stream;
import jakarta.annotation.PostConstruct;
......@@ -241,19 +241,15 @@ class PostfachService {
}
public Stream<Postfach> getPostfachs() {
Supplier<Stream<PostfachRemoteService>> postfachRemoteServicesStream = () -> postfachRemoteServices.stream().flatMap(Collection::stream);
var oldBayernIdPostfachStream = buildOldBayernIdPostfach(postfachRemoteServicesStream.get());
var postfachsStream = postfachRemoteServicesStream.get().map(this::buildPostfach);
return Stream.concat(postfachsStream, oldBayernIdPostfachStream);
return postfachRemoteServices.stream().flatMap(Collection::stream).map(this::getPostfaecher).flatMap(Collection::stream);
}
// TODO Nach Umstellung auf BAYERN_ID entfernen
private Stream<Postfach> buildOldBayernIdPostfach(Stream<PostfachRemoteService> postfachRemoteServicesStream) {
return postfachRemoteServicesStream.filter(remotePostfach -> "BAYERN_ID".equals(remotePostfach.getPostfachType()))
.map(remotePostfach -> Postfach.builder()
.type("BayernId")
.isReplyAllowed(isReplyAllowed(remotePostfach))
.build());
private List<Postfach> getPostfaecher(PostfachRemoteService remoteService) {
var postfach = buildPostfach(remoteService);
return "BAYERN_ID".equals(remoteService.getPostfachType())
? List.of(postfach, Postfach.builder().type("BayernId").isReplyAllowed(postfach.isReplyAllowed()).build())
: List.of(postfach);
}
Postfach buildPostfach(PostfachRemoteService postfachRemoteService) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment