use of org.hl7.fhir.r5.context.IWorkerContext.ValidationResult in project org.hl7.fhir.core by hapifhir.
the class BaseWorkerContext method handleByCache.
private ValidationResult handleByCache(ValueSet vs, CodeableConcept concept, boolean tryCache) {
String cacheId = cacheId(concept);
Map<String, ValidationResult> cache = validationCache.get(vs.getUrl());
if (cache == null) {
cache = new HashMap<String, IWorkerContext.ValidationResult>();
validationCache.put(vs.getUrl(), cache);
}
if (cache.containsKey(cacheId))
return cache.get(cacheId);
if (validationCache.containsKey(vs.getUrl()) && validationCache.get(vs.getUrl()).containsKey(cacheId))
return validationCache.get(vs.getUrl()).get(cacheId);
if (!tryCache)
return null;
if (!cacheValidation)
return null;
if (failed.contains(vs.getUrl()))
return null;
ValueSetExpansionOutcome vse = expandVS(vs, true);
if (vse.getValueset() == null || notcomplete(vse.getValueset())) {
failed.add(vs.getUrl());
return null;
}
ValidationResult res = validateCode(concept, vse.getValueset());
cache.put(cacheId, res);
return res;
}
use of org.hl7.fhir.r5.context.IWorkerContext.ValidationResult in project org.hl7.fhir.core by hapifhir.
the class BaseWorkerContext method handleByCache.
private ValidationResult handleByCache(ValueSet vs, Coding coding, boolean tryCache) {
String cacheId = cacheId(coding);
Map<String, ValidationResult> cache = validationCache.get(vs.getUrl());
if (cache == null) {
cache = new HashMap<String, IWorkerContext.ValidationResult>();
validationCache.put(vs.getUrl(), cache);
}
if (cache.containsKey(cacheId))
return cache.get(cacheId);
if (!tryCache)
return null;
if (!cacheValidation)
return null;
if (failed.contains(vs.getUrl()))
return null;
ValueSetExpansionOutcome vse = expandVS(vs, true);
if (vse.getValueset() == null || notcomplete(vse.getValueset())) {
failed.add(vs.getUrl());
return null;
}
ValidationResult res = validateCode(coding, vse.getValueset());
cache.put(cacheId, res);
return res;
}
use of org.hl7.fhir.r5.context.IWorkerContext.ValidationResult in project org.hl7.fhir.core by hapifhir.
the class BaseWorkerContext method verifyCodeExternal.
private ValidationResult verifyCodeExternal(ValueSet vs, CodeableConcept cc, boolean tryCache) throws Exception {
ValidationResult res = handleByCache(vs, cc, tryCache);
if (res != null) {
return res;
}
Parameters pin = new Parameters();
pin.addParameter().setName("codeableConcept").setValue(cc);
pin.addParameter().setName("valueSet").setResource(vs);
res = serverValidateCode(pin, false);
Map<String, ValidationResult> cache = validationCache.get(vs.getUrl());
cache.put(cacheId(cc), res);
return res;
}
use of org.hl7.fhir.r5.context.IWorkerContext.ValidationResult in project org.hl7.fhir.core by hapifhir.
the class BaseWorkerContext method handleByCache.
private ValidationResult handleByCache(ValueSet vs, CodeableConcept concept, boolean tryCache) {
String cacheId = cacheId(concept);
Map<String, ValidationResult> cache = validationCache.get(vs.getUrl());
if (cache == null) {
cache = new HashMap<String, IWorkerContext.ValidationResult>();
validationCache.put(vs.getUrl(), cache);
}
if (cache.containsKey(cacheId)) {
return cache.get(cacheId);
}
if (validationCache.containsKey(vs.getUrl()) && validationCache.get(vs.getUrl()).containsKey(cacheId)) {
return validationCache.get(vs.getUrl()).get(cacheId);
}
if (!tryCache) {
return null;
}
if (!cacheValidation) {
return null;
}
if (failed.contains(vs.getUrl())) {
return null;
}
ValueSetExpansionOutcome vse = expandVS(vs, true, false);
if (vse.getValueset() == null || notcomplete(vse.getValueset())) {
failed.add(vs.getUrl());
return null;
}
ValidationResult res = validateCode(concept, vse.getValueset());
cache.put(cacheId, res);
return res;
}
use of org.hl7.fhir.r5.context.IWorkerContext.ValidationResult in project org.hl7.fhir.core by hapifhir.
the class BaseWorkerContext method handleByCache.
private ValidationResult handleByCache(ValueSet vs, Coding coding, boolean tryCache) {
String cacheId = cacheId(coding);
Map<String, ValidationResult> cache = validationCache.get(vs.getUrl());
if (cache == null) {
cache = new HashMap<String, IWorkerContext.ValidationResult>();
validationCache.put(vs.getUrl(), cache);
}
if (cache.containsKey(cacheId)) {
return cache.get(cacheId);
}
if (!tryCache) {
return null;
}
if (!cacheValidation) {
return null;
}
if (failed.contains(vs.getUrl())) {
return null;
}
ValueSetExpansionOutcome vse = expandVS(vs, true, false);
if (vse.getValueset() == null || notcomplete(vse.getValueset())) {
failed.add(vs.getUrl());
return null;
}
ValidationResult res = validateCode(coding, vse.getValueset());
cache.put(cacheId, res);
return res;
}
Aggregations