001package ca.cdr.api.pub.hl7v2; 002 003/*- 004 * #%L 005 * Smile CDR - CDR 006 * %% 007 * Copyright (C) 2016 - 2024 Smile CDR, Inc. 008 * %% 009 * All rights reserved. 010 * #L% 011 */ 012 013import ca.cdr.api.pub.hl7v2.model.MappingContext; 014import ca.cdr.api.pub.hl7v2.model.MappingResult; 015import ca.uhn.hl7v2.HL7Exception; 016import ca.uhn.hl7v2.model.Message; 017 018/** 019 * An HL7 v2 Message mapper is used to translate messages from one 020 * format to another when sending or receiving them. This can be used 021 * to provide mappings from a source system format to a format that 022 * Smile CDR understands. 023 */ 024public interface IHl7V2MessageMapper { 025 026 /** 027 * Returns the input message type for this translator 028 */ 029 Class<? extends Message> getInputType(); 030 031 /** 032 * Returns the output message type for this translator 033 */ 034 Class<? extends Message> getOutputType(); 035 036 /** 037 * This method should return <code>true</code> if the 038 * mapper should process this message 039 */ 040 boolean applies(String theMessageType, String theMessageTrigger); 041 042 /** 043 * Translate a message 044 * 045 * @param theInput 046 * The source message 047 * @param theContext 048 * An object containing context information 049 * @return A result containing the output of the mapping 050 */ 051 MappingResult map(Message theInput, MappingContext theContext) throws HL7Exception; 052}