Package ca.uhn.hl7v2.model

Examples of ca.uhn.hl7v2.model.GenericSegment


    public Type getComponent(int number) throws DataTypeException {

        try {
            return this.data[number];
        } catch (ArrayIndexOutOfBoundsException e) {
            throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)");
        }
    }
View Full Code Here


          Object[] constructorParamArgs = { dummy, factory };
          Constructor<? extends Segment> constructor = c.getConstructor(constructorParamTypes);
          msh = constructor.newInstance(constructorParamArgs);
        }
      } else {
        msh = new GenericSegment(dummy, "MSH");     
      }
    } catch (Exception e) {
      throw new HL7Exception("Couldn't create MSH for version " + version
          + " (does your classpath include this version?) ... ", e);
    }
View Full Code Here

    /**
     * Returns
     * GenericSegment (any order segment) - creates it if necessary
     */
    public GenericSegment getGenericSegment() {
       GenericSegment ret = null;
       try {
          ret = (GenericSegment)this.get("GenericSegment");
       } catch(HL7Exception e) {
          HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
          throw new RuntimeException(e);
View Full Code Here

    /**
     * Returns
     * GenericSegment (any order segment) - creates it if necessary
     */
    public GenericSegment getGenericSegment() {
       GenericSegment ret = null;
       try {
          ret = (GenericSegment)this.get("GenericSegment");
       } catch(HL7Exception e) {
          LoggerFactory.getLogger(getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
          throw new RuntimeException(e);
View Full Code Here

          Object[] constructorParamArgs = { dummy, factory };
          Constructor<? extends Segment> constructor = c.getConstructor(constructorParamTypes);
          msh = constructor.newInstance(constructorParamArgs);
        }
      } else {
        msh = new GenericSegment(dummy, "MSH");     
      }
    } catch (Exception e) {
      throw new HL7Exception("Couldn't create MSH for version " + version
          + " (does your classpath include this version?) ... ", e);
    }
View Full Code Here

        return new RouteBuilder() {
            public void configure() throws Exception {
                from("mina2:tcp://127.0.0.1:" + getPort() + "?sync=true&codec=#hl7codec")
                    .process(new Processor() {
                        public void process(Exchange exchange) throws Exception {
                            Message input = exchange.getIn().getBody(Message.class);

                            assertEquals("2.4", input.getVersion());
                            QRD qrd = (QRD)input.get("QRD");
                            assertEquals("0101701234", qrd.getWhoSubjectFilter(0).getIDNumber().getValue());

                            Message response = createHL7AsMessage();
                            exchange.getOut().setBody(response);
                        }
                    })
                    .to("mock:result");
            }
View Full Code Here

        return new RouteBuilder() {
            public void configure() throws Exception {
                from("mina2:tcp://127.0.0.1:" + getPort() + "?sync=true&codec=#hl7codec")
                    .process(new Processor() {
                        public void process(Exchange exchange) throws Exception {
                            Message input = exchange.getIn().getBody(Message.class);

                            assertEquals("2.4", input.getVersion());
                            QRD qrd = (QRD)input.get("QRD");
                            assertEquals("0101701234", qrd.getWhoSubjectFilter(0).getIDNumber().getValue());

                            Message response = createHL7AsMessage();
                            exchange.getOut().setBody(response);
                        }
                    })
                    .to("mock:result");
            }
View Full Code Here

    @Test
    public void testDefaultValidationContext() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:test1");
        mock.expectedMessageCount(1);
        Message msg = createADT01Message();
        template.sendBody("direct:test1", msg);
        assertMockEndpointsSatisfied();
    }
View Full Code Here

    @Test(expected = CamelExecutionException.class)
    public void testCustomValidationContext() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:test2");
        mock.expectedMessageCount(0);
        Message msg = createADT01Message();
        template.sendBody("direct:test2", msg);
        assertMockEndpointsSatisfied();
    }
View Full Code Here

    @Test
    public void testDynamicCustomValidationContext() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:test3");
        mock.expectedMessageCount(1);
        Message msg = createADT01Message();
        template.sendBodyAndHeader("direct:test3", msg, "validator", defaultContext);
        assertMockEndpointsSatisfied();
    }
View Full Code Here

TOP

Related Classes of ca.uhn.hl7v2.model.GenericSegment

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.