More work on R4 <-> R4B guides

This commit is contained in:
Grahame Grieve 2022-11-14 18:03:22 +11:00
parent e01216b7f3
commit cb72792b7e
6 changed files with 27 additions and 30 deletions

View File

@ -2516,7 +2516,7 @@ public class ImplementationGuide43_50 {
org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionParameterComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionParameterComponent(); org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionParameterComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionParameterComponent();
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
if (src.hasCode()) if (src.hasCode())
tgt.getCode().setCode(src.getCode().toCode()); tgt.getCode().setCode(src.getCode());
if (src.hasValue()) if (src.hasValue())
tgt.setValueElement(String43_50.convertString(src.getValueElement())); tgt.setValueElement(String43_50.convertString(src.getValueElement()));
return tgt; return tgt;

View File

@ -15842,7 +15842,7 @@ public class JsonParser extends JsonParserBase {
protected void parseImplementationGuideDefinitionParameterComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDefinitionParameterComponent res) throws IOException, FHIRFormatError { protected void parseImplementationGuideDefinitionParameterComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDefinitionParameterComponent res) throws IOException, FHIRFormatError {
parseBackboneElementProperties(json, res); parseBackboneElementProperties(json, res);
if (json.has("code")) if (json.has("code"))
res.setCodeElement(parseEnumeration(json.get("code").getAsString(), ImplementationGuide.GuideParameterCode.NULL, new ImplementationGuide.GuideParameterCodeEnumFactory())); res.setCodeElement(parseString(json.get("code").getAsString()));
if (json.has("_code")) if (json.has("_code"))
parseElementProperties(getJObject(json, "_code"), res.getCodeElement()); parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
if (json.has("value")) if (json.has("value"))
@ -46799,8 +46799,8 @@ public class JsonParser extends JsonParserBase {
protected void composeImplementationGuideDefinitionParameterComponentProperties(ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException { protected void composeImplementationGuideDefinitionParameterComponentProperties(ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
composeBackboneElementProperties(element); composeBackboneElementProperties(element);
if (element.hasCodeElement()) { if (element.hasCodeElement()) {
composeEnumerationCore("code", element.getCodeElement(), new ImplementationGuide.GuideParameterCodeEnumFactory(), false); composeStringCore("code", element.getCodeElement(), false);
composeEnumerationExtras("code", element.getCodeElement(), new ImplementationGuide.GuideParameterCodeEnumFactory(), false); composeStringExtras("code", element.getCodeElement(), false);
} }
if (element.hasValueElement()) { if (element.hasValueElement()) {
composeStringCore("value", element.getValueElement(), false); composeStringCore("value", element.getValueElement(), false);

View File

@ -12577,7 +12577,7 @@ public class RdfParser extends RdfParserBase {
} }
composeBackboneElement(t, "parameter", name, element, index); composeBackboneElement(t, "parameter", name, element, index);
if (element.hasCodeElement()) { if (element.hasCodeElement()) {
composeEnum(t, "ImplementationGuideDefinitionParameterComponent", "code", element.getCodeElement(), -1); composeString(t, "ImplementationGuideDefinitionParameterComponent", "code", element.getCodeElement(), -1);
} }
if (element.hasValueElement()) { if (element.hasValueElement()) {
composeString(t, "ImplementationGuideDefinitionParameterComponent", "value", element.getValueElement(), -1); composeString(t, "ImplementationGuideDefinitionParameterComponent", "value", element.getValueElement(), -1);

View File

@ -13779,7 +13779,7 @@ public class XmlParser extends XmlParserBase {
protected boolean parseImplementationGuideDefinitionParameterComponentContent(int eventType, XmlPullParser xpp, ImplementationGuide.ImplementationGuideDefinitionParameterComponent res) throws XmlPullParserException, IOException, FHIRFormatError { protected boolean parseImplementationGuideDefinitionParameterComponentContent(int eventType, XmlPullParser xpp, ImplementationGuide.ImplementationGuideDefinitionParameterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) { if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
res.setCodeElement(parseEnumeration(xpp, ImplementationGuide.GuideParameterCode.NULL, new ImplementationGuide.GuideParameterCodeEnumFactory())); res.setCodeElement(parseString(xpp));
} else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) { } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
res.setValueElement(parseString(xpp)); res.setValueElement(parseString(xpp));
} else if (!parseBackboneElementContent(eventType, xpp, res)){ } else if (!parseBackboneElementContent(eventType, xpp, res)){
@ -40194,7 +40194,7 @@ public class XmlParser extends XmlParserBase {
protected void composeImplementationGuideDefinitionParameterComponentElements(ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException { protected void composeImplementationGuideDefinitionParameterComponentElements(ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
composeBackboneElementElements(element); composeBackboneElementElements(element);
if (element.hasCodeElement()) if (element.hasCodeElement())
composeEnumeration("code", element.getCodeElement(), new ImplementationGuide.GuideParameterCodeEnumFactory()); composeString("code", element.getCodeElement());
if (element.hasValueElement()) { if (element.hasValueElement()) {
composeString("value", element.getValueElement()); composeString("value", element.getValueElement());
} }

View File

@ -8282,10 +8282,9 @@ public class ImplementationGuide extends CanonicalResource {
/** /**
* apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template. * apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template.
*/ */
@Child(name = "code", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=false) @Child(name = "code", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
@Description(shortDefinition="apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template", formalDefinition="apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template." ) @Description(shortDefinition="apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template", formalDefinition="apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/guide-parameter-code") protected StringType code;
protected Enumeration<GuideParameterCode> code;
/** /**
* Value for named type. * Value for named type.
@ -8306,21 +8305,21 @@ public class ImplementationGuide extends CanonicalResource {
/** /**
* Constructor * Constructor
*/ */
public ImplementationGuideDefinitionParameterComponent(GuideParameterCode code, String value) { public ImplementationGuideDefinitionParameterComponent(StringType code, StringType value) {
super(); super();
this.setCode(code); this.code = code;
this.setValue(value); this.value = value;
} }
/** /**
* @return {@link #code} (apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value * @return {@link #code} (apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
*/ */
public Enumeration<GuideParameterCode> getCodeElement() { public StringType getCodeElement() {
if (this.code == null) if (this.code == null)
if (Configuration.errorOnAutoCreate()) if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ImplementationGuideDefinitionParameterComponent.code"); throw new Error("Attempt to auto-create ImplementationGuideDefinitionParameterComponent.code");
else if (Configuration.doAutoCreate()) else if (Configuration.doAutoCreate())
this.code = new Enumeration<GuideParameterCode>(new GuideParameterCodeEnumFactory()); // bb this.code = new StringType(); // bb
return this.code; return this.code;
} }
@ -8335,7 +8334,7 @@ public class ImplementationGuide extends CanonicalResource {
/** /**
* @param value {@link #code} (apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value * @param value {@link #code} (apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
*/ */
public ImplementationGuideDefinitionParameterComponent setCodeElement(Enumeration<GuideParameterCode> value) { public ImplementationGuideDefinitionParameterComponent setCodeElement(StringType value) {
this.code = value; this.code = value;
return this; return this;
} }
@ -8343,16 +8342,16 @@ public class ImplementationGuide extends CanonicalResource {
/** /**
* @return apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template. * @return apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template.
*/ */
public GuideParameterCode getCode() { public String getCode() {
return this.code == null ? null : this.code.getValue(); return this.code == null ? null : this.code.getValue();
} }
/** /**
* @param value apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template. * @param value apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template.
*/ */
public ImplementationGuideDefinitionParameterComponent setCode(GuideParameterCode value) { public ImplementationGuideDefinitionParameterComponent setCode(String value) {
if (this.code == null) if (this.code == null)
this.code = new Enumeration<GuideParameterCode>(new GuideParameterCodeEnumFactory()); this.code = new StringType();
this.code.setValue(value); this.code.setValue(value);
return this; return this;
} }
@ -8404,14 +8403,14 @@ public class ImplementationGuide extends CanonicalResource {
protected void listChildren(List<Property> children) { protected void listChildren(List<Property> children) {
super.listChildren(children); super.listChildren(children);
children.add(new Property("code", "code", "apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template.", 0, 1, code)); children.add(new Property("code", "string", "apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template.", 0, 1, code));
children.add(new Property("value", "string", "Value for named type.", 0, 1, value)); children.add(new Property("value", "string", "Value for named type.", 0, 1, value));
} }
@Override @Override
public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
switch (_hash) { switch (_hash) {
case 3059181: /*code*/ return new Property("code", "code", "apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template.", 0, 1, code); case 3059181: /*code*/ return new Property("code", "string", "apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template.", 0, 1, code);
case 111972721: /*value*/ return new Property("value", "string", "Value for named type.", 0, 1, value); case 111972721: /*value*/ return new Property("value", "string", "Value for named type.", 0, 1, value);
default: return super.getNamedProperty(_hash, _name, _checkValid); default: return super.getNamedProperty(_hash, _name, _checkValid);
} }
@ -8432,8 +8431,7 @@ public class ImplementationGuide extends CanonicalResource {
public Base setProperty(int hash, String name, Base value) throws FHIRException { public Base setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) { switch (hash) {
case 3059181: // code case 3059181: // code
value = new GuideParameterCodeEnumFactory().fromType(TypeConvertor.castToCode(value)); this.code = TypeConvertor.castToString(value); // StringType
this.code = (Enumeration) value; // Enumeration<GuideParameterCode>
return value; return value;
case 111972721: // value case 111972721: // value
this.value = TypeConvertor.castToString(value); // StringType this.value = TypeConvertor.castToString(value); // StringType
@ -8446,8 +8444,7 @@ public class ImplementationGuide extends CanonicalResource {
@Override @Override
public Base setProperty(String name, Base value) throws FHIRException { public Base setProperty(String name, Base value) throws FHIRException {
if (name.equals("code")) { if (name.equals("code")) {
value = new GuideParameterCodeEnumFactory().fromType(TypeConvertor.castToCode(value)); this.code = TypeConvertor.castToString(value); // StringType
this.code = (Enumeration) value; // Enumeration<GuideParameterCode>
} else if (name.equals("value")) { } else if (name.equals("value")) {
this.value = TypeConvertor.castToString(value); // StringType this.value = TypeConvertor.castToString(value); // StringType
} else } else
@ -8468,7 +8465,7 @@ public class ImplementationGuide extends CanonicalResource {
@Override @Override
public String[] getTypesForProperty(int hash, String name) throws FHIRException { public String[] getTypesForProperty(int hash, String name) throws FHIRException {
switch (hash) { switch (hash) {
case 3059181: /*code*/ return new String[] {"code"}; case 3059181: /*code*/ return new String[] {"string"};
case 111972721: /*value*/ return new String[] {"string"}; case 111972721: /*value*/ return new String[] {"string"};
default: return super.getTypesForProperty(hash, name); default: return super.getTypesForProperty(hash, name);
} }

View File

@ -45,7 +45,7 @@ public class IGHelper {
public static String readStringParameter(ImplementationGuideDefinitionComponent ig, String name) { public static String readStringParameter(ImplementationGuideDefinitionComponent ig, String name) {
for (ImplementationGuideDefinitionParameterComponent p : ig.getParameter()) { for (ImplementationGuideDefinitionParameterComponent p : ig.getParameter()) {
if (name == p.getCode().toCode()) { if (name == p.getCode()) {
return p.getValue(); return p.getValue();
} }
} }
@ -59,19 +59,19 @@ public class IGHelper {
public static void setParameter(ImplementationGuideDefinitionComponent ig, String name, String value) { public static void setParameter(ImplementationGuideDefinitionComponent ig, String name, String value) {
for (ImplementationGuideDefinitionParameterComponent p : ig.getParameter()) { for (ImplementationGuideDefinitionParameterComponent p : ig.getParameter()) {
if (name == p.getCode().toCode()) { if (name == p.getCode()) {
p.setValue(value); p.setValue(value);
return; return;
} }
} }
ImplementationGuideDefinitionParameterComponent p = ig.addParameter(); ImplementationGuideDefinitionParameterComponent p = ig.addParameter();
p.setCode(org.hl7.fhir.r4b.model.ImplementationGuide.GuideParameterCode.fromCode(name)); p.setCode(name);
p.setValue(value); p.setValue(value);
} }
public static void addParameter(ImplementationGuideDefinitionComponent ig, String name, String value) { public static void addParameter(ImplementationGuideDefinitionComponent ig, String name, String value) {
ImplementationGuideDefinitionParameterComponent p = ig.addParameter(); ImplementationGuideDefinitionParameterComponent p = ig.addParameter();
p.setCode(org.hl7.fhir.r4b.model.ImplementationGuide.GuideParameterCode.fromCode(name)); p.setCode(name);
p.setValue(value); p.setValue(value);
} }