Revision 57670
Added by Michele Artini over 4 years ago
modules/dnet-orgs-database-application/trunk/src/main/java/eu/dnetlib/organizations/repository/readonly/WarningViewRepository.java | ||
---|---|---|
1 |
package eu.dnetlib.organizations.repository.readonly; |
|
2 |
|
|
3 |
import org.springframework.stereotype.Repository; |
|
4 |
|
|
5 |
import eu.dnetlib.organizations.model.view.WarningView; |
|
6 |
import eu.dnetlib.organizations.model.view.WarningViewPK; |
|
7 |
|
|
8 |
@Repository |
|
9 |
public interface WarningViewRepository extends ReadOnlyRepository<WarningView, WarningViewPK> { |
|
10 |
|
|
11 |
} |
modules/dnet-orgs-database-application/trunk/src/main/java/eu/dnetlib/organizations/model/view/WarningView.java | ||
---|---|---|
1 |
package eu.dnetlib.organizations.model.view; |
|
2 |
|
|
3 |
import java.io.Serializable; |
|
4 |
|
|
5 |
import javax.persistence.Column; |
|
6 |
import javax.persistence.Entity; |
|
7 |
import javax.persistence.Id; |
|
8 |
import javax.persistence.IdClass; |
|
9 |
import javax.persistence.Table; |
|
10 |
|
|
11 |
@Entity |
|
12 |
@Table(name = "warnings_view") |
|
13 |
@IdClass(WarningViewPK.class) |
|
14 |
public class WarningView implements Serializable { |
|
15 |
|
|
16 |
/** |
|
17 |
* |
|
18 |
*/ |
|
19 |
private static final long serialVersionUID = -6621501199394187765L; |
|
20 |
|
|
21 |
@Id |
|
22 |
@Column(name = "id_1") |
|
23 |
private String id1; |
|
24 |
|
|
25 |
@Id |
|
26 |
@Column(name = "id_2") |
|
27 |
private String id2; |
|
28 |
|
|
29 |
@Column(name = "name_1") |
|
30 |
private String name1; |
|
31 |
|
|
32 |
@Column(name = "name_2") |
|
33 |
private String name2; |
|
34 |
|
|
35 |
@Column(name = "type_1") |
|
36 |
private String type1; |
|
37 |
|
|
38 |
@Column(name = "type_2") |
|
39 |
private String type2; |
|
40 |
|
|
41 |
@Column(name = "city_1") |
|
42 |
private String city1; |
|
43 |
|
|
44 |
@Column(name = "city_2") |
|
45 |
private String city2; |
|
46 |
|
|
47 |
@Column(name = "country_1") |
|
48 |
private String country1; |
|
49 |
|
|
50 |
@Column(name = "country_2") |
|
51 |
private String country2; |
|
52 |
|
|
53 |
public String getId1() { |
|
54 |
return id1; |
|
55 |
} |
|
56 |
|
|
57 |
public void setId1(final String id1) { |
|
58 |
this.id1 = id1; |
|
59 |
} |
|
60 |
|
|
61 |
public String getId2() { |
|
62 |
return id2; |
|
63 |
} |
|
64 |
|
|
65 |
public void setId2(final String id2) { |
|
66 |
this.id2 = id2; |
|
67 |
} |
|
68 |
|
|
69 |
public String getName1() { |
|
70 |
return name1; |
|
71 |
} |
|
72 |
|
|
73 |
public void setName1(final String name1) { |
|
74 |
this.name1 = name1; |
|
75 |
} |
|
76 |
|
|
77 |
public String getName2() { |
|
78 |
return name2; |
|
79 |
} |
|
80 |
|
|
81 |
public void setName2(final String name2) { |
|
82 |
this.name2 = name2; |
|
83 |
} |
|
84 |
|
|
85 |
public String getType1() { |
|
86 |
return type1; |
|
87 |
} |
|
88 |
|
|
89 |
public void setType1(final String type1) { |
|
90 |
this.type1 = type1; |
|
91 |
} |
|
92 |
|
|
93 |
public String getType2() { |
|
94 |
return type2; |
|
95 |
} |
|
96 |
|
|
97 |
public void setType2(final String type2) { |
|
98 |
this.type2 = type2; |
|
99 |
} |
|
100 |
|
|
101 |
public String getCity1() { |
|
102 |
return city1; |
|
103 |
} |
|
104 |
|
|
105 |
public void setCity1(final String city1) { |
|
106 |
this.city1 = city1; |
|
107 |
} |
|
108 |
|
|
109 |
public String getCity2() { |
|
110 |
return city2; |
|
111 |
} |
|
112 |
|
|
113 |
public void setCity2(final String city2) { |
|
114 |
this.city2 = city2; |
|
115 |
} |
|
116 |
|
|
117 |
public String getCountry1() { |
|
118 |
return country1; |
|
119 |
} |
|
120 |
|
|
121 |
public void setCountry1(final String country1) { |
|
122 |
this.country1 = country1; |
|
123 |
} |
|
124 |
|
|
125 |
public String getCountry2() { |
|
126 |
return country2; |
|
127 |
} |
|
128 |
|
|
129 |
public void setCountry2(final String country2) { |
|
130 |
this.country2 = country2; |
|
131 |
} |
|
132 |
|
|
133 |
} |
modules/dnet-orgs-database-application/trunk/src/main/java/eu/dnetlib/organizations/model/view/WarningViewPK.java | ||
---|---|---|
1 |
package eu.dnetlib.organizations.model.view; |
|
2 |
|
|
3 |
import java.io.Serializable; |
|
4 |
import java.util.Objects; |
|
5 |
|
|
6 |
public class WarningViewPK implements Serializable { |
|
7 |
|
|
8 |
/** |
|
9 |
* |
|
10 |
*/ |
|
11 |
private static final long serialVersionUID = -4702103726315884367L; |
|
12 |
|
|
13 |
private String id1; |
|
14 |
|
|
15 |
private String id2; |
|
16 |
|
|
17 |
public String getId1() { |
|
18 |
return id1; |
|
19 |
} |
|
20 |
|
|
21 |
public void setId1(final String id1) { |
|
22 |
this.id1 = id1; |
|
23 |
} |
|
24 |
|
|
25 |
public String getId2() { |
|
26 |
return id2; |
|
27 |
} |
|
28 |
|
|
29 |
public void setId2(final String id2) { |
|
30 |
this.id2 = id2; |
|
31 |
} |
|
32 |
|
|
33 |
@Override |
|
34 |
public int hashCode() { |
|
35 |
return Objects.hash(id1, id2); |
|
36 |
} |
|
37 |
|
|
38 |
@Override |
|
39 |
public boolean equals(final Object obj) { |
|
40 |
if (this == obj) { return true; } |
|
41 |
if (obj == null) { return false; } |
|
42 |
if (!(obj instanceof WarningViewPK)) { return false; } |
|
43 |
final WarningViewPK other = (WarningViewPK) obj; |
|
44 |
return Objects.equals(id1, other.id1) && Objects.equals(id2, other.id2); |
|
45 |
} |
|
46 |
|
|
47 |
@Override |
|
48 |
public String toString() { |
|
49 |
return String.format("WarningViewPK [id1=%s, id2=%s]", id1, id2); |
|
50 |
} |
|
51 |
} |
modules/dnet-orgs-database-application/trunk/src/main/resources/static/resources/html/warnings.html | ||
---|---|---|
1 |
<h3>{{warnings.length}} warning(s)</h3> |
|
2 |
|
|
3 |
<div class="card text-white mb-3" ng-repeat="w in warnings" class="mb-2"> |
|
4 |
<div class="card-header bg-primary">Group {{$index+1}}</div> |
|
5 |
<table class="table table-sm"> |
|
6 |
<tr ng-repeat="o in w"> |
|
7 |
<th style="width:40px" class="text-center">#{{$index+1}}</th> |
|
8 |
<td><a href="#!/metadata/0/{{o.id}}" title="{{o.id}}">{{o.name}}</a></td> |
|
9 |
<td style="width:200px"><img ng-src="resources/images/flags/{{o.country}}.gif" /> {{o.city}}, {{o.country}}</td> |
|
10 |
<td style="width:80px" class="text-right">{{o.type}}</td> |
|
11 |
</tr> |
|
12 |
</table> |
|
13 |
<div class="card-footer bg-secondary"> |
|
14 |
<button type="button" class="btn btn-sm btn-primary">merge</button> |
|
15 |
</div> |
|
16 |
</div> |
|
17 |
|
modules/dnet-orgs-database-application/trunk/src/main/resources/static/resources/html/similarities.html | ||
---|---|---|
1 |
<div class="row" style="height: 5em"> |
|
2 |
<div class="col-xl-8 col-lg-10"> |
|
3 |
<p class="muted"><b>ID: </b>{{orgId}}</p> |
|
4 |
</div> |
|
5 |
</div> |
|
6 |
|
|
7 |
<div class="row"> |
|
8 |
<div class="col-xl-10"> |
|
9 |
<div class="card"> |
|
10 |
<div class="card-header"> |
|
11 |
<ul class="nav nav-tabs card-header-tabs"> |
|
12 |
<li class="nav-item"> |
|
13 |
<a href="#!/metadata/0/{{orgId}}" class="nav-link">Metadata</a> |
|
14 |
</li> |
|
15 |
<li class="nav-item"> |
|
16 |
<a href="#!/relations/{{orgId}}" class="nav-link">Relations</a> |
|
17 |
</li> |
|
18 |
<li class="nav-item"> |
|
19 |
<a href="javascript:void(0)" class="nav-link active">Similarities</a> |
|
20 |
</li> |
|
21 |
</ul> |
|
22 |
</div> |
|
23 |
|
|
24 |
<div class="card-body text-muted" ng-if="similarities.length == 0"> |
|
25 |
No similarities |
|
26 |
</div> |
|
27 |
|
|
28 |
<table class="table table-sm mt-2" ng-if="similarities.length > 0"> |
|
29 |
<thead> |
|
30 |
<tr> |
|
31 |
<th class="pl-3" style="border-top: none;">Related organization</th> |
|
32 |
<th class="text-center" style="border-top: none;">Acronym</th> |
|
33 |
<th class="text-center" style="border-top: none;">Country</th> |
|
34 |
<th style="border-top: none;">Source</th> |
|
35 |
<th style="border-top: none;"></th> |
|
36 |
</tr> |
|
37 |
</thead> |
|
38 |
<tbody> |
|
39 |
<tr ng-repeat="sr in similarities"> |
|
40 |
<td class="pl-3"> |
|
41 |
{{sr.oaName}} |
|
42 |
<span class="small" ng-if="sr.oaUrl" ><br /><b>URL: </b><a href="{{sr.oaUrl}}" target="_blank">{{sr.oaUrl}}</a></span> |
|
43 |
</td> |
|
44 |
<td class="text-center small">{{sr.oaAcronym}}</td> |
|
45 |
<td class="text-center small"><img ng-src="resources/images/flags/{{sr.oaCountry}}.gif" /> {{sr.oaCountry}}</td> |
|
46 |
<td class="small"> |
|
47 |
<b>Collected from:</b> {{sr.oaCollectedFrom}}<br /> |
|
48 |
<b>Original Id:</b> <span class="text-monospace">{{sr.oaOriginalId}}</span> |
|
49 |
</td> |
|
50 |
<td class="text-right"> |
|
51 |
<div class="btn-group btn-group-toggle btn-group-sm" data-toggle="buttons"> |
|
52 |
<label class="btn" ng-class="{'btn-danger' : sr.relType == 'is_different', 'btn-outline-danger' : sr.relType != 'is_different'}"> |
|
53 |
<input type="radio" autocomplete="off" ng-model="sr.relType" value="is_different" ng-class="{'active' : sr.relType == 'is_different'}"><i class="fas fa-times fa-fw"></i> |
|
54 |
</label> |
|
55 |
<label class="btn" ng-class="{'btn-info' : sr.relType == 'suggested', 'btn-outline-info' : sr.relType != 'suggested'}"> |
|
56 |
<input type="radio" autocomplete="off" ng-model="sr.relType" value="suggested" ng-class="{'active' : sr.relType == 'suggested'}"><i class="fas fa-question fa-fw"></i> |
|
57 |
</label> |
|
58 |
<label class="btn" ng-class="{'btn-success' : sr.relType == 'is_similar', 'btn-outline-success' : sr.relType != 'is_similar'}"> |
|
59 |
<input type="radio" autocomplete="off" ng-model="sr.relType" value="is_similar" ng-class="{'active' : sr.relType == 'is_similar'}"/><i class="fas fa-check fa-fw"></i> |
|
60 |
</label> |
|
61 |
</div> |
|
62 |
</td> |
|
63 |
</tr> |
|
64 |
</tbody> |
|
65 |
</table> |
|
66 |
<div class="card-footer" ng-if="similarities.length > 0"> |
|
67 |
<button class="btn btn-sm btn-primary" ng-click="saveSimilarities()">save</button> |
|
68 |
</div> |
|
69 |
</div> |
|
70 |
</div> |
|
71 |
</div> |
modules/dnet-orgs-database-application/trunk/src/main/java/eu/dnetlib/organizations/repository/readonly/ConflictViewRepository.java | ||
---|---|---|
1 |
package eu.dnetlib.organizations.repository.readonly; |
|
2 |
|
|
3 |
import org.springframework.stereotype.Repository; |
|
4 |
|
|
5 |
import eu.dnetlib.organizations.model.view.ConflictView; |
|
6 |
import eu.dnetlib.organizations.model.view.ConflictViewPK; |
|
7 |
|
|
8 |
@Repository |
|
9 |
public interface ConflictViewRepository extends ReadOnlyRepository<ConflictView, ConflictViewPK> { |
|
10 |
|
|
11 |
} |
modules/dnet-orgs-database-application/trunk/src/main/java/eu/dnetlib/organizations/model/view/ConflictViewPK.java | ||
---|---|---|
1 |
package eu.dnetlib.organizations.model.view; |
|
2 |
|
|
3 |
import java.io.Serializable; |
|
4 |
import java.util.Objects; |
|
5 |
|
|
6 |
public class ConflictViewPK implements Serializable { |
|
7 |
|
|
8 |
/** |
|
9 |
* |
|
10 |
*/ |
|
11 |
private static final long serialVersionUID = -4702103726315884367L; |
|
12 |
|
|
13 |
private String id1; |
|
14 |
|
|
15 |
private String id2; |
|
16 |
|
|
17 |
public String getId1() { |
|
18 |
return id1; |
|
19 |
} |
|
20 |
|
|
21 |
public void setId1(final String id1) { |
|
22 |
this.id1 = id1; |
|
23 |
} |
|
24 |
|
|
25 |
public String getId2() { |
|
26 |
return id2; |
|
27 |
} |
|
28 |
|
|
29 |
public void setId2(final String id2) { |
|
30 |
this.id2 = id2; |
|
31 |
} |
|
32 |
|
|
33 |
@Override |
|
34 |
public int hashCode() { |
|
35 |
return Objects.hash(id1, id2); |
|
36 |
} |
|
37 |
|
|
38 |
@Override |
|
39 |
public boolean equals(final Object obj) { |
|
40 |
if (this == obj) { return true; } |
|
41 |
if (obj == null) { return false; } |
|
42 |
if (!(obj instanceof ConflictViewPK)) { return false; } |
|
43 |
final ConflictViewPK other = (ConflictViewPK) obj; |
|
44 |
return Objects.equals(id1, other.id1) && Objects.equals(id2, other.id2); |
|
45 |
} |
|
46 |
|
|
47 |
@Override |
|
48 |
public String toString() { |
|
49 |
return String.format("WarningViewPK [id1=%s, id2=%s]", id1, id2); |
|
50 |
} |
|
51 |
} |
modules/dnet-orgs-database-application/trunk/src/main/java/eu/dnetlib/organizations/model/view/ConflictView.java | ||
---|---|---|
1 |
package eu.dnetlib.organizations.model.view; |
|
2 |
|
|
3 |
import java.io.Serializable; |
|
4 |
|
|
5 |
import javax.persistence.Column; |
|
6 |
import javax.persistence.Entity; |
|
7 |
import javax.persistence.Id; |
|
8 |
import javax.persistence.IdClass; |
|
9 |
import javax.persistence.Table; |
|
10 |
|
|
11 |
@Entity |
|
12 |
@Table(name = "conflicts_view") |
|
13 |
@IdClass(ConflictViewPK.class) |
|
14 |
public class ConflictView implements Serializable { |
|
15 |
|
|
16 |
/** |
|
17 |
* |
|
18 |
*/ |
|
19 |
private static final long serialVersionUID = -6621501199394187765L; |
|
20 |
|
|
21 |
@Id |
|
22 |
@Column(name = "id_1") |
|
23 |
private String id1; |
|
24 |
|
|
25 |
@Id |
|
26 |
@Column(name = "id_2") |
|
27 |
private String id2; |
|
28 |
|
|
29 |
@Column(name = "name_1") |
|
30 |
private String name1; |
|
31 |
|
|
32 |
@Column(name = "name_2") |
|
33 |
private String name2; |
|
34 |
|
|
35 |
@Column(name = "type_1") |
|
36 |
private String type1; |
|
37 |
|
|
38 |
@Column(name = "type_2") |
|
39 |
private String type2; |
|
40 |
|
|
41 |
@Column(name = "city_1") |
|
42 |
private String city1; |
|
43 |
|
|
44 |
@Column(name = "city_2") |
|
45 |
private String city2; |
|
46 |
|
|
47 |
@Column(name = "country_1") |
|
48 |
private String country1; |
|
49 |
|
|
50 |
@Column(name = "country_2") |
|
51 |
private String country2; |
|
52 |
|
|
53 |
public String getId1() { |
|
54 |
return id1; |
|
55 |
} |
|
56 |
|
|
57 |
public void setId1(final String id1) { |
|
58 |
this.id1 = id1; |
|
59 |
} |
|
60 |
|
|
61 |
public String getId2() { |
|
62 |
return id2; |
|
63 |
} |
|
64 |
|
|
65 |
public void setId2(final String id2) { |
|
66 |
this.id2 = id2; |
|
67 |
} |
|
68 |
|
|
69 |
public String getName1() { |
|
70 |
return name1; |
|
71 |
} |
|
72 |
|
|
73 |
public void setName1(final String name1) { |
|
74 |
this.name1 = name1; |
|
75 |
} |
|
76 |
|
|
77 |
public String getName2() { |
|
78 |
return name2; |
|
79 |
} |
|
80 |
|
|
81 |
public void setName2(final String name2) { |
|
82 |
this.name2 = name2; |
|
83 |
} |
|
84 |
|
|
85 |
public String getType1() { |
|
86 |
return type1; |
|
87 |
} |
|
88 |
|
|
89 |
public void setType1(final String type1) { |
|
90 |
this.type1 = type1; |
|
91 |
} |
|
92 |
|
|
93 |
public String getType2() { |
|
94 |
return type2; |
|
95 |
} |
|
96 |
|
|
97 |
public void setType2(final String type2) { |
|
98 |
this.type2 = type2; |
|
99 |
} |
|
100 |
|
|
101 |
public String getCity1() { |
|
102 |
return city1; |
|
103 |
} |
|
104 |
|
|
105 |
public void setCity1(final String city1) { |
|
106 |
this.city1 = city1; |
|
107 |
} |
|
108 |
|
|
109 |
public String getCity2() { |
|
110 |
return city2; |
|
111 |
} |
|
112 |
|
|
113 |
public void setCity2(final String city2) { |
|
114 |
this.city2 = city2; |
|
115 |
} |
|
116 |
|
|
117 |
public String getCountry1() { |
|
118 |
return country1; |
|
119 |
} |
|
120 |
|
|
121 |
public void setCountry1(final String country1) { |
|
122 |
this.country1 = country1; |
|
123 |
} |
|
124 |
|
|
125 |
public String getCountry2() { |
|
126 |
return country2; |
|
127 |
} |
|
128 |
|
|
129 |
public void setCountry2(final String country2) { |
|
130 |
this.country2 = country2; |
|
131 |
} |
|
132 |
|
|
133 |
} |
modules/dnet-orgs-database-application/trunk/src/main/java/eu/dnetlib/organizations/controller/OrganizationController.java | ||
---|---|---|
8 | 8 |
import java.util.Map; |
9 | 9 |
import java.util.Set; |
10 | 10 |
import java.util.TreeMap; |
11 |
import java.util.stream.Collectors; |
|
11 | 12 |
|
12 | 13 |
import org.apache.commons.lang3.StringUtils; |
13 | 14 |
import org.springframework.beans.factory.annotation.Autowired; |
... | ... | |
24 | 25 |
import eu.dnetlib.organizations.model.OpenaireSimRel; |
25 | 26 |
import eu.dnetlib.organizations.model.utils.BrowseEntry; |
26 | 27 |
import eu.dnetlib.organizations.model.utils.RelationByOrg; |
28 |
import eu.dnetlib.organizations.model.view.ConflictView; |
|
27 | 29 |
import eu.dnetlib.organizations.model.view.OrganizationSimpleView; |
28 | 30 |
import eu.dnetlib.organizations.model.view.OrganizationView; |
29 |
import eu.dnetlib.organizations.model.view.WarningView; |
|
30 | 31 |
import eu.dnetlib.organizations.repository.OpenaireSimRelRepository; |
31 | 32 |
import eu.dnetlib.organizations.repository.OrganizationRepository; |
33 |
import eu.dnetlib.organizations.repository.readonly.ConflictViewRepository; |
|
32 | 34 |
import eu.dnetlib.organizations.repository.readonly.OrganizationSimpleViewRepository; |
33 | 35 |
import eu.dnetlib.organizations.repository.readonly.OrganizationViewRepository; |
34 |
import eu.dnetlib.organizations.repository.readonly.WarningViewRepository; |
|
35 | 36 |
import eu.dnetlib.organizations.utils.DatabaseUtils; |
37 |
import eu.dnetlib.organizations.utils.OpenOrgsConstants; |
|
36 | 38 |
import eu.dnetlib.organizations.utils.RelationType; |
37 | 39 |
|
38 | 40 |
@RestController |
... | ... | |
48 | 50 |
@Autowired |
49 | 51 |
private OpenaireSimRelRepository openaireSimRelRepository; |
50 | 52 |
@Autowired |
51 |
private WarningViewRepository warningViewRepository;
|
|
53 |
private ConflictViewRepository conflictViewRepository;
|
|
52 | 54 |
@Autowired |
53 | 55 |
private DatabaseUtils databaseUtils; |
54 | 56 |
|
... | ... | |
128 | 130 |
|
129 | 131 |
} |
130 | 132 |
|
131 |
@RequestMapping(value = "/similarities", method = RequestMethod.GET)
|
|
132 |
public List<OpenaireSimRel> findSimilaritiesById(@RequestParam final String id, final Authentication authentication) {
|
|
133 |
@RequestMapping(value = "/enrichments", method = RequestMethod.GET)
|
|
134 |
public List<OpenaireSimRel> findEnrichmentsById(@RequestParam final String id, final Authentication authentication) {
|
|
133 | 135 |
if (UserInfo.isSuperAdmin(authentication) || organizationRepository.verifyAuthorizationForId(id, authentication.getName())) { |
134 |
// return openaireSimRelRepository.findByLocalId(id).stream().filter(s -> |
|
135 |
// !s.getOaOriginalId().startsWith(OpenOrgsConstants.OPENORGS_PREFIX)).collect(Collectors.toList()); |
|
136 |
return openaireSimRelRepository.findByLocalId(id); |
|
136 |
return openaireSimRelRepository.findByLocalId(id) |
|
137 |
.stream() |
|
138 |
.filter(s -> !s.getOaOriginalId().startsWith(OpenOrgsConstants.OPENORGS_PREFIX)) |
|
139 |
.collect(Collectors.toList()); |
|
137 | 140 |
} else { |
138 | 141 |
throw new RuntimeException("User not authorized"); |
139 | 142 |
} |
140 | 143 |
} |
141 | 144 |
|
142 |
@RequestMapping(value = "/warnings", method = RequestMethod.GET) |
|
145 |
@RequestMapping(value = "/conflicts", method = RequestMethod.GET) |
|
146 |
public List<OpenaireSimRel> findConflictsById(@RequestParam final String id, final Authentication authentication) { |
|
147 |
if (UserInfo.isSuperAdmin(authentication) || organizationRepository.verifyAuthorizationForId(id, authentication.getName())) { |
|
148 |
return openaireSimRelRepository.findByLocalId(id) |
|
149 |
.stream() |
|
150 |
.filter(s -> s.getOaOriginalId().startsWith(OpenOrgsConstants.OPENORGS_PREFIX)) |
|
151 |
.collect(Collectors.toList()); |
|
152 |
} else { |
|
153 |
throw new RuntimeException("User not authorized"); |
|
154 |
} |
|
155 |
} |
|
156 |
|
|
157 |
@RequestMapping(value = "/conflicts/all", method = RequestMethod.GET) |
|
143 | 158 |
public Collection<Set<OrganizationSimpleView>> findWarningsById(final Authentication authentication) { |
144 | 159 |
|
145 | 160 |
final Map<String, Set<OrganizationSimpleView>> res = new TreeMap<>(); |
... | ... | |
147 | 162 |
final Map<String, String> roots = new HashMap<>(); |
148 | 163 |
|
149 | 164 |
if (UserInfo.isSuperAdmin(authentication)) { |
150 |
for (final WarningView w : warningViewRepository.findAll()) {
|
|
165 |
for (final ConflictView w : conflictViewRepository.findAll()) {
|
|
151 | 166 |
final String root = findWarningRoot(w, roots); |
152 | 167 |
if (!res.containsKey(root)) { |
153 | 168 |
res.put(root, new LinkedHashSet<OrganizationSimpleView>()); |
... | ... | |
161 | 176 |
} |
162 | 177 |
} |
163 | 178 |
|
164 |
private String findWarningRoot(final WarningView w, final Map<String, String> roots) {
|
|
179 |
private String findWarningRoot(final ConflictView w, final Map<String, String> roots) {
|
|
165 | 180 |
if (roots.containsKey(w.getId1())) { |
166 | 181 |
return roots.get(w.getId1()); |
167 | 182 |
} else if (roots.containsKey(w.getId2())) { |
... | ... | |
175 | 190 |
|
176 | 191 |
} |
177 | 192 |
|
178 |
@RequestMapping(value = "/similarities", method = RequestMethod.POST)
|
|
179 |
public List<OpenaireSimRel> saveSimilarities(@RequestBody final List<OpenaireSimRel> simrels, final Authentication authentication) {
|
|
193 |
@RequestMapping(value = "/enrichments", method = RequestMethod.POST)
|
|
194 |
public List<OpenaireSimRel> saveEnrichments(@RequestBody final List<OpenaireSimRel> simrels, final Authentication authentication) {
|
|
180 | 195 |
|
181 | 196 |
final boolean b = UserInfo.isSuperAdmin(authentication) |
182 | 197 |
|| simrels.stream() |
modules/dnet-orgs-database-application/trunk/src/main/resources/sql/schema.sql | ||
---|---|---|
1 | 1 |
DROP VIEW organizations_view; |
2 | 2 |
DROP VIEW organizations_simple_view; |
3 | 3 |
DROP VIEW users_view; |
4 |
DROP VIEW warnings_view;
|
|
4 |
DROP VIEW conflicts_view;
|
|
5 | 5 |
|
6 | 6 |
DROP TABLE IF EXISTS other_ids; |
7 | 7 |
DROP TABLE IF EXISTS other_names; |
... | ... | |
195 | 195 |
GROUP BY u.email, u.valid, u.role |
196 | 196 |
ORDER BY u.email; |
197 | 197 |
|
198 |
CREATE VIEW warnings_view AS SELECT
|
|
198 |
CREATE VIEW conflicts_view AS SELECT
|
|
199 | 199 |
o1.id AS id_1, |
200 | 200 |
o1.name AS name_1, |
201 | 201 |
o1.type AS type_1, |
modules/dnet-orgs-database-application/trunk/src/main/resources/static/resources/html/allConflicts.html | ||
---|---|---|
1 |
<h3>{{conflicts.length}} warning(s)</h3> |
|
2 |
|
|
3 |
<div class="card text-white mb-3" ng-repeat="w in conflicts" class="mb-2"> |
|
4 |
<div class="card-header bg-primary">Group {{$index+1}}</div> |
|
5 |
<table class="table table-sm"> |
|
6 |
<tr ng-repeat="o in w"> |
|
7 |
<th style="width:40px" class="text-center">#{{$index+1}}</th> |
|
8 |
<td><a href="#!/metadata/0/{{o.id}}" title="{{o.id}}">{{o.name}}</a></td> |
|
9 |
<td style="width:200px"><img ng-src="resources/images/flags/{{o.country}}.gif" /> {{o.city}}, {{o.country}}</td> |
|
10 |
<td style="width:80px" class="text-right">{{o.type}}</td> |
|
11 |
</tr> |
|
12 |
</table> |
|
13 |
<div class="card-footer bg-secondary"> |
|
14 |
<button type="button" class="btn btn-sm btn-primary">merge</button> |
|
15 |
</div> |
|
16 |
</div> |
|
17 |
|
modules/dnet-orgs-database-application/trunk/src/main/resources/static/resources/html/enrichments.html | ||
---|---|---|
1 |
<div class="row" style="height: 5em"> |
|
2 |
<div class="col-xl-8 col-lg-10"> |
|
3 |
<p class="muted"><b>ID: </b>{{orgId}}</p> |
|
4 |
</div> |
|
5 |
</div> |
|
6 |
|
|
7 |
<div class="row"> |
|
8 |
<div class="col-xl-10"> |
|
9 |
<div class="card"> |
|
10 |
<div class="card-header"> |
|
11 |
<ul class="nav nav-tabs card-header-tabs"> |
|
12 |
<li class="nav-item"> |
|
13 |
<a href="#!/metadata/0/{{orgId}}" class="nav-link">Metadata</a> |
|
14 |
</li> |
|
15 |
<li class="nav-item"> |
|
16 |
<a href="#!/relations/{{orgId}}" class="nav-link">Relations</a> |
|
17 |
</li> |
|
18 |
<li class="nav-item"> |
|
19 |
<a href="javascript:void(0)" class="nav-link active">Enrichments</a> |
|
20 |
</li> |
|
21 |
<li class="nav-item"> |
|
22 |
<a href="#!/conflicts/{{orgId}}" class="nav-link">Conflicts</a> |
|
23 |
</li> |
|
24 |
</ul> |
|
25 |
</div> |
|
26 |
|
|
27 |
<div class="card-body text-muted" ng-if="enrichments.length == 0"> |
|
28 |
No enrichments |
|
29 |
</div> |
|
30 |
|
|
31 |
<table class="table table-sm mt-2" ng-if="enrichments.length > 0"> |
|
32 |
<thead> |
|
33 |
<tr> |
|
34 |
<th class="pl-3" style="border-top: none;">Related organization</th> |
|
35 |
<th class="text-center" style="border-top: none;">Acronym</th> |
|
36 |
<th class="text-center" style="border-top: none;">Country</th> |
|
37 |
<th style="border-top: none;">Source</th> |
|
38 |
<th style="border-top: none;"></th> |
|
39 |
</tr> |
|
40 |
</thead> |
|
41 |
<tbody> |
|
42 |
<tr ng-repeat="sr in enrichments"> |
|
43 |
<td class="pl-3"> |
|
44 |
{{sr.oaName}} |
|
45 |
<span class="small" ng-if="sr.oaUrl" ><br /><b>URL: </b><a href="{{sr.oaUrl}}" target="_blank">{{sr.oaUrl}}</a></span> |
|
46 |
</td> |
|
47 |
<td class="text-center small">{{sr.oaAcronym}}</td> |
|
48 |
<td class="text-center small"><img ng-src="resources/images/flags/{{sr.oaCountry}}.gif" /> {{sr.oaCountry}}</td> |
|
49 |
<td class="small"> |
|
50 |
<b>Collected from:</b> {{sr.oaCollectedFrom}}<br /> |
|
51 |
<b>Original Id:</b> <span class="text-monospace">{{sr.oaOriginalId}}</span> |
|
52 |
</td> |
|
53 |
<td class="text-right"> |
|
54 |
<div class="btn-group btn-group-toggle btn-group-sm" data-toggle="buttons"> |
|
55 |
<label class="btn" ng-class="{'btn-danger' : sr.relType == 'is_different', 'btn-outline-danger' : sr.relType != 'is_different'}"> |
|
56 |
<input type="radio" autocomplete="off" ng-model="sr.relType" value="is_different" ng-class="{'active' : sr.relType == 'is_different'}"><i class="fas fa-times fa-fw"></i> |
|
57 |
</label> |
|
58 |
<label class="btn" ng-class="{'btn-info' : sr.relType == 'suggested', 'btn-outline-info' : sr.relType != 'suggested'}"> |
|
59 |
<input type="radio" autocomplete="off" ng-model="sr.relType" value="suggested" ng-class="{'active' : sr.relType == 'suggested'}"><i class="fas fa-question fa-fw"></i> |
|
60 |
</label> |
|
61 |
<label class="btn" ng-class="{'btn-success' : sr.relType == 'is_similar', 'btn-outline-success' : sr.relType != 'is_similar'}"> |
|
62 |
<input type="radio" autocomplete="off" ng-model="sr.relType" value="is_similar" ng-class="{'active' : sr.relType == 'is_similar'}"/><i class="fas fa-check fa-fw"></i> |
|
63 |
</label> |
|
64 |
</div> |
|
65 |
</td> |
|
66 |
</tr> |
|
67 |
</tbody> |
|
68 |
</table> |
|
69 |
<div class="card-footer" ng-if="enrichments > 0"> |
|
70 |
<button class="btn btn-sm btn-primary" ng-click="saveEnrichments()">save</button> |
|
71 |
</div> |
|
72 |
</div> |
|
73 |
</div> |
|
74 |
</div> |
modules/dnet-orgs-database-application/trunk/src/main/resources/static/resources/html/relations.html | ||
---|---|---|
16 | 16 |
<a href="javascript:void(0)" class="nav-link active">Relations</a> |
17 | 17 |
</li> |
18 | 18 |
<li class="nav-item"> |
19 |
<a href="#!/similarities/{{orgId}}" class="nav-link">Similarities</a>
|
|
19 |
<a href="#!/enrichments/{{orgId}}" class="nav-link">Enrichments</a>
|
|
20 | 20 |
</li> |
21 |
<li class="nav-item"> |
|
22 |
<a href="#!/conflicts/{{orgId}}" class="nav-link">Conflicts</a> |
|
23 |
</li> |
|
21 | 24 |
</ul> |
22 | 25 |
</div> |
23 | 26 |
|
modules/dnet-orgs-database-application/trunk/src/main/resources/static/resources/html/conflicts.html | ||
---|---|---|
1 |
<div class="row" style="height: 5em"> |
|
2 |
<div class="col-xl-8 col-lg-10"> |
|
3 |
<p class="muted"><b>ID: </b>{{orgId}}</p> |
|
4 |
</div> |
|
5 |
</div> |
|
6 |
|
|
7 |
<div class="row"> |
|
8 |
<div class="col-xl-10"> |
|
9 |
<div class="card"> |
|
10 |
<div class="card-header"> |
|
11 |
<ul class="nav nav-tabs card-header-tabs"> |
|
12 |
<li class="nav-item"> |
|
13 |
<a href="#!/metadata/0/{{orgId}}" class="nav-link">Metadata</a> |
|
14 |
</li> |
|
15 |
<li class="nav-item"> |
|
16 |
<a href="#!/relations/{{orgId}}" class="nav-link">Relations</a> |
|
17 |
</li> |
|
18 |
<li class="nav-item"> |
|
19 |
<a href="#!/enrichments/{{orgId}}" class="nav-link">Enrichments</a> |
|
20 |
</li> |
|
21 |
<li class="nav-item"> |
|
22 |
<a href="javascript:void(0)" class="nav-link active">Conflicts</a> |
|
23 |
</li> |
|
24 |
</ul> |
|
25 |
</div> |
|
26 |
|
|
27 |
<div class="card-body text-muted" ng-if="conflicts.length == 0"> |
|
28 |
No conflicts |
|
29 |
</div> |
|
30 |
|
|
31 |
<table class="table table-sm mt-2" ng-if="conflicts.length > 0"> |
|
32 |
<thead> |
|
33 |
<tr> |
|
34 |
<th class="pl-3" style="border-top: none;">Related organization</th> |
|
35 |
<th class="text-center" style="border-top: none;">Acronym</th> |
|
36 |
<th class="text-center" style="border-top: none;">Country</th> |
|
37 |
<th style="border-top: none;">Source</th> |
|
38 |
<th style="border-top: none;"></th> |
|
39 |
</tr> |
|
40 |
</thead> |
|
41 |
<tbody> |
|
42 |
<tr ng-repeat="sr in conflicts"> |
|
43 |
<td class="pl-3"> |
|
44 |
{{sr.oaName}} |
|
45 |
<span class="small" ng-if="sr.oaUrl" ><br /><b>URL: </b><a href="{{sr.oaUrl}}" target="_blank">{{sr.oaUrl}}</a></span> |
|
46 |
</td> |
|
47 |
<td class="text-center small">{{sr.oaAcronym}}</td> |
|
48 |
<td class="text-center small"><img ng-src="resources/images/flags/{{sr.oaCountry}}.gif" /> {{sr.oaCountry}}</td> |
|
49 |
<td class="small"> |
|
50 |
<b>Collected from:</b> {{sr.oaCollectedFrom}}<br /> |
|
51 |
<b>Original Id:</b> <span class="text-monospace">{{sr.oaOriginalId}}</span> |
|
52 |
</td> |
|
53 |
<td class="text-right"> |
|
54 |
<div class="btn-group btn-group-toggle btn-group-sm" data-toggle="buttons"> |
|
55 |
<label class="btn" ng-class="{'btn-danger' : sr.relType == 'is_different', 'btn-outline-danger' : sr.relType != 'is_different'}"> |
|
56 |
<input type="radio" autocomplete="off" ng-model="sr.relType" value="is_different" ng-class="{'active' : sr.relType == 'is_different'}"><i class="fas fa-times fa-fw"></i> |
|
57 |
</label> |
|
58 |
<label class="btn" ng-class="{'btn-info' : sr.relType == 'suggested', 'btn-outline-info' : sr.relType != 'suggested'}"> |
|
59 |
<input type="radio" autocomplete="off" ng-model="sr.relType" value="suggested" ng-class="{'active' : sr.relType == 'suggested'}"><i class="fas fa-question fa-fw"></i> |
|
60 |
</label> |
|
61 |
<label class="btn" ng-class="{'btn-success' : sr.relType == 'is_similar', 'btn-outline-success' : sr.relType != 'is_similar'}"> |
|
62 |
<input type="radio" autocomplete="off" ng-model="sr.relType" value="is_similar" ng-class="{'active' : sr.relType == 'is_similar'}"/><i class="fas fa-check fa-fw"></i> |
|
63 |
</label> |
|
64 |
</div> |
|
65 |
</td> |
|
66 |
</tr> |
|
67 |
</tbody> |
|
68 |
</table> |
|
69 |
<div class="card-footer" ng-if="conflicts > 0"> |
|
70 |
<button class="btn btn-sm btn-primary" ng-click="saveEnrichments()">save</button> |
|
71 |
</div> |
|
72 |
</div> |
|
73 |
</div> |
|
74 |
</div> |
modules/dnet-orgs-database-application/trunk/src/main/resources/static/resources/html/edit.html | ||
---|---|---|
21 | 21 |
<a href="#!/relations/{{orgId}}" class="nav-link">Relations</a> |
22 | 22 |
</li> |
23 | 23 |
<li class="nav-item" ng-if="orgId"> |
24 |
<a href="#!/similarities/{{orgId}}" class="nav-link">Similarities</a>
|
|
24 |
<a href="#!/enrichments/{{orgId}}" class="nav-link">Enrichments</a>
|
|
25 | 25 |
</li> |
26 |
<li class="nav-item" ng-if="orgId"> |
|
27 |
<a href="#!/conflicts/{{orgId}}" class="nav-link">Conflicts</a> |
|
28 |
</li> |
|
26 | 29 |
</ul> |
27 | 30 |
</div> |
28 | 31 |
<div class="card-body"> |
modules/dnet-orgs-database-application/trunk/src/main/resources/static/resources/js/organizations.js | ||
---|---|---|
11 | 11 |
.when('/byType/:page/:size/:type*', { templateUrl: 'resources/html/list.html', controller: 'byTypeCtrl' }) |
12 | 12 |
.when('/metadata/:msg/:id', { templateUrl: 'resources/html/edit.html', controller: 'showMetadataCtrl' }) |
13 | 13 |
.when('/relations/:id', { templateUrl: 'resources/html/relations.html', controller: 'showRelationsCtrl' }) |
14 |
.when('/similarities/:id', { templateUrl: 'resources/html/similarities.html', controller: 'showSimilaritiesCtrl' }) |
|
15 |
.when('/warnings', { templateUrl: 'resources/html/warnings.html', controller: 'showWarningsCtrl' }) |
|
14 |
.when('/enrichments/:id', { templateUrl: 'resources/html/enrichments.html', controller: 'showEnrichmentsCtrl' }) |
|
15 |
.when('/conflicts/:id', { templateUrl: 'resources/html/conflicts.html', controller: 'showConflictsCtrl' }) |
|
16 |
.when('/allConflicts', { templateUrl: 'resources/html/allConflicts.html', controller: 'showAllConflictsCtrl' }) |
|
16 | 17 |
.when('/users', { templateUrl: 'resources/html/users.html', controller: 'usersCtrl' }) |
17 | 18 |
.otherwise({ redirectTo: '/search' }); |
18 | 19 |
}); |
... | ... | |
240 | 241 |
|
241 | 242 |
}); |
242 | 243 |
|
243 |
orgsModule.controller('showSimilaritiesCtrl', function ($scope, $http, $routeParams) {
|
|
244 |
orgsModule.controller('showEnrichmentsCtrl', function ($scope, $http, $routeParams) {
|
|
244 | 245 |
$scope.orgId = $routeParams.id; |
245 |
$scope.similarities = [];
|
|
246 |
$scope.enrichments = [];
|
|
246 | 247 |
$scope.vocabularies = {}; |
247 | 248 |
|
248 | 249 |
$http.get('api/vocabularies').then(function successCallback(res) { |
249 | 250 |
$scope.vocabularies = res.data; |
250 | 251 |
|
251 |
$http.get('api/organizations/similarities?id=' + $routeParams.id).then(function successCallback(res) {
|
|
252 |
$scope.similarities = res.data;
|
|
252 |
$http.get('api/organizations/enrichments?id=' + $routeParams.id).then(function successCallback(res) {
|
|
253 |
$scope.enrichments = res.data;
|
|
253 | 254 |
}, function errorCallback(res) { |
254 | 255 |
alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')'); |
255 | 256 |
}); |
... | ... | |
258 | 259 |
}); |
259 | 260 |
|
260 | 261 |
|
261 |
$scope.saveSimilarities = function() {
|
|
262 |
$scope.saveEnrichments = function() {
|
|
262 | 263 |
$http.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8"; |
263 |
$http.post('api/organizations/similarities', $scope.similarities).then(function successCallback(res) {
|
|
264 |
alert('Similarities updated !!!');
|
|
265 |
$scope.similarities = res.data;
|
|
264 |
$http.post('api/organizations/enrichments', $scope.enrichments).then(function successCallback(res) {
|
|
265 |
alert('Enrichments updated !!!');
|
|
266 |
$scope.enrichments = res.data;
|
|
266 | 267 |
}, function errorCallback(res) { |
267 | 268 |
alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')'); |
268 | 269 |
}); |
269 | 270 |
} |
270 | 271 |
}); |
271 | 272 |
|
272 |
|
|
273 |
orgsModule.controller('showWarningsCtrl', function ($scope, $http, $routeParams) { |
|
273 |
orgsModule.controller('showConflictsCtrl', function ($scope, $http, $routeParams) { |
|
274 | 274 |
$scope.orgId = $routeParams.id; |
275 |
$scope.warnings = []; |
|
275 |
$scope.conflicts = []; |
|
276 |
$scope.vocabularies = {}; |
|
276 | 277 |
|
277 |
$http.get('api/organizations/warnings?id=' + $routeParams.id).then(function successCallback(res) { |
|
278 |
$scope.warnings = res.data; |
|
278 |
$http.get('api/vocabularies').then(function successCallback(res) { |
|
279 |
$scope.vocabularies = res.data; |
|
280 |
|
|
281 |
$http.get('api/organizations/conflicts?id=' + $routeParams.id).then(function successCallback(res) { |
|
282 |
$scope.conflicts = res.data; |
|
283 |
}, function errorCallback(res) { |
|
284 |
alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')'); |
|
285 |
}); |
|
279 | 286 |
}, function errorCallback(res) { |
280 | 287 |
alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')'); |
281 | 288 |
}); |
289 |
}); |
|
282 | 290 |
|
291 |
orgsModule.controller('showAllConflictsCtrl', function ($scope, $http) { |
|
292 |
$scope.conflicts = []; |
|
293 |
$http.get('api/organizations/conflicts/all').then(function successCallback(res) { |
|
294 |
$scope.conflicts = res.data; |
|
295 |
}, function errorCallback(res) { |
|
296 |
alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')'); |
|
297 |
}); |
|
283 | 298 |
}); |
284 | 299 |
|
285 |
|
|
286 | 300 |
orgsModule.controller('usersCtrl', function ($scope, $http, $timeout, $route) { |
287 | 301 |
$scope.users = []; |
288 | 302 |
$scope.vocs = {}; |
modules/dnet-orgs-database-application/trunk/src/main/resources/templates/home.html | ||
---|---|---|
54 | 54 |
</div> |
55 | 55 |
</li> |
56 | 56 |
<li class="nav-item"><a class="nav-link" href="#!/new">New</a></li> |
57 |
<li class="nav-item" sec:authorize="hasRole('ROLE_ADMIN')"><a class="nav-link" href="#!/warnings">Warnings</a></li>
|
|
57 |
<li class="nav-item" sec:authorize="hasRole('ROLE_ADMIN')"><a class="nav-link" href="#!/allConflicts">Warnings</a></li>
|
|
58 | 58 |
</ul> |
59 | 59 |
</div> |
60 | 60 |
|
Also available in: Unified diff
warning -> conflicts