Merge branch 'master' of gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot

This commit is contained in:
annampak 2017-10-05 15:43:03 +03:00
commit eefe053701
1 changed files with 42 additions and 0 deletions

View File

@ -149,6 +149,48 @@ public class Datasets {
}
}
@RequestMapping(method = RequestMethod.GET, value = { "/assignDMPToDataset" })
public @ResponseBody ResponseEntity<Object> assignDMPToDataset(@RequestParam("datasetID") String datasetID, @RequestParam("dmpID") String dmpID) {
DMP dmp = null;
Dataset dataset = null;
try {
dmp = dMPDao.read(UUID.fromString(dmpID));
dataset = datasetDao.read(UUID.fromString(datasetID));
dataset.setDmp(dmp);
datasetDao.update(dataset);
return ResponseEntity.status(HttpStatus.OK).build();
}
catch(Exception ex) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
}
// try {dmp = dMPDao.read(UUID.fromString(dmpID));}
// catch(Exception e) {
// RestResponse rr = new RestResponse("Could not find a DMP with id: "+dmpID+"! Detailed message: " + e.getMessage(), null);
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(rr.toString());
// }
// try {dataset = datasetDao.read(UUID.fromString(datasetID));}
// catch(Exception e) {
// RestResponse rr = new RestResponse("Could not find a Dataset with id: "+datasetID+"! Detailed message: " + e.getMessage(), null);
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(rr.toString());
// }
// try {
// dataset.setDmp(dmp);
// datasetDao.update(dataset);
// RestResponse rr = new RestResponse("Assigned DMP with id: "+dmpID+" on Dataset with id: "+datasetID+"!", null);
// return ResponseEntity.status(HttpStatus.OK).body(rr.toString());
// }
// catch(Exception e) {
// RestResponse rr = new RestResponse("Could not assign DMP with id: "+dmpID+" on Dataset with id: "+datasetID+"! Detailed message: " + e.getMessage(), null);
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(rr.toString());
// }
}
/*
@RequestMapping(method = RequestMethod.GET, value = { "/createEmptyDataset" })
public @ResponseBody ResponseEntity<Object> createEmptyDataset() {