Project

General

Profile

« Previous | Next » 

Revision 39076

reformatted code

View differences:

Request.java
11 11
 */
12 12
public class Request implements IsSerializable {
13 13

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

  
26
        private String value;
27
        private int code;
26
		private String value;
27
		private int code;
28 28

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

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

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

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

  
68 68
	public Request() {
69 69
	}
70 70

  
71
    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) {
72
        this.id = id;
73
        this.user = user;
74
        this.date = date;
75
        this.researcher = researcher;
76
        this.organization = organization;
77
        this.project = project;
78
        this.publication = publication;
79
        this.journal = journal;
80
        this.publisher = publisher;
81
        this.publisherEmail = publisherEmail;
82
        this.budget = budget;
83
        this.invoice = invoice;
84
        this.apc = apc;
85
        this.discount = discount;
86
        this.projectParticipation = projectParticipation;
87
        this.fundingRequested = fundingRequested;
88
        this.currency = currency;
89
        this.bankAccount = bankAccount;
90
        this.coFunders = coFunders;
91
        this.apc_paid = apc_paid;
92
        this.transfer_cost = transfer_cost;
93
        this.other_cost = other_cost;
94
        this.date_paid = date_paid;
95
        this.status = status;
96
    }
71
	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) {
72
		this.id = id;
73
		this.user = user;
74
		this.date = date;
75
		this.researcher = researcher;
76
		this.organization = organization;
77
		this.project = project;
78
		this.publication = publication;
79
		this.journal = journal;
80
		this.publisher = publisher;
81
		this.publisherEmail = publisherEmail;
82
		this.budget = budget;
83
		this.invoice = invoice;
84
		this.apc = apc;
85
		this.discount = discount;
86
		this.projectParticipation = projectParticipation;
87
		this.fundingRequested = fundingRequested;
88
		this.currency = currency;
89
		this.bankAccount = bankAccount;
90
		this.coFunders = coFunders;
91
		this.apc_paid = apc_paid;
92
		this.transfer_cost = transfer_cost;
93
		this.other_cost = other_cost;
94
		this.date_paid = date_paid;
95
		this.status = status;
96
	}
97 97

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

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

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

  
128
        coFunders = requestInfo.getCoFunders();
128
		coFunders = requestInfo.getCoFunders();
129 129

  
130
        bankAccount = requestInfo.getBankAccount();
131
    }
130
		bankAccount = requestInfo.getBankAccount();
131
	}
132 132

  
133
    public String getId() {
133
	public String getId() {
134 134
		return id;
135 135
	}
136 136

  
......
162 162
		this.researcher = researcher;
163 163
	}
164 164

  
165
    public String getOrganization() {
166
        return organization;
167
    }
165
	public String getOrganization() {
166
		return organization;
167
	}
168 168

  
169
    public void setOrganization(String organization) {
170
        this.organization = organization;
171
    }
169
	public void setOrganization(String organization) {
170
		this.organization = organization;
171
	}
172 172

  
173
    public String getProject() {
173
	public String getProject() {
174 174
		return project;
175 175
	}
176 176

  
......
210 210
		return (this.status & status.code) == status.code;
211 211
	}
212 212

  
213
    public int getStatus() {
214
        return status;
215
    }
213
	public int getStatus() {
214
		return status;
215
	}
216 216

  
217
    public String getPublisher() {
218
        return publisher;
219
    }
217
	public String getPublisher() {
218
		return publisher;
219
	}
220 220

  
221
    public void setPublisher(String publisher) {
222
        this.publisher = publisher;
223
    }
221
	public void setPublisher(String publisher) {
222
		this.publisher = publisher;
223
	}
224 224

  
225
    public String getPublisherEmail() {
226
        return publisherEmail;
227
    }
225
	public String getPublisherEmail() {
226
		return publisherEmail;
227
	}
228 228

  
229
    public void setPublisherEmail(String publisherEmail) {
230
        this.publisherEmail = publisherEmail;
231
    }
229
	public void setPublisherEmail(String publisherEmail) {
230
		this.publisherEmail = publisherEmail;
231
	}
232 232

  
233
    public String getInvoice() {
234
        return invoice;
235
    }
233
	public String getInvoice() {
234
		return invoice;
235
	}
236 236

  
237
    public void setInvoice(String invoice) {
238
        this.invoice = invoice;
239
    }
237
	public void setInvoice(String invoice) {
238
		this.invoice = invoice;
239
	}
240 240

  
241
    public Float getApc() {
242
        return apc;
243
    }
241
	public Float getApc() {
242
		return apc;
243
	}
244 244

  
245
    public void setApc(Float apc) {
246
        this.apc = apc;
247
    }
245
	public void setApc(Float apc) {
246
		this.apc = apc;
247
	}
248 248

  
249
    public Float getDiscount() {
250
        return discount;
251
    }
249
	public Float getDiscount() {
250
		return discount;
251
	}
252 252

  
253
    public void setDiscount(Float discount) {
254
        this.discount = discount;
255
    }
253
	public void setDiscount(Float discount) {
254
		this.discount = discount;
255
	}
256 256

  
257
    public Float getProjectParticipation() {
258
        return projectParticipation;
259
    }
257
	public Float getProjectParticipation() {
258
		return projectParticipation;
259
	}
260 260

  
261
    public void setProjectParticipation(Float projectParticipation) {
262
        this.projectParticipation = projectParticipation;
263
    }
261
	public void setProjectParticipation(Float projectParticipation) {
262
		this.projectParticipation = projectParticipation;
263
	}
264 264

  
265
    public Float getFundingRequested() {
266
        return fundingRequested;
267
    }
265
	public Float getFundingRequested() {
266
		return fundingRequested;
267
	}
268 268

  
269
    public void setFundingRequested(Float fundingRequested) {
270
        this.fundingRequested = fundingRequested;
271
    }
269
	public void setFundingRequested(Float fundingRequested) {
270
		this.fundingRequested = fundingRequested;
271
	}
272 272

  
273
    public Currency getCurrency() {
274
        return currency;
275
    }
273
	public Currency getCurrency() {
274
		return currency;
275
	}
276 276

  
277
    public void setCurrency(Currency currency) {
278
        this.currency = currency;
279
    }
277
	public void setCurrency(Currency currency) {
278
		this.currency = currency;
279
	}
280 280

  
281
    public BankAccount getBankAccount() {
282
        return bankAccount;
283
    }
281
	public BankAccount getBankAccount() {
282
		return bankAccount;
283
	}
284 284

  
285
    public void setBankAccount(BankAccount bankAccount) {
286
        this.bankAccount = bankAccount;
287
    }
285
	public void setBankAccount(BankAccount bankAccount) {
286
		this.bankAccount = bankAccount;
287
	}
288 288

  
289
    public List<RequestCoFunder> getCoFunders() {
290
        return coFunders;
291
    }
289
	public List<RequestCoFunder> getCoFunders() {
290
		return coFunders;
291
	}
292 292

  
293
    public void setCoFunders(List<RequestCoFunder> coFunders) {
294
        this.coFunders = coFunders;
295
    }
293
	public void setCoFunders(List<RequestCoFunder> coFunders) {
294
		this.coFunders = coFunders;
295
	}
296 296

  
297 297
	public Float getApc_paid() {
298 298
		return apc_paid;

Also available in: Unified diff