private static boolean isRepeating(final Segment segment) throws HL7Exception { if (isEmpty(segment)) { return false; } final Group parent = segment.getParent(); final Group grandparent = parent.getParent(); if (parent == grandparent) { return false; } return grandparent.isRepeating(parent.getName()); }
private void apply(Group theStructure, List<ValidationException> theExceptions) { Set<String> choicesWithContent = null; for (String nextName : theStructure.getNames()) { try { boolean nextIsChoiceElement = theStructure.isChoiceElement(nextName); for (Structure nextStruct : theStructure.getAll(nextName)) { if (nextIsChoiceElement && !nextStruct.isEmpty()) { if (choicesWithContent == null) { choicesWithContent = new HashSet<String>(); } choicesWithContent.add(nextName); } if (nextStruct instanceof Group) { apply((Group) nextStruct, theExceptions); } } } catch (HL7Exception e) { throw new Error("Failed to find " + nextName + " in structure. This is probably a HAPI bug."); } } if (choicesWithContent != null && choicesWithContent.size() > 1) { theExceptions.add(new ValidationException("Structure '" + theStructure.getName() + "' must have content only in one of the following choices: " + choicesWithContent.toString())); } }
public String toString() { StringBuffer ret = new StringBuffer(parent.getName()); ret.append(":"); ret.append(index.name); ret.append("("); ret.append(index.rep); ret.append(")"); return ret.toString(); } }
private void apply(Group theStructure, List<ValidationException> theExceptions) { Set<String> choicesWithContent = null; for (String nextName : theStructure.getNames()) { try { boolean nextIsChoiceElement = theStructure.isChoiceElement(nextName); for (Structure nextStruct : theStructure.getAll(nextName)) { if (nextIsChoiceElement && !nextStruct.isEmpty()) { if (choicesWithContent == null) { choicesWithContent = new HashSet<String>(); } choicesWithContent.add(nextName); } if (nextStruct instanceof Group) { apply((Group) nextStruct, theExceptions); } } } catch (HL7Exception e) { throw new Error("Failed to find " + nextName + " in structure. This is probably a HAPI bug."); } } if (choicesWithContent != null && choicesWithContent.size() > 1) { theExceptions.add(new ValidationException("Structure '" + theStructure.getName() + "' must have content only in one of the following choices: " + choicesWithContent.toString())); } }
public String toString() { StringBuffer ret = new StringBuffer(parent.getName()); ret.append(":"); ret.append(index.name); ret.append("("); ret.append(index.rep); ret.append(")"); return ret.toString(); } }