Search in sources :

Example 6 with Terser

use of ca.uhn.hl7v2.util.Terser in project pentaho-kettle by pentaho.

the class HL7KettleParser method extractValues.

public static List<HL7Value> extractValues(Message message) throws Exception {
    Terser terser = new Terser(message);
    SegmentFinder finder = terser.getFinder();
    List<HL7Value> values = new ArrayList<HL7Value>();
    int childNr = 1;
    while (finder.hasNextChild()) {
        // next group in the message (MSH, PID, EVN and so on)
        // 
        finder.nextChild();
        Structure[] structures = finder.getCurrentChildReps();
        for (int i = 0; i < structures.length; i++) {
            Structure structure = structures[i];
            parseStructure(values, message, terser, structure, Integer.toString(childNr));
        }
        childNr++;
    }
    return values;
}
Also used : Terser(ca.uhn.hl7v2.util.Terser) SegmentFinder(ca.uhn.hl7v2.util.SegmentFinder) ArrayList(java.util.ArrayList) Structure(ca.uhn.hl7v2.model.Structure)

Aggregations

Terser (ca.uhn.hl7v2.util.Terser)3 DefaultHapiContext (ca.uhn.hl7v2.DefaultHapiContext)2 Message (ca.uhn.hl7v2.model.Message)2 Structure (ca.uhn.hl7v2.model.Structure)2 ValidationRuleBuilder (ca.uhn.hl7v2.validation.builder.ValidationRuleBuilder)2 ArrayList (java.util.ArrayList)2 HapiContext (ca.uhn.hl7v2.HapiContext)1 Group (ca.uhn.hl7v2.model.Group)1 Segment (ca.uhn.hl7v2.model.Segment)1 Type (ca.uhn.hl7v2.model.Type)1 GenericParser (ca.uhn.hl7v2.parser.GenericParser)1 Parser (ca.uhn.hl7v2.parser.Parser)1 SegmentFinder (ca.uhn.hl7v2.util.SegmentFinder)1 ValidationContext (ca.uhn.hl7v2.validation.ValidationContext)1 NoValidation (ca.uhn.hl7v2.validation.impl.NoValidation)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 RouteBuilder (org.apache.camel.builder.RouteBuilder)1 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)1