public ERRSegment(char fieldSeparator, String encodingCharacters) { super(9, fieldSeparator, encodingCharacters); setField(0, "ERR"); setHL7ErrorCode(ApplicationInternalError); setSeverity("E"); }
public ERRSegment setErrorLocation(String errorLocation) { setField(2, errorLocation.replace('^', getComponentSeparator())); return this; }
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); }
@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); } } };
public ERRSegment setHL7ErrorCode(String hl7ErrorCode) { setField(3, hl7ErrorCode); return this; }
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); }
@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); } } };
public ERRSegment setUserMessage(String userMessage) { setField(8, userMessage); return this; } }
public ERRSegment setApplicationErrorCode(String applicationErrorCode) { setField(5, applicationErrorCode); return this; }
public ERRSegment setSeverity(String severity) { setField(4, severity); return this; }
public ERRSegment setApplicationErrorParameter(String applicationErrorParameter) { setField(6, applicationErrorParameter); return this; }
public ERRSegment setDiagnosticInformation(String diagnosticInformation) { setField(7, diagnosticInformation); return this; }