use of org.hl7.fhir.r5.utils.validation.IResourceValidator in project org.hl7.fhir.core by hapifhir.
the class ValidationTests method conformsToProfile.
@Override
public boolean conformsToProfile(Object appContext, Base item, String url) throws FHIRException {
IResourceValidator val = TestingUtilities.getSharedWorkerContext(version).newValidator();
List<ValidationMessage> valerrors = new ArrayList<ValidationMessage>();
if (item instanceof Resource) {
val.validate(appContext, valerrors, (Resource) item, url);
boolean ok = true;
for (ValidationMessage v : valerrors) ok = ok && v.getLevel().isError();
return ok;
}
throw new NotImplementedException("Not done yet (IGPublisherHostServices.conformsToProfile), when item is element");
}
use of org.hl7.fhir.r5.utils.validation.IResourceValidator in project org.hl7.fhir.core by hapifhir.
the class ValidationEngine method fetchRaw.
@Override
public byte[] fetchRaw(IResourceValidator validator, String source) throws IOException {
SimpleHTTPClient http = new SimpleHTTPClient();
HTTPResult res = http.get(source);
res.checkThrowException();
return res.getContent();
}
use of org.hl7.fhir.r5.utils.validation.IResourceValidator in project org.hl7.fhir.core by hapifhir.
the class StandAloneValidatorFetcher method fetchCanonicalResource.
@Override
public CanonicalResource fetchCanonicalResource(IResourceValidator validator, String url) throws URISyntaxException {
String[] p = url.split("\\/");
String root = getRoot(p, url);
if (root != null) {
TerminologyClient c;
c = TerminologyClientFactory.makeClient(root, "fhir/validator", context.getVersion());
return c.read(p[p.length - 2], p[p.length - 1]);
} else {
throw new FHIRException("The URL '" + url + "' is not known to the FHIR validator, and has not been provided as part of the setup / parameters");
}
}
use of org.hl7.fhir.r5.utils.validation.IResourceValidator in project org.hl7.fhir.core by hapifhir.
the class ValidationTests method fetchRaw.
@Override
public byte[] fetchRaw(IResourceValidator validator, String source) throws MalformedURLException, IOException {
SimpleHTTPClient http = new SimpleHTTPClient();
HTTPResult res = http.get(source);
res.checkThrowException();
return res.getContent();
}
Aggregations