Project

General

Profile

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.dom4j.Node;
7

    
8
/**
9
 * Created by miriam on 01/08/2018.
10
 */
11
public class Datasource {
12

    
13
    private String openaireId;
14

    
15
    private SelectionConstraints selectionConstraints;
16

    
17

    
18
    public SelectionConstraints getSelCriteria() {
19
        return selectionConstraints;
20
    }
21

    
22
    public SelectionConstraints getSelectionConstraints() {
23
        return selectionConstraints;
24
    }
25

    
26
    public void setSelectionConstraints(SelectionConstraints selectionConstraints) {
27
        this.selectionConstraints = selectionConstraints;
28
    }
29

    
30
    public void setSelCriteria(SelectionConstraints selCriteria) {
31
        this.selectionConstraints = selCriteria;
32
    }
33

    
34
    public String getOpenaireId() {
35
        return openaireId;
36
    }
37

    
38
    public void setOpenaireId(String openaireId) {
39
        this.openaireId = openaireId;
40
    }
41

    
42
    private void setSelCriteria(String json, VerbResolver resolver){
43
        selectionConstraints = new Gson().fromJson(json, SelectionConstraints.class);
44
        selectionConstraints.setSelection(resolver);
45
    }
46

    
47
    public void setSelCriteria(Node n, VerbResolver resolver){
48
        try{
49
            setSelCriteria(n.getText(),resolver);
50
        }catch(Exception e) {
51
            selectionConstraints =null;
52
        }
53

    
54
    }
55

    
56

    
57

    
58
}
(8-8/11)