1 |
42161
|
michele.ar
|
package eu.dnetlib.efg.backlinks;
|
2 |
42098
|
sandro.lab
|
|
3 |
|
|
import java.util.HashMap;
|
4 |
|
|
import java.util.Map;
|
5 |
|
|
|
6 |
|
|
import org.apache.commons.logging.Log;
|
7 |
|
|
import org.apache.commons.logging.LogFactory;
|
8 |
|
|
|
9 |
|
|
public class PropertyBacklinkTypeMatcherImpl implements BacklinkTypeMatcher {
|
10 |
|
|
|
11 |
|
|
private static final Log log = LogFactory.getLog(PropertyBacklinkTypeMatcherImpl.class); // NOPMD by marko on 11/24/08 5:02 PM
|
12 |
|
|
|
13 |
|
|
private Map<String, String> mapRules;
|
14 |
|
|
|
15 |
|
|
public PropertyBacklinkTypeMatcherImpl(String rules) {
|
16 |
|
|
super();
|
17 |
|
|
|
18 |
|
|
this.mapRules = new HashMap<String, String>();
|
19 |
|
|
|
20 |
|
|
for (String i : rules.split(";")) {
|
21 |
|
|
String[] arr = i.split("<->");
|
22 |
|
|
if (arr.length == 2) {
|
23 |
|
|
String arr0 = arr[0].trim();
|
24 |
|
|
String arr1 = arr[1].trim();
|
25 |
|
|
mapRules.put(arr0.toLowerCase(), arr1);
|
26 |
|
|
mapRules.put(arr1.toLowerCase(), arr0);
|
27 |
|
|
}
|
28 |
|
|
}
|
29 |
|
|
|
30 |
|
|
for (Map.Entry<String, String> e : mapRules.entrySet()) {
|
31 |
|
|
log.info("MapRules key: " + e.getKey() + " - value: " + e.getValue());
|
32 |
|
|
}
|
33 |
|
|
}
|
34 |
|
|
|
35 |
|
|
@Override
|
36 |
|
|
public String getInverseType(String type) {
|
37 |
|
|
if (type != null && mapRules.containsKey(type.toLowerCase().trim()))
|
38 |
|
|
return mapRules.get(type.toLowerCase().trim());
|
39 |
|
|
return type;
|
40 |
|
|
}
|
41 |
|
|
|
42 |
|
|
}
|