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);