Revision 43719
Added by Claudio Atzori about 8 years ago
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.6/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
3 |
<parent> |
|
4 |
<groupId>eu.dnetlib</groupId> |
|
5 |
<artifactId>dnet-parent</artifactId> |
|
6 |
<version>1.0.0</version> |
|
7 |
<relativePath /> |
|
8 |
</parent> |
|
9 |
<modelVersion>4.0.0</modelVersion> |
|
10 |
<groupId>eu.dnetlib</groupId> |
|
11 |
<artifactId>dnet-openaire-blacklist</artifactId> |
|
12 |
<packaging>jar</packaging> |
|
13 |
<version>1.0.6</version> |
|
14 |
<scm> |
|
15 |
<developerConnection> |
|
16 |
scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.6 |
|
17 |
</developerConnection> |
|
18 |
</scm> |
|
19 |
<dependencies> |
|
20 |
<dependency> |
|
21 |
<groupId>eu.dnetlib</groupId> |
|
22 |
<artifactId>cnr-resultset-client</artifactId> |
|
23 |
<version>[2.0.0,3.0.0)</version> |
|
24 |
</dependency> |
|
25 |
<dependency> |
|
26 |
<groupId>eu.dnetlib</groupId> |
|
27 |
<artifactId>cnr-enabling-database-api</artifactId> |
|
28 |
<version>[2.0.0,3.0.0)</version> |
|
29 |
</dependency> |
|
30 |
<dependency> |
|
31 |
<groupId>eu.dnetlib</groupId> |
|
32 |
<artifactId>dnet-modular-ui</artifactId> |
|
33 |
<version>[3.0.0,4.0.0)</version> |
|
34 |
</dependency> |
|
35 |
<dependency> |
|
36 |
<groupId>eu.dnetlib</groupId> |
|
37 |
<artifactId>dnet-msro-service</artifactId> |
|
38 |
<version>[3.0.0,4.0.0)</version> |
|
39 |
</dependency> |
|
40 |
<dependency> |
|
41 |
<groupId>eu.dnetlib</groupId> |
|
42 |
<artifactId>dnet-hadoop-service-rmi</artifactId> |
|
43 |
<version>[1.0.0,2.0.0)</version> |
|
44 |
</dependency> |
|
45 |
<dependency> |
|
46 |
<groupId>eu.dnetlib</groupId> |
|
47 |
<artifactId>dnet-openaireplus-mapping-utils</artifactId> |
|
48 |
<version>[4.0.0,5.0.0)</version> |
|
49 |
</dependency> |
|
50 |
<dependency> |
|
51 |
<groupId>javax.servlet</groupId> |
|
52 |
<artifactId>javax.servlet-api</artifactId> |
|
53 |
<version>${javax.servlet.version}</version> |
|
54 |
<scope>provided</scope> |
|
55 |
</dependency> |
|
56 |
<dependency> |
|
57 |
<groupId>junit</groupId> |
|
58 |
<artifactId>junit</artifactId> |
|
59 |
<version>${junit.version}</version> |
|
60 |
<scope>test</scope> |
|
61 |
</dependency> |
|
62 |
<dependency> |
|
63 |
<groupId>org.mockito</groupId> |
|
64 |
<artifactId>mockito-core</artifactId> |
|
65 |
<version>1.9.5</version> |
|
66 |
</dependency> |
|
67 |
|
|
68 |
</dependencies> |
|
69 |
</project> |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.6/src/main/resources/eu/dnetlib/web/resources/js/blacklist_controllers.js | ||
---|---|---|
1 |
var blacklistControllers = angular.module('blacklistControllers', []); |
|
2 |
|
|
3 |
function common_init($scope, $http, $sce, $location) { |
|
4 |
initSpinner(); |
|
5 |
$scope.showError = function (error) { |
|
6 |
show_notification("error", error); |
|
7 |
}; |
|
8 |
$scope.showNotification = function (message) { |
|
9 |
show_notification("info", message); |
|
10 |
}; |
|
11 |
$scope.showSpinner = function () { |
|
12 |
showSpinner(); |
|
13 |
}; |
|
14 |
$scope.hideSpinner = function () { |
|
15 |
hideSpinner(); |
|
16 |
}; |
|
17 |
$scope.to_trusted = function (html) { |
|
18 |
return $sce.trustAsHtml(html); |
|
19 |
}; |
|
20 |
$scope.go = function (path) { |
|
21 |
$location.path(path); |
|
22 |
}; |
|
23 |
$scope.encodeValue = function (val) { |
|
24 |
return val; |
|
25 |
}; |
|
26 |
} |
|
27 |
|
|
28 |
blacklistControllers.controller('blacklistCtrl', [ |
|
29 |
'$scope', '$http', '$sce', '$location', function ($scope, $http, $sce, $location) { |
|
30 |
common_init($scope, $http, $sce, $location); |
|
31 |
|
|
32 |
$scope.blacklist = []; |
|
33 |
$scope.relationTypes = []; |
|
34 |
$scope.blacklistFilter = ''; |
|
35 |
|
|
36 |
$scope.entryToEdit = {}; |
|
37 |
$scope.showBlacklistForm = false; |
|
38 |
$scope.modeBlacklistForm = ''; |
|
39 |
|
|
40 |
$scope.predicate = ''; |
|
41 |
$scope.reverse = true; |
|
42 |
|
|
43 |
$scope.order = function(predicate) { |
|
44 |
$scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false; |
|
45 |
$scope.predicate = predicate; |
|
46 |
}; |
|
47 |
|
|
48 |
$scope.getBlacklist = function () { |
|
49 |
$scope.blacklist = []; |
|
50 |
|
|
51 |
$scope.showSpinner(); |
|
52 |
|
|
53 |
$http.get('blacklist/getBlacklist.do').success(function (data) { |
|
54 |
$scope.hideSpinner(); |
|
55 |
$scope.blacklist = data; |
|
56 |
}).error(function () { |
|
57 |
$scope.showError('Problems getting the blacklist'); |
|
58 |
$scope.hideSpinner(); |
|
59 |
}); |
|
60 |
}; |
|
61 |
|
|
62 |
$scope.getBlacklist(); |
|
63 |
|
|
64 |
$scope.prepareNewEntry = function() { |
|
65 |
$scope.modeBlacklistForm = 'ADD'; |
|
66 |
$scope.entryToEdit = {}; |
|
67 |
$scope.showBlacklistForm = true; |
|
68 |
}; |
|
69 |
|
|
70 |
$scope.prepareForEdit = function (entry) { |
|
71 |
$scope.modeBlacklistForm = 'UPDATE'; |
|
72 |
$scope.entryToEdit = angular.copy(entry); |
|
73 |
$scope.showBlacklistForm = true; |
|
74 |
}; |
|
75 |
|
|
76 |
$scope.addBlacklistEntry = function (newEntry) { |
|
77 |
$scope.showSpinner(); |
|
78 |
$http.post('blacklist/addToBlacklist.do', newEntry).success(function (data) { |
|
79 |
$scope.hideSpinner(); |
|
80 |
if (data === 'false') { |
|
81 |
$scope.showError('Cannot add blacklist entry: probably it is a duplicate') |
|
82 |
} else { |
|
83 |
$scope.showNotification('Blacklist entry successfully added'); |
|
84 |
$scope.getBlacklist(); |
|
85 |
} |
|
86 |
}).error(function () { |
|
87 |
$scope.hideSpinner(); |
|
88 |
$scope.showError('ERROR: cannot add blacklist entry'); |
|
89 |
}); |
|
90 |
}; |
|
91 |
|
|
92 |
$scope.editBlacklistEntry = function (entry) { |
|
93 |
$scope.showSpinner(); |
|
94 |
$http.post('blacklist/editBlacklistEntry.do', entry).success(function (data) { |
|
95 |
$scope.hideSpinner(); |
|
96 |
if (data === 'false') { |
|
97 |
$scope.showError('Cannot edit entry') |
|
98 |
} else { |
|
99 |
$scope.showNotification('Blacklist entry successfully edited'); |
|
100 |
$scope.getBlacklist(); |
|
101 |
} |
|
102 |
}).error(function () { |
|
103 |
$scope.hideSpinner(); |
|
104 |
$scope.showError('ERROR: cannot edit blacklist entry'); |
|
105 |
}); |
|
106 |
}; |
|
107 |
|
|
108 |
$scope.deleteFromBlacklist = function (id) { |
|
109 |
var result = confirm("Are you sure you want to delete it?"); |
|
110 |
if (result) { |
|
111 |
$scope.showSpinner(); |
|
112 |
$http.post('blacklist/deleteFromBlacklist.do', id).success(function (data) { |
|
113 |
$scope.hideSpinner(); |
|
114 |
if (data === 'false') { |
|
115 |
$scope.showError('Cannot delete entry') |
|
116 |
} else { |
|
117 |
$scope.showNotification('Blacklist entry successfully deleted'); |
|
118 |
$scope.getBlacklist(); |
|
119 |
} |
|
120 |
}).error(function () { |
|
121 |
$scope.hideSpinner(); |
|
122 |
$scope.showError('ERROR: cannot delete blacklist entry'); |
|
123 |
}); |
|
124 |
} |
|
125 |
}; |
|
126 |
} |
|
127 |
]); |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.6/src/main/resources/eu/dnetlib/web/resources/js/blacklist.js | ||
---|---|---|
1 |
var module = angular.module('blacklist', ['ngRoute', 'blacklistControllers']); |
|
2 |
|
|
3 |
module.config([ |
|
4 |
'$routeProvider', |
|
5 |
function ($routeProvider) { |
|
6 |
$routeProvider |
|
7 |
.when('/blacklist', { |
|
8 |
templateUrl: '../resources/html/blacklist/blacklist.html', |
|
9 |
controller: 'blacklistCtrl' |
|
10 |
}) |
|
11 |
.otherwise({redirectTo: '/blacklist'}); |
|
12 |
} |
|
13 |
]); |
|
14 |
|
|
15 |
module.directive('ngBlacklistForm', function ($http) { |
|
16 |
return { |
|
17 |
restrict : 'E', |
|
18 |
templateUrl : '../resources/html/blacklist/blacklistEntryForm.html', |
|
19 |
transclude : true, |
|
20 |
replace : true, |
|
21 |
scope: { |
|
22 |
entry : "=", |
|
23 |
visible : "=", |
|
24 |
mode : "=", |
|
25 |
addFunction : "&", |
|
26 |
updateFunction : "&" |
|
27 |
}, |
|
28 |
link: function (scope, element, attrs, ctrl) { |
|
29 |
scope.entityTypes = ['result', 'project', 'datasource', 'organization', 'person']; |
|
30 |
scope.relationTypes = []; |
|
31 |
|
|
32 |
$(element).modal({'show': false}); |
|
33 |
|
|
34 |
scope.$watch(function() { |
|
35 |
return scope.visible; |
|
36 |
}, function(value) { |
|
37 |
if (value != true) { return } |
|
38 |
$(element).modal('show'); |
|
39 |
scope.visible = false; |
|
40 |
}); |
|
41 |
|
|
42 |
scope.resetIisInfo = function() { |
|
43 |
delete scope.entry['iisModule']; |
|
44 |
delete scope.entry['iisStatus']; |
|
45 |
} |
|
46 |
|
|
47 |
scope.getListOfRelationships = function () { |
|
48 |
$http.get('blacklist/getListOfRelationships.do').success(function (data) { |
|
49 |
scope.relationTypes = data; |
|
50 |
}).error(function () { |
|
51 |
show_notification('error', 'Problems getting the list of relationships..'); |
|
52 |
}); |
|
53 |
}; |
|
54 |
|
|
55 |
scope.saveEntry = function() { |
|
56 |
if (scope.mode == 'ADD') { scope.addFunction() } |
|
57 |
else if (scope.mode == 'UPDATE') { scope.updateFunction() } |
|
58 |
else { show_notification('error', 'Missing Mode (ADD / UPDATE)'); } |
|
59 |
} |
|
60 |
|
|
61 |
scope.getListOfRelationships(); |
|
62 |
} |
|
63 |
} |
|
64 |
}); |
|
65 |
|
|
66 |
module.directive('bsHasError', function () { |
|
67 |
return { |
|
68 |
restrict: "A", |
|
69 |
link: function (scope, element, attrs, ctrl) { |
|
70 |
element.toggleClass('has-feedback', true); |
|
71 |
var input = element.find('input[ng-model], select[ng-model], textarea[ng-model]'); |
|
72 |
if (input) { |
|
73 |
scope.$watch(function () { |
|
74 |
if (input.controller('ngModel').$invalid) { |
|
75 |
return 0; |
|
76 |
} else if (!input.controller('ngModel').$viewValue) { |
|
77 |
return 1; |
|
78 |
} else { |
|
79 |
return 2; |
|
80 |
} |
|
81 |
}, function (code) { |
|
82 |
if (code < 0) return; |
|
83 |
|
|
84 |
if (code == 2) { input.css('color', "#666666"); } |
|
85 |
else { input.css('color', "#999999"); } |
|
86 |
|
|
87 |
input.find('option').css('color', '#666666'); |
|
88 |
input.find('option.empty').css('color', '#999999'); |
|
89 |
|
|
90 |
element.toggleClass('has-error', (code == 0)); |
|
91 |
element.toggleClass('has-warning', (code == 1)); |
|
92 |
element.toggleClass('has-success', (code == 2)); |
|
93 |
|
|
94 |
var feedback = element.find('.form-control-feedback'); |
|
95 |
if (feedback) { |
|
96 |
feedback.toggleClass('glyphicon-remove', (code == 0)); |
|
97 |
feedback.toggleClass('glyphicon-warning-sign', (code == 1)); |
|
98 |
feedback.toggleClass('glyphicon-ok', (code == 2)); |
|
99 |
} |
|
100 |
}); |
|
101 |
} |
|
102 |
} |
|
103 |
}; |
|
104 |
}); |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.6/src/main/resources/eu/dnetlib/web/resources/html/blacklist/blacklist.html | ||
---|---|---|
1 |
<ng-blacklist-form entry="entryToEdit" |
|
2 |
visible="showBlacklistForm" |
|
3 |
add-function="addBlacklistEntry(entryToEdit)" |
|
4 |
update-function="editBlacklistEntry(entryToEdit)" |
|
5 |
mode="modeBlacklistForm"> |
|
6 |
</ng-blacklist-form> |
|
7 |
|
|
8 |
<div class="row"> |
|
9 |
<div class="col-xs-3"> |
|
10 |
<button class="btn btn-sm btn-primary" ng-click="prepareNewEntry()">Add blacklist entry</button> |
|
11 |
</div> |
|
12 |
<div class="col-xs-9"> |
|
13 |
<form role="form" class="form-inline pull-right"> |
|
14 |
<input type="text" placeholder="Filter..." ng-model="blacklistFilter" class="form-control input-sm"> |
|
15 |
<button type="button" class="btn btn-default btn btn-sm" ng-click="getBlacklist()"><span class="glyphicon glyphicon-refresh"></span></button> |
|
16 |
</form> |
|
17 |
</div> |
|
18 |
</div> |
|
19 |
|
|
20 |
<table class="table table-hover" style="font-size: 12px; margin-top: 30px;"> |
|
21 |
<thead> |
|
22 |
<tr> |
|
23 |
<th class="text-right"> |
|
24 |
<a href="javascript:void(0)" ng-click="order('ticketId')"> |
|
25 |
Ticket |
|
26 |
<span class="glyphicon" ng-class="{ |
|
27 |
'glyphicon-sort' : predicate != 'ticketId', |
|
28 |
'glyphicon-chevron-up' : predicate == 'ticketId' && reverse, |
|
29 |
'glyphicon-chevron-down' : predicate == 'ticketId' && !reverse |
|
30 |
}"></span> |
|
31 |
</a> |
|
32 |
</th> |
|
33 |
<th class="text-center"> |
|
34 |
<a href="javascript:void(0)" ng-click="order('sourceObject')"> |
|
35 |
Source Object |
|
36 |
<span class="glyphicon" ng-class="{ |
|
37 |
'glyphicon-sort' : predicate != 'sourceObject', |
|
38 |
'glyphicon-chevron-up' : predicate == 'sourceObject' && reverse, |
|
39 |
'glyphicon-chevron-down' : predicate == 'sourceObject' && !reverse |
|
40 |
}"></span> |
|
41 |
</a> |
|
42 |
</th> |
|
43 |
<th class="text-center"> |
|
44 |
<a href="javascript:void(0)" ng-click="order('relationship')"> |
|
45 |
Relationship |
|
46 |
<span class="glyphicon" ng-class="{ |
|
47 |
'glyphicon-sort' : predicate != 'relationship', |
|
48 |
'glyphicon-chevron-up' : predicate == 'relationship' && reverse, |
|
49 |
'glyphicon-chevron-down' : predicate == 'relationship' && !reverse |
|
50 |
}"></span> |
|
51 |
</a> |
|
52 |
</th> |
|
53 |
<th class="text-center"> |
|
54 |
<a href="javascript:void(0)" ng-click="order('targetObject')"> |
|
55 |
Target Object |
|
56 |
<span class="glyphicon" ng-class="{ |
|
57 |
'glyphicon-sort' : predicate != 'targetObject', |
|
58 |
'glyphicon-chevron-up' : predicate == 'targetObject' && reverse, |
|
59 |
'glyphicon-chevron-down' : predicate == 'targetObject' && !reverse |
|
60 |
}"></span> |
|
61 |
</a> |
|
62 |
</th> |
|
63 |
<th class="text-center"> |
|
64 |
<a href="javascript:void(0)" ng-click="order('status')"> |
|
65 |
Status |
|
66 |
<span class="glyphicon" ng-class="{ |
|
67 |
'glyphicon-sort' : predicate != 'status', |
|
68 |
'glyphicon-chevron-up' : predicate == 'status' && reverse, |
|
69 |
'glyphicon-chevron-down' : predicate == 'status' && !reverse |
|
70 |
}"></span> |
|
71 |
</a> |
|
72 |
</th> |
|
73 |
<th class="text-center"> |
|
74 |
<a href="javascript:void(0)" ng-click="order('provenance')"> |
|
75 |
Provenance |
|
76 |
<span class="glyphicon" ng-class="{ |
|
77 |
'glyphicon-sort' : predicate != 'provenance', |
|
78 |
'glyphicon-chevron-up' : predicate == 'provenance' && reverse, |
|
79 |
'glyphicon-chevron-down' : predicate == 'provenance' && !reverse |
|
80 |
}"></span> |
|
81 |
</a> |
|
82 |
</th> |
|
83 |
<th class="text-center"> |
|
84 |
<a href="javascript:void(0)" ng-click="order('lastUpdateDate')"> |
|
85 |
Last Update Date |
|
86 |
<span class="glyphicon" ng-class="{ |
|
87 |
'glyphicon-sort' : predicate != 'lastUpdateDate', |
|
88 |
'glyphicon-chevron-up' : predicate == 'lastUpdateDate' && reverse, |
|
89 |
'glyphicon-chevron-down' : predicate == 'lastUpdateDate' && !reverse |
|
90 |
}"></span> |
|
91 |
</a> |
|
92 |
</th> |
|
93 |
<th></th> |
|
94 |
</tr> |
|
95 |
</thead> |
|
96 |
<tbody> |
|
97 |
<tr ng-repeat="entry in blacklist | filter:blacklistFilter | orderBy:predicate:reverse"> |
|
98 |
<td class="text-right"> |
|
99 |
<a ng-show="entry.ticketId && entry.ticketId > 0" target="_blank" href="https://issue.openaire.research-infrastructures.eu/issues/{{entry.ticketId}}">{{entry.ticketId}}</a> |
|
100 |
<span ng-hide="entry.ticketId && entry.ticketId > 0">-</span> |
|
101 |
</td> |
|
102 |
<td class="text-center" style="font-family: monospace" title="{{entry.sourceType}}"> |
|
103 |
<b class="text-info">{{entry.sourceObject}}</b> |
|
104 |
<span ng-repeat="origId in entry.originalSourceObjects" class="text-muted" ng-show="origId != entry.sourceObject"><br />{{origId}}</span> |
|
105 |
</td> |
|
106 |
<td class="text-center">{{entry.relationship}}</td> |
|
107 |
<td class="text-center" style="font-family: monospace" title="{{entry.targetType}}"> |
|
108 |
<b class="text-info">{{entry.targetObject}}</b> |
|
109 |
<span ng-repeat="origId in entry.originalTargetObjects" class="text-muted" ng-show="origId != entry.targetObject"><br />{{origId}}</span> |
|
110 |
</td> |
|
111 |
<td class="text-center"> |
|
112 |
<span class="label" ng-class="{ |
|
113 |
'label-default' : entry.status == 'PENDING', |
|
114 |
'label-success' : entry.status == 'ACCEPTED', |
|
115 |
'label label-warning' : entry.status == 'REFUSED', |
|
116 |
'label-danger' : entry.status == 'DELETED' |
|
117 |
}">{{entry.status}}</span> |
|
118 |
</td> |
|
119 |
<td class="text-center" ng-switch="entry.provenance"> |
|
120 |
<span ng-switch-when='iis' title="{{entry.iisStatus}}" ng-class="{'text-success' : entry.iisStatus == 'SOLVED', 'text-danger' : entry.iisStatus == 'UNSOLVED' }">{{entry.iisModule}}</span> |
|
121 |
<span ng-switch-default>{{entry.provenance}}</span> |
|
122 |
</td> |
|
123 |
<td class="text-center">{{entry.lastUpdateDate}}</td> |
|
124 |
<td class="text-right" style="white-space: nowrap;"> |
|
125 |
<button type="button" class="btn btn-warning btn-xs" ng-click="prepareForEdit(entry)">Edit</button> |
|
126 |
<button type="button" class="btn btn-danger btn-xs" ng-click="deleteFromBlacklist(entry.id)">Delete</button> |
|
127 |
</td> |
|
128 |
</tr> |
|
129 |
</tbody> |
|
130 |
</table> |
|
131 |
|
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.6/src/main/resources/eu/dnetlib/web/resources/html/blacklist/blacklistEntryForm.html | ||
---|---|---|
1 |
<div class="modal fade"> |
|
2 |
<div class="modal-dialog modal-lg"> |
|
3 |
<div class="modal-content"> |
|
4 |
<div class="modal-header"> |
|
5 |
<button type="button" class="close" data-dismiss="modal"> |
|
6 |
<span aria-hidden="true">×</span> |
|
7 |
</button> |
|
8 |
<h4 class="modal-title" ng-if="mode == 'ADD'">Add new blacklist entry</h4> |
|
9 |
<h4 class="modal-title" ng-if="mode == 'UPDATE'">Edit blacklist entry</h4> |
|
10 |
</div> |
|
11 |
<div class="modal-body"> |
|
12 |
<form class="form-horizontal" name="formBlacklist"> |
|
13 |
|
|
14 |
<div class="form-group"> |
|
15 |
<label class="col-xs-3 control-label">Ticket ID</label> |
|
16 |
<div class="col-xs-2"> |
|
17 |
<div bs-has-error> |
|
18 |
<input class="form-control" ng-model="entry.ticketId" type="text" ng-pattern="/^\d+$/" placeholder="ID..." /> |
|
19 |
<span class="form-control-feedback glyphicon"></span> |
|
20 |
</div> |
|
21 |
</div> |
|
22 |
</div> |
|
23 |
|
|
24 |
<div class="form-group"> |
|
25 |
<label class="col-xs-3 control-label">Relationship</label> |
|
26 |
<div class="col-xs-9"> |
|
27 |
<div bs-has-error> |
|
28 |
<select class="form-control" ng-model="entry.relationship" required="required"> |
|
29 |
<option value="" disabled="disabled" style="display: none;">- Please Choose -</option> |
|
30 |
<option value="{{item}}" ng-repeat="item in relationTypes">{{item}}</option> |
|
31 |
</select> |
|
32 |
<span class="form-control-feedback glyphicon"></span> |
|
33 |
</div> |
|
34 |
</div> |
|
35 |
</div> |
|
36 |
|
|
37 |
<div class="form-group"> |
|
38 |
<label class="col-xs-3 control-label">Source</label> |
|
39 |
<div class="col-xs-3"> |
|
40 |
<div bs-has-error> |
|
41 |
<select class="form-control" ng-model="entry.sourceType" required="required"> |
|
42 |
<option value="" disabled="disabled" style="display: none;">- Choose Type... -</option> |
|
43 |
<option value="{{item}}" ng-repeat="item in entityTypes">{{item}}</option> |
|
44 |
</select> |
|
45 |
<span class="form-control-feedback glyphicon"></span> |
|
46 |
</div> |
|
47 |
</div> |
|
48 |
<div class="col-xs-6"> |
|
49 |
<div bs-has-error> |
|
50 |
<input class="form-control" ng-model="entry.sourceObject" type="text" required="required" ng-pattern="/^\S{12}::\S{32}$/" placeholder="Source ID..." ng-disabled="mode == 'UPDATE'"/> |
|
51 |
<span class="form-control-feedback glyphicon"></span> |
|
52 |
</div> |
|
53 |
</div> |
|
54 |
</div> |
|
55 |
|
|
56 |
<div class="form-group"> |
|
57 |
<label class="col-xs-3 control-label">Target</label> |
|
58 |
<div class="col-xs-3"> |
|
59 |
<div bs-has-error> |
|
60 |
<select class="form-control" ng-model="entry.targetType" required="required"> |
|
61 |
<option value="" disabled="disabled" style="display: none;">- Choose Type... -</option> |
|
62 |
<option value="{{item}}" ng-repeat="item in entityTypes">{{item}}</option> |
|
63 |
</select> |
|
64 |
<span class="form-control-feedback glyphicon"></span> |
|
65 |
</div> |
|
66 |
</div> |
|
67 |
<div class="col-xs-6"> |
|
68 |
<div bs-has-error> |
|
69 |
<input class="form-control" ng-model="entry.targetObject" type="text" required="required" ng-pattern="/^\S{12}::\S{32}$/" placeholder="Target ID..." ng-disabled="mode == 'UPDATE'" /> |
|
70 |
<span class="form-control-feedback glyphicon"></span> |
|
71 |
</div> |
|
72 |
</div> |
|
73 |
</div> |
|
74 |
|
|
75 |
<div class="form-group"> |
|
76 |
<label class="col-xs-3 control-label">Status</label> |
|
77 |
<div class="col-xs-3"> |
|
78 |
<div bs-has-error> |
|
79 |
<select class="form-control" ng-model="entry.status" required="required"> |
|
80 |
<option value="" disabled="disabled" style="display: none;">- Please Choose -</option> |
|
81 |
<option value="PENDING">PENDING</option> |
|
82 |
<option value="ACCEPTED">ACCEPTED</option> |
|
83 |
<option value="REFUSED">REFUSED</option> |
|
84 |
<option value="DELETED">DELETED</option> |
|
85 |
</select> |
|
86 |
<span class="form-control-feedback glyphicon"></span> |
|
87 |
</div> |
|
88 |
</div> |
|
89 |
</div> |
|
90 |
|
|
91 |
<div class="form-group"> |
|
92 |
<label class="col-xs-3 control-label">Provenance</label> |
|
93 |
<div class="col-xs-3"> |
|
94 |
<div bs-has-error> |
|
95 |
<select class="form-control" ng-model="entry.provenance" required="required" ng-change="resetIisInfo()"> |
|
96 |
<option value="" disabled="disabled" style="display: none;">- Please Choose -</option> |
|
97 |
<option value="iis">iis</option> |
|
98 |
<option value="crosswalk">crosswalk</option> |
|
99 |
<option value="claim">claim</option> |
|
100 |
<option value="unknown">unknown</option> |
|
101 |
</select> |
|
102 |
<span class="form-control-feedback glyphicon"></span> |
|
103 |
</div> |
|
104 |
</div> |
|
105 |
</div> |
|
106 |
|
|
107 |
<div class="form-group" ng-show="entry.provenance == 'iis'"> |
|
108 |
<label class="col-xs-3 control-label">IIS module</label> |
|
109 |
<div class="col-xs-6"> |
|
110 |
<div bs-has-error> |
|
111 |
<input class="form-control" ng-model="entry.iisModule" type="text" placeholder="E.g. iis::document_referencedProjects" ng-required="entry.provenance == 'iis'" /> |
|
112 |
<span class="form-control-feedback glyphicon"></span> |
|
113 |
</div> |
|
114 |
</div> |
|
115 |
<div class="col-xs-3"> |
|
116 |
<div bs-has-error> |
|
117 |
<select ng-model="entry.iisStatus" class="form-control" ng-required="entry.provenance == 'iis'"> |
|
118 |
<option value="" disabled="disabled" style="display: none;">- Please Choose -</option> |
|
119 |
<option value="UNSOLVED">UNSOLVED</option> |
|
120 |
<option value="SOLVED">SOLVED</option> |
|
121 |
</select> |
|
122 |
<span class="form-control-feedback glyphicon"></span> |
|
123 |
</div> |
|
124 |
</div> |
|
125 |
</div> |
|
126 |
|
|
127 |
<div class="form-group"> |
|
128 |
<label class="col-xs-3 control-label">Note</label> |
|
129 |
<div class="col-xs-9"> |
|
130 |
<div bs-has-error> |
|
131 |
<textarea class="form-control" rows="5" ng-model="entry.note" placeholder="Note..."></textarea> |
|
132 |
<span class="form-control-feedback glyphicon"></span> |
|
133 |
</div> |
|
134 |
</div> |
|
135 |
</div> |
|
136 |
|
|
137 |
</form> |
|
138 |
</div> |
|
139 |
<div class="modal-footer"> |
|
140 |
<button class="btn btn-default" data-dismiss="modal">Close</button> |
|
141 |
<button class="btn btn-primary" data-dismiss="modal" ng-click="saveEntry()" ng-disabled="formBlacklist.$invalid">Save changes</button> |
|
142 |
</div> |
|
143 |
</div> |
|
144 |
</div> |
|
145 |
</div> |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.6/src/main/resources/eu/dnetlib/applicationContext-dnet-openaire-blacklist.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
3 |
xmlns="http://www.springframework.org/schema/beans" |
|
4 |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> |
|
5 |
|
|
6 |
<bean id="blacklistManager" class="eu.dnetlib.openaire.blacklist.BlacklistManager" /> |
|
7 |
|
|
8 |
<bean id="openaireIdResolver" class="eu.dnetlib.openaire.blacklist.OpenaireIdResolver"/> |
|
9 |
|
|
10 |
<bean id="wfNodeApplyBlacklistJob" class="eu.dnetlib.msro.workflows.blacklist.ApplyBlacklistJobNode" |
|
11 |
scope="prototype" /> |
|
12 |
|
|
13 |
</beans> |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.6/src/main/resources/eu/dnetlib/openaire/blacklist/db/dnet_blacklists_data.sql | ||
---|---|---|
1 |
CREATE TYPE IIS_STATUS AS ENUM ('UNSOLVED', 'SOLVED'); |
|
2 |
CREATE TYPE STATUS AS ENUM ('PENDING', 'ACCEPTED', 'REFUSED', 'DELETED'); |
|
3 |
|
|
4 |
CREATE TABLE blacklist ( |
|
5 |
id SERIAL, |
|
6 |
source_object CHARACTER VARYING(255) NOT NULL, |
|
7 |
target_object CHARACTER VARYING(255) NOT NULL, |
|
8 |
|
|
9 |
source_type CHARACTER VARYING(255) NOT NULL, |
|
10 |
target_type CHARACTER VARYING(255) NOT NULL, |
|
11 |
|
|
12 |
relationship CHARACTER VARYING(255) NOT NULL, |
|
13 |
|
|
14 |
provenance CHARACTER VARYING(255) NOT NULL, |
|
15 |
iis_module CHARACTER VARYING(255), |
|
16 |
iis_module_profile CHARACTER VARYING(255), |
|
17 |
|
|
18 |
iis_status IIS_STATUS, |
|
19 |
status STATUS NOT NULL, |
|
20 |
|
|
21 |
original_source_objects CHARACTER VARYING(255) ARRAY, |
|
22 |
original_target_objects CHARACTER VARYING(255) ARRAY, |
|
23 |
|
|
24 |
creation_time TIMESTAMP DEFAULT now(), |
|
25 |
last_update_time TIMESTAMP DEFAULT now(), |
|
26 |
|
|
27 |
note TEXT, |
|
28 |
ticket_id CHARACTER VARYING(255), |
|
29 |
userid CHARACTER VARYING(255) NOT NULL, |
|
30 |
|
|
31 |
PRIMARY KEY (source_object, target_object, relationship) |
|
32 |
|
|
33 |
); |
|
34 |
|
|
35 |
CREATE INDEX ON blacklist (source_object); |
|
36 |
CREATE INDEX ON blacklist (target_object); |
|
37 |
CREATE INDEX ON blacklist (ticket_id, original_source_objects, original_target_objects); |
|
38 |
CREATE INDEX ON blacklist (iis_status); |
|
39 |
CREATE INDEX ON blacklist (status); |
|
40 |
|
|
41 |
--TRIGGER TO UPDATE THE last_update_time on UPDATES |
|
42 |
CREATE OR REPLACE FUNCTION update_modified_column() |
|
43 |
RETURNS TRIGGER AS $$ |
|
44 |
BEGIN |
|
45 |
NEW.last_update_time = now(); |
|
46 |
RETURN NEW; |
|
47 |
END; |
|
48 |
$$ LANGUAGE 'plpgsql'; |
|
49 |
|
|
50 |
CREATE TRIGGER update_blacklist_modtime BEFORE UPDATE ON blacklist FOR EACH ROW EXECUTE PROCEDURE update_modified_column(); |
|
51 |
|
|
52 |
-- Just for test |
|
53 |
|
|
54 |
-- INSERT INTO blacklist (userid, relationship, provenance, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
55 |
-- VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'crosswalk', |
|
56 |
-- 'ACCEPTED', 'od________18::xxxxxxxxxxxxxxxxxx', 'result', |
|
57 |
-- 'corda_______::9826e8aba3e8f3a2a46545cf341838a8', 'project', '1'); |
|
58 |
-- INSERT INTO blacklist (userid, relationship, provenance, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
59 |
-- VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'crosswalk', |
|
60 |
-- 'PENDING', 'od________18::yyyyyyyyyyyyyyyyyyyy', 'result', |
|
61 |
-- 'corda_______::9826e8aba3e8f3a2a46545cf341838a8', 'project', '1'); |
|
62 |
-- INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
63 |
-- VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
64 |
-- 'iis::document_referencedProjects', |
|
65 |
-- 'UNSOLVED', 'ACCEPTED', 'od______2367::eb76f733498920166d4ce77ec37d4X', 'result', |
|
66 |
-- 'corda_______::800e636c0a24ac3767701a789a96baX', 'project', '1360', '{"idsource::origi1", "idsource:orig2"}', |
|
67 |
-- '{"idtarget::origi1", "idtarget:orig2","idtarget:orig3"}'); |
|
68 |
|
|
69 |
-- https://issue.openaire.research-infrastructures.eu/issues/1245 |
|
70 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
71 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
72 |
'iis::document_referencedProjects', 'UNSOLVED', 'ACCEPTED', 'od_______908::a47e1c3ede9a21ee5278a2e5c338d69b', 'result', |
|
73 |
'corda_______::fda6a1c19dac47508b6fb619518328c7', 'project', '1245', '{"od_______908::a47e1c3ede9a21ee5278a2e5c338d69b"}', '{"corda_______::fda6a1c19dac47508b6fb619518328c7"}'); |
|
74 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
75 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
76 |
'iis::document_referencedProjects', 'UNSOLVED', 'ACCEPTED', 'od_______908::a47e1c3ede9a21ee5278a2e5c338d69b', 'result', |
|
77 |
'corda_______::189ff31d637eaaeaf4d3584dc490b1cf', 'project', '1245', '{"od_______908::a47e1c3ede9a21ee5278a2e5c338d69b"}', '{"corda_______::189ff31d637eaaeaf4d3584dc490b1cf"}'); |
|
78 |
|
|
79 |
-- https://issue.openaire.research-infrastructures.eu/issues/1360 |
|
80 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
81 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
82 |
'iis::document_referencedProjects', 'UNSOLVED', 'ACCEPTED', 'od________18::a727cc288016db7132ef9a799aa83350', 'result', |
|
83 |
'corda_______::9826e8aba3e8f3a2a46545cf341838a8', 'project', '1360', '{"od________18::a727cc288016db7132ef9a799aa83350"}', '{"corda_______::9826e8aba3e8f3a2a46545cf341838a8"}'); |
|
84 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
85 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
86 |
'iis::document_referencedProjects', 'UNSOLVED', 'ACCEPTED', 'od________18::062cf091d5c7a7d730001c34177042e3', 'result', |
|
87 |
'corda_______::9826e8aba3e8f3a2a46545cf341838a8', 'project', '1360', '{"od________18::062cf091d5c7a7d730001c34177042e3"}', |
|
88 |
'{"corda_______::9826e8aba3e8f3a2a46545cf341838a8"}'); |
|
89 |
|
|
90 |
-- https://issue.openaire.research-infrastructures.eu/issues/1254 |
|
91 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
92 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
93 |
'iis::document_referencedProjects', 'SOLVED', |
|
94 |
'ACCEPTED', 'webcrawl____::68c191d9b972b47a235d311804c7f6f5', 'result', 'corda_______::c3d0b21615b129cd7395e24f9cf6bb64', 'project', |
|
95 |
'1254', '{"webcrawl____::68c191d9b972b47a235d311804c7f6f5"}', '{"corda_______::c3d0b21615b129cd7395e24f9cf6bb64"}'); |
|
96 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
97 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
98 |
'iis::document_referencedProjects', |
|
99 |
'UNSOLVED', 'ACCEPTED', 'od_______908::1b172ab34639e7935e2357119cf20830', 'result', |
|
100 |
'corda_______::c3d0b21615b129cd7395e24f9cf6bb64', 'project', '1254', '{"od_______908::1b172ab34639e7935e2357119cf20830"}', |
|
101 |
'{"corda_______::c3d0b21615b129cd7395e24f9cf6bb64"}'); |
|
102 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
103 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
104 |
'iis::document_referencedProjects', |
|
105 |
'UNSOLVED', 'ACCEPTED', 'doajarticles::cb234c66327d29ba5f13c0db7a4cf423', 'result', |
|
106 |
'corda_______::c3d0b21615b129cd7395e24f9cf6bb64', 'project', '1254', '{"doajarticles::cb234c66327d29ba5f13c0db7a4cf423"}', |
|
107 |
'{"corda_______::c3d0b21615b129cd7395e24f9cf6bb64"}'); |
|
108 |
|
|
109 |
-- https://issue.openaire.research-infrastructures.eu/issues/1297 |
|
110 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
111 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
112 |
'iis::document_referencedProjects', 'UNSOLVED', |
|
113 |
'ACCEPTED', 'od______1146::e2fafaba636a14e408f02c6ea26acb0e', 'result', 'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', |
|
114 |
'1297', '{"od______1146::e2fafaba636a14e408f02c6ea26acb0e"}', '{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
115 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
116 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
117 |
'iis::document_referencedProjects', |
|
118 |
'UNSOLVED', 'ACCEPTED', 'od_______908::b8e86ed982ff331764456e1f0759ed9c', 'result', |
|
119 |
'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', '1297', '{"od_______908::b8e86ed982ff331764456e1f0759ed9c"}', |
|
120 |
'{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
121 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
122 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
123 |
'iis::document_referencedProjects', |
|
124 |
'UNSOLVED', 'ACCEPTED', 'webcrawl____::c472bf5944ce0495844d505d43d1c021', 'result', |
|
125 |
'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', '1297', '{"webcrawl____::c472bf5944ce0495844d505d43d1c021"}', |
|
126 |
'{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
127 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
128 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
129 |
'iis::document_referencedProjects', |
|
130 |
'UNSOLVED', 'ACCEPTED', 'od_______908::bbe86580e44dbefa401d435259baddf1', 'result', |
|
131 |
'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', '1297', '{"od_______908::bbe86580e44dbefa401d435259baddf1"}', |
|
132 |
'{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
133 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
134 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
135 |
'iis::document_referencedProjects', |
|
136 |
'UNSOLVED', 'ACCEPTED', 'webcrawl____::ae0ae3ea5641ac24fa148ac38397dfcd', 'result', |
|
137 |
'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', '1297', '{"webcrawl____::ae0ae3ea5641ac24fa148ac38397dfcd"}', |
|
138 |
'{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
139 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
140 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
141 |
'iis::document_referencedProjects', |
|
142 |
'UNSOLVED', 'ACCEPTED', 'webcrawl____::5f46a8c6420f5b5eaf30d7212b0ada5b', 'result', |
|
143 |
'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', '1297', '{"webcrawl____::5f46a8c6420f5b5eaf30d7212b0ada5b"}', |
|
144 |
'{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
145 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
146 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
147 |
'iis::document_referencedProjects', |
|
148 |
'UNSOLVED', 'ACCEPTED', 'od_______908::49d9b3df9cf7e9c991e09e53677e40e3', 'result', |
|
149 |
'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', '1297', '{"od_______908::49d9b3df9cf7e9c991e09e53677e40e3"}', |
|
150 |
'{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
151 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
152 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
153 |
'iis::document_referencedProjects', |
|
154 |
'UNSOLVED', 'ACCEPTED', 'od_______330::aa2edd06a6121a1a1db63be83cd7b7c7', 'result', |
|
155 |
'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', '1297', '{"od_______330::aa2edd06a6121a1a1db63be83cd7b7c7"}', |
|
156 |
'{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
157 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
158 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
159 |
'iis::document_referencedProjects', |
|
160 |
'UNSOLVED', 'ACCEPTED', 'od_______908::45f342e6f10d5543631a757b417388d7', 'result', |
|
161 |
'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', '1297', '{"od_______908::45f342e6f10d5543631a757b417388d7"}', |
|
162 |
'{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
163 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
164 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
165 |
'iis::document_referencedProjects', |
|
166 |
'UNSOLVED', 'ACCEPTED', 'webcrawl____::6ce2789da52c6036501533ed5613d71a', 'result', |
|
167 |
'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', '1297', '{"webcrawl____::6ce2789da52c6036501533ed5613d71a"}', |
|
168 |
'{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
169 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
170 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
171 |
'iis::document_referencedProjects', |
|
172 |
'UNSOLVED', 'ACCEPTED', 'webcrawl____::f887afc3d7a8e8c708b9b773d26cdd9d', 'result', |
|
173 |
'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', '1297', '{"webcrawl____::f887afc3d7a8e8c708b9b773d26cdd9d"}', |
|
174 |
'{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
175 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
176 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
177 |
'iis::document_referencedProjects', |
|
178 |
'UNSOLVED', 'ACCEPTED', 'webcrawl____::161ee67349e268750701ee437188340b', 'result', |
|
179 |
'corda_______::35695c955c51f0bb39482ce5477047c7', 'project', '1297', '{"webcrawl____::161ee67349e268750701ee437188340b"}', |
|
180 |
'{"corda_______::35695c955c51f0bb39482ce5477047c7"}'); |
|
181 |
|
|
182 |
-- https://issue.openaire.research-infrastructures.eu/issues/1412 |
|
183 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
184 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
185 |
'iis::document_referencedProjects', |
|
186 |
'UNSOLVED', 'ACCEPTED', 'od______2367::eb76f733498920166d4ce77ec37d487c', 'result', |
|
187 |
'corda_______::800e636c0a24ac3767701a789a96ba89', 'project', '1360', '{"od______2367::eb76f733498920166d4ce77ec37d487c"}', |
|
188 |
'{"corda_______::800e636c0a24ac3767701a789a96ba89"}'); |
|
189 |
|
|
190 |
-- https://issue.openaire.research-infrastructures.eu/issues/1530 |
|
191 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
192 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
193 |
'iis::document_referencedProjects', |
|
194 |
'UNSOLVED', 'ACCEPTED', 'dedup_wf_001::67d425112b2858ac59c44589496260b6', 'result', |
|
195 |
'corda__h2020::c4093823864f0ceb5747977245d1ad57', 'project', '1360', |
|
196 |
'{"doajarticles::67d425112b2858ac59c44589496260b6", "issn20484194::e8fe2f03154ed785e968ab72f54707e1"}', |
|
197 |
'{"corda__h2020::c4093823864f0ceb5747977245d1ad57"}'); |
|
198 |
|
|
199 |
INSERT INTO blacklist (userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, ticket_id, original_source_objects, original_target_objects) |
|
200 |
VALUES ('unknown', 'resultProject_outcome_isProducedBy', 'iis', |
|
201 |
'iis::document_referencedProjects', |
|
202 |
'UNSOLVED', 'ACCEPTED', 'dedup_wf_001::42baa97c7d0a4316f72bc61c373b6d2c', 'result', |
|
203 |
'corda__h2020::bc993a53736173ace2f6dd2ddc459dd5', 'project', '1360', |
|
204 |
'{"erc_________::42baa97c7d0a4316f72bc61c373b6d2c", "webcrawl____::488517651c5e126d97b45ad0416dd8a8", "od_______908::80a1640c67870bc5d4673a8d1ad0534a", "od_______610::9a1a5461cd13d2192950497bbe0b52ed"}', |
|
205 |
'{"corda__h2020::bc993a53736173ace2f6dd2ddc459dd5"}'); |
|
206 |
|
|
207 |
|
|
208 |
|
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.6/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/blacklist.st | ||
---|---|---|
1 |
$common/master( header={ |
|
2 |
<script type="text/javascript" src="../resources/js/angular.min.js" ></script> |
|
3 |
<script type="text/javascript" src="../resources/js/angular-route.min.js"></script> |
|
4 |
<script type="text/javascript" src="../resources/js/ui-bootstrap.min.js"></script> |
|
5 |
<script type="text/javascript" src="../resources/js/jquery-ui-1.10.4.min.js"></script> |
|
6 |
|
|
7 |
<script type="text/javascript" src="../resources/js/blacklist.js"></script> |
|
8 |
<script type="text/javascript" src="../resources/js/blacklist_controllers.js"></script> |
|
9 |
|
|
10 |
<link rel="stylesheet" type="text/css" href="../resources/css/jquery-ui-1.10.4.min.css" /> |
|
11 |
|
|
12 |
}, body={ |
|
13 |
<div ng-app="blacklist"> |
|
14 |
<div ng-view></div> |
|
15 |
</div> |
|
16 |
} )$ |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.6/src/main/resources/eu/dnetlib/functionality/modular/ui/webContext-modular-ui-blacklist.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans xmlns="http://www.springframework.org/schema/beans" |
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" |
|
4 |
xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:wsa="http://cxf.apache.org/ws/addressing" |
|
5 |
xmlns:p="http://www.springframework.org/schema/p" xmlns:http="http://cxf.apache.org/transports/http/configuration" |
|
6 |
xmlns:t="http://dnetlib.eu/springbeans/t" xmlns:template="http://dnetlib.eu/springbeans/template" |
|
7 |
xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context" |
|
8 |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd |
|
9 |
http://cxf.apache.org/ws/addressing http://cxf.apache.org/schemas/ws-addr-conf.xsd |
|
10 |
http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd |
|
11 |
http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd |
|
12 |
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd |
|
13 |
http://dnetlib.eu/springbeans/template http://dnetlib.eu/springbeans/template.xsd |
|
14 |
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd |
|
15 |
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> |
|
16 |
|
|
17 |
|
|
18 |
<bean name="/ui/blacklist.do" |
|
19 |
class="eu.dnetlib.functionality.modular.ui.blacklist.BlacklistEntryPointController" |
|
20 |
p:menu="Blacklist Manager" |
|
21 |
p:title="Blacklist Manager" |
|
22 |
p:description="Manager for the Blacklist of links" |
|
23 |
p:group="Tools"> |
|
24 |
<property name="permissionLevels"> |
|
25 |
<set> |
|
26 |
<value>IS_ADMIN</value> |
|
27 |
</set> |
|
28 |
</property> |
|
29 |
</bean> |
|
30 |
|
|
31 |
</beans> |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.6/src/main/resources/eu/dnetlib/applicationContext-dnet-openaire-blacklist.properties | ||
---|---|---|
1 |
dnet.openaire.blacklist.db.name=dnet_openaire_blacklist |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.6/src/main/java/eu/dnetlib/openaire/blacklist/OpenaireIdResolver.java | ||
---|---|---|
1 |
package eu.dnetlib.openaire.blacklist; |
|
2 |
|
|
3 |
import java.io.StringReader; |
|
4 |
import java.util.List; |
|
5 |
|
|
6 |
import org.apache.commons.lang.StringUtils; |
|
7 |
import org.apache.commons.logging.Log; |
|
8 |
import org.apache.commons.logging.LogFactory; |
|
9 |
import org.apache.solr.client.solrj.SolrQuery; |
|
10 |
import org.apache.solr.client.solrj.impl.CloudSolrServer; |
|
11 |
import org.apache.solr.client.solrj.response.QueryResponse; |
|
12 |
import org.apache.solr.common.SolrDocument; |
|
13 |
import org.apache.solr.common.SolrDocumentList; |
|
14 |
import org.dom4j.Attribute; |
|
15 |
import org.dom4j.Document; |
|
16 |
import org.dom4j.DocumentException; |
|
17 |
import org.dom4j.io.SAXReader; |
|
18 |
import org.springframework.beans.factory.annotation.Autowired; |
|
19 |
|
|
20 |
import com.google.common.base.Function; |
|
21 |
import com.google.common.collect.Iterables; |
|
22 |
import com.google.common.collect.Lists; |
|
23 |
|
|
24 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; |
|
25 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
|
26 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
|
27 |
|
|
28 |
/** |
|
29 |
* The goal of this task is to return the original identifiers of objects merged in a representative object by deduplication. Created by |
|
30 |
* alessia on 09/02/16. |
|
31 |
*/ |
|
32 |
public class OpenaireIdResolver { |
|
33 |
|
|
34 |
public final static String SOLR_COLLECTION_POSTFIX = "-index-openaire"; |
|
35 |
private static final Log log = LogFactory.getLog(OpenaireIdResolver.class); |
|
36 |
private final static String RESULT_FIELD = "__result"; |
|
37 |
private final static String XPATH_TO_MERGED = "//*[local-name()='entity']/*//children/result/@objidentifier"; |
|
38 |
private final SAXReader saxReader = new SAXReader(); |
|
39 |
@Autowired |
|
40 |
private UniqueServiceLocator serviceLocator; |
|
41 |
|
|
42 |
public List<String> resolveIdentifier(final String id) { |
|
43 |
if (StringUtils.isBlank(id)) return Lists.newArrayList(); |
|
44 |
else { |
|
45 |
return findOriginalIds(id); |
|
46 |
} |
|
47 |
} |
|
48 |
|
|
49 |
protected List<String> findOriginalIds(final String id) { |
|
50 |
CloudSolrServer solrCore = null; |
|
51 |
final SolrQuery q = new SolrQuery("objidentifier:\"" + id + "\""); |
|
52 |
QueryResponse response = null; |
|
53 |
try { |
|
54 |
solrCore = new CloudSolrServer(getIndexEndpoint()); |
|
55 |
solrCore.setDefaultCollection(getPublicIndexCollection() + SOLR_COLLECTION_POSTFIX); |
|
56 |
response = solrCore.query(q); |
|
57 |
final SolrDocumentList results = response.getResults(); |
|
58 |
if (results.isEmpty()) { |
|
59 |
log.debug("Query " + q + " returned 0 documents"); |
|
60 |
return Lists.newArrayList(); |
|
61 |
} |
|
62 |
// my results contain the document with the given identifier |
|
63 |
final SolrDocument solrDoc = results.get(0); |
|
64 |
return extractMergedIdentifiers(solrDoc); |
|
65 |
} catch (final Exception e) { |
|
66 |
log.error("Can't get original ids for " + id + "\n ", e); |
|
67 |
throw new RuntimeException("Can't get original ids for " + id + "\n " + e); |
|
68 |
} finally { |
|
69 |
solrCore.shutdown(); |
|
70 |
} |
|
71 |
} |
|
72 |
|
|
73 |
@SuppressWarnings("unchecked") |
|
74 |
protected List<String> extractMergedIdentifiers(final SolrDocument doc) throws DocumentException { |
|
75 |
final String xmlRecord = (String) doc.getFirstValue(RESULT_FIELD); |
|
76 |
final Document xmlDoc = this.saxReader.read(new StringReader(xmlRecord)); |
|
77 |
return Lists.newArrayList(Iterables.transform(xmlDoc.selectNodes(XPATH_TO_MERGED), new Function<Attribute, String>() { |
|
78 |
|
|
79 |
@Override |
|
80 |
public String apply(final Attribute a) { |
|
81 |
return a.getStringValue(); |
|
82 |
} |
|
83 |
})); |
|
84 |
} |
|
85 |
|
|
86 |
protected String getIndexEndpoint() throws ISLookUpException { |
|
87 |
return this.serviceLocator.getService(ISLookUpService.class).getResourceProfileByQuery( |
|
88 |
"for $x in collection('/db/DRIVER/ServiceResources/IndexServiceResourceType') return $x//PROTOCOL[./@name='solr']/@address/string()"); |
|
89 |
} |
|
90 |
|
|
91 |
protected String getPublicIndexCollection() throws ISLookUpException { |
|
92 |
return this.serviceLocator.getService(ISLookUpService.class).getResourceProfileByQuery( |
|
93 |
"for $x in collection('/db/DRIVER/ServiceResources/SearchServiceResourceType') return $x[.//PROPERTY[@key='infrastructure']/@value='public']//PROPERTY[@key='mdformat']/@value/string()"); |
|
94 |
} |
|
95 |
|
|
96 |
public UniqueServiceLocator getServiceLocator() { |
|
97 |
return serviceLocator; |
|
98 |
} |
|
99 |
|
|
100 |
public void setServiceLocator(final UniqueServiceLocator serviceLocator) { |
|
101 |
this.serviceLocator = serviceLocator; |
|
102 |
} |
|
103 |
|
|
104 |
} |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.6/src/main/java/eu/dnetlib/openaire/blacklist/BlacklistManager.java | ||
---|---|---|
1 |
package eu.dnetlib.openaire.blacklist; |
|
2 |
|
|
3 |
import java.io.StringReader; |
|
4 |
import java.util.Collection; |
|
5 |
import java.util.List; |
|
6 |
import java.util.Set; |
|
7 |
|
|
8 |
import javax.xml.ws.wsaddressing.W3CEndpointReference; |
|
9 |
|
|
10 |
import org.apache.commons.lang.StringUtils; |
|
11 |
import org.apache.commons.logging.Log; |
|
12 |
import org.apache.commons.logging.LogFactory; |
|
13 |
import org.dom4j.Document; |
|
14 |
import org.dom4j.DocumentException; |
|
15 |
import org.dom4j.Element; |
|
16 |
import org.dom4j.io.SAXReader; |
|
17 |
import org.springframework.beans.factory.annotation.Autowired; |
|
18 |
import org.springframework.beans.factory.annotation.Value; |
|
19 |
|
|
20 |
import com.google.common.collect.Lists; |
|
21 |
|
|
22 |
import eu.dnetlib.enabling.database.rmi.DatabaseException; |
|
23 |
import eu.dnetlib.enabling.database.rmi.DatabaseService; |
|
24 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
|
25 |
import eu.dnetlib.enabling.resultset.client.IterableResultSetClient; |
|
26 |
import eu.dnetlib.enabling.resultset.client.ResultSetClientFactory; |
|
27 |
import eu.dnetlib.miscutils.collections.MappedCollection; |
|
28 |
import eu.dnetlib.miscutils.functional.UnaryFunction; |
|
29 |
import eu.dnetlib.openaire.hadoop.utils.HBaseTableUtils; |
|
30 |
|
|
31 |
public class BlacklistManager { |
|
32 |
|
|
33 |
private static final Log log = LogFactory.getLog(BlacklistManager.class); // NOPMD by marko on 11/24/08 5:02 PM |
|
34 |
@Value("${dnet.openaire.blacklist.db.name}") |
|
35 |
private String blacklistDatabaseName; |
|
36 |
@Autowired |
|
37 |
private UniqueServiceLocator serviceLocator; |
|
38 |
@Autowired |
|
39 |
private ResultSetClientFactory resultSetClientFactory; |
|
40 |
@Autowired |
|
41 |
private OpenaireIdResolver openaireIdResolver; |
|
42 |
|
|
43 |
private List<String> getOriginalIds(final String id, final String entityType) { |
|
44 |
List<String> originalIds = Lists.newArrayList(); |
|
45 |
// We need to find original ids only for entities that are deduplicated: result, organization, person. |
|
46 |
if (entityType.equals("result") || entityType.equals("organization") || entityType.equals("person")) { |
|
47 |
originalIds = openaireIdResolver.resolveIdentifier(id); |
|
48 |
} |
|
49 |
return originalIds; |
|
50 |
} |
|
51 |
|
|
52 |
public void addToBlacklist(final BlacklistEntry entry) throws DatabaseException { |
|
53 |
final List<String> sourceIds = getOriginalIds(entry.getSourceObject(), entry.getSourceType()); |
|
54 |
final List<String> targetIds = getOriginalIds(entry.getTargetObject(), entry.getTargetType()); |
|
55 |
entry.setOriginalSourceObjects(sourceIds); |
|
56 |
entry.setOriginalTargetObjects(targetIds); |
|
57 |
|
|
58 |
final DatabaseService dbService = serviceLocator.getService(DatabaseService.class); |
|
59 |
final String addQuery = String.format( |
|
60 |
"INSERT INTO blacklist(userid, relationship, provenance, iis_module, iis_status, status, source_object, source_type, target_object, target_type, " |
|
61 |
+ "ticket_id, original_source_objects, original_target_objects, note) " |
|
62 |
+ " VALUES(%1$s, %2$s, %3$s, %4$s, %5$s, %6$s, %7$s, %8$s, %9$s, %10$s, %11$s, %12$s, %13$s, %14$s)", |
|
63 |
asSqlParam(entry.getUser()), |
|
64 |
asSqlParam(entry.getRelationship()), |
|
65 |
asSqlParam(entry.getProvenance()), |
|
66 |
asSqlParam(entry.getIisModule()), |
|
67 |
asSqlParam(entry.getIisStatus()), |
|
68 |
asSqlParam(entry.getStatus()), |
|
69 |
asSqlParam(entry.getSourceObject()), |
|
70 |
asSqlParam(entry.getSourceType()), |
|
71 |
asSqlParam(entry.getTargetObject()), |
|
72 |
asSqlParam(entry.getTargetType()), |
|
73 |
asSqlParam(entry.getTicketId()), |
|
74 |
asSqlParam(joinCollectionForSQL(sourceIds.isEmpty() ? Lists.newArrayList(entry.getSourceObject()) : sourceIds)), |
|
75 |
asSqlParam(joinCollectionForSQL(targetIds.isEmpty() ? Lists.newArrayList(entry.getTargetObject()) : targetIds)), |
|
76 |
asSqlParam(entry.getNote())); |
|
77 |
log.debug("Adding new blacklist entry"); |
|
78 |
this.safeUpdateSql(dbService, blacklistDatabaseName, addQuery); |
|
79 |
} |
|
80 |
|
|
81 |
private String joinCollectionForSQL(final Collection<String> coll) { |
|
82 |
return "{\"" + StringUtils.join(coll, "\",\"") + "\"}"; |
|
83 |
} |
|
84 |
|
|
85 |
public void editBlacklistEntry(final BlacklistEntry entry) throws DatabaseException { |
|
86 |
|
|
87 |
final DatabaseService dbService = serviceLocator.getService(DatabaseService.class); |
|
88 |
final String editQuery = String.format( |
|
89 |
"UPDATE blacklist SET userid=%s, relationship=%s, provenance=%s, iis_module=%s, iis_status=%s, status=%s, source_type=%s, " |
|
90 |
+ "target_type=%s, ticket_id=%s, note=%s WHERE id=%s", |
|
91 |
asSqlParam(entry.getUser()), |
|
92 |
asSqlParam(entry.getRelationship()), |
|
93 |
asSqlParam(entry.getProvenance()), |
|
94 |
asSqlParam(entry.getIisModule()), |
|
95 |
asSqlParam(entry.getIisStatus()), |
|
96 |
asSqlParam(entry.getStatus()), |
|
97 |
asSqlParam(entry.getSourceType()), |
|
98 |
asSqlParam(entry.getTargetType()), |
|
99 |
asSqlParam(entry.getTicketId()), |
|
100 |
asSqlParam(entry.getNote()), |
|
101 |
asSqlParam(entry.getId())); |
|
102 |
log.debug("Editing blacklist entry: " + entry.getId()); |
|
103 |
this.safeUpdateSql(dbService, blacklistDatabaseName, editQuery); |
|
104 |
} |
|
105 |
|
|
106 |
private String asSqlParam(final Object o) { |
|
107 |
if (o == null) { |
|
108 |
return "NULL"; |
|
109 |
} else if ((o instanceof Number) || (o instanceof Boolean)) { |
|
110 |
return o.toString(); |
|
111 |
} else { |
|
112 |
return "'" + o.toString() + "'"; |
|
113 |
} |
|
114 |
} |
|
115 |
|
|
116 |
public void deleteFromBlacklist(final int entryId) throws DatabaseException { |
|
117 |
final DatabaseService dbService = serviceLocator.getService(DatabaseService.class); |
|
118 |
log.debug("Deleting entry " + entryId + " from blacklist"); |
|
119 |
this.safeUpdateSql(dbService, blacklistDatabaseName, String.format("DELETE FROM blacklist WHERE id='%s' ", entryId)); |
|
120 |
} |
|
121 |
|
|
122 |
public Iterable<BlacklistEntry> getBlacklist() throws DatabaseException { |
|
123 |
final String sqlQuery = "SELECT * from blacklist order by ticket_id"; |
|
124 |
final W3CEndpointReference epr = serviceLocator.getService(DatabaseService.class).searchSQL(blacklistDatabaseName, sqlQuery); |
|
125 |
final IterableResultSetClient iter = resultSetClientFactory.getClient(epr); |
|
126 |
return this.getBlacklistIterable(iter); |
|
127 |
} |
|
128 |
|
|
129 |
public W3CEndpointReference getAcceptedBlacklistEntries() throws DatabaseException { |
|
130 |
final String sqlQuery = |
|
131 |
"SELECT source_type, unnest(original_source_objects) as source, target_type, unnest(original_target_objects) as target, relationship FROM blacklist WHERE status = 'ACCEPTED'"; |
|
132 |
return serviceLocator.getService(DatabaseService.class).searchSQL(blacklistDatabaseName, sqlQuery); |
|
133 |
} |
|
134 |
|
|
135 |
private void safeUpdateSql(final DatabaseService dbService, final String dbName, final String sql) throws DatabaseException { |
|
136 |
log.info(sql); |
|
137 |
dbService.updateSQL(dbName, sql); |
|
138 |
} |
|
139 |
|
|
140 |
public Iterable<BlacklistEntry> getBlacklistIterable(final Iterable<String> xmlEntries) { |
|
141 |
return new MappedCollection<BlacklistEntry, String>(xmlEntries, new UnaryFunction<BlacklistEntry, String>() { |
|
142 |
|
|
143 |
@Override |
|
144 |
public BlacklistEntry evaluate(final String dbEntry) { |
|
145 |
final SAXReader saxReader = new SAXReader(); |
|
146 |
final BlacklistEntry be = new BlacklistEntry(); |
|
147 |
Document doc; |
|
148 |
try { |
|
149 |
doc = saxReader.read(new StringReader(dbEntry)); |
|
150 |
be.setId(Integer.parseInt(doc.selectSingleNode("//FIELD[./@name='id']").getText())); |
|
151 |
be.setCreationDate(doc.selectSingleNode("//FIELD[./@name='creation_time']").getText()); |
|
152 |
be.setLastUpdateDate(doc.selectSingleNode("//FIELD[./@name='last_update_time']").getText()); |
|
153 |
be.setNote(doc.selectSingleNode("//FIELD[./@name='note']").getText()); |
|
154 |
be.setRelationship(doc.selectSingleNode(".//FIELD[./@name='relationship']").getText()); |
|
155 |
be.setStatus(STATUS.valueOf(StringUtils.upperCase(doc.selectSingleNode("//FIELD[./@name='status']").getText()))); |
|
156 |
be.setTicketId(doc.selectSingleNode("//FIELD[./@name='ticket_id']").getText()); |
|
157 |
be.setUser(doc.selectSingleNode("//FIELD[./@name='userid']").getText()); |
|
158 |
be.setSourceObject(doc.selectSingleNode("//FIELD[./@name='source_object']").getText()); |
|
159 |
be.setSourceType(doc.selectSingleNode("//FIELD[./@name='source_type']").getText()); |
|
160 |
be.setTargetObject(doc.selectSingleNode("//FIELD[./@name='target_object']").getText()); |
|
161 |
be.setTargetType(doc.selectSingleNode("//FIELD[./@name='target_type']").getText()); |
|
162 |
final String provenance = doc.selectSingleNode("//FIELD[./@name='provenance']").getText(); |
|
163 |
be.setProvenance(provenance); |
|
164 |
if (provenance.equalsIgnoreCase("iis")) { |
|
165 |
be.setIisModule(doc.selectSingleNode("//FIELD[./@name='iis_module']").getText()); |
|
166 |
be.setIisStatus(IIS_STATUS.valueOf(StringUtils.upperCase(doc.selectSingleNode("//FIELD[./@name='iis_status']").getText()))); |
|
167 |
} |
|
168 |
// get the array of original identifiers |
|
169 |
final List<Element> sources = doc.selectNodes("//FIELD[./@name='original_source_objects']/ITEM"); |
|
170 |
if ((sources != null) && !sources.isEmpty()) { |
|
171 |
for (final Element e : sources) { |
|
172 |
be.getOriginalSourceObjects().add(e.getText()); |
|
173 |
} |
|
174 |
} |
|
175 |
|
|
176 |
final List<Element> targets = doc.selectNodes("//FIELD[./@name='original_target_objects']/ITEM"); |
|
177 |
if ((targets != null) && !targets.isEmpty()) { |
|
178 |
for (final Element e : targets) { |
|
179 |
be.getOriginalTargetObjects().add(e.getText()); |
|
180 |
} |
|
181 |
} |
|
182 |
} catch (final DocumentException e) { |
|
183 |
log.error(e); |
|
184 |
throw new RuntimeException(e); |
|
185 |
} |
|
186 |
return be; |
|
187 |
} |
|
188 |
}); |
|
189 |
} |
|
190 |
|
|
191 |
public Set<String> getListOfRelationships() { |
|
192 |
return HBaseTableUtils.listRelationships(); |
|
193 |
} |
|
194 |
|
|
195 |
public enum IIS_STATUS { |
|
196 |
UNSOLVED, SOLVED |
|
197 |
} |
|
198 |
|
|
199 |
public enum STATUS { |
|
200 |
PENDING, ACCEPTED, REFUSED, DELETED |
|
201 |
} |
|
202 |
|
|
203 |
} |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.6/src/main/java/eu/dnetlib/openaire/blacklist/BlacklistEntry.java | ||
---|---|---|
1 |
package eu.dnetlib.openaire.blacklist; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
|
|
5 |
import com.google.common.collect.Lists; |
|
6 |
import com.google.gson.Gson; |
|
7 |
import eu.dnetlib.openaire.blacklist.BlacklistManager.IIS_STATUS; |
|
8 |
import eu.dnetlib.openaire.blacklist.BlacklistManager.STATUS; |
|
9 |
|
|
10 |
public class BlacklistEntry { |
|
11 |
|
|
12 |
|
|
13 |
private int id; |
|
14 |
/** |
|
15 |
* The user who reported the wrong link |
|
16 |
**/ |
|
17 |
private String user = "unknown"; |
|
18 |
/** |
|
19 |
* A note regarding the reported 'wrong' relationship |
|
20 |
**/ |
|
21 |
private String note = ""; |
|
22 |
/** |
|
23 |
* The id of the ticket associated to this entry |
|
24 |
**/ |
|
25 |
private String ticketId = "unknown"; |
|
26 |
/** |
|
27 |
* Provenance of the relationship. 'iis' when the relationship is inferred. 'crosswalk' if it is aggregated. 'claim' if it is a claim. |
|
28 |
**/ |
|
29 |
private String provenance; |
|
30 |
/** |
|
31 |
* Relationship label: 'resultProject_outcome_isProducedBy' for result-project relationships. |
|
32 |
*/ |
|
33 |
private String relationship; |
|
34 |
|
|
35 |
/** |
|
36 |
* The inference module that generated the relationship. 'iis::document_referencedProjects' for result-project relationships. Blank if provenance is not 'iis'. |
|
37 |
**/ |
|
38 |
private String iisModule = ""; |
|
39 |
|
|
40 |
/** |
|
41 |
* Status of the report |
|
42 |
**/ |
|
43 |
private STATUS status = STATUS.PENDING; |
|
44 |
/** |
|
45 |
* Status of the issue from the pov of IIS. Blank if provenance is not 'iis'. |
|
46 |
**/ |
|
47 |
private IIS_STATUS iisStatus = null; |
|
48 |
|
|
49 |
private String creationDate, lastUpdateDate; |
|
50 |
|
|
51 |
/** |
|
52 |
* OpenAIRE ids of the objects linked by the 'wrong' relationship |
|
53 |
**/ |
|
54 |
private String sourceObject, targetObject; |
|
55 |
/** |
|
56 |
* Type of the source and target objects. |
|
57 |
**/ |
|
58 |
private String sourceType, targetType; |
|
59 |
/** |
|
60 |
* If the source or the target are representatives, then the following strings are not empty and contain the json strings with the ids of the merged objects |
|
61 |
**/ |
|
62 |
private List<String> originalSourceObjects = Lists.newArrayList(), originalTargetObjects = Lists.newArrayList(); |
|
63 |
|
|
64 |
@Override |
|
65 |
public String toString() { |
|
66 |
Gson gson = new Gson(); |
|
67 |
return gson.toJson(this); |
|
68 |
} |
|
69 |
|
|
70 |
public String getRelationship() { |
|
71 |
return relationship; |
|
72 |
} |
|
73 |
|
|
74 |
public void setRelationship(final String relationship) { |
|
75 |
this.relationship = relationship; |
|
76 |
} |
|
77 |
|
|
78 |
public String getSourceType() { |
|
79 |
return sourceType; |
|
80 |
} |
|
81 |
|
|
82 |
public void setSourceType(final String sourceType) { |
|
83 |
this.sourceType = sourceType; |
|
84 |
} |
|
85 |
|
|
86 |
public String getTargetType() { |
|
87 |
return targetType; |
|
88 |
} |
|
89 |
|
|
90 |
public void setTargetType(final String targetType) { |
|
91 |
this.targetType = targetType; |
|
92 |
} |
|
93 |
|
|
94 |
public int getId() { |
|
95 |
return id; |
|
96 |
} |
|
97 |
|
|
98 |
public void setId(int id) { |
|
99 |
this.id = id; |
|
100 |
} |
|
101 |
|
|
102 |
public String getUser() { |
|
103 |
return user; |
|
104 |
} |
|
105 |
|
|
106 |
public void setUser(final String user) { |
|
107 |
this.user = user; |
|
108 |
} |
|
109 |
|
|
110 |
public String getNote() { |
|
111 |
return note; |
|
112 |
} |
|
113 |
|
|
114 |
public void setNote(final String note) { |
|
115 |
this.note = note; |
|
116 |
} |
|
117 |
|
|
118 |
public String getTicketId() { |
|
119 |
return ticketId; |
|
120 |
} |
|
121 |
|
|
122 |
public void setTicketId(final String ticketId) { |
|
123 |
this.ticketId = ticketId; |
|
124 |
} |
|
125 |
|
|
126 |
public String getProvenance() { |
|
127 |
return provenance; |
|
128 |
} |
|
129 |
|
|
130 |
public void setProvenance(final String provenance) { |
|
131 |
this.provenance = provenance; |
|
132 |
} |
|
133 |
|
|
134 |
public String getIisModule() { |
|
135 |
return iisModule; |
|
136 |
} |
|
137 |
|
|
138 |
public void setIisModule(final String iisModule) { |
|
139 |
this.iisModule = iisModule; |
|
140 |
} |
|
141 |
|
|
142 |
public STATUS getStatus() { |
|
143 |
return status; |
|
144 |
} |
|
145 |
|
|
146 |
public void setStatus(final STATUS status) { |
|
147 |
this.status = status; |
|
148 |
} |
|
149 |
|
|
150 |
public IIS_STATUS getIisStatus() { |
|
151 |
return iisStatus; |
|
152 |
} |
|
153 |
|
|
154 |
public void setIisStatus(final IIS_STATUS iisStatus) { |
|
155 |
this.iisStatus = iisStatus; |
|
156 |
} |
|
157 |
|
|
158 |
public String getCreationDate() { |
|
159 |
return creationDate; |
|
160 |
} |
|
161 |
|
|
162 |
public void setCreationDate(final String creationDate) { |
|
163 |
this.creationDate = creationDate; |
|
164 |
} |
|
165 |
|
|
166 |
public String getLastUpdateDate() { |
|
167 |
return lastUpdateDate; |
|
168 |
} |
|
169 |
|
|
170 |
public void setLastUpdateDate(final String lastUpdateDate) { |
|
171 |
this.lastUpdateDate = lastUpdateDate; |
|
172 |
} |
|
173 |
|
|
174 |
public String getSourceObject() { |
|
175 |
return sourceObject; |
|
176 |
} |
|
177 |
|
|
178 |
public void setSourceObject(final String sourceObject) { |
|
179 |
this.sourceObject = sourceObject; |
|
180 |
} |
|
181 |
|
|
182 |
public String getTargetObject() { |
|
183 |
return targetObject; |
|
184 |
} |
|
185 |
|
|
186 |
public void setTargetObject(final String targetObject) { |
|
187 |
this.targetObject = targetObject; |
|
188 |
} |
|
189 |
|
|
190 |
public List<String> getOriginalSourceObjects() { |
|
191 |
return originalSourceObjects; |
|
192 |
} |
|
193 |
|
|
194 |
public void setOriginalSourceObjects(final List<String> originalSourceObjects) { |
|
195 |
this.originalSourceObjects = originalSourceObjects; |
|
196 |
} |
|
197 |
|
|
198 |
public List<String> getOriginalTargetObjects() { |
|
199 |
return originalTargetObjects; |
|
200 |
} |
|
201 |
|
|
202 |
public void setOriginalTargetObjects(final List<String> originalTargetObjects) { |
|
203 |
this.originalTargetObjects = originalTargetObjects; |
|
204 |
} |
|
205 |
|
|
206 |
} |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.6/src/main/java/eu/dnetlib/functionality/modular/ui/blacklist/BlacklistInternalController.java | ||
---|---|---|
1 |
package eu.dnetlib.functionality.modular.ui.blacklist; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
import java.util.Set; |
|
5 |
import javax.annotation.Resource; |
|
6 |
|
|
7 |
import com.google.common.collect.Lists; |
|
8 |
import eu.dnetlib.enabling.database.rmi.DatabaseException; |
|
9 |
import eu.dnetlib.functionality.modular.ui.AbstractAjaxController; |
|
10 |
import eu.dnetlib.openaire.blacklist.BlacklistEntry; |
|
11 |
import eu.dnetlib.openaire.blacklist.BlacklistManager; |
|
12 |
import org.apache.commons.logging.Log; |
|
13 |
import org.apache.commons.logging.LogFactory; |
|
14 |
import org.springframework.stereotype.Controller; |
|
15 |
import org.springframework.web.bind.annotation.RequestBody; |
|
16 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
17 |
import org.springframework.web.bind.annotation.ResponseBody; |
|
18 |
|
|
19 |
/** |
|
20 |
* Created by alessia on 18/09/15. |
|
21 |
*/ |
|
22 |
@Controller |
|
23 |
public class BlacklistInternalController extends AbstractAjaxController { |
|
24 |
|
|
25 |
private static final Log log = LogFactory.getLog(BlacklistInternalController.class); // NOPMD by marko on 11/24/08 5:02 PM |
|
26 |
|
|
27 |
@Resource |
|
28 |
private BlacklistManager blacklistManager; |
|
29 |
|
|
30 |
@ResponseBody |
|
31 |
@RequestMapping(value = "/ui/blacklist/getBlacklist.do") |
|
32 |
public List<BlacklistEntry> getBlacklist() throws DatabaseException { |
|
33 |
log.debug("getBlacklist"); |
|
34 |
return Lists.newArrayList(this.blacklistManager.getBlacklist()); |
|
35 |
} |
|
36 |
|
|
37 |
@ResponseBody |
|
38 |
@RequestMapping(value = "/ui/blacklist/addToBlacklist.do") |
|
39 |
public void addToBlacklist(@RequestBody(required = true) final BlacklistEntry entry) throws DatabaseException { |
|
40 |
log.debug("addToBlacklist"); |
|
41 |
this.blacklistManager.addToBlacklist(entry); |
|
42 |
} |
|
43 |
|
|
44 |
@ResponseBody |
|
45 |
@RequestMapping(value = "/ui/blacklist/editBlacklistEntry.do") |
|
46 |
public void editBlacklistEntry(@RequestBody(required = true) final BlacklistEntry entry) throws DatabaseException { |
|
47 |
log.debug("editing blacklist entry " + entry.getId()); |
|
48 |
this.blacklistManager.editBlacklistEntry(entry); |
|
49 |
} |
|
50 |
|
|
51 |
@ResponseBody |
|
52 |
@RequestMapping(value = "/ui/blacklist/deleteFromBlacklist.do") |
|
53 |
public void deleteFromBlacklist(@RequestBody(required = true) final int entryId) throws DatabaseException { |
|
54 |
log.debug("deleting blacklist entry " + entryId); |
|
55 |
this.blacklistManager.deleteFromBlacklist(entryId); |
|
56 |
} |
|
57 |
|
|
58 |
@ResponseBody |
|
59 |
@RequestMapping(value = "/ui/blacklist/getListOfRelationships.do") |
|
60 |
public Set<String> getListOfRelationships() throws DatabaseException { |
|
61 |
return this.blacklistManager.getListOfRelationships(); |
|
62 |
} |
|
63 |
|
|
64 |
} |
modules/dnet-openaire-blacklist/tags/dnet-openaire-blacklist-1.0.6/src/main/java/eu/dnetlib/functionality/modular/ui/blacklist/BlacklistEntryPointController.java | ||
---|---|---|
1 |
package eu.dnetlib.functionality.modular.ui.blacklist; |
|
2 |
|
Also available in: Unified diff
[maven-release-plugin] copy for tag dnet-openaire-blacklist-1.0.6