dnet-applications/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/controller/SuggestionInfo.java

66 lines
1.4 KiB
Java

package eu.dnetlib.organizations.controller;
import java.util.LinkedHashMap;
import java.util.Map;
import eu.dnetlib.organizations.model.view.SuggestionInfoViewByCountry;
public class SuggestionInfo {
public class SuggestionCounter {
private long nDuplicates = 0;
private long nConflicts = 0;
private long nPendingOrgs = 0;
public long getnDuplicates() {
return nDuplicates;
}
public void setnDuplicates(final long nDuplicates) {
this.nDuplicates = nDuplicates;
}
public long getnConflicts() {
return nConflicts;
}
public void setnConflicts(final long nConflicts) {
this.nConflicts = nConflicts;
}
public long getnPendingOrgs() {
return nPendingOrgs;
}
public void setnPenfingOrgs(final long nPendingOrgs) {
this.nPendingOrgs = nPendingOrgs;
}
public void add(final SuggestionInfoViewByCountry infoCountry) {
nDuplicates += infoCountry.getnDuplicates();
nConflicts += infoCountry.getnConflicts();
nPendingOrgs += infoCountry.getnPendingOrgs();
}
}
public SuggestionCounter total = new SuggestionCounter();;
public Map<String, SuggestionCounter> byCountry = new LinkedHashMap<>();
public void add(final SuggestionInfoViewByCountry infoCountry) {
final String country = infoCountry.getCountry();
if (!byCountry.containsKey(country)) {
byCountry.put(country, new SuggestionCounter());
}
byCountry.get(country).add(infoCountry);
total.add(infoCountry);
}
}