use of org.apache.nifi.hl7.model.HL7Segment in project nifi by apache.
the class HapiMessage method populateSegments.
private void populateSegments(final Group group, final List<HL7Segment> segments) throws HL7Exception {
for (final String structureName : group.getNames()) {
final Structure[] structures = group.getAll(structureName);
if (group.isGroup(structureName)) {
for (final Structure structure : structures) {
populateSegments((Group) structure, segments);
}
} else {
for (final Structure structure : structures) {
final Segment segment = (Segment) structure;
final HapiSegment hapiSegment = new HapiSegment(segment);
segments.add(hapiSegment);
}
}
}
}
use of org.apache.nifi.hl7.model.HL7Segment in project nifi by apache.
the class FieldEvaluator method evaluate.
public List<HL7Field> evaluate(final Map<String, Object> objectMap) {
final List<HL7Segment> segments = segmentEvaluator.evaluate(objectMap);
if (segments == null) {
return Collections.emptyList();
}
final Integer index = indexEvaluator.evaluate(objectMap);
if (index == null) {
return Collections.emptyList();
}
final List<HL7Field> fields = new ArrayList<>();
for (final HL7Segment segment : segments) {
final List<HL7Field> segmentFields = segment.getFields();
if (segmentFields.size() <= index) {
continue;
}
fields.add(segmentFields.get(index));
}
return fields;
}
use of org.apache.nifi.hl7.model.HL7Segment in project nifi by apache.
the class SegmentEvaluator method evaluate.
public List<HL7Segment> evaluate(final Map<String, Object> objectMap) {
final String segmentType = segmentTypeEvaluator.evaluate(objectMap);
if (segmentType == null) {
return Collections.emptyList();
}
final HL7Message message = (HL7Message) objectMap.get(Evaluator.MESSAGE_KEY);
final List<HL7Segment> segments = message.getSegments(segmentType);
return (segments == null) ? Collections.<HL7Segment>emptyList() : segments;
}
Aggregations