fixed npe

This commit is contained in:
Michele Artini 2020-07-06 11:48:36 +02:00
parent 99bae13b31
commit 737df27c41
3 changed files with 83 additions and 15 deletions

3
.gitignore vendored
View File

@ -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

View File

@ -107,7 +107,7 @@ public class SubscriptionEventMatcher implements Runnable {
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())

View File

@ -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();
}); });