use of edu.harvard.iq.dataverse.engine.command.impl.SetDatasetCitationDateCommand in project dataverse by IQSS.
the class Datasets method setCitationDate.
@PUT
@Path("{id}/citationdate")
public Response setCitationDate(@PathParam("id") String id, String dsfTypeName) {
return response(req -> {
if (dsfTypeName.trim().isEmpty()) {
return badRequest("Please provide a dataset field type in the requst body.");
}
DatasetFieldType dsfType = null;
if (!":publicationDate".equals(dsfTypeName)) {
dsfType = datasetFieldSvc.findByName(dsfTypeName);
if (dsfType == null) {
return badRequest("Dataset Field Type Name " + dsfTypeName + " not found.");
}
}
execCommand(new SetDatasetCitationDateCommand(req, findDatasetOrDie(id), dsfType));
return ok("Citation Date for dataset " + id + " set to: " + (dsfType != null ? dsfType.getDisplayName() : "default"));
});
}
Aggregations