Skip to content

Commit

Permalink
Support dataset exclusion in nub configs
Browse files Browse the repository at this point in the history
  • Loading branch information
mdoering committed Jul 5, 2023
1 parent 1f386a3 commit 558f793
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ public boolean isDoubtful(String name) {
return doubtful.contains(name.trim());
}

/**
* Set of dataset keys to be excluded from processing that publisher sources like Plazi otherwise provide.
*/
@NotNull
@Valid
public Set<UUID> datasetExclusions = new HashSet<>();

/**
* List of higher wrong homonyms that should be removed, regardless of which source they came from.
* Map of a canonical name to its direct parent.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ private List<NubSource> loadSources() {
LOG.warn("Duplicate source {} skipped", sd.key);
continue;
}
if (cfg.datasetExclusions.contains(sd.key)) {
LOG.warn("Source {} excluded in configs", sd.key);
continue;
}
keys.add(sd.key);
Dataset d = datasetService.get(sd.key);
if (d != null) {
Expand All @@ -144,6 +148,10 @@ private List<NubSource> loadSources() {
if (org != null) {
int counter = 0;
for (Dataset d2 : Iterables.publishedDatasets(org.getKey(), DatasetType.CHECKLIST, organizationService)) {
if (cfg.datasetExclusions.contains(d2)) {
LOG.warn("Source {} from publisher {} excluded in configs", d2, org.getTitle());
continue;
}
if (!keys.contains(d2.getKey())) {
sources.add(buildSource(d2, cfg, sd));
counter++;
Expand All @@ -156,6 +164,10 @@ private List<NubSource> loadSources() {
if (inst != null) {
int counter = 0;
for (Dataset d2 : Iterables.hostedDatasets(inst.getKey(), DatasetType.CHECKLIST, installationService)) {
if (cfg.datasetExclusions.contains(d2)) {
LOG.warn("Source {} from installation {} excluded in configs", d2, inst.getKey());
continue;
}
if (!keys.contains(d2.getKey())) {
sources.add(buildSource(d2, cfg, sd));
counter++;
Expand Down

0 comments on commit 558f793

Please sign in to comment.