Project

General

Profile

1
package  eu.dnetlib.data.claims.migration;
2

    
3
import com.google.gson.annotations.SerializedName;
4

    
5
import java.util.Date;
6

    
7
public class ClaimGenerics<S extends Object, T extends Object> {
8

    
9
	@SerializedName("@context")
10
	private final String context = "https://dl.dropboxusercontent.com/u/19168406/oa-openaire.jsonld";
11

    
12
	@SerializedName("@type")
13
	private final String type = "oa:Annotation";
14
			
15
	@SerializedName("@id")
16
	private String id;
17
	
18
	@SerializedName("annotatedBy")
19
	private Person person = new Person();
20

    
21
	private Date date;
22
    private String sourceType;
23
    private String targetType;
24

    
25
	@SerializedName("hasTarget")
26
	private T target;
27
	@SerializedName("hasSource")
28
	private S body;
29
	
30
	public T getTarget() {
31
		return target;
32
	}
33

    
34
	public void setTarget(T target) {
35
		this.target = target;
36
	}
37

    
38
	public S getBody() {
39
		return body;
40
	}
41

    
42
	public void setBody(S body) {
43
		this.body = body;
44
	}
45

    
46
	public String getId() {
47
		return id;
48
	}
49

    
50
	public void setId(String id) {
51
		this.id = "http://www.openaire.eu/annotations/" + id;
52
	}
53

    
54
//	public String getUserMail() {
55
//		return userMail;
56
//	}
57

    
58
	public void setUserMail(String userMail) {
59
//		this.userMail = userMail;
60
		this.person.setId(userMail.split("@")[0]);
61
		this.person.getMbox().setId(userMail);
62
	}
63
    public String getUserMail() {
64
        return this.person.getMbox().getId();
65
    }
66
	public Date getDate() {
67
		return date;
68
	}
69

    
70
	public void setDate(Date date) {
71
		this.date = date;
72
	}
73

    
74
    public String getSourceType() {
75
        return sourceType;
76
    }
77

    
78
    public void setSourceType(String sourceType) {
79
        this.sourceType = sourceType;
80
    }
81

    
82
    public String getTargetType() {
83
        return targetType;
84
    }
85

    
86
    public void setTargetType(String targetType) {
87
        this.targetType = targetType;
88
    }
89

    
90
    public void getClaimFromDB() {
91
		// query rel2action
92
		// parse to get ids;
93
	}
94

    
95
    @Override
96
    public String toString() {
97
        return "ClaimGenerics{" +
98
                "\ntarget=" + target.toString() +
99
                ",\n body=" + body.toString() +
100
                ", \nid='" + id + '\'' +
101
//                ", userMail='" + userMail + '\'' +
102
                ", date=" + date +
103
                '}';
104
    }
105
    private class Person {
106
    	@SerializedName("@id")
107
    	private String id;
108
    	
109
    	@SerializedName("@type")
110
    	private final String type = "foaf:Person";
111
    	
112
    	private Mbox mbox = new Mbox();
113
    	
114
		public String getId() {
115
			return id;
116
		}
117

    
118
		public void setId(String id) {
119
			this.id = "http://www.openaire.eu/people/"+id;
120
		}
121

    
122
		public Mbox getMbox() {
123
			return mbox;
124
		}
125
		
126
		public void setMbox(Mbox mbox) {
127
			this.mbox = mbox;
128
		}
129
    	
130
    	private class Mbox {
131
    		
132
    		@SerializedName("@id")
133
    		private String id;
134

    
135
			public String getId() {
136
				return id;
137
			}
138

    
139
			public void setId(String id) {
140
				this.id = "mailto:" + id;
141
			}
142
    		
143
    	}
144
    }
145
    
146
}
147

    
(1-1/6)