All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ca.uhn.hl7v2.protocol.impl.TransportableImpl Maven / Gradle / Ivy

/*
 * Created on 19-Apr-2004
 */
package ca.uhn.hl7v2.protocol.impl;

import java.util.HashMap;
import java.util.Map;

import ca.uhn.hl7v2.protocol.Transportable;

/**
 * Default implementation of Transportable. 
 * 
 * @author Bryan Tripp
 * @version $Revision: 1.1 $ updated on $Date: 2007-02-19 02:24:26 $ by $Author: jamesagnew $
 */
public class TransportableImpl implements Transportable {

    private final String myMessageText;
    private final Map myMetadata;
    
    /**
     * Creates a new instance with no associated metadata (metadata can 
     * be added later using getMetadata(). 
     * 
     * @param theMessageText the text of an HL7 message 
     */
    public TransportableImpl(String theMessageText) {
        myMessageText = theMessageText;
        myMetadata = new HashMap();
    }
    
    /**
     * Creates a new instance with specified metadata (further metadata can   
     * be added later using getMetadata(). 
     * 
     * @param theMessageText the text of an HL7 message 
     * @param theMetadata metadata associated with the message (typical examples 
     *      would be selected field values for routing) 
     */
    public TransportableImpl(String theMessageText, Map theMetadata) {
        myMessageText = theMessageText;
        myMetadata = theMetadata;
    }

    /** 
     * @see ca.uhn.hl7v2.protocol.Transportable#getMessage()
     */
    public String getMessage() {
        return myMessageText;
    }

    /** 
     * @see ca.uhn.hl7v2.protocol.Transportable#getMetadata()
     */
    public Map getMetadata() {
        return myMetadata;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy