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