Refactor getManagerFromQuery method

This commit is contained in:
AsamK 2023-11-09 16:36:01 +01:00
parent 3027ba2cf1
commit 6b04197eaa

View file

@ -201,22 +201,22 @@ public class HttpServerHandler {
} }
private List<Manager> getManagerFromQuery(final Map<String, String> query) { private List<Manager> getManagerFromQuery(final Map<String, String> query) {
List<Manager> managers;
if (m != null) { if (m != null) {
managers = List.of(m); return List.of(m);
} else { }
if (c != null) {
final var account = query.get("account"); final var account = query.get("account");
if (account == null || account.isEmpty()) { if (account == null || account.isEmpty()) {
managers = c.getManagers(); return c.getManagers();
} else { } else {
final var manager = c.getManager(account); final var manager = c.getManager(account);
if (manager == null) { if (manager == null) {
return null; return null;
} }
managers = List.of(manager); return List.of(manager);
} }
} }
return managers; return List.of();
} }
private List<Pair<Manager, Manager.ReceiveMessageHandler>> subscribeReceiveHandlers( private List<Pair<Manager, Manager.ReceiveMessageHandler>> subscribeReceiveHandlers(