Package ca.uhn.hl7v2.model.v26.message

Examples of ca.uhn.hl7v2.model.v26.message.ACK


    }

    @Test
    public void testNakExpressionWithParameters() throws Exception {
        ADT_A01 a01 = createADT01Message();
        ACK ack = template.requestBody("direct:test4", a01, ACK.class);
        assertEquals("AR", ack.getMSA().getAcknowledgementCode().getValue());
        assertEquals(a01.getMSH().getMessageControlID().getValue(), ack.getMSA().getMessageControlID()
            .getValue());
        assertEquals(String.valueOf(ErrorCode.APPLICATION_INTERNAL_ERROR.getCode()), ack.getERR()
            .getErrorCodeAndLocation(0).getCodeIdentifyingError().getIdentifier().getValue());
        assertEquals("Problem!", ack.getERR().getErrorCodeAndLocation(0).getCodeIdentifyingError()
            .getAlternateText().getValue());
    }
View Full Code Here


    }

    @Test
    public void testNakExpressionWithoutException() throws Exception {
        ADT_A01 a01 = createADT01Message();
        ACK ack = template.requestBody("direct:test5", a01, ACK.class);
        assertEquals("AR", ack.getMSA().getAcknowledgementCode().getValue());
        assertEquals(a01.getMSH().getMessageControlID().getValue(), ack.getMSA().getMessageControlID()
            .getValue());
        assertEquals(String.valueOf(ErrorCode.DATA_TYPE_ERROR.getCode()), ack.getERR().getErrorCodeAndLocation(0)
            .getCodeIdentifyingError().getIdentifier().getValue());
        assertEquals("Problem!", ack.getERR().getErrorCodeAndLocation(0).getCodeIdentifyingError()
            .getAlternateText().getValue());
    }
View Full Code Here

public class AckExpressionTest extends CamelTestSupport {

    @Test
    public void testAckExpression() throws Exception {
        ADT_A01 a01 = createADT01Message();
        ACK ack = template.requestBody("direct:test1", a01, ACK.class);
        assertEquals("AA", ack.getMSA().getAcknowledgementCode().getValue());
        assertEquals(a01.getMSH().getMessageControlID().getValue(), ack.getMSA().getMessageControlID()
            .getValue());
    }
View Full Code Here

    }

    @Test
    public void testAckExpressionWithCode() throws Exception {
        ADT_A01 a01 = createADT01Message();
        ACK ack = template.requestBody("direct:test2", a01, ACK.class);
        assertEquals("CA", ack.getMSA().getAcknowledgementCode().getValue());
        assertEquals(a01.getMSH().getMessageControlID().getValue(), ack.getMSA().getMessageControlID()
            .getValue());
    }
View Full Code Here

    }

    @Test
    public void testNakExpression() throws Exception {
        ADT_A01 a01 = createADT01Message();
        ACK ack = template.requestBody("direct:test3", a01, ACK.class);
        assertEquals("AE", ack.getMSA().getAcknowledgementCode().getValue());
        assertEquals(a01.getMSH().getMessageControlID().getValue(), ack.getMSA().getMessageControlID()
            .getValue());
        assertEquals(String.valueOf(HL7Exception.APPLICATION_INTERNAL_ERROR), ack.getERR()
            .getErrorCodeAndLocation(0).getCodeIdentifyingError().getIdentifier().getValue());
    }
View Full Code Here

    }

    @Test
    public void testNakExpressionWithParameters() throws Exception {
        ADT_A01 a01 = createADT01Message();
        ACK ack = template.requestBody("direct:test4", a01, ACK.class);
        assertEquals("AR", ack.getMSA().getAcknowledgementCode().getValue());
        assertEquals(a01.getMSH().getMessageControlID().getValue(), ack.getMSA().getMessageControlID()
            .getValue());
        assertEquals(String.valueOf(HL7Exception.APPLICATION_INTERNAL_ERROR), ack.getERR()
            .getErrorCodeAndLocation(0).getCodeIdentifyingError().getIdentifier().getValue());
        assertEquals("Problem!", ack.getERR().getErrorCodeAndLocation(0).getCodeIdentifyingError()
            .getAlternateText().getValue());
    }
View Full Code Here

    }

    @Test
    public void testNakExpressionWithoutException() throws Exception {
        ADT_A01 a01 = createADT01Message();
        ACK ack = template.requestBody("direct:test5", a01, ACK.class);
        assertEquals("AR", ack.getMSA().getAcknowledgementCode().getValue());
        assertEquals(a01.getMSH().getMessageControlID().getValue(), ack.getMSA().getMessageControlID()
            .getValue());
        assertEquals(String.valueOf(HL7Exception.DATA_TYPE_ERROR), ack.getERR().getErrorCodeAndLocation(0)
            .getCodeIdentifyingError().getIdentifier().getValue());
        assertEquals("Problem!", ack.getERR().getErrorCodeAndLocation(0).getCodeIdentifyingError()
            .getAlternateText().getValue());
    }
