From 737df27c4141ee2439637f47d550ce4aa0ce5d18 Mon Sep 17 00:00:00 2001 From: "michele.artini" Date: Mon, 6 Jul 2020 11:48:36 +0200 Subject: [PATCH] fixed npe --- .gitignore | 3 +- .../matchers/SubscriptionEventMatcher.java | 28 ++++---- .../static/openaire/openaire-lbs-ui.js | 67 +++++++++++++++++++ 3 files changed, 83 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index c2f5477a..e773ec19 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,5 @@ spark-warehouse /**/*.log .svn /**/.svn - +apps/dnet-orgs-database-application/data/ +apps/dnet-orgs-database-application/src/main/resources/tmp_data diff --git a/apps/dhp-broker-application/src/main/java/eu/dnetlib/lbs/matchers/SubscriptionEventMatcher.java b/apps/dhp-broker-application/src/main/java/eu/dnetlib/lbs/matchers/SubscriptionEventMatcher.java index 4d0aa72b..d4cf2555 100644 --- a/apps/dhp-broker-application/src/main/java/eu/dnetlib/lbs/matchers/SubscriptionEventMatcher.java +++ b/apps/dhp-broker-application/src/main/java/eu/dnetlib/lbs/matchers/SubscriptionEventMatcher.java @@ -99,25 +99,25 @@ public class SubscriptionEventMatcher implements Runnable { final BoolQueryBuilder mapQuery = QueryBuilders.boolQuery(); s.getConditionsAsList() - .stream() - .map(MapCondition::asQueryBuilder) - .filter(Objects::nonNull) - .forEach(mapQuery::must); + .stream() + .map(MapCondition::asQueryBuilder) + .filter(Objects::nonNull) + .forEach(mapQuery::must); final NativeSearchQuery searchQuery = new NativeSearchQueryBuilder() - .withQuery(QueryBuilders.boolQuery() - .must(QueryBuilders.matchQuery("topic", s.getTopic())) - .must(QueryBuilders.rangeQuery("creationDate").from(s.getLastNotificationDate().getTime())) - .must(QueryBuilders.nestedQuery("map", mapQuery, ScoreMode.None))) - .withSearchType(SearchType.DEFAULT) - // .withIndices(elasticSearchProperties.getEventsIndexName()) - // .withTypes(elasticSearchProperties.getEventsIndexType()) - .withPageable(PageRequest.of(0, 10)) - .build(); + .withQuery(QueryBuilders.boolQuery() + .must(QueryBuilders.matchQuery("topic", s.getTopic())) + .must(QueryBuilders.rangeQuery("creationDate").from(s.getLastNotificationDate() != null ? s.getLastNotificationDate().getTime() : 0)) + .must(QueryBuilders.nestedQuery("map", mapQuery, ScoreMode.None))) + .withSearchType(SearchType.DEFAULT) + // .withIndices(elasticSearchProperties.getEventsIndexName()) + // .withTypes(elasticSearchProperties.getEventsIndexType()) + .withPageable(PageRequest.of(0, 10)) + .build(); final List events = new ArrayList<>(); final CloseableIterator> it = - esOperations.searchForStream(searchQuery, Event.class, IndexCoordinates.of(elasticSearchProperties.getEventsIndexName())); + esOperations.searchForStream(searchQuery, Event.class, IndexCoordinates.of(elasticSearchProperties.getEventsIndexName())); while (it.hasNext()) { final Event e = it.next().getContent(); final Notification n = new Notification(s, e); diff --git a/apps/dhp-broker-application/src/main/resources/static/openaire/openaire-lbs-ui.js b/apps/dhp-broker-application/src/main/resources/static/openaire/openaire-lbs-ui.js index 7d91a15c..eecef5c1 100644 --- a/apps/dhp-broker-application/src/main/resources/static/openaire/openaire-lbs-ui.js +++ b/apps/dhp-broker-application/src/main/resources/static/openaire/openaire-lbs-ui.js @@ -348,6 +348,28 @@ openaireBrokerControllers.controller('notificationsCtrl', function ($scope, $htt $location.path('/ntf/' + n + "/" + $scope.subscrId); } + $scope.isAuthorHighlighted = function(author, list) { + if (list) { + for (var i=0; i