parser.setValidationContext( validationContext ); Message msg = parser.parse( message ); Message ack = msg.generateACK();
/** * Generates an HL7v2 NAK response message on the basis * of the thrown exception and the original HAPI request message. * * @param exception thrown exception. * @param originalMessage original HAPI request message. * @param ackTypeCode HL7v2 acknowledgement type code. */ public Message createNak(Message originalMessage, HL7Exception exception, AcknowledgmentCode ackTypeCode) throws HL7Exception, IOException { return originalMessage.generateACK(ackTypeCode, exception); }
/** * Generates a transaction-specific HL7v2 ACK response message on the basis * of the original HAPI request message. * * @param originalMessage original HAPI request message. */ public Message createAck(Message originalMessage) throws HL7Exception, IOException { return originalMessage.generateACK(useCAckTypeCodes ? AcknowledgmentCode.CA : AcknowledgmentCode.AA, null); }
/** * Creates an ACK message with the minimum required information from an * inbound message. Optional fields can be filled in afterwards, before the * message is returned. Please note that MSH-10, the outbound message * control ID, is also set using the class * <code>ca.uhn.hl7v2.util.MessageIDGenerator</code>. Also note that the ACK * messages returned is the same version as the version stated in the * inbound MSH if there is a generic ACK for that version, otherwise a * version 2.4 ACK is returned. MSA-1 is set to AA by default. * * @param message message * the MSH segment if the inbound message * * @deprecated use {@link Message#generateACK()} */ public static Message makeACK(Message message) throws HL7Exception, IOException { return message.generateACK(); }
/** * Creates an ACK message with the minimum required information from an * inbound message. Optional fields can be filled in afterwards, before the * message is returned. Please note that MSH-10, the outbound message * control ID, is also set using the class * <code>ca.uhn.hl7v2.util.MessageIDGenerator</code>. Also note that the ACK * messages returned is the same version as the version stated in the * inbound MSH if there is a generic ACK for that version, otherwise a * version 2.4 ACK is returned. MSA-1 is set to AA by default. * * @param message message * the MSH segment if the inbound message * * @deprecated use {@link Message#generateACK()} */ public static Message makeACK(Message message) throws HL7Exception, IOException { return message.generateACK(); }
public Message processMessage(Message theMessage, Map<String, Object> theMetadata) throws ReceivingApplicationException { try { if (myMessage != null) { return theMessage.generateACK(myAcknowledgmentCode, new HL7Exception(myMessage)); } else { return theMessage.generateACK(myAcknowledgmentCode, null); } } catch (Exception e) { throw new ReceivingApplicationException("Couldn't create response message: " + e.getMessage()); } }
public Message processMessage(Message theMessage, Map<String, Object> theMetadata) throws ReceivingApplicationException { try { if (myMessage != null) { return theMessage.generateACK(myAcknowledgmentCode, new HL7Exception(myMessage)); } else { return theMessage.generateACK(myAcknowledgmentCode, null); } } catch (Exception e) { throw new ReceivingApplicationException("Couldn't create response message: " + e.getMessage()); } }
public Message generateACK() throws HL7Exception, IOException { return getDelegate().generateACK(); }
public Message generateACK(AcknowledgmentCode theAcknowlegementCode, HL7Exception theException) throws HL7Exception, IOException { return getDelegate().generateACK(theAcknowlegementCode, theException); }
public Message generateACK(String theAcknowlegementCode, HL7Exception theException) throws HL7Exception, IOException { return getDelegate().generateACK(theAcknowlegementCode, theException); }
public Message generateACK(String theAcknowlegementCode, HL7Exception theException) throws HL7Exception, IOException { return getDelegate().generateACK(theAcknowlegementCode, theException); }
public Message generateACK() throws HL7Exception, IOException { return getDelegate().generateACK(); }
public Message generateACK(AcknowledgmentCode theAcknowlegementCode, HL7Exception theException) throws HL7Exception, IOException { return getDelegate().generateACK(theAcknowlegementCode, theException); }
/** * @deprecated use {@link Message#generateACK()} */ public static Message makeACK(Segment inboundHeader) throws HL7Exception, IOException { // Make sure that the referenced message is not just a dummy DeepCopy.copy(inboundHeader, (Segment)inboundHeader.getMessage().get("MSH")); return inboundHeader.getMessage().generateACK(); }
/** * @deprecated use {@link Message#generateACK()} */ public static Message makeACK(Segment inboundHeader) throws HL7Exception, IOException { // Make sure that the referenced message is not just a dummy DeepCopy.copy(inboundHeader, (Segment)inboundHeader.getMessage().get("MSH")); return inboundHeader.getMessage().generateACK(); }
if (out == null) { Message in = getInMessage(inHeader); out = in.generateACK(defaultAcknowledgementMode, hl7e);
/** * 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); } }
private static Transportable makeAcceptAck(Transportable theMessage, String theAckCode, ErrorCode theErrorCode, String theDescription) throws HL7Exception { Segment header = ourParser.getCriticalResponseData(theMessage.getMessage()); Message dummy = header.getMessage(); // MSH header refers to dummy, but not the other way round! DeepCopy.copy(header, (Segment)dummy.get("MSH")); try { HL7Exception hl7e = new HL7Exception(theDescription, theErrorCode); AcknowledgmentCode code = theAckCode == null ? AcknowledgmentCode.CR : AcknowledgmentCode.valueOf(theAckCode); Message out = dummy.generateACK(code, hl7e); String originalEncoding = ourParser.getEncoding(theMessage.getMessage()); String ackText = ourParser.encode(out, originalEncoding); return new TransportableImpl(ackText); } catch (IOException e) { throw new HL7Exception(e); } }
private static Transportable makeAcceptAck(Transportable theMessage, String theAckCode, ErrorCode theErrorCode, String theDescription) throws HL7Exception { Segment header = ourParser.getCriticalResponseData(theMessage.getMessage()); Message dummy = header.getMessage(); // MSH header refers to dummy, but not the other way round! DeepCopy.copy(header, (Segment)dummy.get("MSH")); try { HL7Exception hl7e = new HL7Exception(theDescription, theErrorCode); AcknowledgmentCode code = theAckCode == null ? AcknowledgmentCode.CR : AcknowledgmentCode.valueOf(theAckCode); Message out = dummy.generateACK(code, hl7e); String originalEncoding = ourParser.getEncoding(theMessage.getMessage()); String ackText = ourParser.encode(out, originalEncoding); return new TransportableImpl(ackText); } catch (IOException e) { throw new HL7Exception(e); } }