Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
SynchronousLoanBroker |
|
| 0.0;0 |
1 | /* | |
2 | * $Id: SynchronousLoanBroker.java 19191 2010-08-25 21:05:23Z tcarlson $ | |
3 | * -------------------------------------------------------------------------------------- | |
4 | * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com | |
5 | * | |
6 | * The software in this package is published under the terms of the CPAL v1.0 | |
7 | * license, a copy of which has been included with this distribution in the | |
8 | * LICENSE.txt file. | |
9 | */ | |
10 | ||
11 | package org.mule.example.loanbroker.esn; | |
12 | ||
13 | import org.mule.example.loanbroker.DefaultLoanBroker; | |
14 | import org.mule.example.loanbroker.LoanBrokerException; | |
15 | import org.mule.example.loanbroker.credit.CreditAgencyService; | |
16 | import org.mule.example.loanbroker.messages.CreditProfile; | |
17 | import org.mule.example.loanbroker.messages.CustomerQuoteRequest; | |
18 | import org.mule.example.loanbroker.messages.LoanBrokerQuoteRequest; | |
19 | ||
20 | /** | |
21 | * <code>SyncLoanBroker</code> is a synchronous Loan Broker that makes the calls to | |
22 | * various components through the event context synchronously. | |
23 | */ | |
24 | 0 | public class SynchronousLoanBroker extends DefaultLoanBroker |
25 | { | |
26 | //A proxy for this object gets injected via the <nested-router> element configured on this service. | |
27 | //The proxy will then call out to an endpoint and return the result. | |
28 | //The transformers configured on the endpoint control how data is marshalled into and out of the call. | |
29 | private CreditAgencyService creditAgency; | |
30 | ||
31 | @Override | |
32 | public Object getLoanQuote(CustomerQuoteRequest request) throws LoanBrokerException | |
33 | { | |
34 | 0 | super.getLoanQuote(request); |
35 | 0 | LoanBrokerQuoteRequest bqr = new LoanBrokerQuoteRequest(); |
36 | 0 | bqr.setCustomerRequest(request); |
37 | ||
38 | //This calls out to the CreditAgency service (see above) | |
39 | 0 | CreditProfile cp = creditAgency.getCreditProfile(request.getCustomer()); |
40 | 0 | bqr.setCreditProfile(cp); |
41 | ||
42 | 0 | return bqr; |
43 | } | |
44 | ||
45 | public CreditAgencyService getCreditAgency() | |
46 | { | |
47 | 0 | return creditAgency; |
48 | } | |
49 | ||
50 | public void setCreditAgency(CreditAgencyService creditAgency) | |
51 | { | |
52 | 0 | this.creditAgency = creditAgency; |
53 | 0 | } |
54 | } |