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