Package org.zanata.webtrans.client.history

Examples of org.zanata.webtrans.client.history.Window$Location


    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


        .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.setSegmentName(s.getName());
          location.setField(field);
          location.setFieldRepetition(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);
        location.setComponent(comp + 1);
        testComponent(components[comp], handler, location);
      }
    } else if (type instanceof Varies) {
      testType(((Varies) type).getData(), handler, l);
    } else {
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);
        location.setSubcomponent(sub + 1);
        testSubComponent(component[sub], handler, location);
      }
    } else if (type instanceof Varies) {
      testComponent(((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();
    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

TOP

Related Classes of org.zanata.webtrans.client.history.Window$Location

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.