Project

General

Profile

1
package eu.dnetlib.data.mapreduce.util;
2

    
3
import com.google.common.base.Predicate;
4

    
5
import eu.dnetlib.data.proto.OafProtos.Oaf;
6
import eu.dnetlib.data.proto.OafProtos.OafRel;
7
import eu.dnetlib.data.proto.RelTypeProtos.RelType;
8

    
9
public class PersonResultFilter implements Predicate<Oaf> {
10
	private String key;
11

    
12
	public PersonResultFilter(String key) {
13
		this.key = key;
14
	}
15

    
16
	@Override
17
	public boolean apply(Oaf oaf) {
18
		final OafRel oafRel = oaf.getRel();
19
		if (RelType.personResult.equals(oafRel.getRelType())) {
20
			return !key.contains(oafRel.getSource().replaceAll("^.*\\:\\:", ""));
21
		}
22
		return true;
23
	}
24
}
(4-4/8)