end Poind Try Catch to Delete DatasetProfile
This commit is contained in:
parent
ad84ff8235
commit
0039da7c3c
|
@ -2,6 +2,7 @@ package eu.eudat.controllers;
|
|||
|
||||
import eu.eudat.core.logger.Logger;
|
||||
import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem;
|
||||
import eu.eudat.exceptions.datamanagementplan.DMPWithDatasetsDeleteException;
|
||||
import eu.eudat.logic.managers.AdminManager;
|
||||
import eu.eudat.logic.managers.DatasetProfileManager;
|
||||
import eu.eudat.logic.managers.UserManager;
|
||||
|
@ -94,13 +95,12 @@ public class Admin extends BaseController {
|
|||
@RequestMapping(method = RequestMethod.DELETE, value = {"{id}"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DatasetProfile>> inactivate(@PathVariable String id, Principal principal) throws IllegalAccessException, InstantiationException {
|
||||
eu.eudat.data.entities.DatasetProfile ret= AdminManager.inactivate(this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao(),this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetDao() , id);
|
||||
if(ret!=null){
|
||||
try{
|
||||
eu.eudat.data.entities.DatasetProfile ret= AdminManager.inactivate(this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao(),this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetDao() , id);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>().status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
}catch (DMPWithDatasetsDeleteException exception) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>().status(ApiMessageCode.ERROR_MESSAGE).message(exception.getMessage()));
|
||||
}
|
||||
|
||||
}else {
|
||||
return ResponseEntity.status(HttpStatus.FORBIDDEN).body(new ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>().status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue