Package parser

Examples of parser.Parser


        // 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

        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

     * 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());
       
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

        // 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

        }

        // convert to string
        String body;
        if (message instanceof Message) {
            Parser parser = new PipeParser();
            body = parser.encode((Message)message);
        } else if (message instanceof String) {
            body = (String)message;
        } else if (message instanceof byte[]) {
            body = new String((byte[])message);
        } else {
View Full Code Here

TOP

Related Classes of parser.Parser

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.