From 287753417d6cea4f278fcc698ab3eedc131d0cbb Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Thu, 6 Apr 2023 12:22:38 +0200 Subject: [PATCH] better implementation for the fix --- .../main/java/eu/dnetlib/dhp/bulktag/community/Community.java | 4 ++-- .../dhp/bulktag/community/CommunityConfigurationFactory.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/Community.java b/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/Community.java index 041272be1..f0986a832 100644 --- a/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/Community.java +++ b/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/Community.java @@ -16,7 +16,7 @@ public class Community implements Serializable { private List subjects = new ArrayList<>(); private List providers = new ArrayList<>(); private List zenodoCommunities = new ArrayList<>(); - private SelectionConstraints constraints = new SelectionConstraints(); + private SelectionConstraints constraints; public String toJson() { final Gson g = new Gson(); @@ -27,7 +27,7 @@ public class Community implements Serializable { return !getSubjects().isEmpty() || !getProviders().isEmpty() || !getZenodoCommunities().isEmpty() - || constraints != null; + || !getConstraints().getCriteria().isEmpty(); } public String getId() { diff --git a/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/CommunityConfigurationFactory.java b/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/CommunityConfigurationFactory.java index ef4428ce7..da144fb7b 100644 --- a/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/CommunityConfigurationFactory.java +++ b/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/CommunityConfigurationFactory.java @@ -92,7 +92,7 @@ public class CommunityConfigurationFactory { private static SelectionConstraints parseConstrains(Node node) { Node advConstsNode = node.selectSingleNode("./advancedConstraints"); if (advConstsNode == null || StringUtils.isBlank(StringUtils.trim(advConstsNode.getText()))) { - return null; + return new SelectionConstraints(); } SelectionConstraints selectionConstraints = new Gson() .fromJson(advConstsNode.getText(), SelectionConstraints.class);