Commit 31107cba authored by Matija Obreza's avatar Matija Obreza

Allow updating accession UUID with REST call

parent 463def3e
......@@ -19,6 +19,7 @@ package org.genesys2.server.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
......@@ -107,6 +108,20 @@ public class BatchRESTServiceImpl implements BatchRESTService {
updated = true;
}
}
value = accnJson.get("uuid");
if (value != null) {
String uuid = value.isNull() ? null : value.textValue();
if (!StringUtils.equals(uuid, accession.getUuid())) {
if (uuid != null) {
// Throws a runtime exception if format is invalid
UUID.fromString(uuid);
}
accession.setUuid(uuid);
updated = true;
}
}
value = accnJson.get("acqDate");
if (value != null) {
String acqDate = value.isNull() ? null : value.textValue();
......
......@@ -150,6 +150,7 @@ ce.methods=Methods
ce.method=Method
method.fieldName=DB Field
accession.uuid=UUID
accession.accessionName=Accession
accession.origin=Country of origin
accession.holdingInstitute=Holding institute
......
......@@ -66,6 +66,12 @@
<td><spring:message code="accession.accessionName" /></td>
<td><c:out value="${accession.accessionName}" /></td>
</tr>
<c:if test="${accession.uuid ne null}">
<tr>
<td><spring:message code="accession.uuid" /></td>
<td><b><c:out value="${accession.uuid}" /></b></td>
</tr>
</c:if>
<c:if test="${crops ne null}">
<tr>
......
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