Commit 4ede2380 authored by Matija Obreza's avatar Matija Obreza
Browse files

API: Should not be able to rename a new accession entry

parent 2019f1ce
......@@ -560,8 +560,13 @@ public class BatchRESTServiceImpl implements BatchRESTService {
return null;
}
private boolean updateAcceNumb(Accession accession, JsonNode value) throws RESTApiDataTypeException, RESTApiValueException {
private boolean updateAcceNumb(Accession accession, JsonNode value) throws RESTApiDataTypeException, RESTApiException {
if (value != null) {
// Rename is possible only if accession exists
if (accession.getId() == null) {
throw new RESTApiException("Cannot rename a new accession entry");
}
if (!value.isTextual()) {
throw new RESTApiDataTypeException("newAcceNumb must be a String");
}
......@@ -899,7 +904,7 @@ public class BatchRESTServiceImpl implements BatchRESTService {
}
if (!institute.getCode().equals(dataJson.instCode)) {
throw new RuntimeException("Accession does not belong to instCode=" + institute.getCode() + " acn=" + dataJson);
throw new RESTApiException("Accession does not belong to instCode=" + institute.getCode() + " acn=" + dataJson);
}
Accession accession;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment