[BulkTagging] Fix for tagging from datasource #513

Merged
claudio.atzori merged 1 commits from main_bulktag into main 2024-11-26 15:34:47 +01:00
2 changed files with 11 additions and 6 deletions

View File

@ -130,6 +130,7 @@ public class ResultTagger implements Serializable {
// log.info("Remove constraints for " + communityId); // log.info("Remove constraints for " + communityId);
if (conf.getRemoveConstraintsMap().keySet().contains(communityId) && if (conf.getRemoveConstraintsMap().keySet().contains(communityId) &&
conf.getRemoveConstraintsMap().get(communityId).getCriteria() != null && conf.getRemoveConstraintsMap().get(communityId).getCriteria() != null &&
!conf.getRemoveConstraintsMap().get(communityId).getCriteria().isEmpty() &&
conf conf
.getRemoveConstraintsMap() .getRemoveConstraintsMap()
.get(communityId) .get(communityId)
@ -161,29 +162,30 @@ public class ResultTagger implements Serializable {
// Tagging for datasource // Tagging for datasource
final Set<String> datasources = new HashSet<>(); final Set<String> datasources = new HashSet<>();
final Set<String> collfrom = new HashSet<>(); final Set<String> cfhb = new HashSet<>();
final Set<String> hostdby = new HashSet<>(); final Set<String> hostdby = new HashSet<>();
if (Objects.nonNull(result.getInstance())) { if (Objects.nonNull(result.getInstance())) {
for (Instance i : result.getInstance()) { for (Instance i : result.getInstance()) {
if (Objects.nonNull(i.getCollectedfrom()) && Objects.nonNull(i.getCollectedfrom().getKey())) { if (Objects.nonNull(i.getCollectedfrom()) && Objects.nonNull(i.getCollectedfrom().getKey())) {
collfrom.add(i.getCollectedfrom().getKey()); cfhb.add(i.getCollectedfrom().getKey());
} }
if (Objects.nonNull(i.getHostedby()) && Objects.nonNull(i.getHostedby().getKey())) { if (Objects.nonNull(i.getHostedby()) && Objects.nonNull(i.getHostedby().getKey())) {
cfhb.add(i.getHostedby().getKey());
hostdby.add(i.getHostedby().getKey()); hostdby.add(i.getHostedby().getKey());
} }
} }
collfrom cfhb
.forEach( .forEach(
dsId -> datasources dsId -> datasources
.addAll( .addAll(
conf.getCommunityForDatasource(dsId, param))); conf.getCommunityForDatasource(dsId, param)));
hostdby.forEach(dsId -> { hostdby.forEach(dsId -> {
datasources // datasources
.addAll( // .addAll(
conf.getCommunityForDatasource(dsId, param)); // conf.getCommunityForDatasource(dsId, param));
if (conf.isEoscDatasource(dsId)) { if (conf.isEoscDatasource(dsId)) {
datasources.add("eosc"); datasources.add("eosc");
} }
@ -226,6 +228,7 @@ public class ResultTagger implements Serializable {
.forEach(communityId -> { .forEach(communityId -> {
if (!removeCommunities.contains(communityId) && if (!removeCommunities.contains(communityId) &&
conf.getSelectionConstraintsMap().get(communityId).getCriteria() != null && conf.getSelectionConstraintsMap().get(communityId).getCriteria() != null &&
!conf.getSelectionConstraintsMap().get(communityId).getCriteria().isEmpty() &&
conf conf
.getSelectionConstraintsMap() .getSelectionConstraintsMap()
.get(communityId) .get(communityId)

View File

@ -33,6 +33,8 @@ public class SelectionConstraints implements Serializable {
// Constraints in or // Constraints in or
public boolean verifyCriteria(final Map<String, List<String>> param) { public boolean verifyCriteria(final Map<String, List<String>> param) {
if (criteria.isEmpty())
return true;
for (Constraints selc : criteria) { for (Constraints selc : criteria) {
if (selc.verifyCriteria(param)) { if (selc.verifyCriteria(param)) {
return true; return true;