Project

General

Profile

1
package eu.dnetlib.data.mapreduce.hbase.openorgs;
2

    
3
import org.apache.commons.lang.StringUtils;
4

    
5
import eu.dnetlib.data.proto.OafProtos.Oaf;
6

    
7
public class GenerateOrganizationsMapper extends AbstractOpenOrgsMapper {
8

    
9
	@Override
10
	protected String calculateKeyOut(final Oaf oaf, final String rootId, final Context context) {
11

    
12
		if (oaf.getDataInfo().getDeletedbyinference() && StringUtils.isNotBlank(rootId)) {
13
			context.getCounter("organization", "deletedbyinference = true").increment(1);
14
			return rootId;
15
		} else if (!oaf.getDataInfo().getDeletedbyinference() && StringUtils.isBlank(rootId)) {
16
			context.getCounter("organization", "deletedbyinference = false").increment(1);
17
			return oaf.getEntity().getId();
18
		} else {
19
			context.getCounter("organization", "deletedbyinference (INVALID)").increment(1);
20
			return null;
21
		}
22
	}
23

    
24
}
(2-2/7)