Package ca.uhn.hl7v2.model

Examples of ca.uhn.hl7v2.model.MessageVisitors


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


                handleException("Error on writing HL7 Error to output stream", e);
            }
        } else {
            try {
                String xmlFormat = omElement.toString();
                Message message = new DefaultXMLParser().parse(xmlFormat);
                String msg = new PipeParser().encode(message);
                if (log.isDebugEnabled()) {
                    log.debug("Message inside the formatter : " + message);
                }
                outputStream.write(msg.getBytes());
View Full Code Here

     * Serialize HL7 message to XML
     * @param rowHL7
     * @return XML String
     */
    private String serializeHL7toXML(String rowHL7) {
        Parser xmlParser = new DefaultXMLParser();
        Parser ediParser = new PipeParser();
        ediParser.setValidationContext(new NoValidation());
        String xmlDoc = null;
        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);
        } catch (HL7Exception e) {
            handleException("Error on converting to HL7",e);
        }
        return xmlDoc;
    }
View Full Code Here

    private SOAPEnvelope createEnvelope(Message message) throws HL7Exception, XMLStreamException {
        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope envelope = fac.getDefaultEnvelope();

        Parser xmlParser = new DefaultXMLParser();
        String xmlDoc = xmlParser.encode(message);

        OMElement hl7Element = AXIOMUtil.stringToOM(xmlDoc);
        OMNamespace ns = fac.createOMNamespace("http://wso2.org/hl7", "hl7");
        OMElement topicOm = fac.createOMElement("message", ns);
        topicOm.addChild(hl7Element);
View Full Code Here

    private SOAPEnvelope createEnvelope(Message message) throws HL7Exception, XMLStreamException {
        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope envelope = fac.getDefaultEnvelope();

        Parser xmlParser = new DefaultXMLParser();
        String xmlDoc = xmlParser.encode(message);

        OMElement hl7Element = AXIOMUtil.stringToOM(xmlDoc);
        OMNamespace ns = fac.createOMNamespace("http://wso2.org/hl7", "hl7");
        OMElement topicOm = fac.createOMElement("message", ns);
        topicOm.addChild(hl7Element);
View Full Code Here

                                      + "GT1||0222PL|NOTREAL^BOB^B||STREET^OTHER STREET^CITY^ST^77787|(444)999-3333|(222)777-5555||||MO|111-33-5555||||NOTREAL GILL N|STREET^OTHER STREET^CITY^ST^99999|(111)222-3333\r"
                                      + "IN1||022254P|4558PD|BLUE CROSS|STREET^OTHER STREET^CITY^ST^00990||(333)333-6666||221K|LENIX|||19980515|19990515|||PATIENT01 TEST D||||||||||||||||||02LL|022LP554";


    public HL7Message() throws HL7Exception {
        Parser p = new GenericParser();
        adtMessage = p.parse(SAMPLE_MSG);
    }
View Full Code Here

        Parser p = new GenericParser();
        adtMessage = p.parse(SAMPLE_MSG);
    }

    public HL7Message(String msg) throws HL7Exception {
        Parser p = new GenericParser();
        adtMessage = p.parse(msg);
    }
View Full Code Here

        // Helper class
    }

    @Converter
    public static String toString(Message message) throws HL7Exception {
        Parser parser = new PipeParser();
        String encoded = parser.encode(message);
        return encoded;
    }
View Full Code Here

    @Converter
    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

                                      + "GT1||0222PL|NOTREAL^BOB^B||STREET^OTHER STREET^CITY^ST^77787|(444)999-3333|(222)777-5555||||MO|111-33-5555||||NOTREAL GILL N|STREET^OTHER STREET^CITY^ST^99999|(111)222-3333\r"
                                      + "IN1||022254P|4558PD|BLUE CROSS|STREET^OTHER STREET^CITY^ST^00990||(333)333-6666||221K|LENIX|||19980515|19990515|||PATIENT01 TEST D||||||||||||||||||02LL|022LP554";


    public HL7Message() throws HL7Exception {
        Parser p = new GenericParser();
        adtMessage = p.parse(SAMPLE_MSG);
    }
View Full Code Here

TOP

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

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.