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();
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
if (src.hasCode())
tgt.getCode().setCode(src.getCode().toCode());
tgt.getCode().setCode(src.getCode());
if (src.hasValue())
tgt.setValueElement(String43_50.convertString(src.getValueElement()));
return tgt;

View File

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

View File

@ -12577,7 +12577,7 @@ public class RdfParser extends RdfParserBase {
}
composeBackboneElement(t, "parameter", name, element, index);
if (element.hasCodeElement()) {
composeEnum(t, "ImplementationGuideDefinitionParameterComponent", "code", element.getCodeElement(), -1);
composeString(t, "ImplementationGuideDefinitionParameterComponent", "code", element.getCodeElement(), -1);
}
if (element.hasValueElement()) {
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 {
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")) {
res.setValueElement(parseString(xpp));
} else if (!parseBackboneElementContent(eventType, xpp, res)){
@ -40194,7 +40194,7 @@ public class XmlParser extends XmlParserBase {
protected void composeImplementationGuideDefinitionParameterComponentElements(ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
composeBackboneElementElements(element);
if (element.hasCodeElement())
composeEnumeration("code", element.getCodeElement(), new ImplementationGuide.GuideParameterCodeEnumFactory());
composeString("code", element.getCodeElement());
if (element.hasValueElement()) {
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.
*/
@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." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/guide-parameter-code")
protected Enumeration<GuideParameterCode> code;
protected StringType code;
/**
* Value for named type.
@ -8306,21 +8305,21 @@ public class ImplementationGuide extends CanonicalResource {
/**
* Constructor
*/
public ImplementationGuideDefinitionParameterComponent(GuideParameterCode code, String value) {
public ImplementationGuideDefinitionParameterComponent(StringType code, StringType value) {
super();
this.setCode(code);
this.setValue(value);
this.code = code;
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
*/
public Enumeration<GuideParameterCode> getCodeElement() {
public StringType getCodeElement() {
if (this.code == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ImplementationGuideDefinitionParameterComponent.code");
else if (Configuration.doAutoCreate())
this.code = new Enumeration<GuideParameterCode>(new GuideParameterCodeEnumFactory()); // bb
this.code = new StringType(); // bb
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
*/
public ImplementationGuideDefinitionParameterComponent setCodeElement(Enumeration<GuideParameterCode> value) {
public ImplementationGuideDefinitionParameterComponent setCodeElement(StringType value) {
this.code = value;
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.
*/
public GuideParameterCode getCode() {
public String getCode() {
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.
*/
public ImplementationGuideDefinitionParameterComponent setCode(GuideParameterCode value) {
public ImplementationGuideDefinitionParameterComponent setCode(String value) {
if (this.code == null)
this.code = new Enumeration<GuideParameterCode>(new GuideParameterCodeEnumFactory());
this.code = new StringType();
this.code.setValue(value);
return this;
}
@ -8404,14 +8403,14 @@ public class ImplementationGuide extends CanonicalResource {
protected void listChildren(List<Property> 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));
}
@Override
public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
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);
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 {
switch (hash) {
case 3059181: // code
value = new GuideParameterCodeEnumFactory().fromType(TypeConvertor.castToCode(value));
this.code = (Enumeration) value; // Enumeration<GuideParameterCode>
this.code = TypeConvertor.castToString(value); // StringType
return value;
case 111972721: // value
this.value = TypeConvertor.castToString(value); // StringType
@ -8446,8 +8444,7 @@ public class ImplementationGuide extends CanonicalResource {
@Override
public Base setProperty(String name, Base value) throws FHIRException {
if (name.equals("code")) {
value = new GuideParameterCodeEnumFactory().fromType(TypeConvertor.castToCode(value));
this.code = (Enumeration) value; // Enumeration<GuideParameterCode>
this.code = TypeConvertor.castToString(value); // StringType
} else if (name.equals("value")) {
this.value = TypeConvertor.castToString(value); // StringType
} else
@ -8468,7 +8465,7 @@ public class ImplementationGuide extends CanonicalResource {
@Override
public String[] getTypesForProperty(int hash, String name) throws FHIRException {
switch (hash) {
case 3059181: /*code*/ return new String[] {"code"};
case 3059181: /*code*/ return new String[] {"string"};
case 111972721: /*value*/ return new String[] {"string"};
default: return super.getTypesForProperty(hash, name);
}

View File

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