Project

General

Profile

1
package eu.dnetlib.openaire.exporter.model.project;
2

    
3
import java.sql.Date;
4
import java.util.List;
5
import javax.persistence.Column;
6
import javax.persistence.Entity;
7
import javax.persistence.Id;
8
import javax.persistence.Table;
9

    
10
import com.fasterxml.jackson.annotation.JsonIgnore;
11
import com.google.common.collect.Lists;
12
import io.swagger.annotations.ApiModel;
13
import org.apache.commons.lang3.StringUtils;
14

    
15
/**
16
 * Created by claudio on 05/07/2017.
17
 */
18
@Entity
19
@Table(name = "projects_tsv")
20
@ApiModel(value = "Project TSV model", description = "project TSV model description")
21
public class ProjectTsv {
22

    
23
	@Id
24
	@JsonIgnore
25
	private long rowid;
26
	private String code;
27
	private String acronym;
28
	private String title;
29
	@Column(name = "call_identifier")
30
	private String callIdentifier;
31
	private Date startdate;
32
	private Date enddate;
33
	@Column(name = "ec_sc39")
34
	private Boolean ecSc39;
35
	@Column(name = "oa_mandate_for_publications")
36
	private Boolean oaMandateForPublications;
37
	@Column(name = "oa_mandate_for_datasets")
38
	private Boolean oaMandateForDatasets;
39
	@JsonIgnore
40
	private String fundingpathid;
41
	private String description;
42
	@Column(name = "legalname")
43
	private String orgLegalname;
44
	@Column(name = "country")
45
	private String orgCountry;
46
	@Column(name = "role")
47
	private String orgRole;
48
	private String firstname;
49
	private String secondnames;
50
	private String email;
51

    
52
	public ProjectTsv() {}
53

    
54
	public List<String> asList() {
55
		return Lists.newArrayList(
56
				clean(getCode()),
57
				clean(getAcronym()),
58
				clean(getTitle()),
59
				clean(getCallIdentifier()),
60
				clean(getStartdate() != null ? getStartdate().toString() : ""),
61
				clean(getEnddate() != null ? getEnddate().toString() : ""),
62
				clean(String.valueOf(isOaMandateForPublications())),
63
				clean(String.valueOf(isOaMandateForDatasets())),
64
				clean(getDescription()),
65
				clean(getOrgLegalname()),
66
				clean(getOrgCountry()),
67
				clean(getOrgRole()),
68
				clean(getFirstname()),
69
				clean(getSecondnames()),
70
				clean(getEmail()));
71
	}
72

    
73
	private String clean(final String s) {
74
		return StringUtils.isNotBlank(s) ? "\"" + s.replaceAll("\\n|\\t|\\s+", " ").replace("\"","\"\"").trim() + "\"" : "";
75
	}
76

    
77
	public long getRowid() {
78
		return rowid;
79
	}
80

    
81
	public void setRowid(final long rowid) {
82
		this.rowid = rowid;
83
	}
84

    
85
	public String getCode() {
86
		return code;
87
	}
88

    
89
	public void setCode(final String code) {
90
		this.code = code;
91
	}
92

    
93
	public String getAcronym() {
94
		return acronym;
95
	}
96

    
97
	public void setAcronym(final String acronym) {
98
		this.acronym = acronym;
99
	}
100

    
101
	public String getTitle() {
102
		return title;
103
	}
104

    
105
	public void setTitle(final String title) {
106
		this.title = title;
107
	}
108

    
109
	public String getCallIdentifier() {
110
		return callIdentifier;
111
	}
112

    
113
	public void setCallIdentifier(final String callIdentifier) {
114
		this.callIdentifier = callIdentifier;
115
	}
116

    
117
	public Date getStartdate() {
118
		return startdate;
119
	}
120

    
121
	public void setStartdate(final Date startdate) {
122
		this.startdate = startdate;
123
	}
124

    
125
	public Date getEnddate() {
126
		return enddate;
127
	}
128

    
129
	public void setEnddate(final Date enddate) {
130
		this.enddate = enddate;
131
	}
132

    
133
	public Boolean isEcSc39() {
134
		return ecSc39;
135
	}
136

    
137
	public void setEcSc39(final Boolean ecSc39) {
138
		this.ecSc39 = ecSc39;
139
	}
140

    
141
	public Boolean isOaMandateForPublications() {
142
		return oaMandateForPublications;
143
	}
144

    
145
	public void setOaMandateForPublications(final Boolean oaMandateForPublications) {
146
		this.oaMandateForPublications = oaMandateForPublications;
147
	}
148

    
149
	public Boolean isOaMandateForDatasets() {
150
		return oaMandateForDatasets;
151
	}
152

    
153
	public void setOaMandateForDatasets(final Boolean oaMandateForDatasets) {
154
		this.oaMandateForDatasets = oaMandateForDatasets;
155
	}
156

    
157
	public String getFundingpathid() {
158
		return fundingpathid;
159
	}
160

    
161
	public void setFundingpathid(final String fundingpathid) {
162
		this.fundingpathid = fundingpathid;
163
	}
164

    
165
	public String getDescription() {
166
		return description;
167
	}
168

    
169
	public void setDescription(final String description) {
170
		this.description = description;
171
	}
172

    
173
	public String getOrgLegalname() {
174
		return orgLegalname;
175
	}
176

    
177
	public void setOrgLegalname(final String orgLegalname) {
178
		this.orgLegalname = orgLegalname;
179
	}
180

    
181
	public String getOrgCountry() {
182
		return orgCountry;
183
	}
184

    
185
	public void setOrgCountry(final String orgCountry) {
186
		this.orgCountry = orgCountry;
187
	}
188

    
189
	public String getOrgRole() {
190
		return orgRole;
191
	}
192

    
193
	public void setOrgRole(final String orgRole) {
194
		this.orgRole = orgRole;
195
	}
196

    
197
	public String getFirstname() {
198
		return firstname;
199
	}
200

    
201
	public void setFirstname(final String firstname) {
202
		this.firstname = firstname;
203
	}
204

    
205
	public String getSecondnames() {
206
		return secondnames;
207
	}
208

    
209
	public void setSecondnames(final String secondnames) {
210
		this.secondnames = secondnames;
211
	}
212

    
213
	public String getEmail() {
214
		return email;
215
	}
216

    
217
	public void setEmail(final String email) {
218
		this.email = email;
219
	}
220

    
221
}
(4-4/4)