/** * {@inheritDoc} */ @Override public Message parse(String theMessage) throws HL7Exception { Message retVal = super.parse(theMessage); Parser parser = getAppropriateParser(theMessage); retVal.setParser(parser); return retVal; }
/** * {@inheritDoc} */ @Override public Message parse(String theMessage) throws HL7Exception { Message retVal = super.parse(theMessage); Parser parser = getAppropriateParser(theMessage); retVal.setParser(parser); return retVal; }
public <T extends Message> T newMessage(Class<T> clazz) throws HL7Exception { T msg = ReflectionUtil.instantiateMessage(clazz, getModelClassFactory()); msg.setParser(getGenericParser()); return msg; }
public <T extends Message> T newMessage(Class<T> clazz) throws HL7Exception { T msg = ReflectionUtil.instantiateMessage(clazz, getModelClassFactory()); msg.setParser(getGenericParser()); return msg; }
/** * 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; }
/** * Parse a message using a specific model package instead of the default, using * {@link ModelClassFactory#getMessageClassInASpecificPackage(String, String, boolean, String)} * . * * <b>WARNING: This method is only implemented in some parser implementations</b>. Currently it * will only work with the PipeParser parser implementation. Use with caution. * * @param message message string * @param packageName name of the package of the models * @return parsed message * @throws HL7Exception if an error occurred while parsing */ public Message parseForSpecificPackage(String message, String packageName) throws HL7Exception { String encoding = getEncoding(message); if (!supportsEncoding(encoding)) { throw new EncodingNotSupportedException("Can't parse message beginning " + message.substring(0, Math.min(message.length(), 50))); } String version = getVersion(message); assertVersionExists(version); assertMessageValidates(message, encoding, version); Message result = doParseForSpecificPackage(message, version, packageName); assertMessageValidates(result); result.setParser(this); return result; }
/** * Parse a message using a specific model package instead of the default, using * {@link ModelClassFactory#getMessageClassInASpecificPackage(String, String, boolean, String)} * . * * <b>WARNING: This method is only implemented in some parser implementations</b>. Currently it * will only work with the PipeParser parser implementation. Use with caution. * * @param message message string * @param packageName name of the package of the models * @return parsed message * @throws HL7Exception if an error occurred while parsing */ public Message parseForSpecificPackage(String message, String packageName) throws HL7Exception { String encoding = getEncoding(message); if (!supportsEncoding(encoding)) { throw new EncodingNotSupportedException("Can't parse message beginning " + message.substring(0, Math.min(message.length(), 50))); } String version = getVersion(message); assertVersionExists(version); assertMessageValidates(message, encoding, version); Message result = doParseForSpecificPackage(message, version, packageName); assertMessageValidates(result); result.setParser(this); return result; }
assertMessageValidates(result); result.setParser(this);
assertMessageValidates(result); result.setParser(this);
/** * {@inheritDoc } */ public Message generateACK(AcknowledgmentCode theAcknowledgementCode, HL7Exception theException) throws HL7Exception, IOException { if (theException != null && theException.getResponseMessage() != null) { return theException.getResponseMessage(); } Message out = instantiateACK(); out.setParser(getParser()); fillResponseHeader(out, theAcknowledgementCode); if (theException != null) { theException.populateResponse(out, theAcknowledgementCode, 0); } return out; }
/** * {@inheritDoc } */ public Message generateACK(AcknowledgmentCode theAcknowledgementCode, HL7Exception theException) throws HL7Exception, IOException { if (theException != null && theException.getResponseMessage() != null) { return theException.getResponseMessage(); } Message out = instantiateACK(); out.setParser(getParser()); fillResponseHeader(out, theAcknowledgementCode); if (theException != null) { theException.populateResponse(out, theAcknowledgementCode, 0); } return out; }