Commit ea6d6353 authored by Matija Obreza's avatar Matija Obreza

Removed accession#tileIndex

- Duplicate of accession.accessionId.geo#tileIndex
parent eab9b663
......@@ -43,8 +43,7 @@ import org.springframework.data.elasticsearch.annotations.Document;
@Index(name = "IX_origcty_seqNo", columnList = "orgCtyId,seqNo"),
@Index(name = "IX_taxa_seq", columnList = "taxonomyId2,seqNo"),
@Index(name = "IX_seqNo", columnList = "seqNo"),
@Index(name = "IX_accession_lastModifiedDate", columnList = "lastModifiedDate"),
@Index(unique = false, columnList = "tileIndex")})
@Index(name = "IX_accession_lastModifiedDate", columnList = "lastModifiedDate")})
@Audited
@Document(indexName = "genesys")
public class Accession extends AccessionData {
......
......@@ -40,7 +40,6 @@ import org.genesys.blocks.model.AuditedVersionedModel;
import org.genesys.blocks.model.IdUUID;
import org.genesys.blocks.model.JsonViews;
import org.genesys.blocks.model.SelfCleaning;
import org.genesys.worldclim.WorldClimUtil;
import org.genesys2.server.model.impl.AccessionIdentifier3;
import org.genesys2.server.model.impl.Country;
import org.genesys2.server.model.impl.Crop;
......@@ -205,8 +204,6 @@ public abstract class AccessionData extends AuditedVersionedModel implements IdU
@JsonInclude
private boolean sgsv;
private Long tileIndex;
/**
* Update MCPD {@link #storageStr}
*/
......@@ -226,18 +223,6 @@ public abstract class AccessionData extends AuditedVersionedModel implements IdU
this.instituteCode = getInstitute().getCode();
this.storageStr = MCPDUtil.toMcpdArray(accessionId.getStorage());
this.duplSiteStr = MCPDUtil.toMcpdArray(accessionId.getDuplSite());
AccessionGeo geo = this.accessionId.getGeo();
if (geo != null) {
Double longitude = geo.getLongitude();
Double latitude = geo.getLatitude();
if ((longitude != null && longitude == 0) && (latitude != null && latitude == 0)) {
tileIndex = WorldClimUtil.getWorldclim25Tile(longitude, latitude);
} else {
tileIndex = null;
}
}
}
public FaoInstitute getInstitute() {
......@@ -402,13 +387,6 @@ public abstract class AccessionData extends AuditedVersionedModel implements IdU
this.accessionId = accessionId;
}
public Long getTileIndex() {
return tileIndex;
}
public void setTileIndex(Long tileIndex) {
this.tileIndex = tileIndex;
}
@Override
@Transient
......
......@@ -359,14 +359,7 @@ public class AdminController {
if (geo != null) {
Long index = WorldClimUtil.getWorldclim25Tile(geo.getLongitude(), geo.getLatitude());
geo.setTileIndex(index);
if (ObjectUtils.compare(index, accession.getTileIndex()) != 0) {
updateAccessionTileIndex(accession, index);
}
toSave.add(geo);
} else {
if (accession.getTileIndex() != null) {
updateAccessionTileIndex(accession, null);
}
}
});
......@@ -380,13 +373,13 @@ public class AdminController {
return "redirect:/admin/";
}
private void updateAccessionTileIndex(Accession accession, Long index) {
if (index == null) {
jpaQueryFactory.update(QAccession.accession).where(QAccession.accession.eq(accession)).setNull(QAccession.accession.tileIndex).execute();
} else {
jpaQueryFactory.update(QAccession.accession).where(QAccession.accession.eq(accession)).set(QAccession.accession.tileIndex, index).execute();
}
}
// private void updateAccessionTileIndex(Accession accession, Long index) {
// if (index == null) {
// jpaQueryFactory.update(QAccession.accession).where(QAccession.accession.eq(accession)).setNull(QAccession.accession.tileIndex).execute();
// } else {
// jpaQueryFactory.update(QAccession.accession).where(QAccession.accession.eq(accession)).set(QAccession.accession.tileIndex, index).execute();
// }
// }
@RequestMapping(value = "/admin-action", method = RequestMethod.POST, params = "georegion")
public String updateGeoReg() throws IOException, ParserConfigurationException, SAXException {
......
......@@ -452,7 +452,6 @@ public class GenesysFilterServiceImpl implements GenesysFilterService {
BooleanBuilder filt = new BooleanBuilder();
// filt.and(accessionGeo.isNotNull()).and(accessionGeo.latitude.isNotNull()).and(accessionGeo.longitude.isNotNull());
filt.and(accession.tileIndex.isNotNull());
if (filter != null) {
filt.and(filter.buildQuery());
}
......
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