Commit 04bbeffc authored by Matija Obreza's avatar Matija Obreza

Treat lat/lon (0, 0) as null

parent 7ef9f80f
......@@ -68,6 +68,13 @@ public class AccessionGeo extends BasicModel implements GeoReferencedEntity, Acc
@PreUpdate
private void prePersist() {
trimStringsToNull();
// Treat (0, 0) as null
if ((this.longitude == 0 || this.longitude == null) && (this.latitude == 0 || this.latitude == null)) {
this.longitude = null;
this.latitude = null;
}
tileIndex = WorldClimUtil.getTileIndex(5, this.longitude, this.latitude);
}
......
......@@ -126,6 +126,16 @@ public class AccessionId extends AuditedVersionedModel implements IdUUID {
if (uuid == null) {
uuid = UUID.randomUUID();
}
// Remove empty AccessionGeo
if (this.geo != null && this.geo.isEmpty()) {
this.geo = null;
}
// Remove empty AccessionCollect
if (this.coll != null && this.coll.isEmpty()) {
this.coll = null;
}
}
@Override
......
......@@ -28,7 +28,6 @@ import javax.persistence.PersistenceContext;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.lang.time.StopWatch;
import org.genesys2.server.persistence.domain.AccessionIdRepository;
import org.genesys2.server.persistence.domain.AccessionRepository;
import org.genesys2.server.service.ContentService;
import org.genesys2.server.service.CountryNamesUpdater;
......
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