41 lines
862 B
Java
41 lines
862 B
Java
package eu.dnetlib.broker.oa.controllers;
|
|
|
|
import java.io.Serializable;
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
import eu.dnetlib.broker.common.elasticsearch.Notification;
|
|
import eu.dnetlib.broker.objects.OaBrokerEventPayload;
|
|
|
|
public class NotificationMessage implements Serializable {
|
|
|
|
/**
|
|
*
|
|
*/
|
|
private static final long serialVersionUID = 7302363775341307950L;
|
|
|
|
private String topic;
|
|
|
|
public static NotificationMessage fromNotification(final Notification n) {
|
|
final Gson gson = new Gson();
|
|
|
|
final OaBrokerEventPayload payload = gson.fromJson(n.getPayload(), OaBrokerEventPayload.class);
|
|
|
|
final NotificationMessage res = new NotificationMessage();
|
|
|
|
res.setTopic(n.getTopic());
|
|
|
|
// TODO Auto-generated method stub
|
|
return res;
|
|
}
|
|
|
|
public String getTopic() {
|
|
return topic;
|
|
}
|
|
|
|
public void setTopic(final String topic) {
|
|
this.topic = topic;
|
|
}
|
|
|
|
}
|