Package ca.uhn.hl7v2

Examples of ca.uhn.hl7v2.Location$GroupLocation


 
  public ValidationException[] apply(Message msg) {
    List<ValidationException> exceptions = new ArrayList<ValidationException>();

    ValidationException ve = new ValidationException("Invalid version: " + msg.getVersion());
    Location location = new Location();
    location.setSegmentName("MSH");
    location.setField(12);
    ve.setLocation(location);
    ve.setError(ErrorCode.UNSUPPORTED_VERSION_ID);
    exceptions.add(ve);

    return exceptions.toArray(new ValidationException[exceptions.size()]);
View Full Code Here


    public Location getLocation(Message msg) throws HL7Exception {
      Terser t = new Terser(msg);
      StringTokenizer tok = new StringTokenizer(expression, "-", false);
      Segment segment = t.getSegment(tok.nextToken());
      Location location = new Location();
      location.setSegmentName(segment.getName());
      location.setFieldIndizes(Terser.getIndices(expression));
      return location;
    }
View Full Code Here

    for (Iterator<Structure> iter = ReadOnlyMessageIterator
        .createPopulatedStructureIterator(msg, GenericSegment.class); iter.hasNext();) {
      String segmentName = iter.next().getName();
      ValidationException ve = new ValidationException("Found unknown segment: " + segmentName);
      Location location = new Location();
      location.setSegmentName(segmentName);
      ve.setLocation(location);
      exceptions.add(ve);
    }
    return exceptions.toArray(new ValidationException[exceptions.size()]);
  }
View Full Code Here

  private void testComponent(Type type, ValidationExceptionHandler<R> handler, Location l) {
    if (type instanceof Composite) {
      Type[] component = ((Composite) type).getComponents();
      for (int sub = 0; sub < component.length; sub++) {
        Location location = new Location(l).withSubcomponent(sub + 1);
        testSubComponent(component[sub], handler, location);
      }
    } else if (type instanceof Varies) {
      testComponent(((Varies) type).getData(), handler, l);
    } else {
View Full Code Here

        .createPopulatedSegmentIterator(message); iter.hasNext();) {
      Segment s = (Segment) iter.next();
      for (int field = 1; field <= s.numFields(); field++) {
        Type[] t = s.getField(field);
        for (int rep = 0; rep < t.length; rep++) {
          Location location = new Location();
          location
              .withSegmentName(s.getName())
              .withField(field)
              .withFieldRepetition(rep);
          testType(t[rep], handler, location);
        }
View Full Code Here

  private void testType(Type type, ValidationExceptionHandler<R> handler, Location l) {
    if (type instanceof Composite) {
      Type[] components = ((Composite) type).getComponents();
      for (int comp = 0; comp < components.length; comp++) {
        Location location = new Location(l).withComponent(comp + 1);
        testComponent(components[comp], handler, location);
      }
    } else if (type instanceof Varies) {
      testType(((Varies) type).getData(), handler, l);
    } else {
View Full Code Here

 
  public ValidationException[] apply(Message msg) {
    List<ValidationException> exceptions = new ArrayList<ValidationException>();

    ValidationException ve = new ValidationException("Invalid version: " + msg.getVersion());
    Location location = new Location()
        .withSegmentName("MSH")
        .withField(12);
    ve.setLocation(location);
    ve.setError(ErrorCode.UNSUPPORTED_VERSION_ID);
    exceptions.add(ve);
View Full Code Here

    public Location getLocation(Message msg) throws HL7Exception {
      Terser t = new Terser(msg);
      StringTokenizer tok = new StringTokenizer(expression, "-", false);
      Segment segment = t.getSegment(tok.nextToken());
      Location location = new Location()
          .withSegmentName(segment.getName())
          .withFieldIndizes(Terser.getIndices(expression));
      return location;
    }
View Full Code Here

    for (Iterator<Structure> iter = ReadOnlyMessageIterator
        .createPopulatedStructureIterator(msg, GenericSegment.class); iter.hasNext();) {
      String segmentName = iter.next().getName();
      ValidationException ve = new ValidationException("Found unknown segment: " + segmentName);
      Location location = new Location().withSegmentName(segmentName);
      ve.setLocation(location);
      exceptions.add(ve);
    }
    return exceptions.toArray(new ValidationException[exceptions.size()]);
  }
View Full Code Here

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

    public Location provideLocation(Location parentLocation, int index, int repetition) {
        return new Location(parentLocation).withField(index);
    }
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.