forked from D-Net/dnet-hadoop
[BulkTagging] added fix to consider when the set of constraints for the datasource is empty. Added check for remove constraints and advanced constraints to verify if the constraints list is empty and in that case do nothing
This commit is contained in:
parent
2e54715d71
commit
ca2d480df3
|
@ -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)
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue