Package ca.uhn.hl7v2

Examples of ca.uhn.hl7v2.AcknowledgmentCode


    public Object evaluate(Exchange exchange) {
        Throwable t = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class);
        Message msg = exchange.getIn().getBody(Message.class);
        try {
            HL7Exception hl7e = generateHL7Exception(t);
            AcknowledgmentCode code = acknowledgementCode;
            if (t != null && code == null) {
                code = AcknowledgmentCode.AE;
            }
            return msg.generateACK(code == null ? AcknowledgmentCode.AA : code, hl7e);
        } catch (Exception e) {
View Full Code Here


    /**
     * {@inheritDoc }
     * @deprecated
     */
    public Message generateACK(String theAcknowledgementCode, HL7Exception theException) throws HL7Exception, IOException {
      AcknowledgmentCode theCode = theAcknowledgementCode == null ?
          AcknowledgmentCode.AA :
          AcknowledgmentCode.valueOf(theAcknowledgementCode);
        return generateACK(theCode, theException);
    }
View Full Code Here

        // 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);
View Full Code Here

    /**
     * {@inheritDoc }
     * @deprecated
     */
    public Message generateACK(String theAcknowledgementCode, HL7Exception theException) throws HL7Exception, IOException {
      AcknowledgmentCode theCode = theAcknowledgementCode == null ?
          AcknowledgmentCode.AA :
          AcknowledgmentCode.valueOf(theAcknowledgementCode);
        return generateACK(theCode, theException);
    }
View Full Code Here

    @Override
    public Object evaluate(Exchange exchange) {
        Throwable t = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class);
        Message msg = exchange.getIn().getBody(Message.class);
        try {
            HL7Exception hl7e = generateHL7Exception(t);
            AckCode code = acknowledgementCode;
            if (t != null && code == null) {
                code = AckCode.AE;
            }
            return msg.generateACK(code == null ? AcknowledgmentCode.AA : code.toAcknowledgmentCode(), hl7e);
View Full Code Here

            throw ObjectHelper.wrapRuntimeCamelException(e);
        }
    }

    private HL7Exception generateHL7Exception(Throwable t) {
        HL7Exception hl7Exception = null;
        if (t == null) {
            if (acknowledgementCode != null && acknowledgementCode.isError()) {
                hl7Exception = new HL7Exception(errorMessage, errorCode);
            }
        } else {
            if (t instanceof HL7Exception) {
                hl7Exception = (HL7Exception)t;
            } else {
                hl7Exception = new HL7Exception(errorMessage != null ? errorMessage : t.getMessage(),
                                                errorCode, t);
            }
        }
        return hl7Exception;
    }
View Full Code Here

        try {
            Message message = ediParser.parse(rowHL7);
            ConformanceProfileRule rule = new ConformanceProfileRule();
        ValidationException[] exs = rule.test(message);
        if (exs != null && exs.length > 0) {
          throw new HL7Exception(exs[0].getMessage());
       
            if(log.isDebugEnabled()){
                log.debug("HL7 parsing completed." + message);
            }
            xmlDoc = xmlParser.encode(message);
View Full Code Here

        try {
            // This method takes in the MSH segment of an incoming message, and generates an
            // appropriate ACK
            retVal = DefaultApplication.makeACK(msh);
        } catch (IOException e) {
            throw new HL7Exception(e);
        }

        return retVal;
    }
View Full Code Here

        try {
            return message.generateACK();
        } catch (IOException e) {
            String msg = "Error while constructing an HL7 ACK";
            log.error(msg, e);
            throw new HL7Exception(msg, e);
        }
    }
View Full Code Here

    private Message createNAck(Message message, String error, Throwable t) throws HL7Exception {
        log.error(error, t);

        try {
            return message.generateACK("AE", new HL7Exception(error, t));
        } catch (IOException e) {
            String msg = "Error while constructing an HL7 NACK";
            log.error(msg, e);
            throw new HL7Exception(msg, e);
        }
    }
View Full Code Here

TOP

Related Classes of ca.uhn.hl7v2.AcknowledgmentCode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.