parameter to obtain a single subcommunity
This commit is contained in:
parent
6c6253115a
commit
bc8acad413
|
@ -59,12 +59,14 @@ public class SubCommunityApiController extends AbstractExporterController {
|
||||||
@ApiResponse(responseCode = "404", description = "not found"),
|
@ApiResponse(responseCode = "404", description = "not found"),
|
||||||
@ApiResponse(responseCode = "500", description = "unexpected error")
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
})
|
})
|
||||||
public List<SubCommunity> getSubCommunities(@PathVariable final String id, @RequestParam(required = false, defaultValue = "false") final boolean all)
|
public List<SubCommunity> getSubCommunities(@PathVariable final String id,
|
||||||
|
@RequestParam(required = false) final String subCommunityId,
|
||||||
|
@RequestParam(required = false, defaultValue = "false") final boolean all)
|
||||||
throws CommunityException {
|
throws CommunityException {
|
||||||
try {
|
try {
|
||||||
return communityService.getSubCommunitiesForCommunity(id)
|
return communityService.getSubCommunitiesForCommunity(id)
|
||||||
.stream()
|
.stream()
|
||||||
.filter(sc -> all || sc.isBrowsable())
|
.filter(sc -> subCommunityId != null ? subCommunityId.equals(sc.getSubCommunityId()) : all || sc.isBrowsable())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
} catch (final ResourceNotFoundException e) {
|
} catch (final ResourceNotFoundException e) {
|
||||||
throw e;
|
throw e;
|
||||||
|
|
Loading…
Reference in New Issue