use of org.hl7.fhir.dstu2.model.Timing in project org.hl7.fhir.core by hapifhir.
the class TimingRepeatComponent10_30Test method testMedicationRequestConversion.
@Test
@DisplayName("Issue #383 - Test 10_30 TimingRepeatComponent with Timing.when as null")
public void testMedicationRequestConversion() {
final int SET_COUNT = 11;
org.hl7.fhir.dstu2.model.Timing src_timing = new org.hl7.fhir.dstu2.model.Timing();
org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent src_timing_repeat = new org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent();
src_timing_repeat.setCount(SET_COUNT);
src_timing.setRepeat(src_timing_repeat);
org.hl7.fhir.dstu3.model.Timing tgt_timing = (Timing) VersionConvertorFactory_10_30.convertType(src_timing);
org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent tgt_timing_repeat = tgt_timing.getRepeat();
Assertions.assertEquals(SET_COUNT, tgt_timing_repeat.getCount(), "Count field not preserved through version conversion.");
Assertions.assertFalse(tgt_timing_repeat.hasWhen(), "hasWhen() should return false for this conversion.");
Assertions.assertTrue(tgt_timing_repeat.getWhen().isEmpty(), "When no _when time_ is provided, getWhen() should return an empty list.");
}
use of org.hl7.fhir.dstu2.model.Timing in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeDeviceUseStatement.
protected void composeDeviceUseStatement(Complex parent, String parentType, String name, DeviceUseStatement element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "DeviceUseStatement", name, element, index);
if (element.hasBodySite())
composeType(t, "DeviceUseStatement", "bodySite", element.getBodySite(), -1);
if (element.hasWhenUsed())
composePeriod(t, "DeviceUseStatement", "whenUsed", element.getWhenUsed(), -1);
if (element.hasDevice())
composeReference(t, "DeviceUseStatement", "device", element.getDevice(), -1);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "DeviceUseStatement", "identifier", element.getIdentifier().get(i), i);
for (int i = 0; i < element.getIndication().size(); i++) composeCodeableConcept(t, "DeviceUseStatement", "indication", element.getIndication().get(i), i);
for (int i = 0; i < element.getNotes().size(); i++) composeString(t, "DeviceUseStatement", "notes", element.getNotes().get(i), i);
if (element.hasRecordedOnElement())
composeDateTime(t, "DeviceUseStatement", "recordedOn", element.getRecordedOnElement(), -1);
if (element.hasSubject())
composeReference(t, "DeviceUseStatement", "subject", element.getSubject(), -1);
if (element.hasTiming())
composeType(t, "DeviceUseStatement", "timing", element.getTiming(), -1);
}
use of org.hl7.fhir.dstu2.model.Timing in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeProtocolProtocolStepActivityDetailComponent.
protected void composeProtocolProtocolStepActivityDetailComponent(Complex parent, String parentType, String name, Protocol.ProtocolStepActivityDetailComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "detail", name, element, index);
if (element.hasCategoryElement())
composeEnum(t, "Protocol", "category", element.getCategoryElement(), -1);
if (element.hasCode())
composeCodeableConcept(t, "Protocol", "code", element.getCode(), -1);
if (element.hasTiming())
composeType(t, "Protocol", "timing", element.getTiming(), -1);
if (element.hasLocation())
composeReference(t, "Protocol", "location", element.getLocation(), -1);
for (int i = 0; i < element.getPerformer().size(); i++) composeReference(t, "Protocol", "performer", element.getPerformer().get(i), i);
if (element.hasProduct())
composeReference(t, "Protocol", "product", element.getProduct(), -1);
if (element.hasQuantity())
composeQuantity(t, "Protocol", "quantity", element.getQuantity(), -1);
if (element.hasDescriptionElement())
composeString(t, "Protocol", "description", element.getDescriptionElement(), -1);
}
use of org.hl7.fhir.dstu2.model.Timing in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeMedicationOrderMedicationOrderDosageInstructionComponent.
protected void composeMedicationOrderMedicationOrderDosageInstructionComponent(Complex parent, String parentType, String name, MedicationOrder.MedicationOrderDosageInstructionComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "dosageInstruction", name, element, index);
if (element.hasTextElement())
composeString(t, "MedicationOrder", "text", element.getTextElement(), -1);
if (element.hasAdditionalInstructions())
composeCodeableConcept(t, "MedicationOrder", "additionalInstructions", element.getAdditionalInstructions(), -1);
if (element.hasTiming())
composeTiming(t, "MedicationOrder", "timing", element.getTiming(), -1);
if (element.hasAsNeeded())
composeType(t, "MedicationOrder", "asNeeded", element.getAsNeeded(), -1);
if (element.hasSite())
composeType(t, "MedicationOrder", "site", element.getSite(), -1);
if (element.hasRoute())
composeCodeableConcept(t, "MedicationOrder", "route", element.getRoute(), -1);
if (element.hasMethod())
composeCodeableConcept(t, "MedicationOrder", "method", element.getMethod(), -1);
if (element.hasDose())
composeType(t, "MedicationOrder", "dose", element.getDose(), -1);
if (element.hasRate())
composeType(t, "MedicationOrder", "rate", element.getRate(), -1);
if (element.hasMaxDosePerPeriod())
composeRatio(t, "MedicationOrder", "maxDosePerPeriod", element.getMaxDosePerPeriod(), -1);
}
use of org.hl7.fhir.dstu2.model.Timing in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeTimingTimingRepeatComponent.
protected void composeTimingTimingRepeatComponent(Complex parent, String parentType, String name, Timing.TimingRepeatComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeElement(t, "repeat", name, element, index);
if (element.hasBounds())
composeType(t, "Timing", "bounds", element.getBounds(), -1);
if (element.hasCountElement())
composeInteger(t, "Timing", "count", element.getCountElement(), -1);
if (element.hasCountMaxElement())
composeInteger(t, "Timing", "countMax", element.getCountMaxElement(), -1);
if (element.hasDurationElement())
composeDecimal(t, "Timing", "duration", element.getDurationElement(), -1);
if (element.hasDurationMaxElement())
composeDecimal(t, "Timing", "durationMax", element.getDurationMaxElement(), -1);
if (element.hasDurationUnitElement())
composeEnum(t, "Timing", "durationUnit", element.getDurationUnitElement(), -1);
if (element.hasFrequencyElement())
composeInteger(t, "Timing", "frequency", element.getFrequencyElement(), -1);
if (element.hasFrequencyMaxElement())
composeInteger(t, "Timing", "frequencyMax", element.getFrequencyMaxElement(), -1);
if (element.hasPeriodElement())
composeDecimal(t, "Timing", "period", element.getPeriodElement(), -1);
if (element.hasPeriodMaxElement())
composeDecimal(t, "Timing", "periodMax", element.getPeriodMaxElement(), -1);
if (element.hasPeriodUnitElement())
composeEnum(t, "Timing", "periodUnit", element.getPeriodUnitElement(), -1);
if (element.hasWhenElement())
composeEnum(t, "Timing", "when", element.getWhenElement(), -1);
if (element.hasOffsetElement())
composeUnsignedInt(t, "Timing", "offset", element.getOffsetElement(), -1);
}
Aggregations