Commit c7c2e333 authored by Maxym Borodenko's avatar Maxym Borodenko

Never delete accessions with DOI

parent 7342f3d5
......@@ -813,10 +813,14 @@ public class GenesysServiceImpl implements GenesysService, DatasetService {
final Set<Long> accessionIds = new HashSet<Long>();
for (final Accession accn : toDelete) {
if (institute.getId().equals(accn.getInstitute().getId()))
if (institute.getId().equals(accn.getInstitute().getId())) {
accessionIds.add(accn.getAccessionId().getId());
else
} else {
throw new RuntimeException("Accession " + accn.getAccessionName() + " does not belong to " + institute.getCode());
}
if (accn.getDoi() != null) {
throw new RuntimeException("Refusing to delete accession that has DOI assigned - accession " + accn.getAccessionName() + " has DOI " + accn.getDoi());
}
}
accessionRepository.delete(toDelete);
......
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