Revision 39076
Added by Antonis Lempesis over 8 years ago
AccountingEligibilityManager.java | ||
---|---|---|
14 | 14 |
*/ |
15 | 15 |
public class AccountingEligibilityManager implements EligibilityManager { |
16 | 16 |
|
17 |
@Autowired
|
|
18 |
private PublicationDAO publicationDAO;
|
|
19 |
@Autowired
|
|
20 |
private CurrencyConverter currencyConverter;
|
|
17 |
@Autowired
|
|
18 |
private PublicationDAO publicationDAO;
|
|
19 |
@Autowired
|
|
20 |
private CurrencyConverter currencyConverter;
|
|
21 | 21 |
|
22 |
private String participationNoNoMessage;
|
|
23 |
private String fundingRequestedNoNoMessage;
|
|
22 |
private String participationNoNoMessage;
|
|
23 |
private String fundingRequestedNoNoMessage;
|
|
24 | 24 |
|
25 |
private float maxArticleAPC;
|
|
26 |
private String maxArticleAPCNoNoMessage;
|
|
27 |
private float maxMonographAPC;
|
|
28 |
private String maxMonographAPCNoNoMessage;
|
|
25 |
private float maxArticleAPC;
|
|
26 |
private String maxArticleAPCNoNoMessage;
|
|
27 |
private float maxMonographAPC;
|
|
28 |
private String maxMonographAPCNoNoMessage;
|
|
29 | 29 |
|
30 |
@Override
|
|
31 |
public Eligibility validate(Request request) {
|
|
32 |
Eligibility eligibility = new Eligibility();
|
|
30 |
@Override
|
|
31 |
public Eligibility validate(Request request) {
|
|
32 |
Eligibility eligibility = new Eligibility();
|
|
33 | 33 |
|
34 |
if (request.getProjectParticipation() != null && (request.getProjectParticipation() <= 0 || request.getProjectParticipation() > 100))
|
|
35 |
eligibility.merge(new Eligibility(Eligibility.Status.NONO, this.participationNoNoMessage));
|
|
34 |
if (request.getProjectParticipation() != null && (request.getProjectParticipation() <= 0 || request.getProjectParticipation() > 100))
|
|
35 |
eligibility.merge(new Eligibility(Eligibility.Status.NONO, this.participationNoNoMessage));
|
|
36 | 36 |
|
37 |
if (request.getFundingRequested() != null && (request.getFundingRequested() <= 0))
|
|
38 |
eligibility.merge(new Eligibility(Eligibility.Status.NONO, this.fundingRequestedNoNoMessage));
|
|
37 |
if (request.getFundingRequested() != null && (request.getFundingRequested() <= 0))
|
|
38 |
eligibility.merge(new Eligibility(Eligibility.Status.NONO, this.fundingRequestedNoNoMessage));
|
|
39 | 39 |
|
40 |
if (request.getPublication() != null && request.getFundingRequested() != null) {
|
|
41 |
Publication publication = publicationDAO.getPublication(request.getPublication());
|
|
42 |
float amount = currencyConverter.convert(request.getCurrency(), Currency.EUR, request.getFundingRequested());
|
|
40 |
if (request.getPublication() != null && request.getFundingRequested() != null) {
|
|
41 |
Publication publication = publicationDAO.getPublication(request.getPublication());
|
|
42 |
float amount = currencyConverter.convert(request.getCurrency(), Currency.EUR, request.getFundingRequested());
|
|
43 | 43 |
|
44 |
switch (publication.getType()) {
|
|
45 |
case ARTICLE:
|
|
46 |
if (amount > maxArticleAPC)
|
|
47 |
eligibility.merge(new Eligibility(Eligibility.Status.NONO, maxArticleAPCNoNoMessage));
|
|
48 |
break;
|
|
49 |
case MONOGRAPH:
|
|
50 |
if (amount > maxMonographAPC)
|
|
51 |
eligibility.merge(new Eligibility(Eligibility.Status.NONO, maxMonographAPCNoNoMessage));
|
|
52 |
break;
|
|
53 |
}
|
|
54 |
}
|
|
44 |
switch (publication.getType()) {
|
|
45 |
case ARTICLE:
|
|
46 |
if (amount > maxArticleAPC)
|
|
47 |
eligibility.merge(new Eligibility(Eligibility.Status.NONO, maxArticleAPCNoNoMessage));
|
|
48 |
break;
|
|
49 |
case MONOGRAPH:
|
|
50 |
if (amount > maxMonographAPC)
|
|
51 |
eligibility.merge(new Eligibility(Eligibility.Status.NONO, maxMonographAPCNoNoMessage));
|
|
52 |
break;
|
|
53 |
}
|
|
54 |
}
|
|
55 | 55 |
|
56 |
return eligibility;
|
|
57 |
}
|
|
56 |
return eligibility;
|
|
57 |
}
|
|
58 | 58 |
|
59 |
public String getParticipationNoNoMessage() {
|
|
60 |
return participationNoNoMessage;
|
|
61 |
}
|
|
59 |
public String getParticipationNoNoMessage() {
|
|
60 |
return participationNoNoMessage;
|
|
61 |
}
|
|
62 | 62 |
|
63 |
public void setParticipationNoNoMessage(String participationNoNoMessage) {
|
|
64 |
this.participationNoNoMessage = participationNoNoMessage;
|
|
65 |
}
|
|
63 |
public void setParticipationNoNoMessage(String participationNoNoMessage) {
|
|
64 |
this.participationNoNoMessage = participationNoNoMessage;
|
|
65 |
}
|
|
66 | 66 |
|
67 |
public String getFundingRequestedNoNoMessage() {
|
|
68 |
return fundingRequestedNoNoMessage;
|
|
69 |
}
|
|
67 |
public String getFundingRequestedNoNoMessage() {
|
|
68 |
return fundingRequestedNoNoMessage;
|
|
69 |
}
|
|
70 | 70 |
|
71 |
public void setFundingRequestedNoNoMessage(String fundingRequestedNoNoMessage) {
|
|
72 |
this.fundingRequestedNoNoMessage = fundingRequestedNoNoMessage;
|
|
73 |
}
|
|
71 |
public void setFundingRequestedNoNoMessage(String fundingRequestedNoNoMessage) {
|
|
72 |
this.fundingRequestedNoNoMessage = fundingRequestedNoNoMessage;
|
|
73 |
}
|
|
74 | 74 |
|
75 |
public float getMaxArticleAPC() {
|
|
76 |
return maxArticleAPC;
|
|
77 |
}
|
|
75 |
public float getMaxArticleAPC() {
|
|
76 |
return maxArticleAPC;
|
|
77 |
}
|
|
78 | 78 |
|
79 |
public void setMaxArticleAPC(float maxArticleAPC) {
|
|
80 |
this.maxArticleAPC = maxArticleAPC;
|
|
81 |
}
|
|
79 |
public void setMaxArticleAPC(float maxArticleAPC) {
|
|
80 |
this.maxArticleAPC = maxArticleAPC;
|
|
81 |
}
|
|
82 | 82 |
|
83 |
public String getMaxArticleAPCNoNoMessage() {
|
|
84 |
return maxArticleAPCNoNoMessage;
|
|
85 |
}
|
|
83 |
public String getMaxArticleAPCNoNoMessage() {
|
|
84 |
return maxArticleAPCNoNoMessage;
|
|
85 |
}
|
|
86 | 86 |
|
87 |
public void setMaxArticleAPCNoNoMessage(String maxArticleAPCNoNoMessage) {
|
|
88 |
this.maxArticleAPCNoNoMessage = maxArticleAPCNoNoMessage;
|
|
89 |
}
|
|
87 |
public void setMaxArticleAPCNoNoMessage(String maxArticleAPCNoNoMessage) {
|
|
88 |
this.maxArticleAPCNoNoMessage = maxArticleAPCNoNoMessage;
|
|
89 |
}
|
|
90 | 90 |
|
91 |
public float getMaxMonographAPC() {
|
|
92 |
return maxMonographAPC;
|
|
93 |
}
|
|
91 |
public float getMaxMonographAPC() {
|
|
92 |
return maxMonographAPC;
|
|
93 |
}
|
|
94 | 94 |
|
95 |
public void setMaxMonographAPC(float maxMonographAPC) {
|
|
96 |
this.maxMonographAPC = maxMonographAPC;
|
|
97 |
}
|
|
95 |
public void setMaxMonographAPC(float maxMonographAPC) {
|
|
96 |
this.maxMonographAPC = maxMonographAPC;
|
|
97 |
}
|
|
98 | 98 |
|
99 |
public String getMaxMonographAPCNoNoMessage() {
|
|
100 |
return maxMonographAPCNoNoMessage;
|
|
101 |
}
|
|
99 |
public String getMaxMonographAPCNoNoMessage() {
|
|
100 |
return maxMonographAPCNoNoMessage;
|
|
101 |
}
|
|
102 | 102 |
|
103 |
public void setMaxMonographAPCNoNoMessage(String maxMonographAPCNoNoMessage) {
|
|
104 |
this.maxMonographAPCNoNoMessage = maxMonographAPCNoNoMessage;
|
|
105 |
}
|
|
103 |
public void setMaxMonographAPCNoNoMessage(String maxMonographAPCNoNoMessage) {
|
|
104 |
this.maxMonographAPCNoNoMessage = maxMonographAPCNoNoMessage;
|
|
105 |
}
|
|
106 | 106 |
} |
Also available in: Unified diff
reformatted code