#934 Parameters object's getParameter(String theParameterName) is misnamed

This commit is contained in:
Grahame Grieve 2022-11-02 08:51:17 +11:00
parent c2259e2524
commit 1ae7093eef
7 changed files with 128 additions and 54 deletions

View File

@ -60,52 +60,52 @@ public class ExpansionProfile30_40 {
if (src == null)
return null;
org.hl7.fhir.dstu3.model.ExpansionProfile tgt = new org.hl7.fhir.dstu3.model.ExpansionProfile();
if (src.hasParameter("profile-url"))
tgt.setUrl(src.getParameter("profile-url").primitiveValue());
if (src.hasParameter("profile-version"))
tgt.setVersion(src.getParameter("profile-version").primitiveValue());
if (src.hasParameter("profile-name"))
tgt.setName(src.getParameter("profile-name").primitiveValue());
if (src.hasParameter("profile-status"))
tgt.setStatus(PublicationStatus.fromCode(src.getParameter("profile-status").primitiveValue()));
for (Type t : src.getParameters("system-version")) {
if (src.hasParameterValue("profile-url"))
tgt.setUrl(src.getParameterValue("profile-url").primitiveValue());
if (src.hasParameterValue("profile-version"))
tgt.setVersion(src.getParameterValue("profile-version").primitiveValue());
if (src.hasParameterValue("profile-name"))
tgt.setName(src.getParameterValue("profile-name").primitiveValue());
if (src.hasParameterValue("profile-status"))
tgt.setStatus(PublicationStatus.fromCode(src.getParameterValue("profile-status").primitiveValue()));
for (Type t : src.getParameterValues("system-version")) {
String[] v = t.primitiveValue().split("\\|");
tgt.addFixedVersion().setSystem(v[0]).setVersion(v[1]).setMode(SystemVersionProcessingMode.DEFAULT);
}
for (Type t : src.getParameters("force-system-version")) {
for (Type t : src.getParameterValues("force-system-version")) {
String[] v = t.primitiveValue().split("\\|");
tgt.addFixedVersion().setSystem(v[0]).setVersion(v[1]).setMode(SystemVersionProcessingMode.OVERRIDE);
}
for (Type t : src.getParameters("check-system-version")) {
for (Type t : src.getParameterValues("check-system-version")) {
String[] v = t.primitiveValue().split("\\|");
tgt.addFixedVersion().setSystem(v[0]).setVersion(v[1]).setMode(SystemVersionProcessingMode.CHECK);
}
for (Type t : src.getParameters("exclude-system")) {
for (Type t : src.getParameterValues("exclude-system")) {
String[] v = t.primitiveValue().split("\\|");
tgt.getExcludedSystem().setSystem(v[0]).setVersion(v[1]);
}
if (src.hasParameter("includeDesignations"))
if (src.hasParameterValue("includeDesignations"))
tgt.setIncludeDesignations(src.getParameterBool(""));
for (Type t : src.getParameters("designation")) {
for (Type t : src.getParameterValues("designation")) {
String[] v = t.primitiveValue().split("\\|");
if ("urn:ietf:bcp:47".equals(v[0]))
tgt.getDesignation().getInclude().addDesignation().setLanguage(v[1]);
else
tgt.getDesignation().getInclude().addDesignation().getUse().setSystem(v[0]).setCode(v[1]);
}
if (src.hasParameter("includeDefinition"))
if (src.hasParameterValue("includeDefinition"))
tgt.setIncludeDefinition(src.getParameterBool("includeDefinition"));
if (src.hasParameter("activeOnly"))
if (src.hasParameterValue("activeOnly"))
tgt.setActiveOnly(src.getParameterBool("activeOnly"));
if (src.hasParameter("excludeNested"))
if (src.hasParameterValue("excludeNested"))
tgt.setExcludeNested(src.getParameterBool("excludeNested"));
if (src.hasParameter("excludeNotForUI"))
if (src.hasParameterValue("excludeNotForUI"))
tgt.setExcludeNotForUI(src.getParameterBool("excludeNotForUI"));
if (src.hasParameter("excludeNotForUI"))
if (src.hasParameterValue("excludeNotForUI"))
tgt.setExcludePostCoordinated(src.getParameterBool("excludeNotForUI"));
if (src.hasParameter("displayLanguage"))
tgt.setDisplayLanguage(src.getParameter("displayLanguage").primitiveValue());
if (src.hasParameter("limitedExpansion"))
if (src.hasParameterValue("displayLanguage"))
tgt.setDisplayLanguage(src.getParameterValue("displayLanguage").primitiveValue());
if (src.hasParameterValue("limitedExpansion"))
tgt.setLimitedExpansion(src.getParameterBool("getParameterBool"));
return tgt;
}

View File

@ -214,7 +214,7 @@ public class Resource30_40 {
public org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src, BaseAdvisor_30_40 advisor) throws FHIRException {
if (src == null) return null;
if (src instanceof org.hl7.fhir.r4.model.Parameters) {
if (((org.hl7.fhir.r4.model.Parameters) src).hasParameter("profile-url"))
if (((org.hl7.fhir.r4.model.Parameters) src).hasParameterValue("profile-url"))
return ExpansionProfile30_40.convertExpansionProfile((org.hl7.fhir.r4.model.Parameters) src);
else return Parameters30_40.convertParameters((org.hl7.fhir.r4.model.Parameters) src);
}

View File

@ -285,7 +285,7 @@ public class Resource30_50 {
public org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src) throws FHIRException {
if (src == null) return null;
if (src instanceof org.hl7.fhir.r5.model.Parameters) {
if (((org.hl7.fhir.r5.model.Parameters) src).hasParameter("profile-url"))
if (((org.hl7.fhir.r5.model.Parameters) src).hasParameterValue("profile-url"))
return ExpansionProfile30_50.convertExpansionProfile((org.hl7.fhir.r5.model.Parameters) src);
else return Parameters30_50.convertParameters((org.hl7.fhir.r5.model.Parameters) src);
}

View File

@ -12,52 +12,52 @@ public class ExpansionProfile30_50 {
if (src == null)
return null;
org.hl7.fhir.dstu3.model.ExpansionProfile tgt = new org.hl7.fhir.dstu3.model.ExpansionProfile();
if (src.hasParameter("profile-url"))
tgt.setUrl(src.getParameter("profile-url").primitiveValue());
if (src.hasParameter("profile-version"))
tgt.setVersion(src.getParameter("profile-version").primitiveValue());
if (src.hasParameter("profile-name"))
tgt.setName(src.getParameter("profile-name").primitiveValue());
if (src.hasParameter("profile-status"))
tgt.setStatus(PublicationStatus.fromCode(src.getParameter("profile-status").primitiveValue()));
for (DataType t : src.getParameters("system-version")) {
if (src.hasParameterValue("profile-url"))
tgt.setUrl(src.getParameterValue("profile-url").primitiveValue());
if (src.hasParameterValue("profile-version"))
tgt.setVersion(src.getParameterValue("profile-version").primitiveValue());
if (src.hasParameterValue("profile-name"))
tgt.setName(src.getParameterValue("profile-name").primitiveValue());
if (src.hasParameterValue("profile-status"))
tgt.setStatus(PublicationStatus.fromCode(src.getParameterValue("profile-status").primitiveValue()));
for (DataType t : src.getParameterValues("system-version")) {
String[] v = t.primitiveValue().split("\\|");
tgt.addFixedVersion().setSystem(v[0]).setVersion(v[1]).setMode(SystemVersionProcessingMode.DEFAULT);
}
for (DataType t : src.getParameters("force-system-version")) {
for (DataType t : src.getParameterValues("force-system-version")) {
String[] v = t.primitiveValue().split("\\|");
tgt.addFixedVersion().setSystem(v[0]).setVersion(v[1]).setMode(SystemVersionProcessingMode.OVERRIDE);
}
for (DataType t : src.getParameters("check-system-version")) {
for (DataType t : src.getParameterValues("check-system-version")) {
String[] v = t.primitiveValue().split("\\|");
tgt.addFixedVersion().setSystem(v[0]).setVersion(v[1]).setMode(SystemVersionProcessingMode.CHECK);
}
for (DataType t : src.getParameters("exclude-system")) {
for (DataType t : src.getParameterValues("exclude-system")) {
String[] v = t.primitiveValue().split("\\|");
tgt.getExcludedSystem().setSystem(v[0]).setVersion(v[1]);
}
if (src.hasParameter("includeDesignations"))
if (src.hasParameterValue("includeDesignations"))
tgt.setIncludeDesignations(src.getParameterBool(""));
for (DataType t : src.getParameters("designation")) {
for (DataType t : src.getParameterValues("designation")) {
String[] v = t.primitiveValue().split("\\|");
if ("urn:ietf:bcp:47".equals(v[0]))
tgt.getDesignation().getInclude().addDesignation().setLanguage(v[1]);
else
tgt.getDesignation().getInclude().addDesignation().getUse().setSystem(v[0]).setCode(v[1]);
}
if (src.hasParameter("includeDefinition"))
if (src.hasParameterValue("includeDefinition"))
tgt.setIncludeDefinition(src.getParameterBool("includeDefinition"));
if (src.hasParameter("activeOnly"))
if (src.hasParameterValue("activeOnly"))
tgt.setActiveOnly(src.getParameterBool("activeOnly"));
if (src.hasParameter("excludeNested"))
if (src.hasParameterValue("excludeNested"))
tgt.setExcludeNested(src.getParameterBool("excludeNested"));
if (src.hasParameter("excludeNotForUI"))
if (src.hasParameterValue("excludeNotForUI"))
tgt.setExcludeNotForUI(src.getParameterBool("excludeNotForUI"));
if (src.hasParameter("excludeNotForUI"))
if (src.hasParameterValue("excludeNotForUI"))
tgt.setExcludePostCoordinated(src.getParameterBool("excludeNotForUI"));
if (src.hasParameter("displayLanguage"))
tgt.setDisplayLanguage(src.getParameter("displayLanguage").primitiveValue());
if (src.hasParameter("limitedExpansion"))
if (src.hasParameterValue("displayLanguage"))
tgt.setDisplayLanguage(src.getParameterValue("displayLanguage").primitiveValue());
if (src.hasParameterValue("limitedExpansion"))
tgt.setLimitedExpansion(src.getParameterBool("getParameterBool"));
return tgt;
}

View File

@ -877,6 +877,14 @@ public class Parameters extends Resource implements IBaseParameters {
return this;
}
public boolean hasParameterValue(String name) {
for (ParametersParameterComponent p : getParameter()) {
if (p.getName().equals(name) && p.hasValue())
return true;
}
return false;
}
public boolean hasParameter(String name) {
for (ParametersParameterComponent p : getParameter()) {
if (p.getName().equals(name))
@ -885,7 +893,7 @@ public class Parameters extends Resource implements IBaseParameters {
return false;
}
public Type getParameter(String name) {
public Type getParameterValue(String name) {
for (ParametersParameterComponent p : getParameter()) {
if (p.getName().equals(name))
return p.getValue();
@ -893,7 +901,15 @@ public class Parameters extends Resource implements IBaseParameters {
return null;
}
public List<Type> getParameters(String name) {
public ParametersParameterComponent getParameter(String name) {
for (ParametersParameterComponent p : getParameter()) {
if (p.getName().equals(name))
return p;
}
return null;
}
public List<Type> getParameterValues(String name) {
List<Type> res = new ArrayList<Type>();
for (ParametersParameterComponent p : getParameter()) {
if (p.getName().equals(name))
@ -902,7 +918,15 @@ public class Parameters extends Resource implements IBaseParameters {
return res;
}
public List<ParametersParameterComponent> getParameters(String name) {
List<ParametersParameterComponent> res = new ArrayList<ParametersParameterComponent>();
for (ParametersParameterComponent p : getParameter()) {
if (p.getName().equals(name))
res.add(p);
}
return res;
}
public boolean getParameterBool(String name) {
for (ParametersParameterComponent p : getParameter()) {
if (p.getName().equals(name)) {

View File

@ -1667,6 +1667,14 @@ public Parameters addParameter(String name, boolean b) {
return this;
}
public boolean hasParameterValue(String name) {
for (ParametersParameterComponent p : getParameter()) {
if (p.getName().equals(name) && p.hasValue())
return true;
}
return false;
}
public boolean hasParameter(String name) {
for (ParametersParameterComponent p : getParameter()) {
if (p.getName().equals(name))
@ -1675,7 +1683,7 @@ public Parameters addParameter(String name, boolean b) {
return false;
}
public DataType getParameter(String name) {
public DataType getParameterValue(String name) {
for (ParametersParameterComponent p : getParameter()) {
if (p.getName().equals(name))
return p.getValue();
@ -1683,7 +1691,15 @@ public Parameters addParameter(String name, boolean b) {
return null;
}
public List<DataType> getParameters(String name) {
public ParametersParameterComponent getParameter(String name) {
for (ParametersParameterComponent p : getParameter()) {
if (p.getName().equals(name))
return p;
}
return null;
}
public List<DataType> getParameterValues(String name) {
List<DataType> res = new ArrayList<>();
for (ParametersParameterComponent p : getParameter()) {
if (p.getName().equals(name))
@ -1692,6 +1708,15 @@ public Parameters addParameter(String name, boolean b) {
return res;
}
public List<ParametersParameterComponent> getParameters(String name) {
List<ParametersParameterComponent> res = new ArrayList<>();
for (ParametersParameterComponent p : getParameter()) {
if (p.getName().equals(name))
res.add(p);
}
return res;
}
public boolean getParameterBool(String name) {
for (ParametersParameterComponent p : getParameter()) {

View File

@ -39,6 +39,7 @@ import org.hl7.fhir.r5.model.Enumerations.*;
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.ICompositeType;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
@ -1747,6 +1748,14 @@ public Parameters addParameter(String name, boolean b) {
return this;
}
public boolean hasParameterValue(String name) {
for (ParametersParameterComponent p : getParameter()) {
if (p.getName().equals(name) && p.hasValue())
return true;
}
return false;
}
public boolean hasParameter(String name) {
for (ParametersParameterComponent p : getParameter()) {
if (p.getName().equals(name))
@ -1755,7 +1764,7 @@ public Parameters addParameter(String name, boolean b) {
return false;
}
public DataType getParameter(String name) {
public DataType getParameterValue(String name) {
for (ParametersParameterComponent p : getParameter()) {
if (p.getName().equals(name))
return p.getValue();
@ -1763,7 +1772,15 @@ public Parameters addParameter(String name, boolean b) {
return null;
}
public List<DataType> getParameters(String name) {
public ParametersParameterComponent getParameter(String name) {
for (ParametersParameterComponent p : getParameter()) {
if (p.getName().equals(name))
return p;
}
return null;
}
public List<DataType> getParameterValues(String name) {
List<DataType> res = new ArrayList<>();
for (ParametersParameterComponent p : getParameter()) {
if (p.getName().equals(name))
@ -1771,7 +1788,15 @@ public Parameters addParameter(String name, boolean b) {
}
return res;
}
public List<ParametersParameterComponent> getParameters(String name) {
List<ParametersParameterComponent> res = new ArrayList<ParametersParameterComponent>();
for (ParametersParameterComponent p : getParameter()) {
if (p.getName().equals(name))
res.add(p);
}
return res;
}
public boolean getParameterBool(String name) {
for (ParametersParameterComponent p : getParameter()) {