Exemplo n.º 1
0
  /** Tests for extra components (i.e. any not defined in the profile) */
  protected List<ValidationException> checkUndefinedComponents(Composite comp, int numInProfile) {
    List<ValidationException> exList = new ArrayList<>();

    StringBuilder extra = new StringBuilder();
    for (int i = numInProfile; i < comp.getComponents().length; i++) {
      try {
        String s = comp.getComponent(i).encode();
        if (s.length() > 0) {
          extra.append(s).append(enc.getComponentSeparator());
        }
      } catch (HL7Exception de) {
        exList.add(new ValidationException(de));
      }
    }
    profileViolatedWhen(
        extra.toString().length() > 0, exList, COMPONENT_NOT_DEFINED_IN_PROFILE, extra.toString());

    return exList;
  }