Package ca.uhn.hl7v2

Examples of ca.uhn.hl7v2.HL7Exception


    @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

     */
    public static EncodingCharacters getInstance(Message message) throws HL7Exception {

        final String encodingCharactersValue = message.getEncodingCharactersValue();
        if (encodingCharactersValue == null || encodingCharactersValue.length() == 0) {
            throw new HL7Exception("encoding characters not populated");
        }

        final Character fieldSeparatorValue = message.getFieldSeparatorValue();
        if (fieldSeparatorValue == null) {
            throw new HL7Exception("Field separator not populated");
        }

        return new EncodingCharacters(fieldSeparatorValue, encodingCharactersValue);
    }
View Full Code Here

    /**
     * Finds appropriate classes to be loaded for the given structure/type
     */
    protected Class<?> findClass(String subpackage, String name, String version) throws HL7Exception {
        if (!Parser.validVersion(version)) {
            throw new HL7Exception("HL7 version " + version + " is not supported",
                    HL7Exception.UNSUPPORTED_VERSION_ID);
        }
        Class<?> classLoaded = null;
        if (customModelClasses != null) {
            if (customModelClasses.containsKey(version)) {
View Full Code Here

                }
            }
            reader.close();           
            finish(eventName, spec, result);
        } catch (IOException e) {
            throw new HL7Exception(e);
        }
       
        return result;
    }
View Full Code Here

        } else if (components[0] != null && components[0].equals("ACK")) {
            structure = "ACK";
        } else if (components[0] != null && components[1] != null) {
            structure = components[0] + "_" + components[1];
        } else {
            throw new HL7Exception("Can't determine message structure from MSH-9: " + msh9,
                    HL7Exception.UNSUPPORTED_MESSAGE_TYPE);
        }
       
        if (components[1] == null) {
            event = components[0];
View Full Code Here

TOP

Related Classes of ca.uhn.hl7v2.HL7Exception

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.