1
2
3
4 package ca.uhn.hl7v2.protocol.impl;
5
6 import java.util.HashMap;
7 import java.util.List;
8 import java.util.Map;
9
10 import ca.uhn.hl7v2.HL7Exception;
11 import ca.uhn.hl7v2.model.Message;
12 import ca.uhn.hl7v2.util.Terser;
13
14
15
16
17
18
19
20
21 public class MetadataExtractor {
22
23
24
25
26
27
28
29 public static Map<String, String> getFields(Message theMessage, List<String> theTerserPaths) throws HL7Exception {
30 Map<String, String> fields = new HashMap<>();
31 Terserhtml#Terser">Terser terser = new Terser(theMessage);
32 for (String path : theTerserPaths) {
33 String fieldValue = terser.get(path);
34 fields.put(path, fieldValue);
35 }
36 return fields;
37 }
38
39 }