Added eventId to ShortEventMessage
This commit is contained in:
parent
d7d72a3240
commit
81627d3be9
|
@ -0,0 +1,37 @@
|
||||||
|
package eu.dnetlib.broker.oa.controllers;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class EventFeedback implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -6967719685282712195L;
|
||||||
|
|
||||||
|
private String eventId;
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
// TOOD status should be an enum having the following values:
|
||||||
|
// * DISCARDED: the event was not processable by the system. OpenAIRE should not interpret such status in a negative or positive sense
|
||||||
|
// with regard to the accuracy of the notification
|
||||||
|
// * REJECTED: a human takes the decision to reject the suggestion as it was wrong
|
||||||
|
// * ACCEPTED: a human takes the decision to apply the suggested enrichment to the local record
|
||||||
|
|
||||||
|
protected String getEventId() {
|
||||||
|
return eventId;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setEventId(final String eventId) {
|
||||||
|
this.eventId = eventId;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setStatus(final String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ import java.io.FileNotFoundException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -40,7 +41,9 @@ import org.springframework.data.elasticsearch.core.query.NativeSearchQuery;
|
||||||
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
|
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@ -103,7 +106,7 @@ public class OpenairePublicController extends AbstractLbsController {
|
||||||
final NativeSearchQuery searchQuery = new NativeSearchQueryBuilder()
|
final NativeSearchQuery searchQuery = new NativeSearchQueryBuilder()
|
||||||
.withQuery(QueryBuilders.termQuery("subscriptionId.keyword", subscrId))
|
.withQuery(QueryBuilders.termQuery("subscriptionId.keyword", subscrId))
|
||||||
.withSearchType(SearchType.DEFAULT)
|
.withSearchType(SearchType.DEFAULT)
|
||||||
.withFields("topic", "payload")
|
.withFields("topic", "payload", "eventId")
|
||||||
.withPageable(PageRequest.of(0, 100))
|
.withPageable(PageRequest.of(0, 100))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -248,6 +251,17 @@ public class OpenairePublicController extends AbstractLbsController {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("Store the feedback of an event (MOCK)")
|
||||||
|
@RequestMapping(value = "/feedback/events", method = {
|
||||||
|
RequestMethod.POST, RequestMethod.PATCH
|
||||||
|
})
|
||||||
|
private Map<String, String> feedbackEvent(@RequestBody final EventFeedback feedback) {
|
||||||
|
// TOOD
|
||||||
|
final Map<String, String> res = new HashMap<>();
|
||||||
|
res.put("status", "done");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
private List<ShortEventMessage> calculateNotificationMessages(final SearchScrollHits<Notification> scroll) {
|
private List<ShortEventMessage> calculateNotificationMessages(final SearchScrollHits<Notification> scroll) {
|
||||||
if (scroll.getSearchHits().size() > 0) {
|
if (scroll.getSearchHits().size() > 0) {
|
||||||
return scroll.stream()
|
return scroll.stream()
|
||||||
|
@ -266,6 +280,7 @@ public class OpenairePublicController extends AbstractLbsController {
|
||||||
|
|
||||||
final ShortEventMessage res = new ShortEventMessage();
|
final ShortEventMessage res = new ShortEventMessage();
|
||||||
|
|
||||||
|
res.setEventId(n.getEventId());
|
||||||
res.setOriginalId(payload.getResult().getOriginalId());
|
res.setOriginalId(payload.getResult().getOriginalId());
|
||||||
res.setTitle(payload.getResult().getTitles().stream().filter(StringUtils::isNotBlank).findFirst().orElse(null));
|
res.setTitle(payload.getResult().getTitles().stream().filter(StringUtils::isNotBlank).findFirst().orElse(null));
|
||||||
res.setTopic(n.getTopic());
|
res.setTopic(n.getTopic());
|
||||||
|
|
|
@ -10,3 +10,11 @@ create table tmp_fulltext(id text primary key, fulltext tsvector);
|
||||||
CREATE INDEX tmp_fulltext_idx ON tmp_fulltext(fulltext);
|
CREATE INDEX tmp_fulltext_idx ON tmp_fulltext(fulltext);
|
||||||
insert into org_index_search(id, txt) select o.id, to_tsvector(o.id||' '||o.name||' '||array_to_string(array_agg(DISTINCT n.name), ' ','')||' ' ||array_to_string(array_agg(DISTINCT a.acronym), ' ','')) from organizations o left outer join other_names n on (o.id = n.id) left outer join acronyms a on (o.id = a.id) group by o.id, o.name;
|
insert into org_index_search(id, txt) select o.id, to_tsvector(o.id||' '||o.name||' '||array_to_string(array_agg(DISTINCT n.name), ' ','')||' ' ||array_to_string(array_agg(DISTINCT a.acronym), ' ','')) from organizations o left outer join other_names n on (o.id = n.id) left outer join acronyms a on (o.id = a.id) group by o.id, o.name;
|
||||||
select o.name from organizations o left outer join tmp_fulltext f on (o.id = f.id) where f.fulltext @@ plainto_tsquery('pisa university');
|
select o.name from organizations o left outer join tmp_fulltext f on (o.id = f.id) where f.fulltext @@ plainto_tsquery('pisa university');
|
||||||
|
|
||||||
|
|
||||||
|
# Togliere filtro se il browse contiene meno di 10 elemnti
|
||||||
|
# Aggiungere filtro nelle select per l'editing dei metadati (solo se la lista è lunga)
|
||||||
|
# Togliere merges e merged_in dalla select per le creare le relazioni nel form di editing dei metadati
|
||||||
|
# Nella risoluzione dei conflicts aggiungere i bottoni merge_all, all_different, merge_advanced
|
||||||
|
# Nella risoluzione dei conflicts a partire dai singoli record redirigere la pagina sul nuovo record invece che sul record di partenza
|
||||||
|
|
|
@ -17,6 +17,8 @@ public class ShortEventMessage implements Serializable {
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 7302363775341307950L;
|
private static final long serialVersionUID = 7302363775341307950L;
|
||||||
|
|
||||||
|
private String eventId;
|
||||||
|
|
||||||
private String originalId;
|
private String originalId;
|
||||||
|
|
||||||
private String title;
|
private String title;
|
||||||
|
@ -27,6 +29,14 @@ public class ShortEventMessage implements Serializable {
|
||||||
|
|
||||||
private Map<String, String> message = new LinkedHashMap<>();
|
private Map<String, String> message = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
public String getEventId() {
|
||||||
|
return eventId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEventId(final String eventId) {
|
||||||
|
this.eventId = eventId;
|
||||||
|
}
|
||||||
|
|
||||||
public String getOriginalId() {
|
public String getOriginalId() {
|
||||||
return originalId;
|
return originalId;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue