Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2009 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;
 
 
Generic Web Service implementation for HL7 v3-based transactions.

Author(s):
Dmytro Rud
 
 abstract public class AbstractHl7v3WebService extends AbstractWebService {
 
 
     public AbstractHl7v3WebService(Hl7v3WsTransactionConfiguration wsTransactionConfiguration) {
         Validate.notNull(wsTransactionConfiguration);
         this. = wsTransactionConfiguration;
     }
    
    
The proper message processing method.

Parameters:
requestString XML payload of the HL7 v3 request message.
Returns:
XML payload of the HL7 v3 response message or an automatically generated NAK.
 
     protected String doProcess(String requestString) {
         Exchange result = process(requestString);
         Exception exception = Exchanges.extractException(result);
         if (exception != null) {
             .info("HL7 v3 service failed"exception);
             return createNak(requestStringexception);
         }
         return Exchanges.resultMessage(result).getBody(String.class);
     }

    
Creates a transaction-specific NAK message.
 
     protected String createNak(String requestStringThrowable throwable) {
         return Hl7v3NakFactory.response(
                 requestString,
                 throwable,
                 .getNakRootElementName(),
                 .getControlActProcessCode(),
                 false);
     }

    
Creates a transaction-specific NAK message.
 
     protected String createNak(GPathResult requestThrowable throwable) {
         return Hl7v3NakFactory.response(
                 requestthrowable,
                 .getNakRootElementName(),
                 .getControlActProcessCode(),
                 false);
     }
 
         return ;
     }
 
 
     protected Hl7v3AuditDataset startAtnaAuditing(String requestStringHl7v3AuditStrategy auditStrategy) {
         Hl7v3AuditDataset auditDataset = null;
         if (auditStrategy != null) {
             try {
                auditDataset = auditStrategy.createAuditDataset();
                MessageContext messageContext = new WebServiceContextImpl().getMessageContext();
                HttpServletRequest servletRequest =
                        (HttpServletRequestmessageContext.get(.);
                if (servletRequest != null) {
                    auditDataset.setClientIpAddress(servletRequest.getRemoteAddr());
                }
                auditDataset.setServiceEndpointUrl((StringmessageContext.get(.));
                AddressingProperties apropos = (AddressingPropertiesmessageContext.get(
                                .);
                if ((apropos != null) && (apropos.getReplyTo() != null) && (apropos.getReplyTo().getAddress() != null)) {
                    auditDataset.setUserId(apropos.getReplyTo().getAddress().getValue());
                }
                if (.isAuditRequestPayload()) {
                    auditDataset.setRequestPayload(requestString);
                }
                auditStrategy.enrichDatasetFromRequest(requestStringauditDataset);
            } catch (Exception e) {
                .error("Phase 1 of server-side ATNA auditing failed"e);
            }
        }
        return auditDataset;
    }
    protected void finalizeAtnaAuditing(
            Object response,
            Hl7v3AuditStrategy auditStrategy,
            Hl7v3AuditDataset auditDataset)
    {
        if (auditStrategy != null) {
            try {
                auditStrategy.enrichDatasetFromResponse(responseauditDataset);
                auditStrategy.audit(auditDataset);
            } catch (Exception e) {
                .error("Phase 2 of server-side ATNA auditing failed"e);
            }
        }
    }
New to GrepCode? Check out our FAQ X