mirror of
https://github.com/ilri/cgspace-java-helpers.git
synced 2024-11-26 08:38:20 +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 {
|
class Country {
|
||||||
private String name; //required
|
private String name; //required
|
||||||
private String commonName; //optional
|
private String common_name; //optional
|
||||||
private String officialName; //optional
|
private String official_name; //optional
|
||||||
private String numeric; //required Hmmmm need to cast this...
|
private String numeric; //required Hmmmm need to cast this...
|
||||||
private String alpha_2; //required
|
private String alpha_2; //required
|
||||||
private String alpha_3; //required
|
private String alpha_3; //required
|
||||||
|
|
||||||
public Country(String name,
|
public Country(String name,
|
||||||
@Nullable String commonName,
|
@Nullable String common_name,
|
||||||
@Nullable String officialName,
|
@Nullable String official_name,
|
||||||
String numeric,
|
String numeric,
|
||||||
String alpha_2,
|
String alpha_2,
|
||||||
String alpha_3) {
|
String alpha_3) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.commonName = commonName;
|
this.common_name = common_name;
|
||||||
this.officialName = officialName;
|
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.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_2 = alpha_2;
|
||||||
this.alpha_3 = alpha_3;
|
this.alpha_3 = alpha_3;
|
||||||
@ -56,12 +56,12 @@ public class CountriesVocabulary {
|
|||||||
return numeric;
|
return numeric;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCommonName() {
|
public String get_common_name() {
|
||||||
return commonName;
|
return common_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOfficialName() {
|
public String get_official_name() {
|
||||||
return officialName;
|
return official_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAlpha_2() {
|
public String getAlpha_2() {
|
||||||
|
@ -94,7 +94,7 @@ public class CountryCodeTagger extends AbstractCurationTask
|
|||||||
Integer addedCodeCount = 0;
|
Integer addedCodeCount = 0;
|
||||||
for (Metadatum itemCountry : itemCountries) {
|
for (Metadatum itemCountry : itemCountries) {
|
||||||
for (CountriesVocabulary.Country country : isocodesCountriesJson.countries) {
|
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());
|
System.out.println(itemHandle + ": adding country code " + country.getAlpha_2());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user