From 26a6659d2ed6ea184cb22a7fb304f81515506d9a Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Mon, 5 Aug 2019 07:33:30 +1000 Subject: [PATCH] fix wrong code generation for Expression.language --- .../convertors/VersionConvertor_30_40.java | 12 +++++----- .../convertors/VersionConvertor_30_50.java | 12 +++++----- .../convertors/VersionConvertor_40_50.java | 4 ++-- .../org/hl7/fhir/r4/formats/JsonParser.java | 6 ++--- .../org/hl7/fhir/r4/formats/RdfParser.java | 2 +- .../org/hl7/fhir/r4/formats/XmlParser.java | 4 ++-- .../org/hl7/fhir/r4/model/Expression.java | 22 +++++++++---------- .../org/hl7/fhir/r5/formats/JsonParser.java | 6 ++--- .../org/hl7/fhir/r5/formats/RdfParser.java | 2 +- .../org/hl7/fhir/r5/formats/XmlParser.java | 4 ++-- .../org/hl7/fhir/r5/model/Expression.java | 22 +++++++++---------- 11 files changed, 46 insertions(+), 50 deletions(-) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_40.java index 581c48732..26d024d34 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_40.java @@ -3358,7 +3358,7 @@ public class VersionConvertor_30_40 { if (src.hasPath()) tgt.setPath(src.getPath()); if (src.hasLanguage()) - tgt.getExpression().setLanguage(ExpressionLanguage.fromCode(src.getLanguage())); + tgt.getExpression().setLanguage(src.getLanguage()); if (src.hasExpression()) tgt.getExpression().setExpression(src.getExpression()); return tgt; @@ -3374,7 +3374,7 @@ public class VersionConvertor_30_40 { if (src.getExpression().hasDescription()) tgt.setDescription(src.getExpression().getDescription()); if (src.getExpression().hasLanguage()) - tgt.setLanguage(src.getExpression().getLanguage().toCode()); + tgt.setLanguage(src.getExpression().getLanguage()); if (src.getExpression().hasExpression()) tgt.setExpression(src.getExpression().getExpression()); return tgt; @@ -22531,7 +22531,7 @@ public class VersionConvertor_30_40 { if (src.hasDescription()) tgt.getExpression().setDescription(src.getDescription()); if (src.hasLanguage()) - tgt.getExpression().setLanguage(ExpressionLanguage.fromCode(src.getLanguage())); + tgt.getExpression().setLanguage(src.getLanguage()); if (src.hasExpression()) tgt.getExpression().setExpression(src.getExpression()); return tgt; @@ -22547,7 +22547,7 @@ public class VersionConvertor_30_40 { if (src.getExpression().hasDescription()) tgt.setDescription(src.getExpression().getDescription()); if (src.getExpression().hasLanguage()) - tgt.setLanguage(src.getExpression().getLanguage().toCode()); + tgt.setLanguage(src.getExpression().getLanguage()); if (src.getExpression().hasExpression()) tgt.setExpression(src.getExpression().getExpression()); return tgt; @@ -22693,7 +22693,7 @@ public class VersionConvertor_30_40 { if (src.hasPath()) tgt.setPath(src.getPath()); if (src.hasLanguage()) - tgt.getExpression().setLanguage(ExpressionLanguage.fromCode(src.getLanguage())); + tgt.getExpression().setLanguage(src.getLanguage()); if (src.hasExpression()) tgt.getExpression().setExpression(src.getExpression()); return tgt; @@ -22709,7 +22709,7 @@ public class VersionConvertor_30_40 { if (src.hasPath()) tgt.setPath(src.getPath()); if (src.getExpression().hasLanguage()) - tgt.setLanguage(src.getExpression().getLanguage().toCode()); + tgt.setLanguage(src.getExpression().getLanguage()); if (src.getExpression().hasExpression()) tgt.setExpression(src.getExpression().getExpression()); return tgt; diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java index a4f32d1bd..bef738b90 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java @@ -3348,7 +3348,7 @@ public class VersionConvertor_30_50 { if (src.hasPath()) tgt.setPath(src.getPath()); if (src.hasLanguage()) - tgt.getExpression().setLanguage(ExpressionLanguage.fromCode(src.getLanguage())); + tgt.getExpression().setLanguage(src.getLanguage()); if (src.hasExpression()) tgt.getExpression().setExpression(src.getExpression()); return tgt; @@ -3364,7 +3364,7 @@ public class VersionConvertor_30_50 { if (src.getExpression().hasDescription()) tgt.setDescription(src.getExpression().getDescription()); if (src.getExpression().hasLanguage()) - tgt.setLanguage(src.getExpression().getLanguage().toCode()); + tgt.setLanguage(src.getExpression().getLanguage()); if (src.getExpression().hasExpression()) tgt.setExpression(src.getExpression().getExpression()); return tgt; @@ -21861,7 +21861,7 @@ public class VersionConvertor_30_50 { if (src.hasDescription()) tgt.getExpression().setDescription(src.getDescription()); if (src.hasLanguage()) - tgt.getExpression().setLanguage(ExpressionLanguage.fromCode(src.getLanguage())); + tgt.getExpression().setLanguage(src.getLanguage()); if (src.hasExpression()) tgt.getExpression().setExpression(src.getExpression()); return tgt; @@ -21877,7 +21877,7 @@ public class VersionConvertor_30_50 { if (src.getExpression().hasDescription()) tgt.setDescription(src.getExpression().getDescription()); if (src.getExpression().hasLanguage()) - tgt.setLanguage(src.getExpression().getLanguage().toCode()); + tgt.setLanguage(src.getExpression().getLanguage()); if (src.getExpression().hasExpression()) tgt.setExpression(src.getExpression().getExpression()); return tgt; @@ -22023,7 +22023,7 @@ public class VersionConvertor_30_50 { if (src.hasPath()) tgt.setPath(src.getPath()); if (src.hasLanguage()) - tgt.getExpression().setLanguage(ExpressionLanguage.fromCode(src.getLanguage())); + tgt.getExpression().setLanguage(src.getLanguage()); if (src.hasExpression()) tgt.getExpression().setExpression(src.getExpression()); return tgt; @@ -22039,7 +22039,7 @@ public class VersionConvertor_30_50 { if (src.hasPath()) tgt.setPath(src.getPath()); if (src.getExpression().hasLanguage()) - tgt.setLanguage(src.getExpression().getLanguage().toCode()); + tgt.setLanguage(src.getExpression().getLanguage()); if (src.getExpression().hasExpression()) tgt.setExpression(src.getExpression().getExpression()); return tgt; diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_40_50.java index af5e38f87..87da62414 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_40_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_40_50.java @@ -1153,7 +1153,7 @@ public class VersionConvertor_40_50 { if (src.hasName()) tgt.setNameElement(convertId(src.getNameElement())); if (src.hasLanguage()) - tgt.setLanguage(convertExpressionLanguage(src.getLanguage())); + tgt.setLanguageElement(convertCode(src.getLanguageElement())); if (src.hasExpression()) tgt.setExpressionElement(convertString(src.getExpressionElement())); if (src.hasReference()) @@ -1171,7 +1171,7 @@ public class VersionConvertor_40_50 { if (src.hasName()) tgt.setNameElement(convertId(src.getNameElement())); if (src.hasLanguage()) - tgt.setLanguage(convertExpressionLanguage(src.getLanguage())); + tgt.setLanguageElement(convertCode(src.getLanguageElement())); if (src.hasExpression()) tgt.setExpressionElement(convertString(src.getExpressionElement())); if (src.hasReference()) diff --git a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/formats/JsonParser.java b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/formats/JsonParser.java index 70afa11bc..2ff3496ff 100644 --- a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/formats/JsonParser.java +++ b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/formats/JsonParser.java @@ -1200,7 +1200,7 @@ public class JsonParser extends JsonParserBase { if (json.has("_name")) parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement()); if (json.has("language")) - res.setLanguageElement(parseEnumeration(json.get("language").getAsString(), Expression.ExpressionLanguage.NULL, new Expression.ExpressionLanguageEnumFactory())); + res.setLanguageElement(parseCode(json.get("language").getAsString())); if (json.has("_language")) parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement()); if (json.has("expression")) @@ -30075,8 +30075,8 @@ public class JsonParser extends JsonParserBase { composeIdExtras("name", element.getNameElement(), false); } if (element.hasLanguageElement()) { - composeEnumerationCore("language", element.getLanguageElement(), new Expression.ExpressionLanguageEnumFactory(), false); - composeEnumerationExtras("language", element.getLanguageElement(), new Expression.ExpressionLanguageEnumFactory(), false); + composeCodeCore("language", element.getLanguageElement(), false); + composeCodeExtras("language", element.getLanguageElement(), false); } if (element.hasExpressionElement()) { composeStringCore("expression", element.getExpressionElement(), false); diff --git a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/formats/RdfParser.java b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/formats/RdfParser.java index 1dd7ddead..32eaebe45 100644 --- a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/formats/RdfParser.java +++ b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/formats/RdfParser.java @@ -1004,7 +1004,7 @@ public class RdfParser extends RdfParserBase { if (element.hasNameElement()) composeId(t, "Expression", "name", element.getNameElement(), -1); if (element.hasLanguageElement()) - composeEnum(t, "Expression", "language", element.getLanguageElement(), -1); + composeCode(t, "Expression", "language", element.getLanguageElement(), -1); if (element.hasExpressionElement()) composeString(t, "Expression", "expression", element.getExpressionElement(), -1); if (element.hasReferenceElement()) diff --git a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/formats/XmlParser.java b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/formats/XmlParser.java index a587a1be2..f75c8fff0 100644 --- a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/formats/XmlParser.java +++ b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/formats/XmlParser.java @@ -1496,7 +1496,7 @@ public class XmlParser extends XmlParserBase { } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) { res.setNameElement(parseId(xpp)); } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) { - res.setLanguageElement(parseEnumeration(xpp, Expression.ExpressionLanguage.NULL, new Expression.ExpressionLanguageEnumFactory())); + res.setLanguageElement(parseCode(xpp)); } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expression")) { res.setExpressionElement(parseString(xpp)); } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) { @@ -26490,7 +26490,7 @@ public class XmlParser extends XmlParserBase { composeId("name", element.getNameElement()); } if (element.hasLanguageElement()) - composeEnumeration("language", element.getLanguageElement(), new Expression.ExpressionLanguageEnumFactory()); + composeCode("language", element.getLanguageElement()); if (element.hasExpressionElement()) { composeString("expression", element.getExpressionElement()); } diff --git a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Expression.java b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Expression.java index f1cd572f9..ccdd162d7 100644 --- a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Expression.java +++ b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Expression.java @@ -193,7 +193,7 @@ public class Expression extends Type implements ICompositeType { @Child(name = "language", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=true) @Description(shortDefinition="text/cql | text/fhirpath | application/x-fhir-query | etc.", formalDefinition="The media type of the language for the expression." ) @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/expression-language") - protected Enumeration language; + protected CodeType language; /** * An expression in the specified language that returns a value. @@ -221,7 +221,7 @@ public class Expression extends Type implements ICompositeType { /** * Constructor */ - public Expression(Enumeration language) { + public Expression(CodeType language) { super(); this.language = language; } @@ -327,12 +327,12 @@ public class Expression extends Type implements ICompositeType { /** * @return {@link #language} (The media type of the language for the expression.). This is the underlying object with id, value and extensions. The accessor "getLanguage" gives direct access to the value */ - public Enumeration getLanguageElement() { + public CodeType getLanguageElement() { if (this.language == null) if (Configuration.errorOnAutoCreate()) throw new Error("Attempt to auto-create Expression.language"); else if (Configuration.doAutoCreate()) - this.language = new Enumeration(new ExpressionLanguageEnumFactory()); // bb + this.language = new CodeType(); // bb return this.language; } @@ -347,7 +347,7 @@ public class Expression extends Type implements ICompositeType { /** * @param value {@link #language} (The media type of the language for the expression.). This is the underlying object with id, value and extensions. The accessor "getLanguage" gives direct access to the value */ - public Expression setLanguageElement(Enumeration value) { + public Expression setLanguageElement(CodeType value) { this.language = value; return this; } @@ -355,16 +355,16 @@ public class Expression extends Type implements ICompositeType { /** * @return The media type of the language for the expression. */ - public ExpressionLanguage getLanguage() { + public String getLanguage() { return this.language == null ? null : this.language.getValue(); } /** * @param value The media type of the language for the expression. */ - public Expression setLanguage(ExpressionLanguage value) { + public Expression setLanguage(String value) { if (this.language == null) - this.language = new Enumeration(new ExpressionLanguageEnumFactory()); + this.language = new CodeType(); this.language.setValue(value); return this; } @@ -512,8 +512,7 @@ public class Expression extends Type implements ICompositeType { this.name = castToId(value); // IdType return value; case -1613589672: // language - value = new ExpressionLanguageEnumFactory().fromType(castToCode(value)); - this.language = (Enumeration) value; // Enumeration + this.language = castToCode(value); // Enumeration return value; case -1795452264: // expression this.expression = castToString(value); // StringType @@ -533,8 +532,7 @@ public class Expression extends Type implements ICompositeType { } else if (name.equals("name")) { this.name = castToId(value); // IdType } else if (name.equals("language")) { - value = new ExpressionLanguageEnumFactory().fromType(castToCode(value)); - this.language = (Enumeration) value; // Enumeration + this.language = castToCode(value); // Enumeration } else if (name.equals("expression")) { this.expression = castToString(value); // StringType } else if (name.equals("reference")) { diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/formats/JsonParser.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/formats/JsonParser.java index 1c8b5d55a..5ef1b66ed 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/formats/JsonParser.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/formats/JsonParser.java @@ -1200,7 +1200,7 @@ public class JsonParser extends JsonParserBase { if (json.has("_name")) parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement()); if (json.has("language")) - res.setLanguageElement(parseEnumeration(json.get("language").getAsString(), Expression.ExpressionLanguage.NULL, new Expression.ExpressionLanguageEnumFactory())); + res.setLanguageElement(parseCode(json.get("language").getAsString())); if (json.has("_language")) parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement()); if (json.has("expression")) @@ -30075,8 +30075,8 @@ public class JsonParser extends JsonParserBase { composeIdExtras("name", element.getNameElement(), false); } if (element.hasLanguageElement()) { - composeEnumerationCore("language", element.getLanguageElement(), new Expression.ExpressionLanguageEnumFactory(), false); - composeEnumerationExtras("language", element.getLanguageElement(), new Expression.ExpressionLanguageEnumFactory(), false); + composeCodeCore("language", element.getLanguageElement(), false); + composeCodeExtras("language", element.getLanguageElement(), false); } if (element.hasExpressionElement()) { composeStringCore("expression", element.getExpressionElement(), false); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/formats/RdfParser.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/formats/RdfParser.java index 0fb6c2e68..252f98d1e 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/formats/RdfParser.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/formats/RdfParser.java @@ -1004,7 +1004,7 @@ public class RdfParser extends RdfParserBase { if (element.hasNameElement()) composeId(t, "Expression", "name", element.getNameElement(), -1); if (element.hasLanguageElement()) - composeEnum(t, "Expression", "language", element.getLanguageElement(), -1); + composeCode(t, "Expression", "language", element.getLanguageElement(), -1); if (element.hasExpressionElement()) composeString(t, "Expression", "expression", element.getExpressionElement(), -1); if (element.hasReferenceElement()) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/formats/XmlParser.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/formats/XmlParser.java index 20272d713..297ed595a 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/formats/XmlParser.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/formats/XmlParser.java @@ -1496,7 +1496,7 @@ public class XmlParser extends XmlParserBase { } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) { res.setNameElement(parseId(xpp)); } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) { - res.setLanguageElement(parseEnumeration(xpp, Expression.ExpressionLanguage.NULL, new Expression.ExpressionLanguageEnumFactory())); + res.setLanguageElement(parseCode(xpp)); } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expression")) { res.setExpressionElement(parseString(xpp)); } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) { @@ -26490,7 +26490,7 @@ public class XmlParser extends XmlParserBase { composeId("name", element.getNameElement()); } if (element.hasLanguageElement()) - composeEnumeration("language", element.getLanguageElement(), new Expression.ExpressionLanguageEnumFactory()); + composeCode("language", element.getLanguageElement()); if (element.hasExpressionElement()) { composeString("expression", element.getExpressionElement()); } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Expression.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Expression.java index 70d33a427..783a1fb9e 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Expression.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Expression.java @@ -193,7 +193,7 @@ public class Expression extends Type implements ICompositeType { @Child(name = "language", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=true) @Description(shortDefinition="text/cql | text/fhirpath | application/x-fhir-query | etc.", formalDefinition="The media type of the language for the expression." ) @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/expression-language") - protected Enumeration language; + protected CodeType language; /** * An expression in the specified language that returns a value. @@ -221,7 +221,7 @@ public class Expression extends Type implements ICompositeType { /** * Constructor */ - public Expression(Enumeration language) { + public Expression(CodeType language) { super(); this.language = language; } @@ -327,12 +327,12 @@ public class Expression extends Type implements ICompositeType { /** * @return {@link #language} (The media type of the language for the expression.). This is the underlying object with id, value and extensions. The accessor "getLanguage" gives direct access to the value */ - public Enumeration getLanguageElement() { + public CodeType getLanguageElement() { if (this.language == null) if (Configuration.errorOnAutoCreate()) throw new Error("Attempt to auto-create Expression.language"); else if (Configuration.doAutoCreate()) - this.language = new Enumeration(new ExpressionLanguageEnumFactory()); // bb + this.language = new CodeType(); // bb return this.language; } @@ -347,7 +347,7 @@ public class Expression extends Type implements ICompositeType { /** * @param value {@link #language} (The media type of the language for the expression.). This is the underlying object with id, value and extensions. The accessor "getLanguage" gives direct access to the value */ - public Expression setLanguageElement(Enumeration value) { + public Expression setLanguageElement(CodeType value) { this.language = value; return this; } @@ -355,16 +355,16 @@ public class Expression extends Type implements ICompositeType { /** * @return The media type of the language for the expression. */ - public ExpressionLanguage getLanguage() { + public String getLanguage() { return this.language == null ? null : this.language.getValue(); } /** * @param value The media type of the language for the expression. */ - public Expression setLanguage(ExpressionLanguage value) { + public Expression setLanguage(String value) { if (this.language == null) - this.language = new Enumeration(new ExpressionLanguageEnumFactory()); + this.language = new CodeType(); this.language.setValue(value); return this; } @@ -512,8 +512,7 @@ public class Expression extends Type implements ICompositeType { this.name = castToId(value); // IdType return value; case -1613589672: // language - value = new ExpressionLanguageEnumFactory().fromType(castToCode(value)); - this.language = (Enumeration) value; // Enumeration + this.language = castToCode(value); // Enumeration return value; case -1795452264: // expression this.expression = castToString(value); // StringType @@ -533,8 +532,7 @@ public class Expression extends Type implements ICompositeType { } else if (name.equals("name")) { this.name = castToId(value); // IdType } else if (name.equals("language")) { - value = new ExpressionLanguageEnumFactory().fromType(castToCode(value)); - this.language = (Enumeration) value; // Enumeration + this.language = castToCode(value); // Enumeration } else if (name.equals("expression")) { this.expression = castToString(value); // StringType } else if (name.equals("reference")) {