fix classes that inherit from BackboneType in R4B

This commit is contained in:
Grahame Grieve 2022-07-28 21:29:02 +10:00
parent f3fa8cae24
commit b9d86aa5af
10 changed files with 88 additions and 41 deletions

View File

@ -201,6 +201,17 @@ public class JsonParser extends JsonParserBase {
};
}
protected void parseBackboneTypeProperties(JsonObject json, BackboneType res) throws IOException, FHIRFormatError {
parseDataTypeProperties(json, res);
if (json.has("modifierExtension")) {
JsonArray array = getJArray(json, "modifierExtension");
for (int i = 0; i < array.size(); i++) {
res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
}
};
}
protected void parseDataTypeProperties(JsonObject json, DataType res) throws IOException, FHIRFormatError {
parseElementProperties(json, res);
}
@ -648,7 +659,7 @@ public class JsonParser extends JsonParserBase {
}
protected void parseDosageProperties(JsonObject json, Dosage res) throws IOException, FHIRFormatError {
parseDataTypeProperties(json, res);
parseBackboneTypeProperties(json, res);
if (json.has("sequence"))
res.setSequenceElement(parseInteger(json.get("sequence").getAsLong()));
if (json.has("_sequence"))
@ -1319,7 +1330,7 @@ public class JsonParser extends JsonParserBase {
}
protected void parseMarketingStatusProperties(JsonObject json, MarketingStatus res) throws IOException, FHIRFormatError {
parseDataTypeProperties(json, res);
parseBackboneTypeProperties(json, res);
if (json.has("country"))
res.setCountry(parseCodeableConcept(getJObject(json, "country")));
if (json.has("jurisdiction"))
@ -1484,7 +1495,7 @@ public class JsonParser extends JsonParserBase {
}
protected void parsePopulationProperties(JsonObject json, Population res) throws IOException, FHIRFormatError {
parseDataTypeProperties(json, res);
parseBackboneTypeProperties(json, res);
DataType age = parseType("age", json);
if (age != null)
res.setAge(age);
@ -1503,7 +1514,7 @@ public class JsonParser extends JsonParserBase {
}
protected void parseProdCharacteristicProperties(JsonObject json, ProdCharacteristic res) throws IOException, FHIRFormatError {
parseDataTypeProperties(json, res);
parseBackboneTypeProperties(json, res);
if (json.has("height"))
res.setHeight(parseQuantity(getJObject(json, "height")));
if (json.has("width"))
@ -1575,7 +1586,7 @@ public class JsonParser extends JsonParserBase {
}
protected void parseProductShelfLifeProperties(JsonObject json, ProductShelfLife res) throws IOException, FHIRFormatError {
parseDataTypeProperties(json, res);
parseBackboneTypeProperties(json, res);
if (json.has("type"))
res.setType(parseCodeableConcept(getJObject(json, "type")));
DataType period = parseType("period", json);
@ -1802,7 +1813,7 @@ public class JsonParser extends JsonParserBase {
}
protected void parseTimingProperties(JsonObject json, Timing res) throws IOException, FHIRFormatError {
parseDataTypeProperties(json, res);
parseBackboneTypeProperties(json, res);
if (json.has("event")) {
JsonArray array = getJArray(json, "event");
for (int i = 0; i < array.size(); i++) {
@ -30250,6 +30261,16 @@ public class JsonParser extends JsonParserBase {
};
}
protected void composeBackboneTypeProperties(BackboneType element) throws IOException {
composeDataTypeProperties(element);
if (element.hasModifierExtension()) {
openArray("modifierExtension");
for (Extension e : element.getModifierExtension())
composeExtension(null, e);
closeArray();
};
}
protected void composeDataTypeProperties(DataType element) throws IOException {
composeElementProperties(element);
}
@ -30720,7 +30741,7 @@ public class JsonParser extends JsonParserBase {
}
protected void composeDosageProperties(Dosage element) throws IOException {
composeDataTypeProperties(element);
composeBackboneTypeProperties(element);
if (element.hasSequenceElement()) {
composeIntegerCore("sequence", element.getSequenceElement(), false);
composeIntegerExtras("sequence", element.getSequenceElement(), false);
@ -30813,7 +30834,7 @@ public class JsonParser extends JsonParserBase {
}
protected void composeElementDefinitionProperties(ElementDefinition element) throws IOException {
composeDataTypeProperties(element);
composeBackboneTypeProperties(element);
if (element.hasPathElement()) {
composeStringCore("path", element.getPathElement(), false);
composeStringExtras("path", element.getPathElement(), false);
@ -31389,7 +31410,7 @@ public class JsonParser extends JsonParserBase {
}
protected void composeMarketingStatusProperties(MarketingStatus element) throws IOException {
composeDataTypeProperties(element);
composeBackboneTypeProperties(element);
if (element.hasCountry()) {
composeCodeableConcept("country", element.getCountry());
}
@ -31570,7 +31591,7 @@ public class JsonParser extends JsonParserBase {
}
protected void composePopulationProperties(Population element) throws IOException {
composeDataTypeProperties(element);
composeBackboneTypeProperties(element);
if (element.hasAge()) {
composeType("age", element.getAge());
}
@ -31594,7 +31615,7 @@ public class JsonParser extends JsonParserBase {
}
protected void composeProdCharacteristicProperties(ProdCharacteristic element) throws IOException {
composeDataTypeProperties(element);
composeBackboneTypeProperties(element);
if (element.hasHeight()) {
composeQuantity("height", element.getHeight());
}
@ -31665,7 +31686,7 @@ public class JsonParser extends JsonParserBase {
}
protected void composeProductShelfLifeProperties(ProductShelfLife element) throws IOException {
composeDataTypeProperties(element);
composeBackboneTypeProperties(element);
if (element.hasType()) {
composeCodeableConcept("type", element.getType());
}
@ -31923,7 +31944,7 @@ public class JsonParser extends JsonParserBase {
}
protected void composeTimingProperties(Timing element) throws IOException {
composeDataTypeProperties(element);
composeBackboneTypeProperties(element);
if (element.hasEvent()) {
if (anyHasValue(element.getEvent())) {
openArray("event");

View File

@ -245,6 +245,15 @@ public class RdfParser extends RdfParserBase {
composeDataType(t, parentType, name, element, index);
}
protected void composeBackboneType(Complex t, String parentType, String name, BackboneType element, int index) {
composeDataType(t, parentType, name, element, index);
for (int i = 0; i < element.getModifierExtension().size(); i++) {
composeExtension(t, "BackboneElement", "modifierExtension", element.getModifierExtension().get(i), i);
}
}
protected void composeAddress(Complex parent, String parentType, String name, Address element, int index) {
if (element == null)
return;
@ -619,7 +628,7 @@ public class RdfParser extends RdfParserBase {
else {
t = parent.predicate("fhir:"+parentType+'.'+name);
}
composeDataType(t, "Dosage", name, element, index);
composeBackboneType(t, "Dosage", name, element, index);
if (element.hasSequenceElement()) {
composeInteger(t, "Dosage", "sequence", element.getSequenceElement(), -1);
}
@ -703,7 +712,7 @@ public class RdfParser extends RdfParserBase {
else {
t = parent.predicate("fhir:"+parentType+'.'+name);
}
composeDataType(t, "ElementDefinition", name, element, index);
composeBackboneType(t, "ElementDefinition", name, element, index);
if (element.hasPathElement()) {
composeString(t, "ElementDefinition", "path", element.getPathElement(), -1);
}
@ -1111,7 +1120,7 @@ public class RdfParser extends RdfParserBase {
else {
t = parent.predicate("fhir:"+parentType+'.'+name);
}
composeDataType(t, "MarketingStatus", name, element, index);
composeBackboneType(t, "MarketingStatus", name, element, index);
if (element.hasCountry()) {
composeCodeableConcept(t, "MarketingStatus", "country", element.getCountry(), -1);
}
@ -1255,7 +1264,7 @@ public class RdfParser extends RdfParserBase {
else {
t = parent.predicate("fhir:"+parentType+'.'+name);
}
composeDataType(t, "Population", name, element, index);
composeBackboneType(t, "Population", name, element, index);
if (element.hasAge()) {
composeType(t, "Population", "age", element.getAge(), -1);
}
@ -1279,7 +1288,7 @@ public class RdfParser extends RdfParserBase {
else {
t = parent.predicate("fhir:"+parentType+'.'+name);
}
composeDataType(t, "ProdCharacteristic", name, element, index);
composeBackboneType(t, "ProdCharacteristic", name, element, index);
if (element.hasHeight()) {
composeQuantity(t, "ProdCharacteristic", "height", element.getHeight(), -1);
}
@ -1324,7 +1333,7 @@ public class RdfParser extends RdfParserBase {
else {
t = parent.predicate("fhir:"+parentType+'.'+name);
}
composeDataType(t, "ProductShelfLife", name, element, index);
composeBackboneType(t, "ProductShelfLife", name, element, index);
if (element.hasType()) {
composeCodeableConcept(t, "ProductShelfLife", "type", element.getType(), -1);
}
@ -1552,7 +1561,7 @@ public class RdfParser extends RdfParserBase {
else {
t = parent.predicate("fhir:"+parentType+'.'+name);
}
composeDataType(t, "Timing", name, element, index);
composeBackboneType(t, "Timing", name, element, index);
for (int i = 0; i < element.getEvent().size(); i++) {
composeDateTime(t, "Timing", "event", element.getEvent().get(i), i);
}

View File

@ -392,6 +392,15 @@ public class XmlParser extends XmlParserBase {
return true;
}
protected boolean parseBackboneTypeContent(int eventType, XmlPullParser xpp, BackboneType res) throws XmlPullParserException, IOException, FHIRFormatError {
if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifierExtension")) {
res.getModifierExtension().add(parseExtension(xpp));
} else if (!parseDataTypeContent(eventType, xpp, res)){
return false;
}
return true;
}
protected boolean parseDataTypeContent(int eventType, XmlPullParser xpp, DataType res) throws XmlPullParserException, IOException, FHIRFormatError {
if (!parseElementContent(eventType, xpp, res)){
return false;
@ -907,7 +916,7 @@ public class XmlParser extends XmlParserBase {
res.setMaxDosePerAdministration(parseQuantity(xpp));
} else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxDosePerLifetime")) {
res.setMaxDosePerLifetime(parseQuantity(xpp));
} else if (!parseDataTypeContent(eventType, xpp, res)){
} else if (!parseBackboneTypeContent(eventType, xpp, res)){
return false;
}
return true;
@ -1047,7 +1056,7 @@ public class XmlParser extends XmlParserBase {
res.setBinding(parseElementDefinitionBindingComponent(xpp));
} else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mapping")) {
res.getMapping().add(parseElementDefinitionMappingComponent(xpp));
} else if (!parseDataTypeContent(eventType, xpp, res)){
} else if (!parseBackboneTypeContent(eventType, xpp, res)){
return false;
}
return true;
@ -1443,7 +1452,7 @@ public class XmlParser extends XmlParserBase {
res.setDateRange(parsePeriod(xpp));
} else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("restoreDate")) {
res.setRestoreDateElement(parseDateTime(xpp));
} else if (!parseDataTypeContent(eventType, xpp, res)){
} else if (!parseBackboneTypeContent(eventType, xpp, res)){
return false;
}
return true;
@ -1621,7 +1630,7 @@ public class XmlParser extends XmlParserBase {
res.setRace(parseCodeableConcept(xpp));
} else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("physiologicalCondition")) {
res.setPhysiologicalCondition(parseCodeableConcept(xpp));
} else if (!parseDataTypeContent(eventType, xpp, res)){
} else if (!parseBackboneTypeContent(eventType, xpp, res)){
return false;
}
return true;
@ -1665,7 +1674,7 @@ public class XmlParser extends XmlParserBase {
res.getImage().add(parseAttachment(xpp));
} else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("scoring")) {
res.setScoring(parseCodeableConcept(xpp));
} else if (!parseDataTypeContent(eventType, xpp, res)){
} else if (!parseBackboneTypeContent(eventType, xpp, res)){
return false;
}
return true;
@ -1693,7 +1702,7 @@ public class XmlParser extends XmlParserBase {
res.setPeriod(parseType("period", xpp));
} else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specialPrecautionsForStorage")) {
res.getSpecialPrecautionsForStorage().add(parseCodeableConcept(xpp));
} else if (!parseDataTypeContent(eventType, xpp, res)){
} else if (!parseBackboneTypeContent(eventType, xpp, res)){
return false;
}
return true;
@ -1971,7 +1980,7 @@ public class XmlParser extends XmlParserBase {
res.setRepeat(parseTimingRepeatComponent(xpp));
} else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
res.setCode(parseCodeableConcept(xpp));
} else if (!parseDataTypeContent(eventType, xpp, res)){
} else if (!parseBackboneTypeContent(eventType, xpp, res)){
return false;
}
return true;
@ -26548,6 +26557,14 @@ public class XmlParser extends XmlParserBase {
composeExtension("modifierExtension", e);
}
}
protected void composeBackboneTypeElements(BackboneType element) throws IOException {
composeDataTypeElements(element);
if (element.hasModifierExtension()) {
for (Extension e : element.getModifierExtension())
composeExtension("modifierExtension", e);
}
}
protected void composeDataTypeElements(DataType element) throws IOException {
composeElementElements(element);
@ -26959,7 +26976,7 @@ public class XmlParser extends XmlParserBase {
}
protected void composeDosageElements(Dosage element) throws IOException {
composeDataTypeElements(element);
composeBackboneTypeElements(element);
if (element.hasSequenceElement()) {
composeInteger("sequence", element.getSequenceElement());
}
@ -27048,7 +27065,7 @@ public class XmlParser extends XmlParserBase {
}
protected void composeElementDefinitionElements(ElementDefinition element) throws IOException {
composeDataTypeElements(element);
composeBackboneTypeElements(element);
if (element.hasPathElement()) {
composeString("path", element.getPathElement());
}
@ -27480,7 +27497,7 @@ public class XmlParser extends XmlParserBase {
}
protected void composeMarketingStatusElements(MarketingStatus element) throws IOException {
composeDataTypeElements(element);
composeBackboneTypeElements(element);
if (element.hasCountry()) {
composeCodeableConcept("country", element.getCountry());
}
@ -27636,7 +27653,7 @@ public class XmlParser extends XmlParserBase {
}
protected void composePopulationElements(Population element) throws IOException {
composeDataTypeElements(element);
composeBackboneTypeElements(element);
if (element.hasAge()) {
composeType("age", element.getAge());
} if (element.hasGender()) {
@ -27661,7 +27678,7 @@ public class XmlParser extends XmlParserBase {
}
protected void composeProdCharacteristicElements(ProdCharacteristic element) throws IOException {
composeDataTypeElements(element);
composeBackboneTypeElements(element);
if (element.hasHeight()) {
composeQuantity("height", element.getHeight());
}
@ -27711,7 +27728,7 @@ public class XmlParser extends XmlParserBase {
}
protected void composeProductShelfLifeElements(ProductShelfLife element) throws IOException {
composeDataTypeElements(element);
composeBackboneTypeElements(element);
if (element.hasType()) {
composeCodeableConcept("type", element.getType());
}
@ -27956,7 +27973,7 @@ public class XmlParser extends XmlParserBase {
}
protected void composeTimingElements(Timing element) throws IOException {
composeDataTypeElements(element);
composeBackboneTypeElements(element);
if (element.hasEvent()) {
for (DateTimeType e : element.getEvent())
composeDateTime("event", e);

View File

@ -49,7 +49,7 @@ import ca.uhn.fhir.model.api.annotation.Block;
* Base StructureDefinition for Dosage Type: Indicates how the medication is/was taken or should be taken by the patient.
*/
@DatatypeDef(name="Dosage")
public class Dosage extends DataType implements ICompositeType {
public class Dosage extends BackboneType implements ICompositeType {
@Block()
public static class DosageDoseAndRateComponent extends Element implements IBaseDatatypeElement {

View File

@ -55,7 +55,7 @@ import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
* Base StructureDefinition for ElementDefinition Type: Captures constraints on each element within the resource, profile, or extension.
*/
@DatatypeDef(name="ElementDefinition")
public class ElementDefinition extends DataType implements ICompositeType {
public class ElementDefinition extends BackboneType implements ICompositeType {
public enum AggregationMode {
/**

View File

@ -48,7 +48,7 @@ import ca.uhn.fhir.model.api.annotation.Block;
* Base StructureDefinition for MarketingStatus Type: The marketing status describes the date when a medicinal product is actually put on the market or the date as of which it is no longer available.
*/
@DatatypeDef(name="MarketingStatus")
public class MarketingStatus extends DataType implements ICompositeType {
public class MarketingStatus extends BackboneType implements ICompositeType {
/**
* The country in which the marketing authorisation has been granted shall be specified It should be specified using the ISO 3166 1 alpha-2 code elements.

View File

@ -48,7 +48,7 @@ import ca.uhn.fhir.model.api.annotation.Block;
* Base StructureDefinition for Population Type: A populatioof people with some set of grouping criteria.
*/
@DatatypeDef(name="Population")
public class Population extends DataType implements ICompositeType {
public class Population extends BackboneType implements ICompositeType {
/**
* The age of the specific population.

View File

@ -49,7 +49,7 @@ import ca.uhn.fhir.model.api.annotation.Block;
* Base StructureDefinition for ProdCharacteristic Type: The marketing status describes the date when a medicinal product is actually put on the market or the date as of which it is no longer available.
*/
@DatatypeDef(name="ProdCharacteristic")
public class ProdCharacteristic extends DataType implements ICompositeType {
public class ProdCharacteristic extends BackboneType implements ICompositeType {
/**
* Where applicable, the height can be specified using a numerical value and its unit of measurement The unit of measurement shall be specified in accordance with ISO 11240 and the resulting terminology The symbol and the symbol identifier shall be used.

View File

@ -48,7 +48,7 @@ import ca.uhn.fhir.model.api.annotation.Block;
* Base StructureDefinition for ProductShelfLife Type: The shelf-life and storage information for a medicinal product item or container can be described using this class.
*/
@DatatypeDef(name="ProductShelfLife")
public class ProductShelfLife extends DataType implements ICompositeType {
public class ProductShelfLife extends BackboneType implements ICompositeType {
/**
* This describes the shelf life, taking into account various scenarios such as shelf life of the packaged Medicinal Product itself, shelf life after transformation where necessary and shelf life after the first opening of a bottle, etc. The shelf life type shall be specified using an appropriate controlled vocabulary The controlled term and the controlled term identifier shall be specified.

View File

@ -50,7 +50,7 @@ import ca.uhn.fhir.model.api.annotation.Block;
* Base StructureDefinition for Timing Type: Specifies an event that may occur multiple times. Timing schedules are used to record when things are planned, expected or requested to occur. The most common usage is in dosage instructions for medications. They are also used when planning care of various kinds, and may be used for reporting the schedule to which past regular activities were carried out.
*/
@DatatypeDef(name="Timing")
public class Timing extends DataType implements ICompositeType {
public class Timing extends BackboneType implements ICompositeType {
public enum EventTiming {
/**