Commit bf389ee6 authored by Matija Obreza's avatar Matija Obreza
Browse files

Moved annotations from getters to fields

parent 4f6c9db4
......@@ -31,18 +31,28 @@ import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.Store;
@Entity
// Add index on genus, genus+species
@Table(name = "all_taxonomy", uniqueConstraints = { @UniqueConstraint(columnNames = {
"genus", "species" }) })
"Taxon_Name" }) })
@Indexed
public class Taxonomy implements java.io.Serializable {
/**
*
*/
private static final long serialVersionUID = 8881324404490162933L;
@Id
@DocumentId
@GeneratedValue
@Column(name="Taxon_Code", unique = true, nullable = false)
private Long id;
@Column(nullable = false, length = 64)
private String genus;
@Column(nullable = false, length = 64)
private String species;
@Column(name="Taxon_Name", nullable = false, length = 200)
@Field(name="title", store=Store.NO)
private String taxonName;
public Taxonomy() {
......@@ -53,10 +63,7 @@ public class Taxonomy implements java.io.Serializable {
this.species = species;
}
@Id
@DocumentId
@GeneratedValue
@Column(name="Taxon_Code", unique = true, nullable = false)
public Long getId() {
return this.id;
}
......@@ -65,7 +72,6 @@ public class Taxonomy implements java.io.Serializable {
this.id = id;
}
@Column(nullable = false, length = 64)
public String getGenus() {
return this.genus;
}
......@@ -74,7 +80,6 @@ public class Taxonomy implements java.io.Serializable {
this.genus = genus;
}
@Column(length = 64)
public String getSpecies() {
return this.species;
}
......@@ -83,8 +88,6 @@ public class Taxonomy implements java.io.Serializable {
this.species = species;
}
@Column(name="Taxon_Name", nullable = false, length = 128)
@Field(name="title", store=Store.NO)
public String getTaxonName() {
return this.taxonName;
}
......
......@@ -42,27 +42,39 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
public class Country extends BusinessModel {
private static final long serialVersionUID = -1688723909298769804L;
@Column(nullable = false, unique = true, length = 3)
@Field(name = "title")
private String code3;
@Column(unique = false, length = 2)
private String code2;
private boolean current;
@Column(unique = false, nullable = false, length = 200)
@Field(name = "body", store = Store.NO)
private String name;
@Column(length = 3)
private String codeNum;
private Long refnameId;
/**
* Localized names
*/
@Lob
private String nameL;
@Lob
private String wikiLink;
@Transient
private JsonNode nameJ;
private String wikiLink;
public Country() {
}
@Column(nullable = false, unique = true, length = 3)
@Field(name = "title")
public String getCode3() {
return code3;
}
......@@ -71,7 +83,6 @@ public class Country extends BusinessModel {
this.code3 = code3;
}
@Column(unique = false, length = 2)
public String getCode2() {
return this.code2;
}
......@@ -80,7 +91,6 @@ public class Country extends BusinessModel {
this.code2 = code2;
}
@Column
public boolean isCurrent() {
return this.current;
}
......@@ -89,8 +99,6 @@ public class Country extends BusinessModel {
this.current = current;
}
@Column(unique = false, nullable = false, length = 200)
@Field(name = "body", store = Store.NO)
public String getName() {
return this.name;
}
......@@ -99,7 +107,6 @@ public class Country extends BusinessModel {
this.name = name;
}
@Column(length = 3)
public void setCodeNum(final String isoNum) {
this.codeNum = isoNum;
}
......@@ -116,7 +123,6 @@ public class Country extends BusinessModel {
return refnameId;
}
@Lob
public String getNameL() {
return nameL;
}
......@@ -158,7 +164,6 @@ public class Country extends BusinessModel {
return MessageFormat.format("Country id={0} name={1} current={2}", id, name, current);
}
@Lob
public String getWikiLink() {
return wikiLink;
}
......
......@@ -175,10 +175,18 @@ public class CountryAlternateNamesUpdater implements CountryNamesUpdater {
}
}
long longRefnameId = Long.parseLong(prevRefnameId);
if (countryRefnameIds.contains(longRefnameId)) {
workIt(Long.parseLong(prevRefnameId), batch);
batch.clear();
if (batch.size() > 0) {
LOG.debug("Have items in the batch after loop.");
if (prevRefnameId != null) {
long longRefnameId = Long.parseLong(prevRefnameId);
if (countryRefnameIds.contains(longRefnameId)) {
workIt(Long.parseLong(prevRefnameId), batch);
batch.clear();
}
} else {
LOG.warn("But no prefRefnameId!!");
}
}
LOG.info("Done importing alternate geonames");
} catch (UnsupportedEncodingException e) {
......
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