Project

General

Profile

« Previous | Next » 

Revision 52922

code refactoring and addition of new class Pair

View differences:

modules/dnet-openaireplus-mapping-utils/branches/solr7/src/main/java/eu/dnetlib/data/bulktag/ZenodoCommunity.java
1 1
package eu.dnetlib.data.bulktag;
2 2

  
3
import org.dom4j.Node;
4

  
5 3
/**
6 4
 * Created by miriam on 01/08/2018.
7 5
 */
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/main/java/eu/dnetlib/data/bulktag/Datasource.java
1 1
package eu.dnetlib.data.bulktag;
2 2

  
3 3

  
4
import org.dom4j.Node;
5

  
6 4
/**
7 5
 * Created by miriam on 01/08/2018.
8 6
 */
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/main/java/eu/dnetlib/data/bulktag/Pair.java
1
package eu.dnetlib.data.bulktag;
2

  
3
/**
4
 * Created by miriam on 03/08/2018.
5
 */
6
public class Pair<A,B> {
7
    private A fst;
8
    private B snd;
9

  
10
    public A getFst() {
11
        return fst;
12
    }
13

  
14
    public Pair setFst(A fst) {
15
        this.fst = fst;
16
        return this;
17
    }
18

  
19
    public B getSnd() {
20
        return snd;
21
    }
22

  
23
    public Pair setSnd(B snd) {
24
        this.snd = snd;
25
        return this;
26
    }
27

  
28
    public Pair(A a, B b){
29
        fst = a;
30
        snd = b;
31
    }
32
}
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/main/java/eu/dnetlib/data/bulktag/CommunityConfiguration.java
2 2

  
3 3
import com.google.common.collect.Lists;
4 4
import com.google.gson.Gson;
5
import com.sun.tools.javac.util.Pair;
6 5
import org.apache.commons.logging.Log;
7 6
import org.apache.commons.logging.LogFactory;
8 7

  
......
82 81

  
83 82
    public List<String> getCommunityForSubjectValue(String value) {
84 83
        try {
85
            return subjectMap.get(value.toLowerCase()).stream().map(p -> p.fst).collect(Collectors.toList());
84
            return subjectMap.get(value.toLowerCase()).stream().map(p -> p.getFst()).collect(Collectors.toList());
86 85
        }catch(Exception e){
87 86
            return new ArrayList<>();
88 87
        }
......
90 89

  
91 90
    public List<String> getCommunityForDatasourceValue(String value) {
92 91
        try {
93
            return datasourceMap.get(value.toLowerCase()).stream().map(p -> p.fst).collect(Collectors.toList());
92
            return datasourceMap.get(value.toLowerCase()).stream().map(p -> p.getFst()).collect(Collectors.toList());
94 93
        }catch(Exception e){
95 94
            return new ArrayList<>();
96 95
        }
......
98 97

  
99 98
    public List<String> getCommunityForZenodoCommunityValue(String value){
100 99
        try {
101
            return zenodocommunityMap.get(value.toLowerCase()).stream().map(p -> p.fst).collect(Collectors.toList());
100
            return zenodocommunityMap.get(value.toLowerCase()).stream().map(p -> p.getFst()).collect(Collectors.toList());
102 101
        }catch(Exception e){
103 102
            return new ArrayList<>();
104 103

  

Also available in: Unified diff