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 contactfullname;
49
	private String contactemail;
50

    
51
	public ProjectTsv() {}
52

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

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

    
75
	public long getRowid() {
76
		return rowid;
77
	}
78

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

    
83
	public String getCode() {
84
		return code;
85
	}
86

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

    
91
	public String getAcronym() {
92
		return acronym;
93
	}
94

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

    
99
	public String getTitle() {
100
		return title;
101
	}
102

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

    
107
	public String getCallIdentifier() {
108
		return callIdentifier;
109
	}
110

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

    
115
	public Date getStartdate() {
116
		return startdate;
117
	}
118

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

    
123
	public Date getEnddate() {
124
		return enddate;
125
	}
126

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

    
131
	public Boolean isEcSc39() {
132
		return ecSc39;
133
	}
134

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

    
139
	public Boolean isOaMandateForPublications() {
140
		return oaMandateForPublications;
141
	}
142

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

    
147
	public Boolean isOaMandateForDatasets() {
148
		return oaMandateForDatasets;
149
	}
150

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

    
155
	public String getFundingpathid() {
156
		return fundingpathid;
157
	}
158

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

    
163
	public String getDescription() {
164
		return description;
165
	}
166

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

    
171
	public String getOrgLegalname() {
172
		return orgLegalname;
173
	}
174

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

    
179
	public String getOrgCountry() {
180
		return orgCountry;
181
	}
182

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

    
187
	public String getOrgRole() {
188
		return orgRole;
189
	}
190

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

    
195
	public String getContactfullname() {
196
		return contactfullname;
197
	}
198

    
199
	public void setContactfullname(final String contactfullname) {
200
		this.contactfullname = contactfullname;
201
	}
202

    
203
	public String getContactemail() {
204
		return contactemail;
205
	}
206

    
207
	public void setContactemail(final String contactemail) {
208
		this.contactemail = contactemail;
209
	}
210
}
(4-4/4)