View Javadoc

1   /*
2    * $Id: LoanQuoteRequestToCreditProfileArgs.java 7976 2007-08-21 14:26:13Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.examples.loanbroker.transformers;
12  
13  import org.mule.examples.loanbroker.messages.LoanBrokerQuoteRequest;
14  import org.mule.transformers.AbstractTransformer;
15  import org.mule.umo.transformer.TransformerException;
16  
17  /**
18   * Extracts the customer information from the request into an array of arguments used
19   * to invoke the Credit Agency Session bean
20   */
21  public class LoanQuoteRequestToCreditProfileArgs extends AbstractTransformer
22  {
23  
24      public LoanQuoteRequestToCreditProfileArgs()
25      {
26          registerSourceType(LoanBrokerQuoteRequest.class);
27      }
28  
29      public Object doTransform(Object src, String encoding) throws TransformerException
30      {
31          LoanBrokerQuoteRequest request = (LoanBrokerQuoteRequest)src;
32          Object[] args = new Object[2];
33          args[0] = request.getCustomerRequest().getCustomer().getName();
34          args[1] = new Integer(request.getCustomerRequest().getCustomer().getSsn());
35          return args;
36      }
37  
38  }