[Subcommunities] added to the list of the communities also the sub community identifiers

This commit is contained in:
Miriam Baglioni 2024-11-21 11:02:52 +01:00
parent 896de42598
commit 9ee061ee90
1 changed files with 11 additions and 1 deletions

View File

@ -345,7 +345,17 @@ public class Utils implements Serializable {
public static List<String> getCommunityIdList(String baseURL) throws IOException {
return getValidCommunities(baseURL)
.stream()
.map(CommunityModel::getId)
.flatMap(communityModel -> {
List<String> communityIds = new ArrayList<>();
communityIds.add(communityModel.getId());
try {
Utils.getSubcommunities(communityModel.getId(), baseURL).forEach(sc -> communityIds.add(sc.getSubCommunityId()));
} catch (IOException e) {
throw new RuntimeException(e);
}
return communityIds.stream();
})
.collect(Collectors.toList());
}