fixed npe
This commit is contained in:
parent
99bae13b31
commit
737df27c41
|
@ -26,4 +26,5 @@ spark-warehouse
|
||||||
/**/*.log
|
/**/*.log
|
||||||
.svn
|
.svn
|
||||||
/**/.svn
|
/**/.svn
|
||||||
|
apps/dnet-orgs-database-application/data/
|
||||||
|
apps/dnet-orgs-database-application/src/main/resources/tmp_data
|
||||||
|
|
|
@ -99,25 +99,25 @@ public class SubscriptionEventMatcher implements Runnable {
|
||||||
|
|
||||||
final BoolQueryBuilder mapQuery = QueryBuilders.boolQuery();
|
final BoolQueryBuilder mapQuery = QueryBuilders.boolQuery();
|
||||||
s.getConditionsAsList()
|
s.getConditionsAsList()
|
||||||
.stream()
|
.stream()
|
||||||
.map(MapCondition::asQueryBuilder)
|
.map(MapCondition::asQueryBuilder)
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.forEach(mapQuery::must);
|
.forEach(mapQuery::must);
|
||||||
|
|
||||||
final NativeSearchQuery searchQuery = new NativeSearchQueryBuilder()
|
final NativeSearchQuery searchQuery = new NativeSearchQueryBuilder()
|
||||||
.withQuery(QueryBuilders.boolQuery()
|
.withQuery(QueryBuilders.boolQuery()
|
||||||
.must(QueryBuilders.matchQuery("topic", s.getTopic()))
|
.must(QueryBuilders.matchQuery("topic", s.getTopic()))
|
||||||
.must(QueryBuilders.rangeQuery("creationDate").from(s.getLastNotificationDate().getTime()))
|
.must(QueryBuilders.rangeQuery("creationDate").from(s.getLastNotificationDate() != null ? s.getLastNotificationDate().getTime() : 0))
|
||||||
.must(QueryBuilders.nestedQuery("map", mapQuery, ScoreMode.None)))
|
.must(QueryBuilders.nestedQuery("map", mapQuery, ScoreMode.None)))
|
||||||
.withSearchType(SearchType.DEFAULT)
|
.withSearchType(SearchType.DEFAULT)
|
||||||
// .withIndices(elasticSearchProperties.getEventsIndexName())
|
// .withIndices(elasticSearchProperties.getEventsIndexName())
|
||||||
// .withTypes(elasticSearchProperties.getEventsIndexType())
|
// .withTypes(elasticSearchProperties.getEventsIndexType())
|
||||||
.withPageable(PageRequest.of(0, 10))
|
.withPageable(PageRequest.of(0, 10))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
final List<Event> events = new ArrayList<>();
|
final List<Event> events = new ArrayList<>();
|
||||||
final CloseableIterator<SearchHit<Event>> it =
|
final CloseableIterator<SearchHit<Event>> it =
|
||||||
esOperations.searchForStream(searchQuery, Event.class, IndexCoordinates.of(elasticSearchProperties.getEventsIndexName()));
|
esOperations.searchForStream(searchQuery, Event.class, IndexCoordinates.of(elasticSearchProperties.getEventsIndexName()));
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
final Event e = it.next().getContent();
|
final Event e = it.next().getContent();
|
||||||
final Notification n = new Notification(s, e);
|
final Notification n = new Notification(s, e);
|
||||||
|
|
|
@ -348,6 +348,28 @@ openaireBrokerControllers.controller('notificationsCtrl', function ($scope, $htt
|
||||||
$location.path('/ntf/' + n + "/" + $scope.subscrId);
|
$location.path('/ntf/' + n + "/" + $scope.subscrId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.isAuthorHighlighted = function(author, list) {
|
||||||
|
if (list) {
|
||||||
|
for (var i=0; i<list.length; i++) {
|
||||||
|
if (author.fullname + author.orcid == list[i].fullname + list[i].orcid) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.isSubjectHighlighted = function(subject, list) {
|
||||||
|
if (list) {
|
||||||
|
for (var i=0; i<list.length; i++) {
|
||||||
|
if (subject.value == list[i].value) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$scope.isInstanceHighlighted = function(instance, list) {
|
$scope.isInstanceHighlighted = function(instance, list) {
|
||||||
if (list) {
|
if (list) {
|
||||||
for (var i=0; i<list.length; i++) {
|
for (var i=0; i<list.length; i++) {
|
||||||
|
@ -359,6 +381,17 @@ openaireBrokerControllers.controller('notificationsCtrl', function ($scope, $htt
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.isProjectHighlighted= function(project, list) {
|
||||||
|
if (list) {
|
||||||
|
for (var i=0; i<list.length; i++) {
|
||||||
|
if (project.openaireId == list[i].openaireId) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$scope.isPidHighlighted = function(pid, list) {
|
$scope.isPidHighlighted = function(pid, list) {
|
||||||
if (list) {
|
if (list) {
|
||||||
for (var i=0; i<list.length; i++) {
|
for (var i=0; i<list.length; i++) {
|
||||||
|
@ -370,5 +403,39 @@ openaireBrokerControllers.controller('notificationsCtrl', function ($scope, $htt
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.isDatasetHighlighted= function(dataset, list) {
|
||||||
|
if (list) {
|
||||||
|
for (var i=0; i<list.length; i++) {
|
||||||
|
if (dataset.openaireId == list[i].openaireId) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.isSoftwareHighlighted= function(sw, list) {
|
||||||
|
if (list) {
|
||||||
|
for (var i=0; i<list.length; i++) {
|
||||||
|
if (sw.openaireId == list[i].openaireId) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$scope.isRelatedPublicationHighlighted= function(pub, list) {
|
||||||
|
if (list) {
|
||||||
|
for (var i=0; i<list.length; i++) {
|
||||||
|
if (pub.openaireId == list[i].openaireId) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$scope.refresh();
|
$scope.refresh();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue