public static HL7Message makeACK(HL7Segment msh, HL7Exception e) { HL7Message ack = makeACK(msh, e.getAcknowledgmentCode(), e.getErrorMessage()); HL7Segment err = e.getErrorSegment(); if (err != null) ack.add(err); return ack; } }
public String getErrorMessage() { return getMessage(); }
public HL7Exception(HL7Segment err) { super(err.getField(8, null)); this.ack = toAck(err); this.err = err; }
@Override public UnparsedHL7Message onMessage(HL7Application hl7App, Connection conn, Socket s, UnparsedHL7Message msg) throws HL7Exception { try { return HL7Rcv.this.onMessage(msg); } catch (Exception e) { throw new HL7Exception( new ERRSegment(msg.msh()).setUserMessage(e.getMessage()), e); } } };
@Override public UnparsedHL7Message onMessage(HL7Application hl7App, Connection conn, Socket s, UnparsedHL7Message msg) throws HL7Exception { try { return HL7Rcv.this.onMessage(msg); } catch (Exception e) { throw new HL7Exception( new ERRSegment(msg.msh()).setUserMessage(e.getMessage()), e); } } };
UnparsedHL7Message onMessage(Connection conn, Socket s, UnparsedHL7Message msg) throws HL7Exception { HL7Segment msh = msg.msh(); if (!(isInstalled() && conns.contains(conn))) throw new HL7Exception( new ERRSegment(msh) .setHL7ErrorCode(ERRSegment.TableValueNotFound) .setErrorLocation(ERRSegment.UnknownReceivingApplication) .setUserMessage("Receiving Application not recognized")); if (!(acceptedSendingApplications.isEmpty() || acceptedSendingApplications.contains(msh.getSendingApplicationWithFacility()))) throw new HL7Exception( new ERRSegment(msh) .setHL7ErrorCode(ERRSegment.TableValueNotFound) .setErrorLocation(ERRSegment.UnknownSendingApplication) .setUserMessage("Sending Application not recognized")); String messageType = msh.getMessageType(); if (!(acceptedMessageTypes.contains("*") || acceptedMessageTypes.contains(messageType))) throw new HL7Exception( new ERRSegment(msh) .setHL7ErrorCode(unsupportedMessageTypeOrEventCode(messageType.substring(0,3))) .setUserMessage("Message Type not supported")); HL7MessageListener listener = getHL7MessageListener(); if (listener == null) throw new HL7Exception(new ERRSegment(msh) .setHL7ErrorCode(ERRSegment.ApplicationInternalError) .setUserMessage("No HL7 Message Listener configured")); return listener.onMessage(this, conn, s, msg); }
public HL7Exception(HL7Segment err, Throwable cause) { super(err.getField(8, null), cause); this.ack = toAck(err); this.err = err; }
UnparsedHL7Message onMessage(Connection conn, Socket s, UnparsedHL7Message msg) throws HL7Exception { HL7Application hl7App = getHL7Application(msg.msh().getReceivingApplicationWithFacility(), true); if (hl7App == null) throw new HL7Exception( new ERRSegment(msg.msh()) .setHL7ErrorCode(ERRSegment.TableValueNotFound) .setErrorLocation(ERRSegment.UnknownReceivingApplication) .setUserMessage("Receiving Application not recognized")); return hl7App.onMessage(conn, s, msg); }