Package ca.uhn.hl7v2.parser

Examples of ca.uhn.hl7v2.parser.PipeParser


    private Connection getConnection(String targetEPR, ConnectionHub hub) throws AxisFault {
        try {
            URI url = new URI(targetEPR);
            String targetHost = url.getHost();
            int targetPort = url.getPort();
            return hub.attach(targetHost, targetPort, new PipeParser(),
                    MinLowerLayerProtocol.class);
        } catch (URISyntaxException e) {
            handleException("Malformed HL7 URI syntax: " + targetEPR, e);
        } catch (HL7Exception e) {
            handleException("Error while obtaining HL7 connection to: " + targetEPR, e);
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

            System.out.println("Usage: TreePanel msg_file_name");
            System.exit(1);
        }
       
        try {           
            PipeParser parser = new PipeParser();
            File messageFile = new File(args[0]);
            long fileLength = messageFile.length();
            FileReader r = new FileReader(messageFile);
            char[] cbuf = new char[(int)fileLength];
            System.out.println("Reading message file ... " + r.read(cbuf) + " of " + fileLength + " chars");
            r.close();
            String messString = String.valueOf(cbuf);
            Message mess = parser.parse(messString);
            System.out.println("Got message of type " + mess.getClass().getName());
            showInNewWindow(mess);
           
            //write message to console ...
            System.out.println(parser.encode(mess, "VB"));
        } catch (Exception e) {
            e.printStackTrace();
            log.error( e.getMessage(), e );
        }
    }
View Full Code Here

      char[] cbuf = new char[fileLength];
      in.read(cbuf, 0, fileLength);
      String messageString = new String(cbuf);

      // parse inbound message ...
      final Parser parser = new PipeParser();
      Message inMessage = null;
      try {
        inMessage = parser.parse(messageString);
      } catch (HL7Exception e) {
        e.printStackTrace();
      }

      // process with responder ...
View Full Code Here

  /**
   * Creates a new instance of SimpleServer that listens on the given port,
   * using the {@link MinLowerLayerProtocol} and a standard {@link PipeParser}.
   */
  public SimpleServer(int port) {
    this(port, new MinLowerLayerProtocol(), new PipeParser(), false);
  }
View Full Code Here

  /**
   * Creates a new instance of SimpleServer that listens on the given port,
   * using the {@link MinLowerLayerProtocol} and a standard {@link PipeParser}.
   */
  public SimpleServer(int port, boolean tls) {
    this(port, new MinLowerLayerProtocol(), new PipeParser(), tls);
 
View Full Code Here

                    for (int i = 0; i < nextStructureList.size(); i++) {
                        if (i > 0) {
                            indent(theStringBuilder, currentIndent + structurePrefix.length());
                        }
                        Segment nextSegment = (Segment)nextStructureList.get(i);
                        theStringBuilder.append(new PipeParser().doEncode(nextSegment, EncodingCharacters.getInstance(getMessage())));
                        theStringBuilder.append(lineSeparator);
                       
                    }
                }
               
View Full Code Here

     * <p>Serialization note: The message parser is marked as transient, so it will not
     * survive serialization.</p>
     */
    public Parser getParser() {
        if (myParser == null) {
            myParser = new PipeParser();
        }

        return myParser;
    }
View Full Code Here

TOP

Related Classes of ca.uhn.hl7v2.parser.PipeParser

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.