Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
TransportableImpl |
|
| 1.0;1 |
1 | /* | |
2 | * Created on 19-Apr-2004 | |
3 | */ | |
4 | package ca.uhn.hl7v2.protocol.impl; | |
5 | ||
6 | import java.util.HashMap; | |
7 | import java.util.Map; | |
8 | ||
9 | import ca.uhn.hl7v2.protocol.Transportable; | |
10 | ||
11 | /** | |
12 | * Default implementation of <code>Transportable</code>. | |
13 | * | |
14 | * @author <a href="mailto:bryan.tripp@uhn.on.ca">Bryan Tripp</a> | |
15 | * @version $Revision: 1.1 $ updated on $Date: 2007-02-19 02:24:26 $ by $Author: jamesagnew $ | |
16 | */ | |
17 | public class TransportableImpl implements Transportable { | |
18 | ||
19 | private final String myMessageText; | |
20 | private final Map<String, Object> myMetadata; | |
21 | ||
22 | /** | |
23 | * Creates a new instance with no associated metadata (metadata can | |
24 | * be added later using <code>getMetadata()</code>. | |
25 | * | |
26 | * @param theMessageText the text of an HL7 message | |
27 | */ | |
28 | 943 | public TransportableImpl(String theMessageText) { |
29 | 943 | myMessageText = theMessageText; |
30 | 943 | myMetadata = new HashMap<String, Object>(); |
31 | 943 | } |
32 | ||
33 | /** | |
34 | * Creates a new instance with specified metadata (further metadata can | |
35 | * be added later using <code>getMetadata()</code>. | |
36 | * | |
37 | * @param theMessageText the text of an HL7 message | |
38 | * @param theMetadata metadata associated with the message (typical examples | |
39 | * would be selected field values for routing) | |
40 | */ | |
41 | 658 | public TransportableImpl(String theMessageText, Map<String, Object> theMetadata) { |
42 | 658 | myMessageText = theMessageText; |
43 | 658 | myMetadata = theMetadata; |
44 | 658 | } |
45 | ||
46 | /** | |
47 | * @see ca.uhn.hl7v2.protocol.Transportable#getMessage() | |
48 | */ | |
49 | public String getMessage() { | |
50 | 1961 | return myMessageText; |
51 | } | |
52 | ||
53 | /** | |
54 | * @see ca.uhn.hl7v2.protocol.Transportable#getMetadata() | |
55 | */ | |
56 | public Map<String, Object> getMetadata() { | |
57 | 823 | return myMetadata; |
58 | } | |
59 | ||
60 | } |