View Full Code Here

        if (log.isDebugEnabled()) {
            log.debug("Inside the HL7 formatter" + omElement.toString());
        }
        if (msgCtx.getFLOW() == MessageContext.OUT_FAULT_FLOW || msgCtx.getEnvelope().hasFault()) {
            SOAPFault soapFault = msgCtx.getEnvelope().getBody().getFault();
            ACK ack = new ACK();
            try {
                //TODO : need to complete the values of the complete hl7 message, this will not properly construct by the parser
                ack.getMSH().getFieldSeparator().setValue(HL7Constants.HL7_FIELD_SEPARATOR);
                ack.getMSH().getEncodingCharacters().setValue(HL7Constants.HL7_ENCODING_CHARS);
                ack.getMSA().getAcknowledgmentCode().setValue(HL7Constants.HL7_ACK_CODE_AR);
                ack.getERR().getErrorCodeAndLocation(0).getCodeIdentifyingError().getIdentifier()
                        .setValue("Backend service reject the value");
                String msg = new PipeParser().encode(ack);
                if (log.isDebugEnabled()) {
                    log.debug("Generate HL7 error : " + ack);
                }
View Full Code Here

    String string = "MSH|^~\\&|ULTRA|TML|OLIS|OLIS|200905011130||ORU^R01|20169838|T|2.3\r"
      + "PID|||7005728\r"
      + "OBR|1\r"
      + "OBX|||||Sample Value\r";

    ORU_R01 msg = new ORU_R01();
    try {
      // This throws an exception
      msg.parse(string);
    } catch (Exception e) {
      e.printStackTrace();
      /*
       * Prints:
       * ca.uhn.hl7v2.HL7Exception: OBX-5 is valued, but OBX-2 is not.  A datatype for OBX-5 must be specified using OBX-2. See JavaDoc for Varies#fixOBX5(Segment, ModelClassFactory)
       * at ca.uhn.hl7v2.model.Varies.fixOBX5(Varies.java:189)
       * at ca.uhn.hl7v2.parser.PipeParser.parse(PipeParser.java:377)
       * at ca.uhn.hl7v2.parser.PipeParser.parse(PipeParser.java:1009)
       * at ca.uhn.hl7v2.model.AbstractMessage.parse(AbstractMessage.java:189)
       * at ca.uhn.hl7v2.examples.ParseInvalidObx2Values.main(ParseInvalidObx2Values.java:28)
       */
    }
   
    /*
     * Setting the following system property allows you to specify a default
     * value to assume if OBX-2 is missing.
     */   
    System.setProperty(Varies.DEFAULT_OBX2_TYPE_PROP, "ST");

    // Parsing now succeeds
    msg = new ORU_R01();
    msg.parse(string);

   
   
    /*
     * The following message has an invalid value in OBX-2
     */
    string = "MSH|^~\\&|ULTRA|TML|OLIS|OLIS|200905011130||ORU^R01|20169838|T|2.3\r"
      + "PID|||7005728\r"
      + "OBR|1\r"
      + "OBX||BAD|||Sample Value\r";
   
    msg = new ORU_R01();
    try {
      // This throws an exception
      msg.parse(string);
    } catch (Exception e) {
      e.printStackTrace();
      /*
       * Prints:
       * ca.uhn.hl7v2.HL7Exception: 'BAD' in record null is invalid for version 2.6. See JavaDoc for Varies#fixOBX5(Segment, ModelClassFactory): Segment: OBX Field #2
       * at ca.uhn.hl7v2.model.Varies.fixOBX5(Varies.java:212)
       * at ca.uhn.hl7v2.parser.PipeParser.parse(PipeParser.java:377)
       * at ca.uhn.hl7v2.parser.PipeParser.parse(PipeParser.java:1009)
       * at ca.uhn.hl7v2.model.AbstractMessage.parse(AbstractMessage.java:189)
       * at ca.uhn.hl7v2.examples.ParseInvalidObx2Values.main(ParseInvalidObx2Values.java:62)
       */
    }
   
    /*
     * Setting the following system property allows you to specify a default
     * value to assume if OBX-2 is missing.
     */   
    System.setProperty(Varies.INVALID_OBX2_TYPE_PROP, "ST");

    // Parsing now succeeds
    msg = new ORU_R01();
    msg.parse(string);
   
   
  }
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.v26.message.ACK

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.