Project

General

Profile

1
package eu.dnetlib.goldoa.domain;
2

    
3
import com.google.gwt.user.client.rpc.IsSerializable;
4

    
5
import java.util.ArrayList;
6
import java.util.Date;
7
import java.util.List;
8

    
9
/**
10
 * Created by antleb on 3/9/15.
11
 */
12
public class Request extends GoldBean implements IsSerializable {
13

    
14
    public enum RequestStatus implements IsSerializable {
15
        INCOMPLETE("Incomplete", 0),
16
        SUBMITTED("Submitted", 1),
17
        APPROVED("Approved", 2),
18
        REJECTED("Rejected", 4),
19
        INVOICE_UPLOADED("Invoice uploaded", 8),
20
        ACCOUNTING_PAID("Paid", 16),
21
        ACCOUNTING_ON_HOLD("On hold", 32),
22
        ACCOUNTING_DENIED("Denied", 64),
23
        COMPLETED("Completed", 128);
24

    
25
        private String value;
26
        private int code;
27

    
28
        RequestStatus(String value, int code) {
29
            this.value = value;
30
            this.code = code;
31
        }
32

    
33
        public String getValue() {
34
            return value;
35
        }
36

    
37
        public int getCode() {
38
            return code;
39
        }
40
    }
41

    
42
	private String user;
43
	private Date date = new Date();
44
	private String researcher;
45
    private String organization;
46
	private String project;
47
	private String publication;
48
	private String journal;
49
    private String publisher;
50
    private String publisherEmail;
51
	private String budget;
52
    private String invoice;
53
    private Float apc;
54
    private Float discount;
55
    private Float projectParticipation;
56
    private Float fundingRequested;
57
    private Currency currency;
58
    private BankAccount bankAccount;
59
    private List<RequestCoFunder> coFunders = new ArrayList<RequestCoFunder>();
60
    private Float apc_paid;
61
    private Float transfer_cost;
62
    private Float other_cost;
63
    private Date date_paid;
64
	private int status = 0;
65

    
66
	public Request() {
67
	}
68

    
69
    public Request(String id, String user, Date date, String researcher, String organization, String project, String publication, String journal, String publisher, String publisherEmail, String budget, String invoice, Float apc, Float discount, Float projectParticipation, Float fundingRequested, Currency currency, BankAccount bankAccount, List<RequestCoFunder> coFunders, Float apc_paid, Float transfer_cost, Float other_cost, Date date_paid, int status) {
70
        super(id);
71
        this.user = user;
72
        this.date = date;
73
        this.researcher = researcher;
74
        this.organization = organization;
75
        this.project = project;
76
        this.publication = publication;
77
        this.journal = journal;
78
        this.publisher = publisher;
79
        this.publisherEmail = publisherEmail;
80
        this.budget = budget;
81
        this.invoice = invoice;
82
        this.apc = apc;
83
        this.discount = discount;
84
        this.projectParticipation = projectParticipation;
85
        this.fundingRequested = fundingRequested;
86
        this.currency = currency;
87
        this.bankAccount = bankAccount;
88
        this.coFunders = coFunders;
89
        this.apc_paid = apc_paid;
90
        this.transfer_cost = transfer_cost;
91
        this.other_cost = other_cost;
92
        this.date_paid = date_paid;
93
        this.status = status;
94
    }
95

    
96
    public Request(RequestInfo requestInfo) {
97
        id = requestInfo.getId();
98
        user = requestInfo.getUser() != null?requestInfo.getUser().getId():null;
99
        date = requestInfo.getDate();
100
        researcher = requestInfo.getResearcher()!=null?requestInfo.getResearcher().getId():null;
101
        organization = requestInfo.getOrganization()!=null?requestInfo.getOrganization().getId():null;
102
        project = requestInfo.getProject()!=null?requestInfo.getProject().getId():null;
103
        publication = requestInfo.getPublication()!=null?requestInfo.getPublication().getId():null;
104
        publisherEmail = requestInfo.getPublisherEmail();
105
        budget = requestInfo.getBudget()!=null?requestInfo.getBudget().getId():null;
106
        invoice = requestInfo.getInvoice()!=null?requestInfo.getInvoice().getId():null;
107
        apc = requestInfo.getApc();
108
        discount = requestInfo.getDiscount();
109
        projectParticipation = requestInfo.getProjectParticipation();
110
        fundingRequested = requestInfo.getFundingRequested();
111
        currency=requestInfo.getCurrency();
112
		apc_paid = requestInfo.getApc_paid();
113
		transfer_cost = requestInfo.getTransfer_cost();
114
		other_cost = requestInfo.getOther_cost();
115
		date_paid = requestInfo.getDate_paid();
116
        status = requestInfo.getStatus().code;
117

    
118
        if (requestInfo.getPublication() != null && requestInfo.getPublication().getJournal() != null) {
119
            journal = requestInfo.getPublication().getJournal().getId();
120
        }
121

    
122
        if (requestInfo.getPublication() != null && requestInfo.getPublication().getPublisher() != null) {
123
            publisher = requestInfo.getPublication().getPublisher().getId();
124
        }
125

    
126
        coFunders = requestInfo.getCoFunders();
127

    
128
        bankAccount = requestInfo.getBankAccount();
129
    }
130

    
131
	public String getUser() {
132
		return user;
133
	}
134

    
135
	public void setUser(String user) {
136
		this.user = user;
137
	}
138

    
139
	public Date getDate() {
140
		return date;
141
	}
142

    
143
	public void setDate(Date date) {
144
		this.date = date;
145
	}
146

    
147
	public String getResearcher() {
148
		return researcher;
149
	}
150

    
151
	public void setResearcher(String researcher) {
152
		this.researcher = researcher;
153
	}
154

    
155
    public String getOrganization() {
156
        return organization;
157
    }
158

    
159
    public void setOrganization(String organization) {
160
        this.organization = organization;
161
    }
162

    
163
    public String getProject() {
164
		return project;
165
	}
166

    
167
	public void setProject(String project) {
168
		this.project = project;
169
	}
170

    
171
	public String getPublication() {
172
		return publication;
173
	}
174

    
175
	public void setPublication(String publication) {
176
		this.publication = publication;
177
	}
178

    
179
	public String getJournal() {
180
		return journal;
181
	}
182

    
183
	public void setJournal(String journal) {
184
		this.journal = journal;
185
	}
186

    
187
	public String getBudget() {
188
		return budget;
189
	}
190

    
191
	public void setBudget(String budget) {
192
		this.budget = budget;
193
	}
194

    
195
	public void addStatus(RequestStatus status) {
196
		this.status |= status.code;
197
	}
198

    
199
	public boolean getStatus(RequestStatus status) {
200
		return (this.status & status.code) == status.code;
201
	}
202

    
203
    public int getStatus() {
204
        return status;
205
    }
206

    
207
    public String getPublisher() {
208
        return publisher;
209
    }
210

    
211
    public void setPublisher(String publisher) {
212
        this.publisher = publisher;
213
    }
214

    
215
    public String getPublisherEmail() {
216
        return publisherEmail;
217
    }
218

    
219
    public void setPublisherEmail(String publisherEmail) {
220
        this.publisherEmail = publisherEmail;
221
    }
222

    
223
    public String getInvoice() {
224
        return invoice;
225
    }
226

    
227
    public void setInvoice(String invoice) {
228
        this.invoice = invoice;
229
    }
230

    
231
    public Float getApc() {
232
        return apc;
233
    }
234

    
235
    public void setApc(Float apc) {
236
        this.apc = apc;
237
    }
238

    
239
    public Float getDiscount() {
240
        return discount;
241
    }
242

    
243
    public void setDiscount(Float discount) {
244
        this.discount = discount;
245
    }
246

    
247
    public Float getProjectParticipation() {
248
        return projectParticipation;
249
    }
250

    
251
    public void setProjectParticipation(Float projectParticipation) {
252
        this.projectParticipation = projectParticipation;
253
    }
254

    
255
    public Float getFundingRequested() {
256
        return fundingRequested;
257
    }
258

    
259
    public void setFundingRequested(Float fundingRequested) {
260
        this.fundingRequested = fundingRequested;
261
    }
262

    
263
    public Currency getCurrency() {
264
        return currency;
265
    }
266

    
267
    public void setCurrency(Currency currency) {
268
        this.currency = currency;
269
    }
270

    
271
    public BankAccount getBankAccount() {
272
        return bankAccount;
273
    }
274

    
275
    public void setBankAccount(BankAccount bankAccount) {
276
        this.bankAccount = bankAccount;
277
    }
278

    
279
    public List<RequestCoFunder> getCoFunders() {
280
        return coFunders;
281
    }
282

    
283
    public void setCoFunders(List<RequestCoFunder> coFunders) {
284
        this.coFunders = coFunders;
285
    }
286

    
287
	public Float getApc_paid() {
288
		return apc_paid;
289
	}
290

    
291
	public void setApc_paid(Float apc_paid) {
292
		this.apc_paid = apc_paid;
293
	}
294

    
295
	public Float getTransfer_cost() {
296
		return transfer_cost;
297
	}
298

    
299
	public void setTransfer_cost(Float transfer_cost) {
300
		this.transfer_cost = transfer_cost;
301
	}
302

    
303
	public Float getOther_cost() {
304
		return other_cost;
305
	}
306

    
307
	public void setOther_cost(Float other_cost) {
308
		this.other_cost = other_cost;
309
	}
310

    
311
	public Date getDate_paid() {
312
		return date_paid;
313
	}
314

    
315
	public void setDate_paid(Date date_paid) {
316
		this.date_paid = date_paid;
317
	}
318
}
(27-27/36)