Package ca.uhn.hl7v2.protocol

Examples of ca.uhn.hl7v2.protocol.Transportable


        if ( !(theMessage instanceof TextMessage)) {
            throw new TransportException("This implementation expects getMessage() to return "
                + " a TextMessage.  Override this method if another message type is to be used");
        }
       
        Transportable result = null;
        try {
            String text = ((TextMessage) theMessage).getText();
            result = new TransportableImpl(text);
            result.getMetadata().putAll(getCommonMetadata());
        } catch (JMSException e) {
            throw new TransportException(e);
        }

        return result;
View Full Code Here


   
    /**
     * @see ca.uhn.hl7v2.protocol.AbstractTransport#doReceive()
     */
    public Transportable doReceive() throws TransportException {
        Transportable result = null;
        try {
            Message message = receiveJMS();
            result = toTransportable(message);
        } catch (JMSException e) {
            throw new TransportException(e);           
View Full Code Here

        AcceptValidator[] validators = theContext.getValidators();
        for (int i = 0; i < validators.length && ruling == null; i++) {
            AcceptValidator.AcceptRuling vr = validators[i].check(theMessage);           
            if (!vr.isAcceptable()) {
                String description = (vr.getReasons().length > 0) ? vr.getReasons()[0] : null;
                Transportable ack = makeAcceptAck(theMessage, vr.getAckCode(), ErrorCode.errorCodeFor(vr.getErrorCode()), description);
                ruling = new AcceptACK(false, ack);
            }
        }
       
        if (ruling == null) {
            try {
                theContext.getSafeStorage().store(theMessage);
                Transportable ack = makeAcceptAck(theMessage, Processor.CA, ErrorCode.MESSAGE_ACCEPTED, "");
                ruling = new AcceptACK(true, ack);
            } catch (HL7Exception e) {
                log.error(e.getMessage(), e);
                Transportable ack = makeAcceptAck(theMessage, Processor.CR, ErrorCode.APPLICATION_INTERNAL_ERROR, e.getMessage());
                ruling = new AcceptACK(false, ack);
            }
        }       
       
        return ruling;
View Full Code Here

    /**
     * @see ca.uhn.hl7v2.protocol.ApplicationRouter#processMessage(ca.uhn.hl7v2.protocol.Transportable)
     */
    public Transportable processMessage(Transportable theMessage) throws HL7Exception {
        String[] result = processMessage(theMessage.getMessage(), theMessage.getMetadata());
        Transportable response = new TransportableImpl(result[0]);
       
        if (result[1] != null) {
            response.getMetadata().put(METADATA_KEY_MESSAGE_CHARSET, result[1]);
        }
       
        return response;
    }
View Full Code Here

        if ( !(theMessage instanceof TextMessage)) {
            throw new TransportException("This implementation expects getMessage() to return "
                + " a TextMessage.  Override this method if another message type is to be used");
        }
       
        Transportable result = null;
        try {
            String text = ((TextMessage) theMessage).getText();
            result = new TransportableImpl(text);
            result.getMetadata().putAll(getCommonMetadata());
        } catch (JMSException e) {
            throw new TransportException(e);
        }

        return result;
View Full Code Here

   
    /**
     * @see ca.uhn.hl7v2.protocol.AbstractTransport#doReceive()
     */
    public Transportable doReceive() throws TransportException {
        Transportable result = null;
        try {
            Message message = myInbound.receive();
            result = toTransportable(message);
        } catch (JMSException e) {
            throw new TransportException(e);           
View Full Code Here

        if ( !(theMessage instanceof TextMessage)) {
            throw new TransportException("This implementation expects getMessage() to return "
                + " a TextMessage.  Override this method if another message type is to be used");
        }
       
        Transportable result = null;
        try {
            String text = ((TextMessage) theMessage).getText();
            result = new TransportableImpl(text);
            result.getMetadata().putAll(getCommonMetadata());
        } catch (JMSException e) {
            throw new TransportException(e);
        }

        return result;
View Full Code Here

   
    /**
     * @see ca.uhn.hl7v2.protocol.AbstractTransport#doReceive()
     */
    public Transportable doReceive() throws TransportException {
        Transportable result = null;
        try {
            Message message = receiveJMS();
            result = toTransportable(message);
        } catch (JMSException e) {
            throw new TransportException(e);           
View Full Code Here

        AcceptValidator[] validators = theContext.getValidators();
        for (int i = 0; i < validators.length && ruling == null; i++) {
            AcceptValidator.AcceptRuling vr = validators[i].check(theMessage);           
            if (!vr.isAcceptable()) {
                String description = (vr.getReasons().length > 0) ? vr.getReasons()[0] : null;
                Transportable ack = makeAcceptAck(theMessage, vr.getAckCode(), vr.getErrorCode(), description);
                ruling = new AcceptACK(false, ack);
            }
        }
       
        if (ruling == null) {
            try {
                theContext.getSafeStorage().store(theMessage);
                Transportable ack = makeAcceptAck(theMessage, Processor.CA, HL7Exception.MESSAGE_ACCEPTED, "");
                ruling = new AcceptACK(true, ack);
            } catch (HL7Exception e) {
                log.error(e);
                int code = HL7Exception.APPLICATION_INTERNAL_ERROR;
                Transportable ack = makeAcceptAck(theMessage, Processor.CR, code, e.getMessage());
                ruling = new AcceptACK(false, ack);
            }
        }       
       
        return ruling;
View Full Code Here

    /**
     * @see ca.uhn.hl7v2.protocol.ApplicationRouter#processMessage(ca.uhn.hl7v2.protocol.Transportable)
     */
    public Transportable processMessage(Transportable theMessage) throws HL7Exception {
        String[] result = processMessage(theMessage.getMessage(), theMessage.getMetadata());
        Transportable response = new TransportableImpl(result[0]);
       
        if (result[1] != null) {
            response.getMetadata().put("MSH-18", result[1]);
        }
       
        return response;
    }
View Full Code Here

TOP

Related Classes of ca.uhn.hl7v2.protocol.Transportable

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.