reverse SearchParameter.base change

This commit is contained in:
Grahame Grieve 2022-12-14 06:29:21 +11:00
parent 0cf8cbcba5
commit 38c4785236
11 changed files with 45 additions and 65 deletions

View File

@ -10,8 +10,6 @@ import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Uri1
import org.hl7.fhir.dstu2.utils.ToolingExtensions;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.CodeType;
import org.hl7.fhir.r5.model.Enumeration;
import org.hl7.fhir.r5.model.Enumerations.AllResourceTypes;
public class SearchParameter10_50 {
@ -38,7 +36,7 @@ public class SearchParameter10_50 {
tgt.setRequirements(src.getPurpose());
if (src.hasCodeElement())
tgt.setCodeElement(Code10_50.convertCode(src.getCodeElement()));
for (Enumeration<AllResourceTypes> t : src.getBase()) tgt.setBase(t.getCode());
for (CodeType t : src.getBase()) tgt.setBaseElement(Code10_50.convertCode(t));
if (src.hasType())
tgt.setTypeElement(Enumerations10_50.convertSearchParamType(src.getTypeElement()));
if (src.hasDescription())
@ -75,7 +73,7 @@ public class SearchParameter10_50 {
tgt.setPurpose(src.getRequirements());
if (src.hasCodeElement())
tgt.setCodeElement(Code10_50.convertCode(src.getCodeElement()));
tgt.addBase(AllResourceTypes.fromCode(src.getBase()));
tgt.getBase().add(Code10_50.convertCode(src.getBaseElement()));
if (src.hasType())
tgt.setTypeElement(Enumerations10_50.convertSearchParamType(src.getTypeElement()));
if (src.hasDescription())

View File

@ -11,8 +11,6 @@ import org.hl7.fhir.convertors.conv14_50.datatypes14_50.primitivetypes14_50.Stri
import org.hl7.fhir.convertors.conv14_50.datatypes14_50.primitivetypes14_50.Uri14_50;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.CodeType;
import org.hl7.fhir.r5.model.Enumeration;
import org.hl7.fhir.r5.model.Enumerations.AllResourceTypes;
public class SearchParameter14_50 {
@ -44,7 +42,7 @@ public class SearchParameter14_50 {
tgt.setRequirements(src.getPurpose());
if (src.hasCodeElement())
tgt.setCodeElement(Code14_50.convertCode(src.getCodeElement()));
for (Enumeration<AllResourceTypes> t : src.getBase()) tgt.setBase(t.asStringValue());
for (CodeType t : src.getBase()) tgt.setBase(t.asStringValue());
if (src.hasType())
tgt.setTypeElement(Enumerations14_50.convertSearchParamType(src.getTypeElement()));
if (src.hasDescription())
@ -87,7 +85,7 @@ public class SearchParameter14_50 {
tgt.setPurpose(src.getRequirements());
if (src.hasCodeElement())
tgt.setCodeElement(Code14_50.convertCode(src.getCodeElement()));
tgt.addBase(AllResourceTypes.fromCode(src.getBase()));
tgt.getBase().add(Code14_50.convertCode(src.getBaseElement()));
if (src.hasType())
tgt.setTypeElement(Enumerations14_50.convertSearchParamType(src.getTypeElement()));
if (src.hasDescription())

View File

@ -15,8 +15,6 @@ import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Stri
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Uri30_50;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.CodeType;
import org.hl7.fhir.r5.model.Enumeration;
import org.hl7.fhir.r5.model.Enumerations.AllResourceTypes;
public class SearchParameter30_50 {
@ -215,7 +213,7 @@ public class SearchParameter30_50 {
tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement()));
if (src.hasCode())
tgt.setCodeElement(Code30_50.convertCode(src.getCodeElement()));
for (org.hl7.fhir.dstu3.model.CodeType t : src.getBase()) tgt.addBase(AllResourceTypes.fromCode(t.asStringValue()));
for (org.hl7.fhir.dstu3.model.CodeType t : src.getBase()) tgt.getBase().add(Code30_50.convertCode(t));
if (src.hasType())
tgt.setTypeElement(Enumerations30_50.convertSearchParamType(src.getTypeElement()));
if (src.hasDerivedFrom())
@ -270,7 +268,7 @@ public class SearchParameter30_50 {
tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement()));
if (src.hasCode())
tgt.setCodeElement(Code30_50.convertCode(src.getCodeElement()));
for (Enumeration<AllResourceTypes> t : src.getBase()) tgt.addBase(t.getCode());
for (CodeType t : src.getBase()) tgt.getBase().add(Code30_50.convertCode(t));
if (src.hasType())
tgt.setTypeElement(Enumerations30_50.convertSearchParamType(src.getTypeElement()));
if (src.hasDerivedFrom())

View File

@ -15,8 +15,6 @@ import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Uri40_50;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.CodeType;
import org.hl7.fhir.r5.model.Enumeration;
import org.hl7.fhir.r5.model.Enumerations.AllResourceTypes;
/*
Copyright (c) 2011+, HL7, Inc.
@ -82,7 +80,7 @@ public class SearchParameter40_50 {
tgt.setPurposeElement(MarkDown40_50.convertMarkdown(src.getPurposeElement()));
if (src.hasCode())
tgt.setCodeElement(Code40_50.convertCode(src.getCodeElement()));
for (org.hl7.fhir.r4.model.CodeType t : src.getBase()) tgt.addBase(AllResourceTypes.fromCode(t.asStringValue()));
for (org.hl7.fhir.r4.model.CodeType t : src.getBase()) tgt.getBase().add(Code40_50.convertCode(t));
if (src.hasType())
tgt.setTypeElement(Enumerations40_50.convertSearchParamType(src.getTypeElement()));
if (src.hasExpression())
@ -141,7 +139,7 @@ public class SearchParameter40_50 {
tgt.setPurposeElement(MarkDown40_50.convertMarkdown(src.getPurposeElement()));
if (src.hasCode())
tgt.setCodeElement(Code40_50.convertCode(src.getCodeElement()));
for (Enumeration<AllResourceTypes> t : src.getBase()) tgt.addBase(t.getCode());
for (CodeType t : src.getBase()) tgt.getBase().add(Code40_50.convertCode(t));
if (src.hasType())
tgt.setTypeElement(Enumerations40_50.convertSearchParamType(src.getTypeElement()));
if (src.hasExpression())

View File

@ -15,8 +15,6 @@ import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.CodeType;
import org.hl7.fhir.r5.model.Enumeration;
import org.hl7.fhir.r5.model.Enumerations.AllResourceTypes;
/*
Copyright (c) 2011+, HL7, Inc.
@ -82,7 +80,7 @@ public class SearchParameter43_50 {
tgt.setPurposeElement(MarkDown43_50.convertMarkdown(src.getPurposeElement()));
if (src.hasCode())
tgt.setCodeElement(Code43_50.convertCode(src.getCodeElement()));
for (org.hl7.fhir.r4b.model.CodeType t : src.getBase()) tgt.addBase(AllResourceTypes.fromCode(t.asStringValue()));
for (org.hl7.fhir.r4b.model.CodeType t : src.getBase()) tgt.getBase().add(Code43_50.convertCode(t));
if (src.hasType())
tgt.setTypeElement(Enumerations43_50.convertSearchParamType(src.getTypeElement()));
if (src.hasExpression())
@ -141,7 +139,7 @@ public class SearchParameter43_50 {
tgt.setPurposeElement(MarkDown43_50.convertMarkdown(src.getPurposeElement()));
if (src.hasCode())
tgt.setCodeElement(Code43_50.convertCode(src.getCodeElement()));
for (Enumeration<AllResourceTypes> t : src.getBase()) tgt.addBase(t.getCode());
for (CodeType t : src.getBase()) tgt.getBase().add(Code43_50.convertCode(t));
if (src.hasType())
tgt.setTypeElement(Enumerations43_50.convertSearchParamType(src.getTypeElement()));
if (src.hasExpression())

View File

@ -309,7 +309,7 @@ public class Analyser {
if (!Utilities.existsInList(name, "Resource")) {
for (SearchParameter sp : definitions.getSearchParams().getList()) {
boolean relevant = false;
for (Enumeration<AllResourceTypes> c : sp.getBase()) {
for (CodeType c : sp.getBase()) {
if (c.getValue().equals(name)) {
relevant = true;
break;

View File

@ -27903,9 +27903,9 @@ public class JsonParser extends JsonParserBase {
JsonArray array = getJArray(json, "base");
for (int i = 0; i < array.size(); i++) {
if (array.get(i).isJsonNull()) {
res.getBase().add(new Enumeration<Enumerations.AllResourceTypes>(new Enumerations.AllResourceTypesEnumFactory(), Enumerations.AllResourceTypes.NULL));
res.getBase().add(new CodeType());
} else {;
res.getBase().add(parseEnumeration(array.get(i).getAsString(), Enumerations.AllResourceTypes.NULL, new Enumerations.AllResourceTypesEnumFactory()));
res.getBase().add(parseCode(array.get(i).getAsString()));
}
}
};
@ -27913,7 +27913,7 @@ public class JsonParser extends JsonParserBase {
JsonArray array = getJArray(json, "_base");
for (int i = 0; i < array.size(); i++) {
if (i == res.getBase().size())
res.getBase().add(parseEnumeration(null, Enumerations.AllResourceTypes.NULL, new Enumerations.AllResourceTypesEnumFactory()));
res.getBase().add(new CodeType());
if (array.get(i) instanceof JsonObject)
parseElementProperties(array.get(i).getAsJsonObject(), res.getBase().get(i));
}
@ -64718,13 +64718,13 @@ public class JsonParser extends JsonParserBase {
}
if (element.hasBase()) {
openArray("base");
for (Enumeration<Enumerations.AllResourceTypes> e : element.getBase())
composeEnumerationCore(null, e, new Enumerations.AllResourceTypesEnumFactory(), true);
for (CodeType e : element.getBase())
composeCodeCore(null, e, true);
closeArray();
if (anyHasExtras(element.getBase())) {
openArray("_base");
for (Enumeration<Enumerations.AllResourceTypes> e : element.getBase())
composeEnumerationExtras(null, e, new Enumerations.AllResourceTypesEnumFactory(), true);
for (CodeType e : element.getBase())
composeCodeExtras(null, e, true);
closeArray();
}
};

View File

@ -22356,7 +22356,7 @@ public class RdfParser extends RdfParserBase {
composeCode(t, "SearchParameter", "code", element.getCodeElement(), -1);
}
for (int i = 0; i < element.getBase().size(); i++) {
composeEnum(t, "SearchParameter", "base", element.getBase().get(i), i);
composeCode(t, "SearchParameter", "base", element.getBase().get(i), i);
}
if (element.hasTypeElement()) {
composeEnum(t, "SearchParameter", "type", element.getTypeElement(), -1);

View File

@ -24175,7 +24175,7 @@ public class XmlParser extends XmlParserBase {
} else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
res.setCodeElement(parseCode(xpp));
} else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("base")) {
res.getBase().add(parseEnumeration(xpp, Enumerations.AllResourceTypes.NULL, new Enumerations.AllResourceTypesEnumFactory()));
res.getBase().add(parseCode(xpp));
} else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
res.setTypeElement(parseEnumeration(xpp, Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
} else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expression")) {
@ -55508,8 +55508,8 @@ public class XmlParser extends XmlParserBase {
composeCode("code", element.getCodeElement());
}
if (element.hasBase())
for (Enumeration<Enumerations.AllResourceTypes> e : element.getBase())
composeEnumeration("base", e, new Enumerations.AllResourceTypesEnumFactory());
for (CodeType e : element.getBase())
composeCode("base", e);
if (element.hasTypeElement())
composeEnumeration("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory());
if (element.hasExpressionElement()) {

View File

@ -1050,7 +1050,7 @@ public class SearchParameter extends CanonicalResource {
@Child(name = "base", type = {CodeType.class}, order=16, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="The resource type(s) this search parameter applies to", formalDefinition="The base resource type(s) that this search parameter can be used against." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/all-resource-types")
protected List<Enumeration<AllResourceTypes>> base;
protected List<CodeType> base;
/**
* The type of value that a search parameter may contain, and how the content is interpreted.
@ -1146,7 +1146,7 @@ public class SearchParameter extends CanonicalResource {
/**
* Constructor
*/
public SearchParameter(String url, String name, PublicationStatus status, String description, String code, AllResourceTypes base, SearchParamType type) {
public SearchParameter(String url, String name, PublicationStatus status, String description, String code, String base, SearchParamType type) {
super();
this.setUrl(url);
this.setName(name);
@ -1934,16 +1934,16 @@ public class SearchParameter extends CanonicalResource {
/**
* @return {@link #base} (The base resource type(s) that this search parameter can be used against.)
*/
public List<Enumeration<AllResourceTypes>> getBase() {
public List<CodeType> getBase() {
if (this.base == null)
this.base = new ArrayList<Enumeration<AllResourceTypes>>();
this.base = new ArrayList<CodeType>();
return this.base;
}
/**
* @return Returns a reference to <code>this</code> for easy method chaining
*/
public SearchParameter setBase(List<Enumeration<AllResourceTypes>> theBase) {
public SearchParameter setBase(List<CodeType> theBase) {
this.base = theBase;
return this;
}
@ -1951,7 +1951,7 @@ public class SearchParameter extends CanonicalResource {
public boolean hasBase() {
if (this.base == null)
return false;
for (Enumeration<AllResourceTypes> item : this.base)
for (CodeType item : this.base)
if (!item.isEmpty())
return true;
return false;
@ -1960,10 +1960,10 @@ public class SearchParameter extends CanonicalResource {
/**
* @return {@link #base} (The base resource type(s) that this search parameter can be used against.)
*/
public Enumeration<AllResourceTypes> addBaseElement() {//2
Enumeration<AllResourceTypes> t = new Enumeration<AllResourceTypes>(new AllResourceTypesEnumFactory());
public CodeType addBaseElement() {//2
CodeType t = new CodeType();
if (this.base == null)
this.base = new ArrayList<Enumeration<AllResourceTypes>>();
this.base = new ArrayList<CodeType>();
this.base.add(t);
return t;
}
@ -1971,11 +1971,11 @@ public class SearchParameter extends CanonicalResource {
/**
* @param value {@link #base} (The base resource type(s) that this search parameter can be used against.)
*/
public SearchParameter addBase(AllResourceTypes value) { //1
Enumeration<AllResourceTypes> t = new Enumeration<AllResourceTypes>(new AllResourceTypesEnumFactory());
t.setValue(value);
public SearchParameter addBase(String code) { //1
CodeType t = new CodeType();
t.setValue(code);
if (this.base == null)
this.base = new ArrayList<Enumeration<AllResourceTypes>>();
this.base = new ArrayList<CodeType>();
this.base.add(t);
return this;
}
@ -1983,11 +1983,11 @@ public class SearchParameter extends CanonicalResource {
/**
* @param value {@link #base} (The base resource type(s) that this search parameter can be used against.)
*/
public boolean hasBase(AllResourceTypes value) {
public boolean hasBase(String code) {
if (this.base == null)
return false;
for (Enumeration<AllResourceTypes> v : this.base)
if (v.getValue().equals(value)) // code
for (CodeType v : this.base)
if (v.getValue().equals(code)) // code
return true;
return false;
}
@ -2838,8 +2838,8 @@ public class SearchParameter extends CanonicalResource {
this.code = TypeConvertor.castToCode(value); // CodeType
return value;
case 3016401: // base
value = new AllResourceTypesEnumFactory().fromType(TypeConvertor.castToCode(value));
this.getBase().add((Enumeration) value); // Enumeration<AllResourceTypes>
value = TypeConvertor.castToCode(value);
this.getBase().add((CodeType) value); // Enumeration<AllResourceTypes>
return value;
case 3575610: // type
value = new SearchParamTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
@ -2919,8 +2919,8 @@ public class SearchParameter extends CanonicalResource {
} else if (name.equals("code")) {
this.code = TypeConvertor.castToCode(value); // CodeType
} else if (name.equals("base")) {
value = new AllResourceTypesEnumFactory().fromType(TypeConvertor.castToCode(value));
this.getBase().add((Enumeration) value);
value = TypeConvertor.castToCode(value);
this.getBase().add((CodeType) value);
} else if (name.equals("type")) {
value = new SearchParamTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
this.type = (Enumeration) value; // Enumeration<SearchParamType>
@ -3162,8 +3162,8 @@ public class SearchParameter extends CanonicalResource {
dst.purpose = purpose == null ? null : purpose.copy();
dst.code = code == null ? null : code.copy();
if (base != null) {
dst.base = new ArrayList<Enumeration<AllResourceTypes>>();
for (Enumeration<AllResourceTypes> i : base)
dst.base = new ArrayList<CodeType>();
for (CodeType i : base)
dst.base.add(i.copy());
};
dst.type = type == null ? null : type.copy();
@ -4477,15 +4477,6 @@ public class SearchParameter extends CanonicalResource {
return false;
}
public boolean hasBase(String n) {
for (Enumeration<AllResourceTypes> b : getBase()) {
if (b.getCode().equals(n)) {
return true;
}
}
return false;
}
// end addition
}

View File

@ -7,7 +7,6 @@ import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.CodeType;
import org.hl7.fhir.r5.model.Enumeration;
import org.hl7.fhir.r5.model.Enumerations.AllResourceTypes;
import org.hl7.fhir.r5.model.OperationDefinition;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.model.SearchParameter;
@ -50,7 +49,7 @@ public class SearchParameterRenderer extends TerminologyRenderer {
XhtmlNode tr = tbl.tr();
tr.td().tx(Utilities.pluralize("Resource", spd.getBase().size()));
XhtmlNode td = tr.td();
for (Enumeration<AllResourceTypes> t : spd.getBase()) {
for (CodeType t : spd.getBase()) {
StructureDefinition sd = context.getWorker().fetchTypeDefinition(t.toString());
if (sd != null && sd.hasUserData("path")) {
td.ah(sd.getUserString("path")).sep(", ").tx(t.getCode());