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