Package org.switchyard.quickstarts.camel.sap.binding.bean

Examples of org.switchyard.quickstarts.camel.sap.binding.bean.FlightTripRequestInfo


     * <p>{@inheritDoc}
     */
    @Override
    public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
        Exchange answer = oldExchange == null ? newExchange : oldExchange;
        FlightTripRequestInfo flightTripRequestInfo;
        Object payload = answer.getIn().getBody();
        if (payload instanceof FlightTripRequestInfo) {
            flightTripRequestInfo = FlightTripRequestInfo.class.cast(payload);
        } else {
            flightTripRequestInfo = new FlightTripRequestInfo();
        }
       
        String to = newExchange.getProperty(Exchange.TO_ENDPOINT, String.class);
        if (LOG.isDebugEnabled()) {
            LOG.debug("To endpoint = {}", to);
        }
        if (to.contains("FlightConnectionInfo")) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Adding Flight Connection Info to exchange.");
            }
           flightTripRequestInfo.setFlightConnectionInfo(newExchange.getIn().getBody(FlightConnectionInfo.class));
        } else if (to.contains("FlightCustomerInfo")){
            if (LOG.isDebugEnabled()) {
                LOG.debug("Adding Flight Customer Info to exchange.");
            }
            flightTripRequestInfo.setFlightCustomerInfo(newExchange.getIn().getBody(FlightCustomerInfo.class));
        } else {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Adding Passenger Info to exchange.");
            }
            flightTripRequestInfo.setPassengerInfo(newExchange.getIn().getBody(PassengerInfo.class));
        }
        answer.getIn().setBody(flightTripRequestInfo);
        return answer;
    }
View Full Code Here


    @Override
    public CamelBindingData decompose(Exchange exchange, CamelBindingData target) throws Exception {
        CamelBindingData response = super.decompose(exchange, target);

        // Get flight connection info, flight customer info and passenger info bean objects
        FlightTripRequestInfo flightTripRequestInfo = exchange.getMessage().getContent(FlightTripRequestInfo.class);
        FlightConnectionInfo flightConnectionInfo = flightTripRequestInfo.getFlightConnectionInfo();
        FlightCustomerInfo flightCustomerInfo = flightTripRequestInfo.getFlightCustomerInfo();
        PassengerInfo passengerInfo = flightTripRequestInfo.getPassengerInfo();
        exchange.getContext().setProperty(FLIGHT_TRIP_REQUEST_INFO, flightTripRequestInfo, Scope.EXCHANGE);

        // Create SAP Request object from target endpoint.
        SAPEndpoint endpoint = response.getMessage().getExchange().getContext().getEndpoint("sap:destination:nplDest:BAPI_FLTRIP_CREATE", SAPEndpoint.class);
        Structure request = endpoint.getRequest();
View Full Code Here

                response.addAttachment(entry.getKey(), entry.getValue().getDataSource());
            }
        }

        // Retrieve flight connection and passenger info from exchange context property.
        FlightTripRequestInfo flightTripRequestInfo = (FlightTripRequestInfo) exchange.getContext().getProperty(FLIGHT_TRIP_REQUEST_INFO).getValue();
        FlightConnectionInfo flightConnectionInfo = flightTripRequestInfo.getFlightConnectionInfo();
        PassengerInfo passengerInfo = flightTripRequestInfo.getPassengerInfo();

        // Retrieve SAP response object from body of exchange message.
        Structure flightTripCreateResponse = source.getMessage().getBody(Structure.class);

        if (flightTripCreateResponse == null) {
View Full Code Here

TOP

Related Classes of org.switchyard.quickstarts.camel.sap.binding.bean.FlightTripRequestInfo

Copyright © 2018 www.massapicom. 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.