1
|
package eu.dnetlib.goldoa.domain;
|
2
|
|
3
|
import com.fasterxml.jackson.annotation.JsonBackReference;
|
4
|
import com.google.gwt.user.client.rpc.IsSerializable;
|
5
|
|
6
|
import java.io.Serializable;
|
7
|
import javax.persistence.*;
|
8
|
|
9
|
import java.sql.Timestamp;
|
10
|
import java.util.ArrayList;
|
11
|
import java.util.List;
|
12
|
|
13
|
|
14
|
/**
|
15
|
* The persistent class for the request database table.
|
16
|
*
|
17
|
*/
|
18
|
@Entity
|
19
|
@NamedQuery(name="Request.findAll", query="SELECT r FROM Request r")
|
20
|
public class Request implements Serializable {
|
21
|
private static final long serialVersionUID = 1L;
|
22
|
|
23
|
public enum RequestStatus implements IsSerializable {
|
24
|
|
25
|
INCOMPLETE("Incomplete", 0),
|
26
|
SUBMITTED("Submitted", 1),
|
27
|
CONDITIONALLY_APPROVED("Conditionally approved", 2),
|
28
|
APPROVED("Approved", 4),
|
29
|
REJECTED("Rejected", 8),
|
30
|
ACCOUNTING_PROCESSING("Processing payment", 16),
|
31
|
ACCOUNTING_PAID("Paid", 32),
|
32
|
ACCOUNTING_ON_HOLD("On hold", 64),
|
33
|
ACCOUNTING_DENIED("Denied", 128),
|
34
|
COMPLETED("Completed", 256),
|
35
|
|
36
|
LIBRARY_FUND_SUBMITTED("Submitted (Library block grant)", 512),
|
37
|
PUBLISHER_FUND_SUBMITTED("Submitted (Publihser block grant)", 1024),
|
38
|
|
39
|
LIBRARY_FUND_PAID("Paid (Library block grant)", 2048),
|
40
|
PUBLISHER_FUND_PAID("Paid (Publihser block grant)", 4096);
|
41
|
|
42
|
private String value;
|
43
|
private int code;
|
44
|
|
45
|
RequestStatus(String value, int code) {
|
46
|
this.value = value;
|
47
|
this.code = code;
|
48
|
}
|
49
|
|
50
|
public String getValue() {
|
51
|
return value;
|
52
|
}
|
53
|
|
54
|
public int getCode() {
|
55
|
return code;
|
56
|
}
|
57
|
|
58
|
public static RequestStatus forStatus(int status) {
|
59
|
if (status == 0)
|
60
|
return INCOMPLETE;
|
61
|
else
|
62
|
return RequestStatus.values()[((int) Math.round(Math.log(status)/Math.log(2)) + 1)];
|
63
|
}
|
64
|
|
65
|
}
|
66
|
|
67
|
@Id
|
68
|
@Column(columnDefinition = "text")
|
69
|
private String id;
|
70
|
private Float apc;
|
71
|
private Float apcPaid;
|
72
|
private Timestamp approvaldate;
|
73
|
private Timestamp date;
|
74
|
private Timestamp datePaid;
|
75
|
private Float discount;
|
76
|
private Float fundingrequested;
|
77
|
private Float otherCost;
|
78
|
private Float projectparticipation;
|
79
|
private Timestamp submissiondate;
|
80
|
private Float transferCost;
|
81
|
|
82
|
|
83
|
@Column(name="publisher_email",columnDefinition = "text")
|
84
|
private String publisherEmail;
|
85
|
|
86
|
@Transient
|
87
|
private Eligibility eligibility;
|
88
|
|
89
|
@OneToOne(cascade = CascadeType.ALL)
|
90
|
@JoinColumn(name = "bankAccount")
|
91
|
private BankAccount bankAccount;
|
92
|
|
93
|
@OneToOne(cascade = CascadeType.ALL)
|
94
|
@JoinColumn(name = "bankTransferReceipt")
|
95
|
private BankTransferReceipt bankTransferReceipt;
|
96
|
|
97
|
@OneToOne(cascade = CascadeType.ALL)
|
98
|
@JoinColumn(name = "budget")
|
99
|
private Budget budget;
|
100
|
|
101
|
@Basic
|
102
|
@Convert( converter=CurrencyConverter.class )
|
103
|
private Currency currency = Currency.EUR;
|
104
|
|
105
|
@OneToOne(cascade = CascadeType.ALL)
|
106
|
@JoinColumn(name = "invoice")
|
107
|
private Invoice invoice;
|
108
|
|
109
|
@OneToOne
|
110
|
@JoinColumn(name = "journal")
|
111
|
private Journal journal;
|
112
|
|
113
|
@OneToOne
|
114
|
@JoinColumn(name = "organization")
|
115
|
private Organization organization;
|
116
|
|
117
|
@OneToOne
|
118
|
@JoinColumn(name = "project")
|
119
|
private Project project;
|
120
|
|
121
|
@OneToOne
|
122
|
@JoinColumn(name = "publication")
|
123
|
private Publication publication;
|
124
|
|
125
|
@OneToOne
|
126
|
@JoinColumn(name = "publisher")
|
127
|
private Publisher publisher;
|
128
|
|
129
|
@OneToOne
|
130
|
@JoinColumn(name = "researcher")
|
131
|
private User researcher;
|
132
|
|
133
|
@Basic
|
134
|
@Convert( converter=RequestStatusConverter.class )
|
135
|
private RequestStatus status;
|
136
|
|
137
|
@OneToOne
|
138
|
@JoinColumn(name = "\"user\"")
|
139
|
private User user;
|
140
|
|
141
|
@OneToMany(mappedBy = "pk.request",cascade = CascadeType.ALL)
|
142
|
private List<RequestCoFunder> requestCoFunders = new ArrayList<>();
|
143
|
|
144
|
@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
|
145
|
@JoinTable(name = "request_comment", joinColumns = {
|
146
|
@JoinColumn(name = "request", nullable = false, updatable = false)},
|
147
|
inverseJoinColumns = { @JoinColumn(name = "comment",
|
148
|
nullable = false, updatable = false) })
|
149
|
private List<Comment> requestComments = new ArrayList<>();
|
150
|
|
151
|
public Request() {}
|
152
|
|
153
|
public String getId() {
|
154
|
return id;
|
155
|
}
|
156
|
|
157
|
public void setId(String id) {
|
158
|
this.id = id;
|
159
|
}
|
160
|
|
161
|
public Float getApc() {
|
162
|
return apc;
|
163
|
}
|
164
|
|
165
|
public void setApc(Float apc) {
|
166
|
this.apc = apc;
|
167
|
}
|
168
|
|
169
|
public Float getApcPaid() {
|
170
|
return apcPaid;
|
171
|
}
|
172
|
|
173
|
public void setApcPaid(Float apcPaid) {
|
174
|
this.apcPaid = apcPaid;
|
175
|
}
|
176
|
|
177
|
public Timestamp getApprovaldate() {
|
178
|
return approvaldate;
|
179
|
}
|
180
|
|
181
|
public void setApprovaldate(Timestamp approvaldate) {
|
182
|
this.approvaldate = approvaldate;
|
183
|
}
|
184
|
|
185
|
public Timestamp getDate() {
|
186
|
return date;
|
187
|
}
|
188
|
|
189
|
public void setDate(Timestamp date) {
|
190
|
this.date = date;
|
191
|
}
|
192
|
|
193
|
public Timestamp getDatePaid() {
|
194
|
return datePaid;
|
195
|
}
|
196
|
|
197
|
public void setDatePaid(Timestamp datePaid) {
|
198
|
this.datePaid = datePaid;
|
199
|
}
|
200
|
|
201
|
public Float getDiscount() {
|
202
|
return discount;
|
203
|
}
|
204
|
|
205
|
public void setDiscount(Float discount) {
|
206
|
this.discount = discount;
|
207
|
}
|
208
|
|
209
|
public Float getFundingrequested() {
|
210
|
return fundingrequested;
|
211
|
}
|
212
|
|
213
|
public void setFundingrequested(Float fundingrequested) {
|
214
|
this.fundingrequested = fundingrequested;
|
215
|
}
|
216
|
|
217
|
public Float getOtherCost() {
|
218
|
return otherCost;
|
219
|
}
|
220
|
|
221
|
public void setOtherCost(Float otherCost) {
|
222
|
this.otherCost = otherCost;
|
223
|
}
|
224
|
|
225
|
public Float getProjectparticipation() {
|
226
|
return projectparticipation;
|
227
|
}
|
228
|
|
229
|
public void setProjectparticipation(Float projectparticipation) {
|
230
|
this.projectparticipation = projectparticipation;
|
231
|
}
|
232
|
|
233
|
public Timestamp getSubmissiondate() {
|
234
|
return submissiondate;
|
235
|
}
|
236
|
|
237
|
public void setSubmissiondate(Timestamp submissiondate) {
|
238
|
this.submissiondate = submissiondate;
|
239
|
}
|
240
|
|
241
|
public Float getTransferCost() {
|
242
|
return transferCost;
|
243
|
}
|
244
|
|
245
|
public void setTransferCost(Float transferCost) {
|
246
|
this.transferCost = transferCost;
|
247
|
}
|
248
|
|
249
|
public BankAccount getBankAccount() {
|
250
|
return bankAccount;
|
251
|
}
|
252
|
|
253
|
public void setBankAccount(BankAccount bankAccount) {
|
254
|
this.bankAccount = bankAccount;
|
255
|
}
|
256
|
|
257
|
public BankTransferReceipt getBankTransferReceipt() {
|
258
|
return bankTransferReceipt;
|
259
|
}
|
260
|
|
261
|
public void setBankTransferReceipt(BankTransferReceipt bankTransferReceipt) {
|
262
|
this.bankTransferReceipt = bankTransferReceipt;
|
263
|
}
|
264
|
|
265
|
public Budget getBudget() {
|
266
|
return budget;
|
267
|
}
|
268
|
|
269
|
public void setBudget(Budget budget) {
|
270
|
this.budget = budget;
|
271
|
}
|
272
|
|
273
|
public Currency getCurrency() {
|
274
|
return currency;
|
275
|
}
|
276
|
|
277
|
public void setCurrency(Currency currency) {
|
278
|
this.currency = currency;
|
279
|
}
|
280
|
|
281
|
public Invoice getInvoice() {
|
282
|
return invoice;
|
283
|
}
|
284
|
|
285
|
public void setInvoice(Invoice invoice) {
|
286
|
this.invoice = invoice;
|
287
|
}
|
288
|
|
289
|
public Journal getJournal() {
|
290
|
return journal;
|
291
|
}
|
292
|
|
293
|
public void setJournal(Journal journal) {
|
294
|
this.journal = journal;
|
295
|
}
|
296
|
|
297
|
public Organization getOrganization() {
|
298
|
return organization;
|
299
|
}
|
300
|
|
301
|
public void setOrganization(Organization organization) {
|
302
|
this.organization = organization;
|
303
|
}
|
304
|
|
305
|
public Project getProject() {
|
306
|
return project;
|
307
|
}
|
308
|
|
309
|
public void setProject(Project project) {
|
310
|
this.project = project;
|
311
|
}
|
312
|
|
313
|
public Publication getPublication() {
|
314
|
return publication;
|
315
|
}
|
316
|
|
317
|
public void setPublication(Publication publication) {
|
318
|
this.publication = publication;
|
319
|
}
|
320
|
|
321
|
public Publisher getPublisher() {
|
322
|
return publisher;
|
323
|
}
|
324
|
|
325
|
public void setPublisher(Publisher publisher) {
|
326
|
this.publisher = publisher;
|
327
|
}
|
328
|
|
329
|
public User getResearcher() {
|
330
|
return researcher;
|
331
|
}
|
332
|
|
333
|
public void setResearcher(User researcher) {
|
334
|
this.researcher = researcher;
|
335
|
}
|
336
|
|
337
|
public RequestStatus getStatus() {
|
338
|
return status;
|
339
|
}
|
340
|
|
341
|
public void setStatus(RequestStatus status) {
|
342
|
this.status = status;
|
343
|
}
|
344
|
|
345
|
public User getUser() {
|
346
|
return user;
|
347
|
}
|
348
|
|
349
|
public void setUser(User user) {
|
350
|
this.user = user;
|
351
|
}
|
352
|
|
353
|
public List<RequestCoFunder> getRequestCoFunders() {
|
354
|
return requestCoFunders;
|
355
|
}
|
356
|
|
357
|
public void setRequestCoFunders(List<RequestCoFunder> requestCoFunders) {
|
358
|
this.requestCoFunders = requestCoFunders;
|
359
|
}
|
360
|
|
361
|
public List<Comment> getRequestComments() {
|
362
|
return requestComments;
|
363
|
}
|
364
|
|
365
|
public void setRequestComments(List<Comment> requestComments) {
|
366
|
this.requestComments = requestComments;
|
367
|
}
|
368
|
|
369
|
public Eligibility getEligibility() {
|
370
|
return eligibility;
|
371
|
}
|
372
|
|
373
|
public void setEligibility(Eligibility eligibility) {
|
374
|
this.eligibility = eligibility;
|
375
|
}
|
376
|
|
377
|
public String getPublisherEmail() {
|
378
|
return publisherEmail;
|
379
|
}
|
380
|
|
381
|
public void setPublisherEmail(String publisherEmail) {
|
382
|
this.publisherEmail = publisherEmail;
|
383
|
}
|
384
|
|
385
|
|
386
|
}
|