Examples of BankQuote


Examples of org.apache.camel.loanbroker.webservice.version.bank.BankQuote

    public static final String BANK_QUOTE = "bank_quote";

    public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
        // Get the bank quote instance from the exchange
        BankQuote oldQuote = oldExchange.getProperty(BANK_QUOTE, BankQuote.class);
        // Get the oldQute from out message body if we can't get it from the exchange
        if (oldQuote == null) {
            Object[] oldResult = (Object[])oldExchange.getOut().getBody();
            oldQuote = (BankQuote) oldResult[0];
        }
        // Get the newQuote
        Object[] newResult = (Object[])newExchange.getOut().getBody();
        BankQuote newQuote = (BankQuote) newResult[0];
        Exchange result = null;
        BankQuote bankQuote;

        if (newQuote.getRate() >= oldQuote.getRate()) {
            result = oldExchange;
            bankQuote = oldQuote;
        } else {
            result = newExchange;
            bankQuote = newQuote;
        }
        // Set the lower rate BankQuote instance back to aggregated exchange
        result.setProperty(BANK_QUOTE, bankQuote);
        // Set the return message for the client
        result.getOut().setBody("The best rate is " + bankQuote.toString());

        return result;

    }
View Full Code Here

Examples of org.apache.camel.loanbroker.webservice.version.bank.BankQuote

        if (oldExchange == null) {
            return newExchange;
        }

        // Get the bank quote instance from the exchange
        BankQuote oldQuote = oldExchange.getProperty(BANK_QUOTE, BankQuote.class);
        // Get the oldQute from out message body if we can't get it from the exchange
        if (oldQuote == null) {
            oldQuote = oldExchange.getOut().getBody(BankQuote.class);
        }
        // Get the newQuote
        BankQuote newQuote = newExchange.getOut().getBody(BankQuote.class);
        Exchange result = null;
        BankQuote bankQuote;

        if (newQuote.getRate() >= oldQuote.getRate()) {
            result = oldExchange;
            bankQuote = oldQuote;
        } else {
            result = newExchange;
            bankQuote = newQuote;
        }
        // Set the lower rate BankQuote instance back to aggregated exchange
        result.setProperty(BANK_QUOTE, bankQuote);
        // Set the return message for the client
        result.getOut().setBody("The best rate is " + bankQuote.toString());

        return result;
    }
View Full Code Here

Examples of org.apache.camel.loanbroker.webservice.version.bank.BankQuote

        if (oldExchange == null) {
            return newExchange;
        }

        // Get the bank quote instance from the exchange
        BankQuote oldQuote = oldExchange.getProperty(BANK_QUOTE, BankQuote.class);
        // Get the oldQute from out message body if we can't get it from the exchange
        if (oldQuote == null) {
            oldQuote = oldExchange.getIn().getBody(BankQuote.class);
        }
        // Get the newQuote
        BankQuote newQuote = newExchange.getIn().getBody(BankQuote.class);
        Exchange result = null;
        BankQuote bankQuote;

        if (newQuote.getRate() >= oldQuote.getRate()) {
            result = oldExchange;
            bankQuote = oldQuote;
        } else {
            result = newExchange;
            bankQuote = newQuote;
        }
        // Set the lower rate BankQuote instance back to aggregated exchange
        result.setProperty(BANK_QUOTE, bankQuote);
        // Set the return message for the client
        result.getOut().setBody("The best rate is " + bankQuote.toString());

        return result;
    }
View Full Code Here

Examples of org.apache.camel.loanbroker.webservice.version.bank.BankQuote

    public static final String BANK_QUOTE = "bank_quote";

    public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
        // Get the bank quote instance from the exchange
        BankQuote oldQuote = oldExchange.getProperty(BANK_QUOTE, BankQuote.class);
        // Get the oldQute from out message body if we can't get it from the exchange
        if (oldQuote == null) {
            oldQuote = oldExchange.getOut().getBody(BankQuote.class);
        }
        // Get the newQuote
        BankQuote newQuote = newExchange.getOut().getBody(BankQuote.class);
        Exchange result = null;
        BankQuote bankQuote;

        if (newQuote.getRate() >= oldQuote.getRate()) {
            result = oldExchange;
            bankQuote = oldQuote;
        } else {
            result = newExchange;
            bankQuote = newQuote;
        }
        // Set the lower rate BankQuote instance back to aggregated exchange
        result.setProperty(BANK_QUOTE, bankQuote);
        // Set the return message for the client
        result.getOut().setBody("The best rate is " + bankQuote.toString());

        return result;

    }
View Full Code Here

Examples of org.apache.camel.loanbroker.webservice.version.bank.BankQuote

        // the first time we only have the new exchange
        if (oldExchange == null) {
            return newExchange;
        }
       
        BankQuote oldQuote = oldExchange.getIn().getBody(BankQuote.class);
        BankQuote newQuote = newExchange.getIn().getBody(BankQuote.class);
       
        // return the winner with the lowest rate
        if (oldQuote.getRate() <= newQuote.getRate()) {
            return oldExchange;
        } else {
            return newExchange;
        }
    }
View Full Code Here

Examples of org.apache.camel.loanbroker.webservice.version.bank.BankQuote

*/
public class ReplyProcessor implements Processor {
   
    @Override
    public void process(Exchange exchange) throws Exception {
        BankQuote quote = exchange.getIn().getBody(BankQuote.class);
       
        String answer = "The best rate is " + quote.toString();
        exchange.getOut().setBody(answer);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.