simplified deprecated methods

This commit is contained in:
Michele Artini 2024-02-27 15:03:02 +01:00
parent 4c3a1af2d2
commit 07cd4dda85
1 changed files with 6 additions and 41 deletions

View File

@ -431,13 +431,7 @@ public class CommunityApiController extends AbstractExporterController {
}) })
public List<CommunityContentprovider> getCommunityContentproviders(@PathVariable final String id, @RequestParam(required = false) final Boolean deposit) public List<CommunityContentprovider> getCommunityContentproviders(@PathVariable final String id, @RequestParam(required = false) final Boolean deposit)
throws CommunityException { throws CommunityException {
try { return getCommunityDatasources(id, deposit);
return deposit == null ? communityService.getCommunityDatasources(id) : communityService.getCommunityDatasourcesWithDeposit(id, deposit);
} catch (final ResourceNotFoundException e) {
throw e;
} catch (final Throwable e) {
throw new CommunityException(e);
}
} }
@Deprecated @Deprecated
@ -454,14 +448,7 @@ public class CommunityApiController extends AbstractExporterController {
@PathVariable final String id, @PathVariable final String id,
@RequestBody final CommunityContentprovider contentprovider) throws CommunityException { @RequestBody final CommunityContentprovider contentprovider) throws CommunityException {
try { return addCommunityDatasource(id, contentprovider);
communityService.addCommunityDatasources(id, contentprovider);
return contentprovider;
} catch (final ResourceNotFoundException e) {
throw e;
} catch (final Throwable e) {
throw new CommunityException(e);
}
} }
@Deprecated @Deprecated
@ -474,16 +461,8 @@ public class CommunityApiController 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 void removeCommunityContentprovider( public void removeCommunityContentprovider(@PathVariable final String id, @RequestParam final String contentproviderId) throws CommunityException {
@PathVariable final String id, removeCommunityDatasource(id, contentproviderId);
@RequestParam final String contentproviderId) throws CommunityException {
try {
communityService.removeCommunityDatasources(id, contentproviderId);
} catch (final ResourceNotFoundException e) {
throw e;
} catch (final Throwable e) {
throw new CommunityException(e);
}
} }
@Deprecated @Deprecated
@ -499,15 +478,7 @@ public class CommunityApiController extends AbstractExporterController {
public CommunityContentprovider[] addCommunityContentProvidersList( public CommunityContentprovider[] addCommunityContentProvidersList(
@PathVariable final String id, @PathVariable final String id,
@RequestBody final CommunityContentprovider[] contentprovidersList) throws CommunityException { @RequestBody final CommunityContentprovider[] contentprovidersList) throws CommunityException {
return addCommunityDatasourcesList(id, contentprovidersList);
try {
communityService.addCommunityDatasources(id, contentprovidersList);
return contentprovidersList;
} catch (final ResourceNotFoundException e) {
throw e;
} catch (final Throwable e) {
throw new CommunityException(e);
}
} }
@Deprecated @Deprecated
@ -523,13 +494,7 @@ public class CommunityApiController extends AbstractExporterController {
public void deleteCommunityContentProvidersList( public void deleteCommunityContentProvidersList(
@PathVariable final String id, @PathVariable final String id,
@RequestBody final String[] contentProviderIdList) throws CommunityException { @RequestBody final String[] contentProviderIdList) throws CommunityException {
try { deleteCommunityDatasourcesList(id, contentProviderIdList);
communityService.removeCommunityDatasources(id, contentProviderIdList);
} catch (final ResourceNotFoundException e) {
throw e;
} catch (final Throwable e) {
throw new CommunityException(e);
}
} }
// ORGANIZATIONS // ORGANIZATIONS