1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.example.loanbroker.creditagency; |
12 | |
|
13 | |
import org.mule.example.loanbroker.model.CreditProfile; |
14 | |
import org.mule.example.loanbroker.model.Customer; |
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | 0 | public class DefaultCreditAgency implements CreditAgencyService |
20 | |
{ |
21 | |
public CreditProfile getCreditProfile(Customer customer) |
22 | |
{ |
23 | 0 | CreditProfile cp = new CreditProfile(); |
24 | 0 | cp.setCreditHistory(getCreditHistoryLength(customer.getSsn())); |
25 | 0 | cp.setCreditScore(getCreditScore(customer.getSsn())); |
26 | 0 | return cp; |
27 | |
} |
28 | |
|
29 | |
protected int getCreditScore(int ssn) |
30 | |
{ |
31 | |
int credit_score; |
32 | |
|
33 | 0 | credit_score = (int)(Math.random() * 600 + 300); |
34 | |
|
35 | 0 | return credit_score; |
36 | |
} |
37 | |
|
38 | |
protected int getCreditHistoryLength(int ssn) |
39 | |
{ |
40 | |
int credit_history_length; |
41 | |
|
42 | 0 | credit_history_length = (int)(Math.random() * 19 + 1); |
43 | |
|
44 | 0 | return credit_history_length; |
45 | |
} |
46 | |
} |