Revision 41834
Added by Eri Katsari about 8 years ago
modules/dnet-openaire-stats/trunk/src/main/java/eu/dnetlib/data/mapreduce/hbase/statsExport/utils/Serializer.java | ||
---|---|---|
39 | 39 |
|
40 | 40 |
private FundingParser fundingParser = new FundingParser(); |
41 | 41 |
|
42 |
|
|
43 | 42 |
public Serializer() { |
44 | 43 |
} |
45 | 44 |
|
... | ... | |
682 | 681 |
|
683 | 682 |
} |
684 | 683 |
|
685 |
private String getFundingLevel(String funding_level, int level) { |
|
686 | 684 |
|
687 |
if (funding_level.isEmpty()) { |
|
688 |
return NULL_STRING; |
|
689 | 685 |
|
690 |
} |
|
691 |
|
|
692 |
if (!funding_level.contains("funding_level_" + level)) { |
|
693 |
return NULL_STRING; |
|
694 |
} |
|
695 |
String[] split = funding_level.split("funding_level_" + level); |
|
696 |
|
|
697 |
if (split == null || split.length == 0) { |
|
698 |
return NULL_STRING; |
|
699 |
} |
|
700 |
|
|
701 |
|
|
702 |
funding_level = split[1]; |
|
703 |
|
|
704 |
split = funding_level.split("name"); |
|
705 |
split = split[1].split(","); |
|
706 |
|
|
707 |
funding_level = split[0].replaceAll(".*:\"", ""); |
|
708 |
funding_level = funding_level.replaceFirst(ENCLOSED, ""); |
|
709 |
funding_level = funding_level.trim(); |
|
710 |
|
|
711 |
return funding_level; |
|
712 |
} |
|
713 |
|
|
714 | 686 |
private String getYearDifferenceInteger(String enddate, String startdate) { |
715 | 687 |
|
716 | 688 |
if (enddate != null && !enddate.isEmpty() && startdate != null && !startdate.isEmpty()) { |
modules/dnet-openaire-stats/trunk/src/main/java/eu/dnetlib/data/mapreduce/hbase/statsExport/StatsMapper.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
private long threshold = 100000; |
44 | 44 |
|
45 |
private enum STATS_COUNTERS { |
|
46 |
datasource, |
|
47 |
organization, |
|
48 |
result, |
|
49 |
person, |
|
50 |
project |
|
51 |
} |
|
45 | 52 |
|
46 | 53 |
@Override |
47 | 54 |
protected void setup(Context context) throws IOException, InterruptedException { |
... | ... | |
118 | 125 |
try { |
119 | 126 |
Text TextKeyOut = new Text(type + "," + serializer.getId(oaf)); |
120 | 127 |
context.write((TextKeyOut), new ImmutableBytesWritable(serialized.getBytes())); |
128 |
context.getCounter(STATS_COUNTERS.valueOf(type.toString())).increment(1); |
|
121 | 129 |
|
122 | 130 |
} catch (IOException e) { |
123 | 131 |
log.error("Error writing entity to M/R output", e); |
Also available in: Unified diff
'added