mirror of
https://github.com/ilri/cgspace-java-helpers.git
synced 2024-11-23 07:10:19 +01:00
src/main/java: minor refactor
Use isEmpty() instead of checking size.
This commit is contained in:
parent
9e965afdb7
commit
f9d7e5f6a2
@ -91,7 +91,7 @@ public class CountryCodeTagger extends AbstractCurationTask {
|
|||||||
itemService.getMetadataByMetadataString(item, config.iso3166Field);
|
itemService.getMetadataByMetadataString(item, config.iso3166Field);
|
||||||
|
|
||||||
// skip items that don't have country metadata
|
// skip items that don't have country metadata
|
||||||
if (itemCountries.size() == 0) {
|
if (itemCountries.isEmpty()) {
|
||||||
alpha2Result.setResult(itemHandle + ": no countries, skipping.");
|
alpha2Result.setResult(itemHandle + ": no countries, skipping.");
|
||||||
alpha2Result.setStatus(Curator.CURATE_SKIP);
|
alpha2Result.setStatus(Curator.CURATE_SKIP);
|
||||||
} else {
|
} else {
|
||||||
@ -134,7 +134,7 @@ public class CountryCodeTagger extends AbstractCurationTask {
|
|||||||
List<MetadataValue> itemAlpha2CountryCodes =
|
List<MetadataValue> itemAlpha2CountryCodes =
|
||||||
itemService.getMetadataByMetadataString(item, config.iso3166Alpha2Field);
|
itemService.getMetadataByMetadataString(item, config.iso3166Alpha2Field);
|
||||||
|
|
||||||
if (itemAlpha2CountryCodes.size() == 0) {
|
if (itemAlpha2CountryCodes.isEmpty()) {
|
||||||
List<String> newAlpha2Codes = new ArrayList<String>();
|
List<String> newAlpha2Codes = new ArrayList<String>();
|
||||||
for (MetadataValue itemCountry : itemCountries) {
|
for (MetadataValue itemCountry : itemCountries) {
|
||||||
// check ISO 3166-1 countries
|
// check ISO 3166-1 countries
|
||||||
@ -158,7 +158,7 @@ public class CountryCodeTagger extends AbstractCurationTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newAlpha2Codes.size() > 0) {
|
if (!newAlpha2Codes.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
itemService.addMetadata(
|
itemService.addMetadata(
|
||||||
Curator.curationContext(),
|
Curator.curationContext(),
|
||||||
|
Loading…
Reference in New Issue
Block a user