fix bug with client sending too much data to tx.fhir.org

This commit is contained in:
Grahame Grieve 2023-08-22 21:46:47 +10:00
parent 32d1d8cad8
commit 54eb35fa1a
1 changed files with 12 additions and 2 deletions

View File

@ -1499,7 +1499,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
boolean cache = false;
for (CanonicalType c : inc.getValueSet()) {
ValueSet vs = fetchResource(ValueSet.class, c.getValue(), src);
if (vs != null) {
if (vs != null && !hasCanonicalResource(pin, "tx-resource", vs.getVUrl())) {
pin.addParameter().setName("tx-resource").setResource(vs);
if (tcc.isTxCaching() && tcc.getCacheId() == null || !tcc.getCached().contains(vs.getVUrl())) {
tcc.getCached().add(vs.getVUrl());
@ -1509,7 +1509,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
}
}
CodeSystem cs = fetchResource(CodeSystem.class, inc.getSystem(), src);
if (cs != null && (cs.getContent() == CodeSystemContentMode.COMPLETE || cs.getContent() == CodeSystemContentMode.FRAGMENT)) {
if (cs != null && !hasCanonicalResource(pin, "tx-resource", cs.getVUrl()) && (cs.getContent() == CodeSystemContentMode.COMPLETE || cs.getContent() == CodeSystemContentMode.FRAGMENT)) {
pin.addParameter().setName("tx-resource").setResource(cs);
if (tcc.isTxCaching() && tcc.getCacheId() == null || !tcc.getCached().contains(cs.getVUrl())) {
tcc.getCached().add(cs.getVUrl());
@ -1520,6 +1520,16 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
return cache;
}
private boolean hasCanonicalResource(Parameters pin, String name, String vUrl) {
for (ParametersParameterComponent p : pin.getParameter()) {
if (name.equals(p.getName()) && p.hasResource() &&
p.getResource() instanceof CanonicalResource && vUrl.equals(((CanonicalResource) p.getResource()).getVUrl())) {
return true;
}
}
return false;
}
public ValidationResult processValidationResult(Parameters pOut, String vs) {
boolean ok = false;
String message = "No Message returned";