private ValidationException[] testAgainstProfile(Message message, String id) throws ProfileException, HL7Exception { HL7Exception[] exceptions; HapiContext context = message.getParser().getHapiContext(); Validator validator = context.getConformanceValidator(); try { ProfileStore profileStore = context.getProfileStore(); String profileString = profileStore.getProfile(id); if (profileString != null) { RuntimeProfile profile = getProfile(profileString); exceptions = validator.validate(message, profile.getMessage()); } else { throw new ProfileException("Unable to find the profile " + id); } } catch (IOException e) { throw new ProfileException("Error retreiving profile " + id, e); } ValidationException[] result = new ValidationException[exceptions.length]; for (int i = 0; i < exceptions.length; i++) { result[i] = ValidationException.fromHL7Exception(exceptions[i]); } return result; }
private ValidationException[] testAgainstProfile(Message message, String id) throws ProfileException, HL7Exception { HL7Exception[] exceptions; HapiContext context = message.getParser().getHapiContext(); Validator validator = context.getConformanceValidator(); try { ProfileStore profileStore = context.getProfileStore(); String profileString = profileStore.getProfile(id); if (profileString != null) { RuntimeProfile profile = getProfile(profileString); exceptions = validator.validate(message, profile.getMessage()); } else { throw new ProfileException("Unable to find the profile " + id); } } catch (IOException e) { throw new ProfileException("Error retreiving profile " + id, e); } ValidationException[] result = new ValidationException[exceptions.length]; for (int i = 0; i < exceptions.length; i++) { result[i] = ValidationException.fromHL7Exception(exceptions[i]); } return result; }