Package ca.uhn.hl7v2.parser

Examples of ca.uhn.hl7v2.parser.Parser


      // set up connection to server
      String host = args[0];
      int port = Integer.parseInt(args[1]);

      final Parser parser = new PipeParser();
      LowerLayerProtocol llp = new MinLowerLayerProtocol();
      Connection connection = new Connection(parser, llp, new Socket(
          host, port));
      final Initiator initiator = connection.getInitiator();
      connection.activate();
      final String outText = "MSH|^~\\&|||||||ACK^^ACK|||R|2.4|\rMSA|AA";
      final IDGenerator generator = new InMemoryIDGenerator();

      // get a bunch of threads to send messages
      for (int i = 0; i < 1000; i++) {
        Thread sender = new Thread(new Runnable() {
         
          public void run() {
            try {
              // get message ID
              String ID = generator.getID();
              Message out = parser.parse(outText);
              Terser tOut = new Terser(out);
              tOut.set("/MSH-10", ID);

              // send, get response
              Message in = initiator.sendAndReceive(out);
View Full Code Here


    }

    DefaultValidator val = new DefaultValidator();
    try {
      String msgString = loadFile(args[0]);
      Parser parser = new GenericParser();
      Message message = parser.parse(msgString);

      String profileString = loadFile(args[1]);
      ProfileParser profParser = new ProfileParser(true);
      RuntimeProfile profile = profParser.parse(profileString);
View Full Code Here

    /**
     * {@inheritDoc }
     */
    @Override
    public String encode() throws HL7Exception {
        Parser p = getMessage().getParser();
        return p.doEncode(this, EncodingCharacters.getInstance(getMessage()));
    }
View Full Code Here

            //set up connection to server
            String host = args[0];
            int port = Integer.parseInt(args[1]);

            final Parser parser = new PipeParser();
            LowerLayerProtocol llp = LowerLayerProtocol.makeLLP();
            Connection connection = new Connection(parser, llp, new Socket(host, port));
            final Initiator initiator = connection.getInitiator();
            final String outText = "MSH|^~\\&|||||||ACK^^ACK|||R|2.4|\rMSA|AA";

            //get a bunch of threads to send messages
            for (int i = 0; i < 1000; i++) {
                Thread sender = new Thread(new Runnable() {
                    public void run() {
                        try {
                                //get message ID
    String ID = MessageIDGenerator.getInstance().getNewID();
                            Message out = parser.parse(outText);
                            Terser tOut = new Terser(out);
                            tOut.set("/MSH-10", ID);

                            //send, get response
                            Message in = initiator.sendAndReceive(out);
View Full Code Here

    }
   
    public int process( InputStream theMsgInputStream ) throws FileNotFoundException, IOException
    {
        Parser hapiParser = new PipeParser();
       
        BufferedReader in =
            new BufferedReader(
                new CommentFilterReader( new InputStreamReader( theMsgInputStream ) )
            );
View Full Code Here

    * @version $Revision: 1.1 $ updated on $Date: 2007/02/19 02:24:27 $ by $Author: jamesagnew $
    */
    public static String[] read( InputStream theMsgInputStream )
     throws FileNotFoundException, IOException
    {
        Parser hapiParser = new PipeParser();
       
        BufferedReader in =
            new BufferedReader(
                new CommentFilterReader( new InputStreamReader( theMsgInputStream ) )
            );
View Full Code Here

{
   
   
    public static void main(String[] args) throws EncodingNotSupportedException, HL7Exception {
       
        Parser p = new GenericParser();
        String msg = "MSH|^~\\&|LABMI1||DMCRES||19951010134000||ORU^R01|LABMI1199510101340007|D|2.2|||AL|\r\n" +
                "PID|||BB1127||LABHLVII^MICRO^A||19780625|F||||||||||001680\r\n" +
                "PV1|||CFLC|||||||MED||||||||P||||||||||||||||||||||||||19950303150000|19950311\r\n" +
                "OBR|1||09528307086003110|6003110^CULTURE BACTERIA UR INDWELL CA^^^C UR ICATH|||19951010131900|||||||19951010131900|S03593&URINE-INDWELLING CATHETER     &&&URI|||||0952830708||1995101013360000||600|P||^^^^^RT||^09528307086003110\r\n" +
                "OBX||CE|6000417^PRELIMINARY^^^R PRE|0002|I80013^^^^GE100,~I80013^^^^GE100,~I80013^^^^GE100,||||||F|||19951010133600||001\r\n";
        Message m = p.parse(msg);
       
        DefaultXMLParser xp = new DefaultXMLParser();
        System.out.println(xp.encode(m));
        //TreePanel.showInNewWindow(m);
       
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();
            }
           
View Full Code Here

      // set up connection to server
      String host = args[0];
      int port = Integer.parseInt(args[1]);

      final Parser parser = new PipeParser();
      LowerLayerProtocol llp = new MinLowerLayerProtocol();
      Connection connection = new ActiveConnection(parser, llp, new Socket(
          host, port));
      final Initiator initiator = connection.getInitiator();
      connection.activate();
      final String outText = "MSH|^~\\&|||||||ACK^^ACK|||R|2.4|\rMSA|AA";
      final IDGenerator generator = new InMemoryIDGenerator();

      // get a bunch of threads to send messages
      for (int i = 0; i < 1000; i++) {
        Thread sender = new Thread(new Runnable() {
         
          public void run() {
            try {
              // get message ID
              String ID = generator.getID();
              Message out = parser.parse(outText);
              Terser tOut = new Terser(out);
              tOut.set("/MSH-10", ID);

              // send, get response
              Message in = initiator.sendAndReceive(out);
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

TOP

Related Classes of ca.uhn.hl7v2.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.