/** * Generates an empty response message. This class generates an * ACKnowledgement using the code returned by {@link #getSuccessAcknowledgementCode()}. * * @param request request message, either a {@link String} or a * {@link Message} * @return acknowledgment to the request * @throws HL7Exception */ protected Message generateResponseMessage(Object request) throws HL7Exception { try { Message in; if (request instanceof String) { Segment s = getHapiContext().getGenericParser().getCriticalResponseData( (String)request); in = s.getMessage(); DeepCopy.copy(s, (Segment) in.get("MSH")); } else if (request instanceof Message) { in = (Message) request; } else { throw new HL7Exception("Validated message must be either Message or String"); } return in.generateACK(getSuccessAcknowledgementCode(), null); } catch (IOException e) { throw new HL7Exception(e); } }
/** * Generates an empty response message. This class generates an * ACKnowledgement using the code returned by {@link #getSuccessAcknowledgementCode()}. * * @param request request message, either a {@link String} or a * {@link Message} * @return acknowledgment to the request * @throws HL7Exception */ protected Message generateResponseMessage(Object request) throws HL7Exception { try { Message in; if (request instanceof String) { Segment s = getHapiContext().getGenericParser().getCriticalResponseData( (String)request); in = s.getMessage(); DeepCopy.copy(s, (Segment) in.get("MSH")); } else if (request instanceof Message) { in = (Message) request; } else { throw new HL7Exception("Validated message must be either Message or String"); } return in.generateACK(getSuccessAcknowledgementCode(), null); } catch (IOException e) { throw new HL7Exception(e); } }