remove duplicate way of handling parameters on expand value set
This commit is contained in:
parent
6004dfe8ea
commit
81569a3984
|
@ -23,6 +23,7 @@ import org.hl7.fhir.r4.model.OperationOutcome;
|
|||
import org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity;
|
||||
import org.hl7.fhir.r4.model.OperationOutcome.IssueType;
|
||||
import org.hl7.fhir.r4.model.Parameters;
|
||||
import org.hl7.fhir.r4.model.UriType;
|
||||
import org.hl7.fhir.r4.model.ValueSet;
|
||||
import org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent;
|
||||
import org.hl7.fhir.r4.utils.client.FHIRToolingClient;
|
||||
|
@ -122,7 +123,9 @@ public class VSACImporter extends OIDBasedValueSetImporter {
|
|||
}
|
||||
t = System.currentTimeMillis();
|
||||
try {
|
||||
ValueSet vse = fhirToolingClient.expandValueset(vs.getUrl(), null);
|
||||
Parameters p = new Parameters();
|
||||
p.addParameter("url", new UriType(vs.getUrl()));
|
||||
ValueSet vse = fhirToolingClient.expandValueset(vs, p);
|
||||
vs.setExpansion(vse.getExpansion());
|
||||
} catch (Exception e) {
|
||||
errs.put(oid, "Expansion: " +e.getMessage());
|
||||
|
@ -132,9 +135,10 @@ public class VSACImporter extends OIDBasedValueSetImporter {
|
|||
Parameters p = new Parameters();
|
||||
int offset = vs.getExpansion().getParameter("offset").getValueIntegerType().getValue() + vs.getExpansion().getParameter("count").getValueIntegerType().getValue();
|
||||
p.addParameter("offset", offset);
|
||||
p.addParameter("url", new UriType(vs.getUrl()));
|
||||
t = System.currentTimeMillis();
|
||||
try {
|
||||
ValueSet vse = fhirToolingClient.expandValueset(vs.getUrl(), p);
|
||||
ValueSet vse = fhirToolingClient.expandValueset(vs, p);
|
||||
vs.getExpansion().getContains().addAll(vse.getExpansion().getContains());
|
||||
vs.getExpansion().setParameter(vse.getExpansion().getParameter());
|
||||
} catch (Exception e2) {
|
||||
|
|
|
@ -104,10 +104,10 @@ public class TerminologyClientR2 implements ITerminologyClient {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValueSet expandValueset(ValueSet vs, Parameters p, Map<String, String> params) throws FHIRException {
|
||||
public ValueSet expandValueset(ValueSet vs, Parameters p) throws FHIRException {
|
||||
org.hl7.fhir.dstu2.model.ValueSet vs2 = (org.hl7.fhir.dstu2.model.ValueSet) VersionConvertorFactory_10_50.convertResource(vs);
|
||||
org.hl7.fhir.dstu2.model.Parameters p2 = (org.hl7.fhir.dstu2.model.Parameters) VersionConvertorFactory_10_50.convertResource(p);
|
||||
vs2 = client.expandValueset(vs2, p2, params);
|
||||
vs2 = client.expandValueset(vs2, p2);
|
||||
return (ValueSet) VersionConvertorFactory_10_50.convertResource(vs2);
|
||||
}
|
||||
|
||||
|
|
|
@ -101,10 +101,10 @@ public class TerminologyClientR3 implements ITerminologyClient {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValueSet expandValueset(ValueSet vs, Parameters p, Map<String, String> params) throws FHIRException {
|
||||
public ValueSet expandValueset(ValueSet vs, Parameters p) throws FHIRException {
|
||||
org.hl7.fhir.dstu3.model.ValueSet vs2 = (org.hl7.fhir.dstu3.model.ValueSet) VersionConvertorFactory_30_50.convertResource(vs);
|
||||
org.hl7.fhir.dstu3.model.Parameters p2 = (org.hl7.fhir.dstu3.model.Parameters) VersionConvertorFactory_30_50.convertResource(p);
|
||||
vs2 = client.expandValueset(vs2, p2, params); // todo: second parameter
|
||||
vs2 = client.expandValueset(vs2, p2); // todo: second parameter
|
||||
return (ValueSet) VersionConvertorFactory_30_50.convertResource(vs2);
|
||||
}
|
||||
|
||||
|
|
|
@ -78,14 +78,11 @@ public class TerminologyClientR4 implements ITerminologyClient {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValueSet expandValueset(ValueSet vs, Parameters p, Map<String, String> params) throws FHIRException {
|
||||
public ValueSet expandValueset(ValueSet vs, Parameters p) throws FHIRException {
|
||||
org.hl7.fhir.r4.model.ValueSet vs2 = vs == null ? null : (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_40_50.convertResource(vs);
|
||||
org.hl7.fhir.r4.model.Parameters p2 = p == null ? null : (org.hl7.fhir.r4.model.Parameters) VersionConvertorFactory_40_50.convertResource(p);
|
||||
if (params == null) {
|
||||
params = new HashMap<>();
|
||||
}
|
||||
try {
|
||||
vs2 = client.expandValueset(vs2, p2, params); // todo: second parameter
|
||||
vs2 = client.expandValueset(vs2, p2); // todo: second parameter
|
||||
return (ValueSet) VersionConvertorFactory_40_50.convertResource(vs2);
|
||||
} catch (org.hl7.fhir.r4.utils.client.EFhirClientException e) {
|
||||
if (e.getServerErrors().size() > 0) {
|
||||
|
|
|
@ -48,6 +48,7 @@ import org.hl7.fhir.dstu2.model.Coding;
|
|||
import org.hl7.fhir.dstu2.model.ConceptMap;
|
||||
import org.hl7.fhir.dstu2.model.Conformance;
|
||||
import org.hl7.fhir.dstu2.model.Extension;
|
||||
import org.hl7.fhir.dstu2.model.IntegerType;
|
||||
import org.hl7.fhir.dstu2.model.Parameters;
|
||||
import org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent;
|
||||
import org.hl7.fhir.dstu2.model.Reference;
|
||||
|
@ -115,11 +116,11 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
@Override
|
||||
public ValueSetExpansionOutcome expandVS(ValueSet vs, boolean cacheOk) {
|
||||
try {
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("_limit", "10000");
|
||||
params.put("_incomplete", "true");
|
||||
params.put("profile", "http://www.healthintersections.com.au/fhir/expansion/no-details");
|
||||
ValueSet result = txServer.expandValueset(vs, null, params);
|
||||
Parameters params = new Parameters();
|
||||
params.addParameter().setName("_limit").setValue(new IntegerType("10000"));
|
||||
params.addParameter().setName("_incomplete").setValue(new BooleanType("true"));
|
||||
params.addParameter().setName("profile").setValue(new UriType("http://www.healthintersections.com.au/fhir/expansion/no-details"));
|
||||
ValueSet result = txServer.expandValueset(vs, params);
|
||||
return new ValueSetExpansionOutcome(result);
|
||||
} catch (Exception e) {
|
||||
return new ValueSetExpansionOutcome("Error expanding ValueSet \"" + vs.getUrl() + ": " + e.getMessage());
|
||||
|
|
|
@ -724,26 +724,6 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
|
|||
return feed;
|
||||
}
|
||||
|
||||
public ValueSet expandValueset(ValueSet source) {
|
||||
recordUse();
|
||||
List<Header> headers = null;
|
||||
ResourceRequest<Resource> result = utils.issuePostRequest(
|
||||
resourceAddress.resolveOperationUri(ValueSet.class, "expand"),
|
||||
utils.getResourceAsByteArray(source, false, isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "1.0"),
|
||||
headers, timeoutLong);
|
||||
result.addErrorStatus(410);// gone
|
||||
result.addErrorStatus(404);// unknown
|
||||
result.addErrorStatus(405);
|
||||
result.addErrorStatus(422);// Unprocessable Entity
|
||||
result.addSuccessStatus(200);
|
||||
result.addSuccessStatus(201);
|
||||
if (result.isUnsuccessfulRequest()) {
|
||||
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(),
|
||||
(OperationOutcome) result.getPayload());
|
||||
}
|
||||
return (ValueSet) result.getPayload();
|
||||
}
|
||||
|
||||
public Parameters lookupCode(Map<String, String> params) {
|
||||
recordUse();
|
||||
ResourceRequest<Resource> result = utils.issueGetResourceRequest(
|
||||
|
@ -762,15 +742,13 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
|
|||
return (Parameters) result.getPayload();
|
||||
}
|
||||
|
||||
public ValueSet expandValueset(ValueSet source, Parameters expParams, Map<String, String> params) {
|
||||
public ValueSet expandValueset(ValueSet source, Parameters expParams) {
|
||||
recordUse();
|
||||
List<Header> headers = null;
|
||||
Parameters p = expParams == null ? new Parameters() : expParams.copy();
|
||||
p.addParameter().setName("valueSet").setResource(source);
|
||||
for (String n : params.keySet())
|
||||
p.addParameter().setName(n).setValue(new StringType(params.get(n)));
|
||||
ResourceRequest<Resource> result = utils.issuePostRequest(
|
||||
resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
|
||||
resourceAddress.resolveOperationUri(ValueSet.class, "expand"),
|
||||
utils.getResourceAsByteArray(p, false, isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "1.0"),
|
||||
headers, 4);
|
||||
result.addErrorStatus(410); // gone
|
||||
|
@ -786,22 +764,6 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
|
|||
return (ValueSet) result.getPayload();
|
||||
}
|
||||
|
||||
// public ValueSet expandValueset(ValueSet source, ExpansionProfile profile, Map<String, String> params) {
|
||||
// List<Header> headers = null;
|
||||
// ResourceRequest<Resource> result = utils.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
|
||||
// utils.getResourceAsByteArray(source, false, isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "1.0"), headers, proxy);
|
||||
// result.addErrorStatus(410);//gone
|
||||
// result.addErrorStatus(404);//unknown
|
||||
// result.addErrorStatus(405);
|
||||
// result.addErrorStatus(422);//Unprocessable Entity
|
||||
// result.addSuccessStatus(200);
|
||||
// result.addSuccessStatus(201);
|
||||
// if(result.isUnsuccessfulRequest()) {
|
||||
// throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
|
||||
// }
|
||||
// return (ValueSet) result.getPayload();
|
||||
// }
|
||||
|
||||
public String getAddress() {
|
||||
return base;
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ import org.hl7.fhir.dstu3.model.Coding;
|
|||
import org.hl7.fhir.dstu3.model.ConceptMap;
|
||||
import org.hl7.fhir.dstu3.model.DataElement;
|
||||
import org.hl7.fhir.dstu3.model.ExpansionProfile;
|
||||
import org.hl7.fhir.dstu3.model.IntegerType;
|
||||
import org.hl7.fhir.dstu3.model.OperationDefinition;
|
||||
import org.hl7.fhir.dstu3.model.OperationOutcome;
|
||||
import org.hl7.fhir.dstu3.model.Parameters;
|
||||
|
@ -448,11 +449,12 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
}
|
||||
|
||||
try {
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("_limit", Integer.toString(expandCodesLimit));
|
||||
params.put("_incomplete", "true");
|
||||
Parameters params = new Parameters();
|
||||
params.addParameter().setName("profile").setResource(expProfile.setIncludeDefinition(false));
|
||||
params.addParameter().setName("_limit").setValue(new IntegerType(expandCodesLimit));
|
||||
params.addParameter().setName("_incomplete").setValue(new BooleanType("true"));
|
||||
tlog("Terminology Server: $expand on " + getVSSummary(vs));
|
||||
ValueSet result = txServer.expandValueset(vs, expProfile.setIncludeDefinition(false), params);
|
||||
ValueSet result = txServer.expandValueset(vs, params);
|
||||
return new ValueSetExpansionOutcome(result);
|
||||
} catch (Exception e) {
|
||||
return new ValueSetExpansionOutcome(
|
||||
|
|
|
@ -414,28 +414,6 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
|
|||
return feed;
|
||||
}
|
||||
|
||||
public ValueSet expandValueset(ValueSet source, Parameters expParams) {
|
||||
recordUse();
|
||||
Parameters p = expParams == null ? new Parameters() : expParams.copy();
|
||||
p.addParameter().setName("valueSet").setResource(source);
|
||||
org.hl7.fhir.dstu3.utils.client.network.ResourceRequest<Resource> result = null;
|
||||
try {
|
||||
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand"),
|
||||
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())),
|
||||
withVer(getPreferredResourceFormat(), "3.0"),
|
||||
generateHeaders(),
|
||||
"ValueSet/$expand?url=" + source.getUrl(),
|
||||
timeoutExpand);
|
||||
if (result.isUnsuccessfulRequest()) {
|
||||
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result == null ? null : (ValueSet) result.getPayload();
|
||||
}
|
||||
|
||||
|
||||
public Parameters lookupCode(Map<String, String> params) {
|
||||
recordUse();
|
||||
org.hl7.fhir.dstu3.utils.client.network.ResourceRequest<Resource> result = null;
|
||||
|
@ -454,41 +432,14 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
|
|||
return (Parameters) result.getPayload();
|
||||
}
|
||||
|
||||
public ValueSet expandValueset(ValueSet source, ExpansionProfile profile, Map<String, String> params) {
|
||||
recordUse();
|
||||
Parameters p = new Parameters();
|
||||
p.addParameter().setName("valueSet").setResource(source);
|
||||
if (profile != null)
|
||||
p.addParameter().setName("profile").setResource(profile);
|
||||
|
||||
org.hl7.fhir.dstu3.utils.client.network.ResourceRequest<Resource> result = null;
|
||||
try {
|
||||
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
|
||||
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())),
|
||||
withVer(getPreferredResourceFormat(), "3.0"),
|
||||
generateHeaders(),
|
||||
"ValueSet/$expand?url=" + source.getUrl(),
|
||||
timeoutExpand);
|
||||
if (result.isUnsuccessfulRequest()) {
|
||||
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result == null ? null : (ValueSet) result.getPayload();
|
||||
}
|
||||
|
||||
public ValueSet expandValueset(ValueSet source, Parameters expParams, Map<String, String> params) {
|
||||
public ValueSet expandValueset(ValueSet source, Parameters expParams) {
|
||||
recordUse();
|
||||
Parameters p = expParams == null ? new Parameters() : expParams.copy();
|
||||
p.addParameter().setName("valueSet").setResource(source);
|
||||
for (String n : params.keySet()) {
|
||||
p.addParameter().setName(n).setValue(new StringType(params.get(n)));
|
||||
}
|
||||
org.hl7.fhir.dstu3.utils.client.network.ResourceRequest<Resource> result = null;
|
||||
try {
|
||||
|
||||
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
|
||||
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand"),
|
||||
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())),
|
||||
withVer(getPreferredResourceFormat(), "3.0"),
|
||||
generateHeaders(),
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.hl7.fhir.r4.model.ConceptMap;
|
|||
import org.hl7.fhir.r4.model.Constants;
|
||||
import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent;
|
||||
import org.hl7.fhir.r4.model.ImplementationGuide;
|
||||
import org.hl7.fhir.r4.model.IntegerType;
|
||||
import org.hl7.fhir.r4.model.MetadataResource;
|
||||
import org.hl7.fhir.r4.model.NamingSystem;
|
||||
import org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType;
|
||||
|
@ -403,12 +404,13 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
if (noTerminologyServer)
|
||||
return new ValueSetExpansionOutcome("Error expanding ValueSet: running without terminology services",
|
||||
TerminologyServiceErrorClass.NOSERVICE);
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("_limit", Integer.toString(expandCodesLimit));
|
||||
params.put("_incomplete", "true");
|
||||
|
||||
p.addParameter().setName("_limit").setValue(new IntegerType(expandCodesLimit));
|
||||
p.addParameter().setName("_incomplete").setValue(new BooleanType("true"));
|
||||
|
||||
tlog("$expand on " + txCache.summary(vs));
|
||||
try {
|
||||
ValueSet result = txClient.expandValueset(vs, p, params);
|
||||
ValueSet result = txClient.expandValueset(vs, p);
|
||||
res = new ValueSetExpansionOutcome(result).setTxLink(txLog.getLastId());
|
||||
} catch (Exception e) {
|
||||
res = new ValueSetExpansionOutcome(e.getMessage() == null ? e.getClass().getName() : e.getMessage(),
|
||||
|
@ -463,12 +465,13 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
if (noTerminologyServer)
|
||||
return new ValueSetExpansionOutcome("Error expanding ValueSet: running without terminology services",
|
||||
TerminologyServiceErrorClass.NOSERVICE);
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("_limit", Integer.toString(expandCodesLimit));
|
||||
params.put("_incomplete", "true");
|
||||
|
||||
p.addParameter().setName("_limit").setValue(new IntegerType(expandCodesLimit));
|
||||
p.addParameter().setName("_incomplete").setValue(new BooleanType("true"));
|
||||
|
||||
tlog("$expand on " + txCache.summary(vs));
|
||||
try {
|
||||
ValueSet result = txClient.expandValueset(vs, p, params);
|
||||
ValueSet result = txClient.expandValueset(vs, p);
|
||||
if (result != null) {
|
||||
if (!result.hasUrl())
|
||||
result.setUrl(vs.getUrl());
|
||||
|
|
|
@ -43,7 +43,7 @@ public interface TerminologyClient {
|
|||
|
||||
public TerminologyCapabilities getTerminologyCapabilities() throws FHIRException;
|
||||
|
||||
public ValueSet expandValueset(ValueSet vs, Parameters p, Map<String, String> params) throws FHIRException;
|
||||
public ValueSet expandValueset(ValueSet vs, Parameters p) throws FHIRException;
|
||||
|
||||
public Parameters validateCS(Parameters pin) throws FHIRException;
|
||||
|
||||
|
|
|
@ -63,8 +63,8 @@ public class TerminologyClientR4 implements TerminologyClient {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValueSet expandValueset(ValueSet vs, Parameters p, Map<String, String> params) {
|
||||
return client.expandValueset(vs, p, params);
|
||||
public ValueSet expandValueset(ValueSet vs, Parameters p) {
|
||||
return client.expandValueset(vs, p);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -403,55 +403,6 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
|
|||
return feed;
|
||||
}
|
||||
|
||||
public ValueSet expandValueset(String vsUrl, Parameters expParams) {
|
||||
recordUse();
|
||||
Map<String, String> parameters = new HashMap<>();
|
||||
parameters.put("url", vsUrl);
|
||||
if (expParams != null) {
|
||||
for (ParametersParameterComponent p : expParams.getParameter()) {
|
||||
if (p.getValue() == null) {
|
||||
throw new FHIRException("Non-value Parameters are not supported for parameter '"+p.getName()+"'");
|
||||
} else if (p.getValue() instanceof PrimitiveType) {
|
||||
parameters.put(p.getName(), p.getValue().primitiveValue());
|
||||
} else {
|
||||
throw new FHIRException("Complex Parameters are not supported for parameter '"+p.getName()+"'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
org.hl7.fhir.r4.utils.client.network.ResourceRequest<Resource> result = null;
|
||||
try {
|
||||
result = client.issueGetResourceRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", parameters),
|
||||
withVer(getPreferredResourceFormat(), "4.0"), generateHeaders(), "ValueSet/$expand?url=" + vsUrl, timeoutExpand);
|
||||
} catch (IOException e) {
|
||||
throw new FHIRException(e);
|
||||
}
|
||||
if (result.isUnsuccessfulRequest()) {
|
||||
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(),
|
||||
(OperationOutcome) result.getPayload());
|
||||
}
|
||||
return result == null ? null : (ValueSet) result.getPayload();
|
||||
}
|
||||
|
||||
public ValueSet expandValueset(ValueSet source, Parameters expParams) {
|
||||
recordUse();
|
||||
Parameters p = expParams == null ? new Parameters() : expParams.copy();
|
||||
p.addParameter().setName("valueSet").setResource(source);
|
||||
org.hl7.fhir.r4.utils.client.network.ResourceRequest<Resource> result = null;
|
||||
try {
|
||||
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand"),
|
||||
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "4.0"),
|
||||
generateHeaders(), "ValueSet/$expand?url=" + source.getUrl(), timeoutExpand);
|
||||
if (result.isUnsuccessfulRequest()) {
|
||||
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(),
|
||||
(OperationOutcome) result.getPayload());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new FHIRException(e);
|
||||
}
|
||||
return result == null ? null : (ValueSet) result.getPayload();
|
||||
}
|
||||
|
||||
public Parameters lookupCode(Map<String, String> params) {
|
||||
recordUse();
|
||||
org.hl7.fhir.r4.utils.client.network.ResourceRequest<Resource> result = null;
|
||||
|
@ -468,18 +419,13 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
|
|||
return (Parameters) result.getPayload();
|
||||
}
|
||||
|
||||
public ValueSet expandValueset(ValueSet source, Parameters expParams, Map<String, String> params) {
|
||||
public ValueSet expandValueset(ValueSet source, Parameters expParams) {
|
||||
recordUse();
|
||||
Parameters p = expParams == null ? new Parameters() : expParams.copy();
|
||||
p.addParameter().setName("valueSet").setResource(source);
|
||||
if (params != null) {
|
||||
for (String n : params.keySet()) {
|
||||
p.addParameter().setName(n).setValue(new StringType(params.get(n)));
|
||||
}
|
||||
}
|
||||
org.hl7.fhir.r4.utils.client.network.ResourceRequest<Resource> result = null;
|
||||
try {
|
||||
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
|
||||
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand"),
|
||||
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())), withVer(getPreferredResourceFormat(), "4.0"),
|
||||
generateHeaders(), source == null ? "ValueSet/$expand" : "ValueSet/$expand?url=" + source.getUrl(),
|
||||
timeoutExpand);
|
||||
|
|
|
@ -874,7 +874,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
}
|
||||
|
||||
try {
|
||||
ValueSet result = tc.getClient().expandValueset(vs, p, null);
|
||||
ValueSet result = tc.getClient().expandValueset(vs, p);
|
||||
res = new ValueSetExpansionOutcome(result).setTxLink(txLog.getLastId());
|
||||
} catch (Exception e) {
|
||||
res = new ValueSetExpansionOutcome(e.getMessage() == null ? e.getClass().getName() : e.getMessage(), TerminologyServiceErrorClass.UNKNOWN, true);
|
||||
|
@ -985,7 +985,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
txLog("$expand on "+txCache.summary(vs)+" on "+tc.getAddress());
|
||||
|
||||
try {
|
||||
ValueSet result = tc.getClient().expandValueset(vs, p, null);
|
||||
ValueSet result = tc.getClient().expandValueset(vs, p);
|
||||
if (result != null) {
|
||||
if (!result.hasUrl()) {
|
||||
result.setUrl(vs.getUrl());
|
||||
|
|
|
@ -51,7 +51,7 @@ public interface ITerminologyClient {
|
|||
String getAddress();
|
||||
String getServerVersion();
|
||||
TerminologyCapabilities getTerminologyCapabilities() throws FHIRException;
|
||||
ValueSet expandValueset(ValueSet vs, Parameters p, Map<String, String> params) throws FHIRException;
|
||||
ValueSet expandValueset(ValueSet vs, Parameters p) throws FHIRException;
|
||||
Parameters validateCS(Parameters pin) throws FHIRException;
|
||||
Parameters validateVS(Parameters pin) throws FHIRException;
|
||||
ITerminologyClient setTimeoutFactor(int i) throws FHIRException;
|
||||
|
|
|
@ -126,8 +126,8 @@ public class TerminologyClientR5 implements ITerminologyClient {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValueSet expandValueset(ValueSet vs, Parameters p, Map<String, String> params) {
|
||||
return client.expandValueset(vs, p, params);
|
||||
public ValueSet expandValueset(ValueSet vs, Parameters p) {
|
||||
return client.expandValueset(vs, p);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -470,7 +470,6 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
|
|||
return result == null ? null : (ValueSet) result.getPayload();
|
||||
}
|
||||
|
||||
|
||||
public Parameters lookupCode(Map<String, String> params) {
|
||||
recordUse();
|
||||
org.hl7.fhir.r5.utils.client.network.ResourceRequest<Resource> result = null;
|
||||
|
@ -489,36 +488,6 @@ public class FHIRToolingClient extends FHIRBaseToolingClient {
|
|||
return (Parameters) result.getPayload();
|
||||
}
|
||||
|
||||
public ValueSet expandValueset(ValueSet source, Parameters expParams, Map<String, String> params) {
|
||||
recordUse();
|
||||
Parameters p = expParams == null ? new Parameters() : expParams.copy();
|
||||
if (source != null) {
|
||||
p.addParameter().setName("valueSet").setResource(source);
|
||||
}
|
||||
if (params == null) {
|
||||
params = new HashMap<>();
|
||||
}
|
||||
for (String n : params.keySet()) {
|
||||
p.addParameter().setName(n).setValue(new StringType(params.get(n)));
|
||||
}
|
||||
org.hl7.fhir.r5.utils.client.network.ResourceRequest<Resource> result = null;
|
||||
try {
|
||||
|
||||
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
|
||||
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())),
|
||||
withVer(getPreferredResourceFormat(), "4.0"),
|
||||
generateHeaders(),
|
||||
source == null ? "ValueSet/$expand" : "ValueSet/$expand?url=" + source.getUrl(),
|
||||
timeoutExpand);
|
||||
if (result.isUnsuccessfulRequest()) {
|
||||
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result == null ? null : (ValueSet) result.getPayload();
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return base;
|
||||
}
|
||||
|
|
|
@ -101,12 +101,6 @@ public class SimpleWorkerContextTests {
|
|||
context.txLog = txLog;
|
||||
}
|
||||
|
||||
private final static Map<String, String> params = new HashMap<>();
|
||||
static {
|
||||
params.put("_limit", Integer.toString(1000));
|
||||
params.put("_incomplete", "true");
|
||||
}
|
||||
|
||||
private final static Parameters pInWithDependentResources = new Parameters();
|
||||
static {
|
||||
pInWithDependentResources.addParameter("includeDefinition", false);
|
||||
|
@ -302,7 +296,7 @@ public class SimpleWorkerContextTests {
|
|||
|
||||
Mockito.verify(terminologyCache).getExpansion(cacheToken);
|
||||
Mockito.verify(terminologyCache, times(0)).cacheExpansion(any(), any(), anyBoolean());
|
||||
Mockito.verify(terminologyClient, times(0)).expandValueset(any(), any(), any());
|
||||
Mockito.verify(terminologyClient, times(0)).expandValueset(any(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -327,7 +321,7 @@ public class SimpleWorkerContextTests {
|
|||
|
||||
|
||||
Mockito.doReturn(expectedValueSet).when(terminologyClient).expandValueset(argThat(new ValueSetMatcher(vs)),
|
||||
argThat(new ParametersMatcher(pInWithDependentResources)), eq(params));
|
||||
argThat(new ParametersMatcher(pInWithDependentResources)));
|
||||
|
||||
ValueSetExpansionOutcome actualExpansionResult = context.expandVS(inc, true, false);
|
||||
|
||||
|
@ -354,7 +348,7 @@ public class SimpleWorkerContextTests {
|
|||
|
||||
Mockito.verify(terminologyCache).getExpansion(cacheToken);
|
||||
Mockito.verify(terminologyCache, times(0)).cacheExpansion(any(), any(), anyBoolean());
|
||||
Mockito.verify(terminologyClient, times(0)).expandValueset(any(), any(), any());
|
||||
Mockito.verify(terminologyClient, times(0)).expandValueset(any(), any());
|
||||
}
|
||||
|
||||
private class ValidationOptionsFhirPublicationMatcher implements ArgumentMatcher<ValidationOptions> {
|
||||
|
@ -393,7 +387,7 @@ public class SimpleWorkerContextTests {
|
|||
|
||||
Mockito.verify(terminologyCache).getExpansion(cacheToken);
|
||||
Mockito.verify(terminologyCache).cacheExpansion(cacheToken, actualExpansionResult, false);
|
||||
Mockito.verify(terminologyClient, times(0)).expandValueset(any(), any(), any());
|
||||
Mockito.verify(terminologyClient, times(0)).expandValueset(any(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -414,7 +408,7 @@ public class SimpleWorkerContextTests {
|
|||
|
||||
Mockito.doReturn(valueSetExpanderSimple).when(context).constructValueSetExpanderSimple(argThat(new ValidationOptionsFhirPublicationMatcher(vs.getFHIRPublicationVersion())));
|
||||
|
||||
Mockito.doReturn(expectedValueSet).when(terminologyClient).expandValueset(eq(vs), argThat(new ParametersMatcher(pInWithDependentResources)), eq(params));
|
||||
Mockito.doReturn(expectedValueSet).when(terminologyClient).expandValueset(eq(vs), argThat(new ParametersMatcher(pInWithDependentResources)));
|
||||
|
||||
ValueSetExpansionOutcome actualExpansionResult = context.expandVS(vs, true, true, true, pIn, false);
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ public class TxTester {
|
|||
p.getParameter().addAll(profile.getParameter());
|
||||
String vsj;
|
||||
try {
|
||||
ValueSet vs = tx.expandValueset(null, p, null);
|
||||
ValueSet vs = tx.expandValueset(null, p);
|
||||
TxTesterScrubbers.scrubVS(vs, tight);
|
||||
TxTesterSorters.sortValueSet(vs);
|
||||
vsj = new org.hl7.fhir.r5.formats.JsonParser().setOutputStyle(OutputStyle.PRETTY).composeString(vs);
|
||||
|
|
Loading…
Reference in New Issue