This commit is contained in:
satyr 2017-11-17 03:16:09 +02:00
parent c2fc7a6fe8
commit e25964ba29
2 changed files with 8 additions and 0 deletions

View File

@ -13,6 +13,7 @@ public class SafeCleanAttribs {
newdmp.setId(dmp.getId()); newdmp.setId(dmp.getId());
dataset.setDmp(newdmp); dataset.setDmp(newdmp);
} }
} }
} }

View File

@ -149,11 +149,15 @@ public class Datasets {
dataset.setModified(new Date()); dataset.setModified(new Date());
dataset.setStatus(new Short("0")); dataset.setStatus(new Short("0"));
dataset.setCreator(userInfo); dataset.setCreator(userInfo);
if("".equals(dataset.getReference())) dataset.setReference(null);
if("".equals(dataset.getProperties())) dataset.setProperties(null);
try { try {
dataset = datasetDao.create(dataset); dataset = datasetDao.create(dataset);
return ResponseEntity.status(HttpStatus.CREATED).body(SerializerProvider.toJson(dataset)); return ResponseEntity.status(HttpStatus.CREATED).body(SerializerProvider.toJson(dataset));
} }
catch(Exception e) { catch(Exception e) {
e.printStackTrace();
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Could not create or update Dataset! Reason: " + e.getMessage()); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Could not create or update Dataset! Reason: " + e.getMessage());
} }
@ -172,6 +176,9 @@ public class Datasets {
SafeCleanAttribs.clean(dataset); SafeCleanAttribs.clean(dataset);
if("".equals(dataset.getReference())) dataset.setReference(null);
if("".equals(dataset.getProperties())) dataset.setProperties(null);
try { try {
dataset = datasetDao.update(dataset); dataset = datasetDao.update(dataset);
return ResponseEntity.status(HttpStatus.CREATED).body(SerializerProvider.toJson(dataset)); return ResponseEntity.status(HttpStatus.CREATED).body(SerializerProvider.toJson(dataset));