use mergeFrom method call to add the country(ies) instead of modify the result directly.

This commit is contained in:
Miriam Baglioni 2020-04-17 16:50:54 +02:00
parent c4987dd12a
commit b46b080ddc
1 changed files with 6 additions and 2 deletions

View File

@ -135,12 +135,16 @@ public class SparkCountryPropagationJob2 {
for (Qualifier country : r.getCountry()) {
countries.add(country.getClassid());
}
Result res = new Result();
res.setId(r.getId());
List<Country> countryList = new ArrayList<>();
for (CountrySbs country : potentialNewCountries.get().getCountrySet()) {
if (!countries.contains(country.getClassid())) {
r.getCountry().add(getCountry(country.getClassid(), country.getClassname()));
countryList.add(getCountry(country.getClassid(), country.getClassname()));
}
}
res.setCountry(countryList);
r.mergeFrom(res);
}
return r;
}, Encoders.bean(resultClazz));