Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 2011 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *     http://www.apache.org/licenses/LICENSE-2.0
  *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.openehealth.ipf.platform.camel.ihe.hl7v3.iti55;
Camel producer for the ITI-55 XCPD transaction with support of the Deferred Response option.

Author(s):
Dmytro Rud
    private static final String PROCESSING_MODE_PROPERTY = Iti55Producer.class.getName() + ".MODE";
    Iti55Producer(AbstractWsEndpoint endpointJaxWsClientFactory clientFactory) {
        super(endpointclientFactoryString.classString.class);
    }
    @Override
    protected void enrichRequestContext(Exchange exchangeWrappedMessageContext requestContext) {
        String requestString = exchange.getIn().getBody(String.class);
        GPathResult requestXml = Hl7v3Utils.slurp(requestString);
        String processingMode = Iti55Utils.processingMode(requestXml);
        if ("D".equals(processingMode)) {
            if (exchange.getIn().getHeader(.String.class) != null) {
                throw new RuntimeException("WS-Addressing asynchrony cannot be combined with the Deferred Response option");
            }
            if (Iti55Utils.deferredResponseUri(requestXml) == null) {
                throw new RuntimeException("missing deferred response URI in the request");
            }
            requestContext.put(..);
        }
        requestContext.put(processingMode);
    }
    @Override
    protected String callService(Object clientString request) {
        BindingProvider bindingProvider = (BindingProviderclient;
        Map<StringObjectrequestContext = bindingProvider.getRequestContext();
        return ("D".equals(requestContext.get())) ?
            ((Iti55PortTypeclient).discoverPatientsDeferred(request) :
            ((Iti55PortTypeclient).discoverPatients(request);
    }
    @Override
    protected String[] getAlternativeRequestKeys(Exchange exchange) {
        String requestString = exchange.getIn().getBody(String.class);
        GPathResult requestXml = Hl7v3Utils.slurp(requestString);
        return new String[] { Iti55Utils.requestQueryId(requestXml) };
    }
New to GrepCode? Check out our FAQ X