This information seems to be misleading - it suggests that no keys are present in the returned map. According to my testing though, this method returns map with keys representing all registered providers and empty lists as values in case the user has no connection with the provider.
Here is my sample code:
ConnectionRepository repository = userConnectionRepository.createConnectionRepository(userId);
MultiValueMap<String, Connection<?>> connections = repository.findAllConnections();
for (String provider : connections.keySet()) {
if (!connections.get(provider).isEmpty()) { // <= this works as expected and skips the provider with no connection
Connection<?> c = connections.getFirst(provider);
Service s = new Service();
s.setName(provider);
s.setConnectionDisplayName(c.getDisplayName());
resultList.add(s);
}
}
It would be nice to fix the docs to be more precise.
Currently, the JavaDoc in
ConnectionRepository::findAllConnections()
method says following:" Returns an empty map if the user has no connections.
This information seems to be misleading - it suggests that no keys are present in the returned map. According to my testing though, this method returns map with keys representing all registered providers and empty lists as values in case the user has no connection with the provider.
Here is my sample code:
It would be nice to fix the docs to be more precise.