Commit 9ae19b06 authored by Matija Obreza's avatar Matija Obreza

Fix: Use sp. instead of spp. in species name

parent 08b13ca4
......@@ -39,7 +39,6 @@ import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIdentityReference;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
......@@ -55,8 +54,12 @@ import com.fasterxml.jackson.annotation.ObjectIdGenerators;
@Document(indexName = "grinspecies")
@JsonIdentityInfo(scope = TaxonomySpecies.class, generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
public class TaxonomySpecies extends CooperatorOwnedModel implements IGrinSpecies, Copyable<TaxonomySpecies> {
private static final long serialVersionUID = -6577613192196396663L;
private static final String GRIN_SP_ABBREVIATION = "sp.";
private static final String GRIN_SPP_ABBREVIATION = "spp.";
private static final String PREFIX_SUBSPECIES = "subsp. ";
private static final String PREFIX_NOTHOSUBSPECIES = "nothosubsp. ";
private static final String PREFIX_VARIETY = "var. ";
......@@ -220,8 +223,13 @@ public class TaxonomySpecies extends CooperatorOwnedModel implements IGrinSpecie
@PrePersist
@PreUpdate
private void updateName() {
{
// Update genusSpecies label
this.genusSpecies = this.taxonomyGenus.getName() + " " + (GRIN_SPP_ABBREVIATION.equals(this.speciesName) ? GRIN_SP_ABBREVIATION : this.speciesName);
}
if (StringUtils.isBlank(this.name)) {
this.name = this.taxonomyGenus.getName() + " " + this.speciesName;
this.name = this.genusSpecies;
this.nameAuthority = this.speciesAuthority;
if (StringUtils.isNotBlank(this.subspeciesName)) {
......@@ -248,11 +256,6 @@ public class TaxonomySpecies extends CooperatorOwnedModel implements IGrinSpecie
this.nameAuthority = this.formaAuthority;
}
}
{
// Update genusSpecies label
this.genusSpecies = this.taxonomyGenus.getName() + " " + this.speciesName;
}
{
// Always recalculate subtaxa field
......
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