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

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


        // Get Flight Customer data from first row of table.
        Structure customer = customerList.get(0);

        // Create bean to hold Flight Customer data.
        FlightCustomerInfo flightCustomerInfo = new FlightCustomerInfo();

        // Get customer id from Flight Customer data and add to bean.
        String customerId = customer.get("CUSTOMERID", String.class);
        if (customerId != null) {
            flightCustomerInfo.setCustomerNumber(customerId);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Set customer number = '{}' in flight customer info", customerId);
            }
        }

        // Get customer name from Flight Customer data and add to bean.
        String customerName = customer.get("CUSTNAME", String.class);
        if (customerName != null) {
            flightCustomerInfo.setName(customerName);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Set customer name = '{}' in flight customer info", customerName);
            }
        }

        // Get customer form of address from Flight Customer data and add to bean.
        String formOfAddress = customer.get("FORM", String.class);
        if (formOfAddress != null) {
            flightCustomerInfo.setFormOfAddress(formOfAddress);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Set form of address = '{}' in flight customer info", formOfAddress);
            }
        }

        // Get customer street name from Flight Customer data and add to bean.
        String street = customer.get("STREET", String.class);
        if (street != null) {
            flightCustomerInfo.setStreet(street);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Set street = '{}' in flight customer info", street);
            }
        }

        // Get customer PO box from Flight Customer data and add to bean.
        String poBox = customer.get("POBOX", String.class);
        if (poBox != null) {
            flightCustomerInfo.setPoBox(poBox);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Set PO box = '{}' in flight customer info", poBox);
            }
        }

        // Get customer postal code from Flight Customer data and add to bean.
        String postalCode = customer.get("POSTCODE", String.class);
        if (postalCode != null) {
            flightCustomerInfo.setPostalCode(postalCode);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Set postal code = '{}' in flight customer info", postalCode);
            }
        }

        // Get customer city name from Flight Customer data and add to bean.
        String city = customer.get("CITY", String.class);
        if (city != null) {
            flightCustomerInfo.setCity(city);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Set city = '{}' in flight customer info", city);
            }
        }

        // Get customer country name from Flight Customer data and add to bean.
        String country = customer.get("COUNTR", String.class);
        if (country != null) {
            flightCustomerInfo.setCountry(country);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Set country = '{}' in flight customer info", country);
            }
        }

        // Get customer country ISO code from Flight Customer data and add to bean.
        String countryIso = customer.get("COUNTR_ISO", String.class);
        if (countryIso != null) {
            flightCustomerInfo.setCountryIso(countryIso);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Set iso country code = '{}' in flight customer info", countryIso);
            }
        }

        // Get customer region name from Flight Customer data and add to bean.
        String region = customer.get("REGION", String.class);
        if (region != null) {
            flightCustomerInfo.setRegion(region);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Set region = '{}' in flight customer info", region);
            }
        }

        // Get customer phone number from Flight Customer data and add to bean.
        String phone = customer.get("PHONE", String.class);
        if (phone != null) {
            flightCustomerInfo.setPhone(phone);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Set phone = '{}' in flight customer info", phone);
            }
        }

        // Get customer email from Flight Customer data and add to bean.
        String email = customer.get("EMAIL", String.class);
        if (email != null) {
            flightCustomerInfo.setEmail(email);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Set email = '{}' in flight customer info", email);
            }
        }
View Full Code Here


        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();

        //
        // Add Flight Trip Data to request object.
        //

        Structure flightTripData = request.get("FLIGHT_TRIP_DATA", Structure.class);

        // Add Travel Agency Number to request if set
        String travelAgencyNumber = flightConnectionInfo.getTravelAgencyNumber();
        if (travelAgencyNumber != null && travelAgencyNumber.length() != 0) {
            flightTripData.put("AGENCYNUM", travelAgencyNumber);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Added AGENCYNUM = '{}' to FLIGHT_TRIP_DATA", travelAgencyNumber);
            }

        }

        // Add Customer ID to request if set
        String flightCustomerNumber = flightCustomerInfo.getCustomerNumber();
        if (flightCustomerNumber != null && flightCustomerNumber.length() != 0) {
            flightTripData.put("CUSTOMERID", flightCustomerNumber);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Added CUSTOMERID = '{}' to FLIGHT_TRIP_DATA", flightCustomerNumber);
            }
View Full Code Here

TOP

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

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.