final HL7Message message; try { final Message hapiMessage = parser.parse(hl7Text); message = new HapiMessage(hapiMessage); } catch (final Exception e) {
final String hl7Text = new String(buffer, charset); try { final Message message = parser.parse(hl7Text); final Map<String, String> attributes = getAttributes(message, useSegmentNames, parseSegmentFields); flowFile = session.putAllAttributes(flowFile, attributes);
/** * Parses a segment string and populates the given Segment object. * Unexpected fields are added as Varies' at the end of the segment. * * @param destination segment to parse the segment string into * @param segment encoded segment * @param encodingChars encoding characters to be used * @throws HL7Exception * if the given string does not contain the given segment or if * the string is not encoded properly */ public void parse(Segment destination, String segment, EncodingCharacters encodingChars) throws HL7Exception { parse(destination, segment, encodingChars, 0); }
/** * Parses a segment string and populates the given Segment object. * Unexpected fields are added as Varies' at the end of the segment. * * @param destination segment to parse the segment string into * @param segment encoded segment * @param encodingChars encoding characters to be used * @throws HL7Exception * if the given string does not contain the given segment or if * the string is not encoded properly */ public void parse(Segment destination, String segment, EncodingCharacters encodingChars) throws HL7Exception { parse(destination, segment, encodingChars, 0); }
public Message parse(String theMessage) throws HL7Exception, EncodingNotSupportedException { theMessage = theMessage.replace("\rPI|", "\rPID|"); return super.parse(theMessage); }};
/** * {@inheritDoc} */ protected Message doParseForSpecificPackage(String message, String version, String packageName) throws HL7Exception { // try to instantiate a message object of the right class MessageStructure structure = getStructure(message); Message m = instantiateMessageInASpecificPackage(structure.messageStructure, version, structure.explicitlyDefined, packageName); parse(m, message); return m; }
/** * {@inheritDoc} */ protected Message doParseForSpecificPackage(String message, String version, String packageName) throws HL7Exception { // try to instantiate a message object of the right class MessageStructure structure = getStructure(message); Message m = instantiateMessageInASpecificPackage(structure.messageStructure, version, structure.explicitlyDefined, packageName); parse(m, message); return m; }
Message message = pipeParser.parse(ackMessageString);
/** * Parses a message string and returns the corresponding Message object. * Unexpected segments added at the end of their group. * * @throws HL7Exception * if the message is not correctly formatted. * @throws EncodingNotSupportedException * if the message encoded is not supported by this parser. */ protected Message doParse(String message, String version) throws HL7Exception { // try to instantiate a message object of the right class MessageStructure structure = getStructure(message); Message m = instantiateMessage(structure.messageStructure, version, structure.explicitlyDefined); m.setParser(this); parse(m, message); return m; }
/** * Parses a message string and returns the corresponding Message object. * Unexpected segments added at the end of their group. * * @throws HL7Exception * if the message is not correctly formatted. * @throws EncodingNotSupportedException * if the message encoded is not supported by this parser. */ protected Message doParse(String message, String version) throws HL7Exception { // try to instantiate a message object of the right class MessageStructure structure = getStructure(message); Message m = instantiateMessage(structure.messageStructure, version, structure.explicitlyDefined); m.setParser(this); parse(m, message); return m; }
parser.parse(validMessage); System.out.println("Successfully parsed valid message"); } catch (HL7Exception e) { parser.parse(invalidMessage); parser.parse(invalidMessage); System.out.println("Successfully parsed invalid message"); } catch (HL7Exception e) { + "PID|1||29^^CAISI_1-2^PI~\"\"||Test300^Leticia^^^^^L||19770202|M||||||||||||||||||||||"; try { Message parsedMessage = parser.parse(invalidMessage);
ca.uhn.hl7v2.model.v25.message.ORU_R01 msg = (ORU_R01) parser.parse(v23message); msg = (ORU_R01) parser.parse(v25message); Message v23Message = parser.parse(v23message); Terser t23 = new Terser(v23Message); System.out.println(t23.get("/MSH-10")); Message v25Message = parser.parse(v25message); Terser t25 = new Terser(v25Message); System.out.println(t25.get("/MSH-10"));
+ "EVN|A31|200903230934\r\n" + "PID|1||29^^CAISI_1-2^PI~\"\"||Test300^Leticia^^^^^L||19770202|M||||||||||||||||||||||"; Message validMessage = new PipeParser().parse(validMessageString);
if (messageIter.hasNext()) { Segment next = (Segment) messageIter.next(); parse(next, segments[i], getEncodingChars(string), repNum);
if (messageIter.hasNext()) { Segment next = (Segment) messageIter.next(); parse(next, segments[i], getEncodingChars(string), repNum);
ADT_A01 message = (ADT_A01) new PipeParser().parse(messageText);
Terser.getPrimitive(field, 1, 1).setValue(reps[j]); } else { parse(field, reps[j], encodingChars);
Terser.getPrimitive(field, 1, 1).setValue(reps[j]); } else { parse(field, reps[j], encodingChars);
/** * {@inheritDoc} */ public Message next() { String nextString = myWrapped.next(); Message retVal; try { if (myMessageType != null) { retVal = ReflectionUtil.instantiateMessage(myMessageType, getHapiContext().getModelClassFactory()); retVal.parse(nextString); } else { retVal = getHapiContext().getPipeParser().parse(nextString); } } catch (EncodingNotSupportedException e) { throw new Hl7InputStreamMessageStringIterator.ParseFailureError("Failed to parse message", e); } catch (HL7Exception e) { throw new Hl7InputStreamMessageStringIterator.ParseFailureError("Failed to parse message", e); } return retVal; }
/** * {@inheritDoc} */ public Message next() { String nextString = myWrapped.next(); Message retVal; try { if (myMessageType != null) { retVal = ReflectionUtil.instantiateMessage(myMessageType, getHapiContext().getModelClassFactory()); retVal.parse(nextString); } else { retVal = getHapiContext().getPipeParser().parse(nextString); } } catch (EncodingNotSupportedException e) { throw new Hl7InputStreamMessageStringIterator.ParseFailureError("Failed to parse message", e); } catch (HL7Exception e) { throw new Hl7InputStreamMessageStringIterator.ParseFailureError("Failed to parse message", e); } return retVal; }