diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java index ae228039..05e1ad52 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java @@ -44,7 +44,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; @RestController @CrossOrigin(origins = { - "*" + "*" }) @ConditionalOnProperty(value = "openaire.exporter.enable.community", havingValue = "true") @Tag(name = "OpenAIRE Communities API", description = "the OpenAIRE Community API") @@ -54,14 +54,14 @@ public class CommunityApiController extends AbstractExporterController { private CommunityService communityService; @RequestMapping(value = "/community/communities", produces = { - "application/json" + "application/json" }, method = RequestMethod.GET) @Operation(summary = "get all community profiles", description = "get all community profiles", tags = { - C, R + C, R }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public List listCommunities() throws CommunityException { try { @@ -74,15 +74,15 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/", produces = { - "application/json" + "application/json" }, method = RequestMethod.POST) @Operation(summary = "add a new community profile", description = "add a new community profile", tags = { - C, W + C, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public CommunityDetails getCommunity(@RequestBody final CommunityDetails details) throws CommunityException { try { @@ -95,15 +95,15 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}", produces = { - "application/json" + "application/json" }, method = RequestMethod.GET) @Operation(summary = "get community profile", description = "get community profile", tags = { - C, R + C, R }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public CommunityDetails getCommunity(@PathVariable final String id) throws CommunityException { try { @@ -116,19 +116,19 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}", produces = { - "application/json" + "application/json" }, method = RequestMethod.POST) @Operation(summary = "update community details", description = "update community details", tags = { - C, W + C, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public void setCommunity( - @PathVariable final String id, - @RequestBody final CommunityWritableProperties properties) throws CommunityException { + @PathVariable final String id, + @RequestBody final CommunityWritableProperties properties) throws CommunityException { try { communityService.setCommunity(id, properties); } catch (final ResourceNotFoundException e) { @@ -139,18 +139,18 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}", produces = { - "application/json" + "application/json" }, method = RequestMethod.DELETE) @Operation(summary = "delete a community", description = "delete a community", tags = { - C, W + C, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public void deleteCommunity(@PathVariable final String id, @RequestParam(required = false, defaultValue = "false") final boolean recursive) - throws CommunityException { + throws CommunityException { try { communityService.deleteCommunity(id, recursive); } catch (final ResourceNotFoundException e) { @@ -161,23 +161,23 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/projects/{page}/{size}", produces = { - "application/json" + "application/json" }, method = RequestMethod.GET) @Operation(summary = "get community projects", description = "get community projects", tags = { - C_PJ, R + C_PJ, R }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public Page getCommunityProjects(@PathVariable final String id, - @PathVariable final Integer page, - @PathVariable final Integer size, - @RequestParam(required = false) final String funder, - @RequestParam(required = false) final String searchFilter, - @RequestParam(required = false) final String orderBy) - throws CommunityException { + @PathVariable final Integer page, + @PathVariable final Integer size, + @RequestParam(required = false) final String funder, + @RequestParam(required = false) final String searchFilter, + @RequestParam(required = false) final String orderBy) + throws CommunityException { try { return communityService.getCommunityProjects(id, funder, searchFilter, page, size, orderBy); } catch (final ResourceNotFoundException e) { @@ -188,19 +188,19 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/projects", produces = { - "application/json" + "application/json" }, method = RequestMethod.POST) @Operation(summary = "associate a project to the community", description = "associate a project to the community", tags = { - C_PJ, W + C_PJ, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public CommunityProject addCommunityProject( - @PathVariable final String id, - @RequestBody final CommunityProject project) throws CommunityException { + @PathVariable final String id, + @RequestBody final CommunityProject project) throws CommunityException { try { return communityService.addCommunityProject(id, project); @@ -212,19 +212,19 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/projects", produces = { - "application/json" + "application/json" }, method = RequestMethod.DELETE) @Operation(summary = "remove a project from the community", description = "remove a project from the community", tags = { - C_PJ, W + C_PJ, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public void deleteCommunityProject( - @PathVariable final String id, - @RequestParam final String projectId) throws CommunityException { + @PathVariable final String id, + @RequestParam final String projectId) throws CommunityException { try { communityService.removeCommunityProjects(id, projectId); } catch (final ResourceNotFoundException e) { @@ -235,19 +235,19 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/projectList", produces = { - "application/json" + "application/json" }, method = RequestMethod.POST) @Operation(summary = "associate a list of project to the community", description = "associate a list of project to the community", tags = { - C_PJ, W + C_PJ, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public CommunityProject[] addCommunityProjectList( - @PathVariable final String id, - @RequestBody final CommunityProject[] projects) throws CommunityException { + @PathVariable final String id, + @RequestBody final CommunityProject[] projects) throws CommunityException { try { communityService.addCommunityProjects(id, projects); return projects; @@ -259,19 +259,19 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/projectList", produces = { - "application/json" + "application/json" }, method = RequestMethod.DELETE) @Operation(summary = "remove a list of projects from the community", description = "remove a list of projects from the community", tags = { - C_PJ, W + C_PJ, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public void deleteCommunityProjectList( - @PathVariable final String id, - @RequestBody final String[] projectIdList) throws CommunityException { + @PathVariable final String id, + @RequestBody final String[] projectIdList) throws CommunityException { try { communityService.removeCommunityProjects(id, projectIdList); } catch (final ResourceNotFoundException e) { @@ -282,18 +282,18 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/funders", produces = { - "application/json" + "application/json" }, method = RequestMethod.GET) @Operation(summary = "get the funders of the projects of a community", description = "get the funders of the projects of a community", tags = { - C_PJ, R + C_PJ, R }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public List getCommunityFunders(@PathVariable final String id) - throws CommunityException { + throws CommunityException { try { return communityService.getCommunityFunders(id); } catch (final ResourceNotFoundException e) { @@ -303,16 +303,18 @@ public class CommunityApiController extends AbstractExporterController { } } - @RequestMapping(value = "/community/{id}/contentproviders", produces = { - "application/json" + @RequestMapping(value = { + "/community/{id}/contentproviders", "/community/{id}/datasources" + }, produces = { + "application/json" }, method = RequestMethod.GET) @Operation(summary = "get the list of content providers associated to a given community", description = "get the list of content providers associated to a given community", tags = { - C_CP, R + C_CP, R }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public List getCommunityContentproviders(@PathVariable final String id) throws CommunityException { try { @@ -324,20 +326,22 @@ public class CommunityApiController extends AbstractExporterController { } } - @RequestMapping(value = "/community/{id}/contentproviders", produces = { - "application/json" + @RequestMapping(value = { + "/community/{id}/contentproviders", "/community/{id}/datasources" + }, produces = { + "application/json" }, method = RequestMethod.POST) @Operation(summary = "associate a content provider to the community", description = "associate a content provider to the community", tags = { - C_CP, W + C_CP, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public CommunityContentprovider addCommunityContentprovider( - @PathVariable final String id, - @RequestBody final CommunityContentprovider contentprovider) throws CommunityException { + @PathVariable final String id, + @RequestBody final CommunityContentprovider contentprovider) throws CommunityException { try { communityService.addCommunityContentProviders(id, contentprovider); @@ -349,20 +353,22 @@ public class CommunityApiController extends AbstractExporterController { } } - @RequestMapping(value = "/community/{id}/contentproviders", produces = { - "application/json" + @RequestMapping(value = { + "/community/{id}/contentproviders", "/community/{id}/datasources" + }, produces = { + "application/json" }, method = RequestMethod.DELETE) @Operation(summary = "remove the association between a content provider and the community", description = "remove the association between a content provider and the community", tags = { - C_CP, W + C_CP, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public void removeCommunityContentprovider( - @PathVariable final String id, - @RequestParam final String contentproviderId) throws CommunityException { + @PathVariable final String id, + @RequestParam final String contentproviderId) throws CommunityException { try { communityService.removeCommunityContentProviders(id, contentproviderId); } catch (final ResourceNotFoundException e) { @@ -372,20 +378,22 @@ public class CommunityApiController extends AbstractExporterController { } } - @RequestMapping(value = "/community/{id}/contentprovidersList", produces = { - "application/json" + @RequestMapping(value = { + "/community/{id}/contentprovidersList", "/community/{id}/datasourcesList" + }, produces = { + "application/json" }, method = RequestMethod.POST) @Operation(summary = "associate a list of content providers to the community", description = "associate a list of content providers to the community", tags = { - C_CP, W + C_CP, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public CommunityContentprovider[] addCommunityContentProvidersList( - @PathVariable final String id, - @RequestBody final CommunityContentprovider[] contentprovidersList) throws CommunityException { + @PathVariable final String id, + @RequestBody final CommunityContentprovider[] contentprovidersList) throws CommunityException { try { communityService.addCommunityContentProviders(id, contentprovidersList); @@ -397,20 +405,22 @@ public class CommunityApiController extends AbstractExporterController { } } - @RequestMapping(value = "/community/{id}/contentprovidersList", produces = { - "application/json" + @RequestMapping(value = { + "/community/{id}/contentprovidersList", "/community/{id}/datasourcesList" + }, produces = { + "application/json" }, method = RequestMethod.DELETE) @Operation(summary = "remove a list of content providers from the community", description = "remove a list of content providers from the community", tags = { - C_CP, W + C_CP, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public void deleteCommunityContentProvidersList( - @PathVariable final String id, - @RequestBody final String[] contentProviderIdList) throws CommunityException { + @PathVariable final String id, + @RequestBody final String[] contentProviderIdList) throws CommunityException { try { communityService.removeCommunityContentProviders(id, contentProviderIdList); } catch (final ResourceNotFoundException e) { @@ -423,15 +433,15 @@ public class CommunityApiController extends AbstractExporterController { // ADDING CODE FOR COMMUNITY ORGANIZATIONS @RequestMapping(value = "/community/{id}/organizations", produces = { - "application/json" + "application/json" }, method = RequestMethod.GET) @Operation(summary = "get the list of organizations for a given community", description = "get the list of organizations for a given community", tags = { - C_O, R + C_O, R }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public List getCommunityOrganizations(@PathVariable final String id) throws CommunityException { try { @@ -444,19 +454,19 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/organizations", produces = { - "application/json" + "application/json" }, method = RequestMethod.POST) @Operation(summary = "associate an organization to the community", description = "associate an organization to the community", tags = { - C_O, W + C_O, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public CommunityOrganization addCommunityOrganization( - @PathVariable final String id, - @RequestBody final CommunityOrganization organization) throws CommunityException { + @PathVariable final String id, + @RequestBody final CommunityOrganization organization) throws CommunityException { try { communityService.addCommunityOrganizations(id, organization); return organization; @@ -468,19 +478,19 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/organizationList", produces = { - "application/json" + "application/json" }, method = RequestMethod.POST) @Operation(summary = "associate a list of organizations to the community", description = "associate a list of organizations to the community", tags = { - C_O, W + C_O, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public CommunityOrganization[] addCommunityOrganizationList( - @PathVariable final String id, - @RequestBody final CommunityOrganization[] orgs) throws CommunityException { + @PathVariable final String id, + @RequestBody final CommunityOrganization[] orgs) throws CommunityException { try { communityService.addCommunityOrganizations(id, orgs); @@ -493,19 +503,19 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/organizations", produces = { - "application/json" + "application/json" }, method = RequestMethod.DELETE) @Operation(summary = "remove the association between an organization and the community", description = "remove the association between an organization and the community", tags = { - C_O, W + C_O, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public void removeCommunityOrganization( - @PathVariable final String id, - @RequestParam final String organizationName) throws CommunityException { + @PathVariable final String id, + @RequestParam final String organizationName) throws CommunityException { try { communityService.removeCommunityOrganizations(id, organizationName); } catch (final ResourceNotFoundException e) { @@ -516,19 +526,19 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/organizationList", produces = { - "application/json" + "application/json" }, method = RequestMethod.DELETE) @Operation(summary = "remove a list of associations between some organizations and the community", description = "remove a list of associations between some organizations and the community", tags = { - C_O, W + C_O, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public void removeCommunityOrganizationList( - @PathVariable final String id, - @RequestBody final String[] orgNames) throws CommunityException { + @PathVariable final String id, + @RequestBody final String[] orgNames) throws CommunityException { try { communityService.removeCommunityOrganizations(id, orgNames); } catch (final ResourceNotFoundException e) { @@ -541,19 +551,19 @@ public class CommunityApiController extends AbstractExporterController { // ********************** @RequestMapping(value = "/community/{id}/subjects", produces = { - "application/json" + "application/json" }, method = RequestMethod.POST) @Operation(summary = "associate a subject to the community", description = "associate a subject to the community", tags = { - C, W + C, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public CommunityDetails addCommunitySubjects( - @PathVariable final String id, - @RequestBody final String[] subjects) throws CommunityException { + @PathVariable final String id, + @RequestBody final String[] subjects) throws CommunityException { try { return communityService.addCommunitySubjects(id, subjects); @@ -565,19 +575,19 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/subjects", produces = { - "application/json" + "application/json" }, method = RequestMethod.DELETE) @Operation(summary = "remove subjects from a community", description = "remove subjects from a community", tags = { - C, W + C, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public CommunityDetails removeCommunitySubjects( - @PathVariable final String id, - @RequestBody final String[] subjects) throws CommunityException { + @PathVariable final String id, + @RequestBody final String[] subjects) throws CommunityException { try { return communityService.removeCommunitySubjects(id, subjects); @@ -589,19 +599,19 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/fos", produces = { - "application/json" + "application/json" }, method = RequestMethod.POST) @Operation(summary = "associate a fos to the community", description = "associate a fos to the community", tags = { - C, W + C, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public CommunityDetails addCommunityFOS( - @PathVariable final String id, - @RequestBody final String[] subjects) throws CommunityException { + @PathVariable final String id, + @RequestBody final String[] subjects) throws CommunityException { try { return communityService.addCommunityFOS(id, subjects); @@ -613,19 +623,19 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/fos", produces = { - "application/json" + "application/json" }, method = RequestMethod.DELETE) @Operation(summary = "remove fos from a community", description = "remove fos from a community", tags = { - C, W + C, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public CommunityDetails removeCommunityFOS( - @PathVariable final String id, - @RequestBody final String[] subjects) throws CommunityException { + @PathVariable final String id, + @RequestBody final String[] subjects) throws CommunityException { try { return communityService.removeCommunityFOS(id, subjects); @@ -637,19 +647,19 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/sdg", produces = { - "application/json" + "application/json" }, method = RequestMethod.POST) @Operation(summary = "associate a sdg to the community", description = "associate a sdg to the community", tags = { - C, W + C, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public CommunityDetails addCommunitySDG( - @PathVariable final String id, - @RequestBody final String[] subjects) throws CommunityException { + @PathVariable final String id, + @RequestBody final String[] subjects) throws CommunityException { try { return communityService.addCommunitySDG(id, subjects); @@ -661,19 +671,19 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/sdg", produces = { - "application/json" + "application/json" }, method = RequestMethod.DELETE) @Operation(summary = "remove sdg from a community", description = "remove sdg from a community", tags = { - C, W + C, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public CommunityDetails removeCommunitySDG( - @PathVariable final String id, - @RequestBody final String[] subjects) throws CommunityException { + @PathVariable final String id, + @RequestBody final String[] subjects) throws CommunityException { try { return communityService.removeCommunitySDG(id, subjects); @@ -685,19 +695,19 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/advancedConstraint", produces = { - "application/json" + "application/json" }, method = RequestMethod.POST) @Operation(summary = "the set of constraints to be used to extend the association between result and community", description = "the set of constraints to be used to extend the association between result and community", tags = { - C, W + C, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public CommunityDetails addAdvancedConstraint( - @PathVariable final String id, - @RequestBody final SelectionCriteria advancedConstraint) throws CommunityException { + @PathVariable final String id, + @RequestBody final SelectionCriteria advancedConstraint) throws CommunityException { try { return communityService.addCommunityAdvancedConstraint(id, advancedConstraint); @@ -709,18 +719,18 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/advancedConstraint", produces = { - "application/json" + "application/json" }, method = RequestMethod.DELETE) @Operation(summary = "remove the constraints to extend the association result community from a community", description = "remove the constraints to extend the association result community from a community", tags = { - C, W + C, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public CommunityDetails removeAdvancedConstraint( - @PathVariable final String id) throws CommunityException { + @PathVariable final String id) throws CommunityException { try { return communityService.removeCommunityAdvancedConstraint(id); @@ -732,19 +742,19 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/removeConstraint", produces = { - "application/json" + "application/json" }, method = RequestMethod.POST) @Operation(summary = "the set of constraints to be used to remove the association between result and community", description = "the set of constraints to be used to remove the association between result and community", tags = { - C, W + C, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public CommunityDetails addRemoveConstraint( - @PathVariable final String id, - @RequestBody final SelectionCriteria removeConstraint) throws CommunityException { + @PathVariable final String id, + @RequestBody final SelectionCriteria removeConstraint) throws CommunityException { try { return communityService.addCommunityRemoveConstraint(id, removeConstraint); @@ -756,15 +766,15 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/removeConstraint", produces = { - "application/json" + "application/json" }, method = RequestMethod.DELETE) @Operation(summary = "remove the constraints to remove the association beetween result and community", description = "remove the constraints to remove the association beetween result and community", tags = { - C, W + C, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public CommunityDetails removeRemoveConstraint(@PathVariable final String id) throws CommunityException { @@ -778,20 +788,20 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/zenodocommunities", produces = { - "application/json" + "application/json" }, method = RequestMethod.POST) @Operation(summary = "associate a Zenodo community to the community", description = "associate a Zenodo community to the community", tags = { - C_ZC, W + C_ZC, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public CommunityDetails addCommunityZenodoCommunity( - @PathVariable final String id, - @RequestParam(required = false, defaultValue = "false") final boolean main, - @RequestParam final String zenodocommunity) throws CommunityException { + @PathVariable final String id, + @RequestParam(required = false, defaultValue = "false") final boolean main, + @RequestParam final String zenodocommunity) throws CommunityException { try { return communityService.addCommunityZenodoCommunity(id, zenodocommunity, main); @@ -804,20 +814,20 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/zenodocommunities", produces = { - "application/json" + "application/json" }, method = RequestMethod.DELETE) @Operation(summary = "remove a Zenodo community from a community", description = "remove a Zenodo community from a community", tags = { - C_ZC, W + C_ZC, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public void removeCommunityZenodoCommunity( - @PathVariable final String id, - @RequestParam(required = false, defaultValue = "false") final boolean main, - @RequestParam final String zenodocommunity) throws CommunityException { + @PathVariable final String id, + @RequestParam(required = false, defaultValue = "false") final boolean main, + @RequestParam final String zenodocommunity) throws CommunityException { try { communityService.removeCommunityZenodoCommunity(id, zenodocommunity, main); } catch (final ResourceNotFoundException e) { @@ -828,15 +838,15 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{zenodoId}/openairecommunities", produces = { - "application/json" + "application/json" }, method = RequestMethod.GET) @Operation(summary = "get the list of OpenAIRE communities associated to a given Zenodo community", description = "get the list of OpenAIRE communities associated to a given Zenodo community", tags = { - C_ZC, R + C_ZC, R }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public CommunityOpenAIRECommunities getOpenAireCommunities(@PathVariable final String zenodoId) throws CommunityException { try { @@ -853,15 +863,15 @@ public class CommunityApiController extends AbstractExporterController { // APIs to manage the propagationOrganizationCommunityMap @RequestMapping(value = "/propagationOrganizationCommunityMap", produces = { - "application/json" + "application/json" }, method = RequestMethod.GET) @Operation(summary = "Get the propagationOrganizationCommunityMap", description = "propagationOrganizationCommunityMap", tags = { - C_O, R + C_O, R }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public Map> getPropagationOrganizationCommunityMap() throws CommunityException { try { @@ -874,15 +884,15 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/propagationOrganizations", produces = { - "application/json" + "application/json" }, method = RequestMethod.GET) @Operation(summary = "try { return the propagation organizations of a community", description = "try { return the propagation organizations of a community", tags = { - C_O, R + C_O, R }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public Set getPropagationOrganizationsForCommunity(@PathVariable final String id) throws CommunityException { try { @@ -895,18 +905,18 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/propagationOrganizations", produces = { - "application/json" + "application/json" }, method = RequestMethod.POST) @Operation(summary = "add an organization to the propagationOrganizationCommunityMap", description = "add an organization to the propagationOrganizationCommunityMap", tags = { - C_O, W + C_O, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public Set addPropagationOrganizationForCommunity(@PathVariable final String id, - @RequestParam final String organizationId) throws CommunityException { + @RequestParam final String organizationId) throws CommunityException { try { return communityService.addPropagationOrganizationForCommunity(id, organizationId.split(",")); @@ -918,18 +928,18 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/propagationOrganizations", produces = { - "application/json" + "application/json" }, method = RequestMethod.DELETE) @Operation(summary = "delete an organization to the propagationOrganizationCommunityMap", description = "delete an organization to the propagationOrganizationCommunityMap", tags = { - C_O, W + C_O, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public Set removePropagationOrganizationForCommunity(@PathVariable final String id, - @RequestParam final String organizationId) throws CommunityException { + @RequestParam final String organizationId) throws CommunityException { try { return communityService.removePropagationOrganizationForCommunity(id, organizationId.split(",")); @@ -943,23 +953,23 @@ public class CommunityApiController extends AbstractExporterController { // APIs to manage the sub communities @RequestMapping(value = "/community/{id}/subcommunities", produces = { - "application/json" + "application/json" }, method = RequestMethod.GET) @Operation(summary = "get the list of subcommunities for a given community", description = "get the list of subcommunities for a given community", tags = { - C_SUB, R + C_SUB, R }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public List getSubCommunities(@PathVariable final String id, @RequestParam(required = false, defaultValue = "false") final boolean all) - throws CommunityException { + throws CommunityException { try { return communityService.getSubCommunities(id) - .stream() - .filter(sc -> all || sc.isBrowsable()) - .collect(Collectors.toList()); + .stream() + .filter(sc -> all || sc.isBrowsable()) + .collect(Collectors.toList()); } catch (final ResourceNotFoundException e) { throw e; } catch (final Throwable e) { @@ -968,19 +978,19 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/subcommunities", produces = { - "application/json" + "application/json" }, method = RequestMethod.POST) @Operation(summary = "associate a subcommunity to the community", description = "associate a subcommunity to the community", tags = { - C_SUB, W + C_SUB, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public SubCommunity addSubCommunity( - @PathVariable final String id, - @RequestBody final SubCommunity subcommunity) throws CommunityException { + @PathVariable final String id, + @RequestBody final SubCommunity subcommunity) throws CommunityException { try { communityService.addSubCommunities(id, subcommunity); return subcommunity; @@ -992,19 +1002,19 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/subcommunitiesList", produces = { - "application/json" + "application/json" }, method = RequestMethod.POST) @Operation(summary = "associate a list of subcommunities to the community", description = "associate a list of subcommunities to the community", tags = { - C_SUB, W + C_SUB, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public SubCommunity[] addSubCommunityList( - @PathVariable final String id, - @RequestBody final SubCommunity[] subcommunities) throws CommunityException { + @PathVariable final String id, + @RequestBody final SubCommunity[] subcommunities) throws CommunityException { try { communityService.addSubCommunities(id, subcommunities); @@ -1017,19 +1027,19 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/subcommunities", produces = { - "application/json" + "application/json" }, method = RequestMethod.DELETE) @Operation(summary = "remove the association between a subcommunity and the community", description = "remove the association between a subcommunity and the community", tags = { - C_SUB, W + C_SUB, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public void removeSubCommunity( - @PathVariable final String id, - @RequestParam final String subCommunityId) throws CommunityException { + @PathVariable final String id, + @RequestParam final String subCommunityId) throws CommunityException { try { communityService.removeSubCommunities(id, subCommunityId); } catch (final ResourceNotFoundException e) { @@ -1040,19 +1050,19 @@ public class CommunityApiController extends AbstractExporterController { } @RequestMapping(value = "/community/{id}/subcommunitiesList", produces = { - "application/json" + "application/json" }, method = RequestMethod.DELETE) @Operation(summary = "remove a list of associations between some subcommunities and the community", description = "remove a list of associations between some subcommunities and the community", tags = { - C_SUB, W + C_SUB, W }) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "not found"), - @ApiResponse(responseCode = "500", description = "unexpected error") + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) public void removeSubcommunities( - @PathVariable final String id, - @RequestBody final String[] subCommunityIdList) throws CommunityException { + @PathVariable final String id, + @RequestBody final String[] subCommunityIdList) throws CommunityException { try { communityService.removeSubCommunities(id, subCommunityIdList); } catch (final ResourceNotFoundException e) {