mirror of
https://github.com/ilri/cgspace-java-helpers.git
synced 2024-11-29 18:18:24 +01:00
src/main/java: Correctly map common_name and official_name
I forgot to fix these so that they map exactly to the ISO 3166-1 JSON so that GSON can deserialize them automatically.
This commit is contained in:
parent
91a4367f38
commit
0f2081db51
@ -28,21 +28,21 @@ public class CountriesVocabulary {
|
||||
|
||||
class Country {
|
||||
private String name; //required
|
||||
private String commonName; //optional
|
||||
private String officialName; //optional
|
||||
private String common_name; //optional
|
||||
private String official_name; //optional
|
||||
private String numeric; //required Hmmmm need to cast this...
|
||||
private String alpha_2; //required
|
||||
private String alpha_3; //required
|
||||
|
||||
public Country(String name,
|
||||
@Nullable String commonName,
|
||||
@Nullable String officialName,
|
||||
@Nullable String common_name,
|
||||
@Nullable String official_name,
|
||||
String numeric,
|
||||
String alpha_2,
|
||||
String alpha_3) {
|
||||
this.name = name;
|
||||
this.commonName = commonName;
|
||||
this.officialName = officialName;
|
||||
this.common_name = common_name;
|
||||
this.official_name = official_name;
|
||||
this.numeric = numeric; // fuuuuu this is a string and we can't cast to Integer because some values are zeropadded like "004"
|
||||
this.alpha_2 = alpha_2;
|
||||
this.alpha_3 = alpha_3;
|
||||
@ -56,12 +56,12 @@ public class CountriesVocabulary {
|
||||
return numeric;
|
||||
}
|
||||
|
||||
public String getCommonName() {
|
||||
return commonName;
|
||||
public String get_common_name() {
|
||||
return common_name;
|
||||
}
|
||||
|
||||
public String getOfficialName() {
|
||||
return officialName;
|
||||
public String get_official_name() {
|
||||
return official_name;
|
||||
}
|
||||
|
||||
public String getAlpha_2() {
|
||||
|
@ -94,7 +94,7 @@ public class CountryCodeTagger extends AbstractCurationTask
|
||||
Integer addedCodeCount = 0;
|
||||
for (Metadatum itemCountry : itemCountries) {
|
||||
for (CountriesVocabulary.Country country : isocodesCountriesJson.countries) {
|
||||
if (itemCountry.value.equalsIgnoreCase(country.getName()) || itemCountry.value.equalsIgnoreCase(country.getOfficialName()) || itemCountry.value.equalsIgnoreCase(country.getCommonName())) {
|
||||
if (itemCountry.value.equalsIgnoreCase(country.getName()) || itemCountry.value.equalsIgnoreCase(country.get_official_name()) || itemCountry.value.equalsIgnoreCase(country.get_common_name())) {
|
||||
System.out.println(itemHandle + ": adding country code " + country.getAlpha_2());
|
||||
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user