Package ca.uhn.hl7v2

Examples of ca.uhn.hl7v2.Location$GroupLocation


    public boolean accept(MessageVisitor visitor, Location location) throws HL7Exception {
        if (visitor.start(this, location)) {
            Type[] types = getComponents();
            for (int i = 0; i < types.length; i++) {
                Type t = getComponent(i);
                Location nextLocation = t.provideLocation(location, i+1, -1);
                if (!t.accept(visitor, nextLocation)) break;
            }
            ExtraComponents ec = getExtraComponents();
            for (int i = 0; i < ec.numComponents(); i++) {
               Varies v = ec.getComponent(i);
               Location nextLocation = v.provideLocation(location, i + types.length, -1);
               if (!v.accept(visitor, nextLocation)) break;
            }
        }
        return visitor.end(this, location);
    }
View Full Code Here


        }
        return visitor.end(this, location);
    }
   
    public Location provideLocation(Location location, int index, int repetition) {
        return new Location(location).pushGroup(getName(), repetition);
    }   
View Full Code Here

    protected void visitNestedStructures(MessageVisitor visitor, Location location) throws HL7Exception {
        for (String name : getNames()) {
            Structure[] structures = getAll(name);
            for (int j=0; j < structures.length; j++) {
                int rep = isRepeating(name) ? j : -1;
                Location nextLocation = structures[j].provideLocation(location, -1, rep);
                if (!structures[j].accept(visitor, nextLocation)) break;
            }
        }       
    }
View Full Code Here

    public boolean accept(MessageVisitor visitor, Location location) throws HL7Exception {
        if (visitor.start(this, location)) {
            String[] names = getNames();
            for (int i = 1; i <= names.length; i++) {
                Field f = new Field(getField(i), getMaxCardinality(i));
                Location nextLocation = f.provideLocation(location, i, -1);
                if (!f.accept(visitor, nextLocation))
                    break;
            }
        }
        return visitor.end(this, location);
View Full Code Here

        }
        return visitor.end(this, location);
    }

  public Location provideLocation(Location location, int index, int repetition) {
        return new Location(location)
            .withSegmentName(getName())
            .withSegmentRepetition(repetition);
    }
View Full Code Here

     * @param visitable message element to be visited
     * @return the MessageVisitor
     * @throws HL7Exception if an error occurs while visiting
     */
    public static <T extends MessageVisitor> T visit(Visitable visitable, T visitor) throws HL7Exception {
        visitable.accept(visitor, new Location());
        return visitor;
    }
View Full Code Here

    return b.toString();
  }

    public Location provideLocation(Location location, int index, int repetition) {
        if (location.getField() < 0)
            return new Location(location)
                .withField(index)
                .withFieldRepetition(repetition);
        if (location.getComponent() < 0)
            return new Location(location)
                .withComponent(index);
        return new Location(location)
            .withSubcomponent(index);
    }
View Full Code Here

    public void start() {
        /*
        * The server may have any number of "application" objects registered to handle messages. We
        * are going to create an application to listen to ADT^A01 messages.
        */
        Application handler = new SampleApp();
        server.registerApplication("*", "*", handler);

        /*
        * Another option would be to specify a single application to handle all messages, like
        * this:
 
View Full Code Here

    @Override
    protected void startEndpoint(HL7Endpoint endpoint) throws AxisFault {
        LowerLayerProtocol llp = LowerLayerProtocol.makeLLP();
        PipeParser parser = new PipeParser();
        SimpleServer server = new SimpleServer(endpoint.getPort(), llp, parser);
        Application callback = new HL7MessageProcessor(endpoint);
        server.registerApplication("*", "*", callback);
        server.start();
        serverTable.put(endpoint, server);

        log.info("Started HL7 endpoint on port: " + endpoint.getPort());
View Full Code Here

    public void send(String host, int port) throws HL7Exception {
        System.out.println("[ Executing HL7Sender : HOST:" + host + "  ;port :" + port + " ]");
        // The connection hub connects to listening servers
        ConnectionHub connectionHub = ConnectionHub.getInstance();
        // A connection object represents a socket attached to an HL7 server
        Connection connection = connectionHub
                .attach(host, port, new PipeParser(), MinLowerLayerProtocol.class);

        // The initiator is used to transmit unsolicited messages
        Initiator initiator = connection.getInitiator();
        HL7Message sampleMessage = new HL7Message();

        //send
        Message response = null;
        try {
View Full Code Here

TOP

Related Classes of ca.uhn.hl7v2.Location$GroupLocation

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.