1
|
package eu.dnetlib.data.bulktag;
|
2
|
|
3
|
|
4
|
import com.google.gson.Gson;
|
5
|
import eu.dnetlib.data.bulktag.selectioncriteria.VerbResolver;
|
6
|
import org.apache.commons.logging.Log;
|
7
|
import org.apache.commons.logging.LogFactory;
|
8
|
import org.dom4j.Node;
|
9
|
|
10
|
/**
|
11
|
* Created by miriam on 01/08/2018.
|
12
|
*/
|
13
|
public class Datasource {
|
14
|
private static final Log log = LogFactory.getLog(Datasource.class);
|
15
|
|
16
|
private String openaireId;
|
17
|
|
18
|
private SelectionConstraints selectionConstraints;
|
19
|
|
20
|
|
21
|
public SelectionConstraints getSelCriteria() {
|
22
|
return selectionConstraints;
|
23
|
}
|
24
|
|
25
|
public SelectionConstraints getSelectionConstraints() {
|
26
|
return selectionConstraints;
|
27
|
}
|
28
|
|
29
|
public void setSelectionConstraints(SelectionConstraints selectionConstraints) {
|
30
|
this.selectionConstraints = selectionConstraints;
|
31
|
}
|
32
|
|
33
|
public void setSelCriteria(SelectionConstraints selCriteria) {
|
34
|
this.selectionConstraints = selCriteria;
|
35
|
}
|
36
|
|
37
|
public String getOpenaireId() {
|
38
|
return openaireId;
|
39
|
}
|
40
|
|
41
|
public void setOpenaireId(String openaireId) {
|
42
|
this.openaireId = openaireId;
|
43
|
}
|
44
|
|
45
|
private void setSelCriteria(String json, VerbResolver resolver){
|
46
|
log.info("Selection constraints for datasource = " + json);
|
47
|
selectionConstraints = new Gson().fromJson(json, SelectionConstraints.class);
|
48
|
|
49
|
selectionConstraints.setSelection(resolver);
|
50
|
}
|
51
|
|
52
|
public void setSelCriteria(Node n, VerbResolver resolver){
|
53
|
try{
|
54
|
setSelCriteria(n.getText(),resolver);
|
55
|
}catch(Exception e) {
|
56
|
log.info("not set selection criteria... ");
|
57
|
selectionConstraints =null;
|
58
|
}
|
59
|
|
60
|
}
|
61
|
|
62
|
|
63
|
|
64
|
}
|