Package ca.uhn.hl7v2.model.primitive

Examples of ca.uhn.hl7v2.model.primitive.ID


        String body = createHL7AsString();
        template.sendBody("direct:unmarshal", body);

        assertMockEndpointsSatisfied();

        Message msg = mock.getExchanges().get(0).getIn().getBody(Message.class);
        assertEquals("2.4", msg.getVersion());
        QRD qrd = (QRD) msg.get("QRD");
        assertEquals("0101701234", qrd.getWhoSubjectFilter(0).getIDNumber().getValue());
    }
View Full Code Here


* @see org.apache.camel.component.hl7.HL7MLLPCodec
*/
public class HL7DataFormat implements DataFormat {

    public void marshal(Exchange exchange, Object body, OutputStream outputStream) throws Exception {
        Message message = ExchangeHelper.convertToMandatoryType(exchange, Message.class, body);
        String encoded = HL7Converter.toString(message);
        outputStream.write(encoded.getBytes());
    }
View Full Code Here

        outputStream.write(encoded.getBytes());
    }

    public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
        String body = ExchangeHelper.convertToMandatoryType(exchange, String.class, inputStream);
        Message message = HL7Converter.toMessage(body);

        // add MSH fields as message out headers
        Terser terser = new Terser(message);
        exchange.getOut().setHeader(HL7Constants.HL7_SENDING_APPLICATION, terser.get("MSH-3"));
        exchange.getOut().setHeader(HL7Constants.HL7_SENDING_FACILITY, terser.get("MSH-4"));
View Full Code Here

    public static Message toMessage(String body) throws HL7Exception {
        // replace \n with \r as HL7 uses 0x0d = \r as segment terminators and HAPI only parses with \r
        body = body.replace('\n', '\r');

        Parser parser = new PipeParser();
        Message message = parser.parse(body);
        return message;
    }
View Full Code Here

        String encodedMessage = new PipeParser().encode(theIn);
        System.out.println("Received message:\n" + encodedMessage + "\n\n");

        // Now we need to generate a message to return. This will generally be an ACK message.
        Segment msh = (Segment) theIn.get("MSH");
        Message retVal;
        try {
            // This method takes in the MSH segment of an incoming message, and generates an
            // appropriate ACK
            retVal = DefaultApplication.makeACK(msh);
View Full Code Here

        if (theAcknowledgementCode == null) {
            theAcknowledgementCode = "AA";
        }

        Segment msa = (Segment)retVal.get("MSA");
        ID ackCode = (ID) msa.getField(1, 0);
        ackCode.setValue(theAcknowledgementCode);

        if (theException != null) {
            Segment err = (Segment) retVal.get("ERR");
            theException.populate(err, null);
        }
View Full Code Here

        if (theAcknowledgementCode == null) {
            theAcknowledgementCode = "AA";
        }

        Segment msa = (Segment)retVal.get("MSA");
        ID ackCode = (ID) msa.getField(1, 0);
        ackCode.setValue(theAcknowledgementCode);

        if (theException != null) {
            Segment err = (Segment) retVal.get("ERR");
            theException.populate(err, null);
        }
View Full Code Here

        if (theAcknowledgementCode == null) {
            theAcknowledgementCode = "AA";
        }

        Segment msa = (Segment)retVal.get("MSA");
        ID ackCode = (ID) msa.getField(1, 0);
        ackCode.setValue(theAcknowledgementCode);

        if (theException != null) {
            Segment err = (Segment) retVal.get("ERR");
            theException.populate(err, null);
        }
View Full Code Here

        if (theAcknowledgementCode == null) {
            theAcknowledgementCode = "AA";
        }

        Segment msa = (Segment)retVal.get("MSA");
        ID ackCode = (ID) msa.getField(1, 0);
        ackCode.setValue(theAcknowledgementCode);

        if (theException != null) {
            Segment err = (Segment) retVal.get("ERR");
            theException.populate(err, null);
        }
View Full Code Here

    /**
     * Creates a new ADT_AXX message with DefaultModelClassFactory.
     */
    public ADT_AXX() {
       this(new DefaultModelClassFactory());
    }
View Full Code Here

TOP

Related Classes of ca.uhn.hl7v2.model.primitive.ID

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.