1 |
1 |
package eu.dnetlib.data.mapreduce.hbase.broker;
|
2 |
2 |
|
3 |
|
import static eu.dnetlib.data.mapreduce.hbase.broker.mapping.EventFactory.asEvent;
|
4 |
|
import static eu.dnetlib.data.mapreduce.util.OafHbaseUtils.getValue;
|
5 |
|
|
6 |
3 |
import java.io.IOException;
|
7 |
4 |
import java.util.List;
|
8 |
5 |
import java.util.Map;
|
... | ... | |
10 |
7 |
import java.util.Set;
|
11 |
8 |
import java.util.stream.Collectors;
|
12 |
9 |
|
13 |
|
import org.apache.commons.lang.StringUtils;
|
14 |
|
import org.apache.hadoop.io.Text;
|
15 |
|
import org.apache.hadoop.mapreduce.Reducer.Context;
|
16 |
|
import org.dom4j.DocumentException;
|
17 |
|
|
18 |
10 |
import com.google.common.collect.Iterables;
|
19 |
11 |
import com.google.common.collect.Lists;
|
20 |
12 |
import com.google.common.collect.Maps;
|
21 |
13 |
import com.google.common.collect.Sets;
|
22 |
|
|
23 |
14 |
import eu.dnetlib.broker.objects.Instance;
|
24 |
15 |
import eu.dnetlib.broker.objects.OpenAireEventPayload;
|
25 |
16 |
import eu.dnetlib.broker.objects.Project;
|
... | ... | |
32 |
23 |
import eu.dnetlib.data.mapreduce.util.DedupUtils;
|
33 |
24 |
import eu.dnetlib.data.proto.OafProtos.Oaf;
|
34 |
25 |
import eu.dnetlib.data.proto.OafProtos.OafEntity;
|
|
26 |
import org.apache.commons.lang.StringUtils;
|
|
27 |
import org.apache.hadoop.io.Text;
|
|
28 |
import org.apache.hadoop.mapreduce.Reducer.Context;
|
|
29 |
import org.dom4j.DocumentException;
|
35 |
30 |
|
|
31 |
import static eu.dnetlib.data.mapreduce.hbase.broker.mapping.EventFactory.asEvent;
|
|
32 |
import static eu.dnetlib.data.mapreduce.util.OafHbaseUtils.getValue;
|
|
33 |
|
36 |
34 |
@SuppressWarnings("rawtypes")
|
37 |
35 |
public class ProjectEventFactory extends ProtoMapping {
|
38 |
36 |
|
... | ... | |
125 |
123 |
final EventMessage event = asEvent(currentEntity, topic, payload, otherEntity, trust);
|
126 |
124 |
event.setPayload(HighlightFactory.highlightEnrichProject(payload, project, provenance).toJSON());
|
127 |
125 |
return EventWrapper.newInstance(event,
|
128 |
|
payload.getHighlight().getProjects().stream().filter(Objects::nonNull).map(p -> p.getFunder() + ":" + p.getCode()).sorted()
|
|
126 |
payload.getHighlight().getProjects()
|
|
127 |
.stream()
|
|
128 |
.filter(Objects::nonNull)
|
|
129 |
.map(p -> p.getFunder() + ":" + p.getCode())
|
|
130 |
.sorted()
|
129 |
131 |
.collect(Collectors.joining(", ")),
|
130 |
132 |
topic.getValue());
|
131 |
133 |
}
|
indentation