Commit 43ddc48d authored by Matija Obreza's avatar Matija Obreza

Fix: Updated TaxonomySpecies#name calculation

parent 900e0b21
......@@ -44,6 +44,12 @@ import com.fasterxml.jackson.annotation.ObjectIdGenerators;
public class TaxonomySpecies extends CooperatorOwnedModel implements Copyable<TaxonomySpecies>, ElasticLoader {
private static final long serialVersionUID = 8750916572382931294L;
public static final String PREFIX_SUBSPECIES = "subsp. ";
public static final String PREFIX_NOTHOSUBSPECIES = "nothosubsp. ";
public static final String PREFIX_VARIETY = "var. ";
public static final String PREFIX_SUBVARIETY = "subvar. ";
public static final String PREFIX_FORMA = "f.";
@Basic
@Column(name = "alternate_name", length = 2000)
private String alternateName;
......@@ -55,14 +61,14 @@ public class TaxonomySpecies extends CooperatorOwnedModel implements Copyable<Ta
@ManyToOne(fetch = FetchType.LAZY, cascade = {})
@JoinColumn(name = "curator1_cooperator_id")
@Field(type = FieldType.Object)
@JsonIgnoreProperties({ "ownedBy", "createdBy", "modifiedBy", "note", "geography", "secondaryGeography", "webCooperator" } )
@JsonIgnoreProperties({ "ownedBy", "createdBy", "modifiedBy", "note", "geography", "secondaryGeography", "webCooperator" })
@JsonIdentityReference(alwaysAsId = false)
private Cooperator curator1Cooperator;
@ManyToOne(fetch = FetchType.LAZY, cascade = {})
@JoinColumn(name = "curator2_cooperator_id")
@Field(type = FieldType.Object)
@JsonIgnoreProperties({ "ownedBy", "createdBy", "modifiedBy", "note", "geography", "secondaryGeography", "webCooperator" } )
@JsonIgnoreProperties({ "ownedBy", "createdBy", "modifiedBy", "note", "geography", "secondaryGeography", "webCooperator" })
@JsonIdentityReference(alwaysAsId = false)
private Cooperator curator2Cooperator;
......@@ -143,13 +149,13 @@ public class TaxonomySpecies extends CooperatorOwnedModel implements Copyable<Ta
@ManyToOne(fetch = FetchType.LAZY, cascade = {})
@JoinColumn(name = "priority1_site_id")
@Field(type = FieldType.Object)
@JsonIgnoreProperties({ "ownedBy", "createdBy", "modifiedBy" } )
@JsonIgnoreProperties({ "ownedBy", "createdBy", "modifiedBy" })
private Site priority1Site;
@ManyToOne(fetch = FetchType.LAZY, cascade = {})
@JoinColumn(name = "priority2_site_id")
@Field(type = FieldType.Object)
@JsonIgnoreProperties({ "ownedBy", "createdBy", "modifiedBy"} )
@JsonIgnoreProperties({ "ownedBy", "createdBy", "modifiedBy" })
private Site priority2Site;
@Basic
......@@ -224,27 +230,31 @@ public class TaxonomySpecies extends CooperatorOwnedModel implements Copyable<Ta
this.nameAuthority = this.speciesAuthority;
if (StringUtils.isNotBlank(this.subspeciesName)) {
this.name += "subsp. " + this.subspeciesName;
if ("Y".equals(isSubspecificHybrid)) {
this.name += PREFIX_NOTHOSUBSPECIES + subspeciesName;
} else {
this.name += PREFIX_SUBSPECIES + this.subspeciesName;
}
this.nameAuthority = this.subspeciesAuthority;
}
if (StringUtils.isNotBlank(this.varietyName)) {
this.name += "var. " + this.varietyName;
this.name += PREFIX_VARIETY + this.varietyName;
this.nameAuthority = this.varietyAuthority;
}
if (StringUtils.isNotBlank(this.subvarietyName)) {
this.name += "var. " + this.subvarietyName;
this.name += PREFIX_SUBVARIETY + this.subvarietyName;
this.nameAuthority = this.subvarietyAuthority;
}
if (StringUtils.isNotBlank(this.subvarietyName)) {
this.name += this.formaRankType +" " + this.formaName;
if (StringUtils.isNotBlank(this.formaName)) {
this.name += this.formaRankType + " " + this.formaName;
this.nameAuthority = this.formaAuthority;
}
}
}
public TaxonomySpecies() {
}
......@@ -555,7 +565,7 @@ public class TaxonomySpecies extends CooperatorOwnedModel implements Copyable<Ta
public void setVerifierCooperator(final Cooperator verifierCooperator) {
this.verifierCooperator = verifierCooperator;
}
@Override
public TaxonomySpecies lazyLoad() {
super.lazyLoad();
......@@ -579,7 +589,6 @@ public class TaxonomySpecies extends CooperatorOwnedModel implements Copyable<Ta
}
return this;
}
@Override
public void prepareForIndexing() {
......
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