deprecation of contentproviders apis
This commit is contained in:
parent
2887e1c9b1
commit
4c3a1af2d2
|
@ -286,8 +286,142 @@ public class CommunityApiController extends AbstractExporterController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping({ "/community/{id}/contentproviders", "/community/{id}/datasources" })
|
// Datasources
|
||||||
@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 = {
|
|
||||||
|
@GetMapping("/community/{id}/datasources")
|
||||||
|
@Operation(summary = "get the list of datasources associated to a given community", description = "get the list of content providers associated to a given community", tags = {
|
||||||
|
C_CP, R
|
||||||
|
})
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "not found"),
|
||||||
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
|
})
|
||||||
|
public List<CommunityContentprovider> getCommunityDatasources(@PathVariable final String id, @RequestParam(required = false) final Boolean deposit)
|
||||||
|
throws CommunityException {
|
||||||
|
try {
|
||||||
|
return deposit == null ? communityService.getCommunityDatasources(id) : communityService.getCommunityDatasourcesWithDeposit(id, deposit);
|
||||||
|
} catch (final ResourceNotFoundException e) {
|
||||||
|
throw e;
|
||||||
|
} catch (final Throwable e) {
|
||||||
|
throw new CommunityException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/community/{id}/datasources")
|
||||||
|
@Operation(summary = "associate a datasource to the community", description = "associate a datasource to the community", tags = {
|
||||||
|
C_CP, W
|
||||||
|
})
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "not found"),
|
||||||
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
|
})
|
||||||
|
public CommunityContentprovider addCommunityDatasource(
|
||||||
|
@PathVariable final String id,
|
||||||
|
@RequestBody final CommunityContentprovider datasource) throws CommunityException {
|
||||||
|
|
||||||
|
try {
|
||||||
|
communityService.addCommunityDatasources(id, datasource);
|
||||||
|
return datasource;
|
||||||
|
} catch (final ResourceNotFoundException e) {
|
||||||
|
throw e;
|
||||||
|
} catch (final Throwable e) {
|
||||||
|
throw new CommunityException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/community/{id}/datasources/deposit")
|
||||||
|
@Operation(summary = "associate a datasource to the community", description = "associate a datasource to the community", tags = {
|
||||||
|
C_CP, W
|
||||||
|
})
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "not found"),
|
||||||
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
|
})
|
||||||
|
public CommunityContentprovider addCommunityDatasourceDeposit(
|
||||||
|
@PathVariable final String id,
|
||||||
|
@RequestBody final DepositionInfo info) throws CommunityException {
|
||||||
|
try {
|
||||||
|
return communityService.updateCommunityDatasourcesDeposit(id, info.getOpenaireId(), info.getDeposit(), info.getMessage());
|
||||||
|
} catch (final ResourceNotFoundException e) {
|
||||||
|
throw e;
|
||||||
|
} catch (final Throwable e) {
|
||||||
|
throw new CommunityException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/community/{id}/datasources")
|
||||||
|
@Operation(summary = "remove the association between a datasource and the community", description = "remove the association between a datasource and the community", tags = {
|
||||||
|
C_CP, W
|
||||||
|
})
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "not found"),
|
||||||
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
|
})
|
||||||
|
public void removeCommunityDatasource(
|
||||||
|
@PathVariable final String id,
|
||||||
|
@RequestParam final String dsId) throws CommunityException {
|
||||||
|
try {
|
||||||
|
communityService.removeCommunityDatasources(id, dsId);
|
||||||
|
} catch (final ResourceNotFoundException e) {
|
||||||
|
throw e;
|
||||||
|
} catch (final Throwable e) {
|
||||||
|
throw new CommunityException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/community/{id}/datasourcesList")
|
||||||
|
@Operation(summary = "associate a list of datasources to the community", description = "associate a list of datasources to the community", tags = {
|
||||||
|
C_CP, W
|
||||||
|
})
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "not found"),
|
||||||
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
|
})
|
||||||
|
public CommunityContentprovider[] addCommunityDatasourcesList(
|
||||||
|
@PathVariable final String id,
|
||||||
|
@RequestBody final CommunityContentprovider[] dsList) throws CommunityException {
|
||||||
|
|
||||||
|
try {
|
||||||
|
communityService.addCommunityDatasources(id, dsList);
|
||||||
|
return dsList;
|
||||||
|
} catch (final ResourceNotFoundException e) {
|
||||||
|
throw e;
|
||||||
|
} catch (final Throwable e) {
|
||||||
|
throw new CommunityException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/community/{id}/datasourcesList")
|
||||||
|
@Operation(summary = "remove a list of datasources from the community", description = "remove a list of datasources from the community", tags = {
|
||||||
|
C_CP, W
|
||||||
|
})
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "not found"),
|
||||||
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
|
})
|
||||||
|
public void deleteCommunityDatasourcesList(
|
||||||
|
@PathVariable final String id,
|
||||||
|
@RequestBody final String[] dsIdList) throws CommunityException {
|
||||||
|
try {
|
||||||
|
communityService.removeCommunityDatasources(id, dsIdList);
|
||||||
|
} catch (final ResourceNotFoundException e) {
|
||||||
|
throw e;
|
||||||
|
} catch (final Throwable e) {
|
||||||
|
throw new CommunityException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Content Providers (DEPRECATED)
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@GetMapping("/community/{id}/contentproviders")
|
||||||
|
@Operation(summary = "get the list of datasources 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 = {
|
@ApiResponses(value = {
|
||||||
|
@ -306,8 +440,9 @@ public class CommunityApiController extends AbstractExporterController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping({ "/community/{id}/contentproviders", "/community/{id}/datasources" })
|
@Deprecated
|
||||||
@Operation(summary = "associate a content provider to the community", description = "associate a content provider to the community", tags = {
|
@PostMapping("/community/{id}/contentproviders")
|
||||||
|
@Operation(summary = "associate a datasource to the community", description = "associate a datasource to the community", tags = {
|
||||||
C_CP, W
|
C_CP, W
|
||||||
})
|
})
|
||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
|
@ -329,29 +464,9 @@ public class CommunityApiController extends AbstractExporterController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/community/{id}/datasources/deposit")
|
@Deprecated
|
||||||
@Operation(summary = "associate a content provider to the community", description = "associate a content provider to the community", tags = {
|
@DeleteMapping("/community/{id}/contentproviders")
|
||||||
C_CP, W
|
@Operation(summary = "remove the association between a datasource and the community", description = "remove the association between a datasource and the community", tags = {
|
||||||
})
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@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 DepositionInfo info) throws CommunityException {
|
|
||||||
try {
|
|
||||||
return communityService.updateCommunityDatasourcesDeposit(id, info.getOpenaireId(), info.getDeposit(), info.getMessage());
|
|
||||||
} catch (final ResourceNotFoundException e) {
|
|
||||||
throw e;
|
|
||||||
} catch (final Throwable e) {
|
|
||||||
throw new CommunityException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@DeleteMapping({ "/community/{id}/contentproviders", "/community/{id}/datasources" })
|
|
||||||
@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 = {
|
@ApiResponses(value = {
|
||||||
|
@ -371,8 +486,9 @@ public class CommunityApiController extends AbstractExporterController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping({ "/community/{id}/contentprovidersList", "/community/{id}/datasourcesList" })
|
@Deprecated
|
||||||
@Operation(summary = "associate a list of content providers to the community", description = "associate a list of content providers to the community", tags = {
|
@PostMapping("/community/{id}/contentprovidersList")
|
||||||
|
@Operation(summary = "associate a list of datasources to the community", description = "associate a list of datasources to the community", tags = {
|
||||||
C_CP, W
|
C_CP, W
|
||||||
})
|
})
|
||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
|
@ -394,8 +510,9 @@ public class CommunityApiController extends AbstractExporterController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping({ "/community/{id}/contentprovidersList", "/community/{id}/datasourcesList" })
|
@Deprecated
|
||||||
@Operation(summary = "remove a list of content providers from the community", description = "remove a list of content providers from the community", tags = {
|
@DeleteMapping("/community/{id}/contentprovidersList")
|
||||||
|
@Operation(summary = "remove a list of datasources from the community", description = "remove a list of datasources from the community", tags = {
|
||||||
C_CP, W
|
C_CP, W
|
||||||
})
|
})
|
||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
|
@ -415,7 +532,7 @@ public class CommunityApiController extends AbstractExporterController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ADDING CODE FOR COMMUNITY ORGANIZATIONS
|
// ORGANIZATIONS
|
||||||
|
|
||||||
@GetMapping("/community/{id}/organizations")
|
@GetMapping("/community/{id}/organizations")
|
||||||
@Operation(summary = "get the list of organizations for a given community", description = "get the list of organizations for a given community", tags = {
|
@Operation(summary = "get the list of organizations for a given community", description = "get the list of organizations for a given community", tags = {
|
||||||
|
|
Loading…
Reference in New Issue