public ValidationException[] apply(Message theValue) { List<ValidationException> exceptions = new ArrayList<ValidationException>(); apply(theValue, exceptions); return exceptions.toArray(new ValidationException[exceptions.size()]); }
public ValidationException[] apply(Message theValue) { List<ValidationException> exceptions = new ArrayList<ValidationException>(); apply(theValue, exceptions); return exceptions.toArray(new ValidationException[exceptions.size()]); }
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())); } }
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())); } }