Merge pull request #118 from lmckenzi/MessageEventConversion
Message event conversion
This commit is contained in:
commit
bf063db86a
|
@ -29,6 +29,7 @@ public class VersionConvertorConstants {
|
|||
public final static String MODIFIER_TAKEN = "http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationStatment.taken";
|
||||
public final static String MODIFIER_REASON_LEGACY = "No Modifier Reason provideed in previous versions of FHIR";
|
||||
public final static String PROFILE_EXTENSION = "http://hl7.org/fhir/4.0/StructureDefinition/extension-ElementDefinition.type.profile";
|
||||
public final static String IG_CONFORMANCE_MESSAGE_EVENT = "http://hl7.org/fhir/1.0/StructureDefinition/extension-Conformance.messaging.event";
|
||||
|
||||
public static String refToVS(String url) {
|
||||
if (url == null)
|
||||
|
|
|
@ -4737,6 +4737,26 @@ public class VersionConvertor_10_40 {
|
|||
tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t));
|
||||
tgt.setReliableCache(src.getReliableCache());
|
||||
tgt.setDocumentation(src.getDocumentation());
|
||||
for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent t : src.getEvent()) {
|
||||
org.hl7.fhir.r4.model.Extension e = new org.hl7.fhir.r4.model.Extension(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT);
|
||||
e.addExtension(new org.hl7.fhir.r4.model.Extension("code", convertCoding(t.getCode())));
|
||||
if (t.hasCategory())
|
||||
e.addExtension(new org.hl7.fhir.r4.model.Extension("category", new org.hl7.fhir.r4.model.CodeType(t.getCategory().toCode())));
|
||||
e.addExtension(new org.hl7.fhir.r4.model.Extension("mode", new org.hl7.fhir.r4.model.CodeType(t.getMode().toCode())));
|
||||
if (t.getFocusElement().hasValue())
|
||||
e.addExtension(new org.hl7.fhir.r4.model.Extension("focus", new org.hl7.fhir.r4.model.StringType(t.getFocus())));
|
||||
else {
|
||||
org.hl7.fhir.r4.model.CodeType focus = new org.hl7.fhir.r4.model.CodeType();
|
||||
org.hl7.fhir.r4.model.Extension focusE = new org.hl7.fhir.r4.model.Extension("focus", focus);
|
||||
copyElement(t.getFocusElement(), focus);
|
||||
e.addExtension(focusE);
|
||||
}
|
||||
e.addExtension(new org.hl7.fhir.r4.model.Extension("request", convertReference(t.getRequest())));
|
||||
e.addExtension(new org.hl7.fhir.r4.model.Extension("response", convertReference(t.getResponse())));
|
||||
if (t.hasDocumentation())
|
||||
e.addExtension(new org.hl7.fhir.r4.model.Extension("documentation", new org.hl7.fhir.r4.model.StringType(t.getDocumentation())));
|
||||
tgt.addExtension(e);
|
||||
}
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
@ -4749,6 +4769,25 @@ public class VersionConvertor_10_40 {
|
|||
tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t));
|
||||
tgt.setReliableCache(src.getReliableCache());
|
||||
tgt.setDocumentation(src.getDocumentation());
|
||||
for (org.hl7.fhir.r4.model.Extension e : src.getExtensionsByUrl(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT)) {
|
||||
org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent event = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent();
|
||||
tgt.addEvent(event);
|
||||
event.setCode(convertCoding((org.hl7.fhir.r4.model.Coding)e.getExtensionByUrl("code").getValue()));
|
||||
if (e.hasExtension("category"))
|
||||
event.setCategory(org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString()));
|
||||
event.setMode(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.fromCode(e.getExtensionByUrl("mode").getValue().toString()));
|
||||
org.hl7.fhir.r4.model.Extension focusE = e.getExtensionByUrl("focus");
|
||||
if (focusE.getValue().hasPrimitiveValue())
|
||||
event.setFocus(focusE.getValue().toString());
|
||||
else {
|
||||
event.setFocusElement(new org.hl7.fhir.dstu2.model.CodeType());
|
||||
copyElement(focusE.getValue(), event.getFocusElement());
|
||||
}
|
||||
event.setRequest(convertReference((org.hl7.fhir.r4.model.Reference)e.getExtensionByUrl("request").getValue()));
|
||||
event.setResponse(convertReference((org.hl7.fhir.r4.model.Reference)e.getExtensionByUrl("response").getValue()));
|
||||
if (e.hasExtension("documentation"))
|
||||
event.setDocumentation(e.getExtensionByUrl("documentation").getValue().toString());
|
||||
}
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
|
|
@ -4771,6 +4771,26 @@ public class VersionConvertor_10_50 {
|
|||
tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t));
|
||||
tgt.setReliableCache(src.getReliableCache());
|
||||
tgt.setDocumentation(src.getDocumentation());
|
||||
for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent t : src.getEvent()) {
|
||||
org.hl7.fhir.r5.model.Extension e = new org.hl7.fhir.r5.model.Extension(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT);
|
||||
e.addExtension(new org.hl7.fhir.r5.model.Extension("code", convertCoding(t.getCode())));
|
||||
if (t.hasCategory())
|
||||
e.addExtension(new org.hl7.fhir.r5.model.Extension("category", new org.hl7.fhir.r5.model.CodeType(t.getCategory().toCode())));
|
||||
e.addExtension(new org.hl7.fhir.r5.model.Extension("mode", new org.hl7.fhir.r5.model.CodeType(t.getMode().toCode())));
|
||||
if (t.getFocusElement().hasValue())
|
||||
e.addExtension(new org.hl7.fhir.r5.model.Extension("focus", new org.hl7.fhir.r5.model.StringType(t.getFocus())));
|
||||
else {
|
||||
org.hl7.fhir.r5.model.CodeType focus = new org.hl7.fhir.r5.model.CodeType();
|
||||
org.hl7.fhir.r5.model.Extension focusE = new org.hl7.fhir.r5.model.Extension("focus", focus);
|
||||
copyElement(t.getFocusElement(), focus);
|
||||
e.addExtension(focusE);
|
||||
}
|
||||
e.addExtension(new org.hl7.fhir.r5.model.Extension("request", convertReference(t.getRequest())));
|
||||
e.addExtension(new org.hl7.fhir.r5.model.Extension("response", convertReference(t.getResponse())));
|
||||
if (t.hasDocumentation())
|
||||
e.addExtension(new org.hl7.fhir.r5.model.Extension("documentation", new org.hl7.fhir.r5.model.StringType(t.getDocumentation())));
|
||||
tgt.addExtension(e);
|
||||
}
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
@ -4783,6 +4803,26 @@ public class VersionConvertor_10_50 {
|
|||
tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t));
|
||||
tgt.setReliableCache(src.getReliableCache());
|
||||
tgt.setDocumentation(src.getDocumentation());
|
||||
for (org.hl7.fhir.r5.model.Extension e : src.getExtensionsByUrl(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT)) {
|
||||
org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent event = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent();
|
||||
tgt.addEvent(event);
|
||||
event.setCode(convertCoding((org.hl7.fhir.r5.model.Coding)e.getExtensionByUrl("code").getValue()));
|
||||
if (e.hasExtension("category"))
|
||||
event.setCategory(org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString()));
|
||||
event.setMode(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.fromCode(e.getExtensionByUrl("mode").getValue().toString()));
|
||||
event.setCode(convertCoding((org.hl7.fhir.r5.model.Coding)e.getExtensionByUrl("code").getValue()));
|
||||
org.hl7.fhir.r5.model.Extension focusE = e.getExtensionByUrl("focus");
|
||||
if (focusE.getValue().hasPrimitiveValue())
|
||||
event.setFocus(focusE.getValue().toString());
|
||||
else {
|
||||
event.setFocusElement(new org.hl7.fhir.dstu2.model.CodeType());
|
||||
copyElement(focusE.getValue(), event.getFocusElement());
|
||||
}
|
||||
event.setRequest(convertReference((org.hl7.fhir.r5.model.Reference)e.getExtensionByUrl("request").getValue()));
|
||||
event.setResponse(convertReference((org.hl7.fhir.r5.model.Reference)e.getExtensionByUrl("response").getValue()));
|
||||
if (e.hasExtension("documentation"))
|
||||
event.setDocumentation(e.getExtensionByUrl("documentation").getValue().toString());
|
||||
}
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ public class VersionConvertor_14_30 {
|
|||
if (src.hasId())
|
||||
tgt.setId(src.getId());
|
||||
for (org.hl7.fhir.dstu2016may.model.Extension e : src.getExtension()) {
|
||||
if (!Utilities.existsInList(e.getUrl(), exemptExtensions)) {
|
||||
if (!Utilities.existsInList(e.getUrl(), exemptExtensions) && (!(e.getUrl().equals(VersionConvertorConstants.PROFILE_EXTENSION) || e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION) || e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)))) {
|
||||
tgt.addExtension(convertExtension(e));
|
||||
}
|
||||
}
|
||||
|
@ -1433,7 +1433,8 @@ public class VersionConvertor_14_30 {
|
|||
}
|
||||
for (org.hl7.fhir.dstu2016may.model.Extension t : src.getExtensionsByUrl(VersionConvertorConstants.PROFILE_EXTENSION)) {
|
||||
// We don't have a good way to distinguish resources that have both 'profile' and 'targetProfile' when the type is reference, so the best we can do is by name.
|
||||
tgt.setProfile(t.getValue().toString());
|
||||
String s = ((org.hl7.fhir.dstu2016may.model.PrimitiveType<String>)t.getValue()).getValue();
|
||||
tgt.setProfile(s);
|
||||
}
|
||||
for (org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode> t : src.getAggregation())
|
||||
copyElement(t, tgt.addAggregationElement().setValue(convertAggregationMode(t.getValue())));
|
||||
|
|
|
@ -113,7 +113,7 @@ public class VersionConvertor_14_40 {
|
|||
if (src.hasId())
|
||||
tgt.setId(src.getId());
|
||||
for (org.hl7.fhir.dstu2016may.model.Extension e : src.getExtension()) {
|
||||
if (!Utilities.existsInList(e.getUrl(), exemptExtensions) && (!(e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION) || e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)))) {
|
||||
if (!Utilities.existsInList(e.getUrl(), exemptExtensions) && (!(e.getUrl().equals(VersionConvertorConstants.PROFILE_EXTENSION) || e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION) || e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)))) {
|
||||
tgt.addExtension(convertExtension(e));
|
||||
}
|
||||
}
|
||||
|
@ -1516,7 +1516,8 @@ public class VersionConvertor_14_40 {
|
|||
}
|
||||
for (org.hl7.fhir.dstu2016may.model.Extension t : src.getExtensionsByUrl(VersionConvertorConstants.PROFILE_EXTENSION)) {
|
||||
// We don't have a good way to distinguish resources that have both 'profile' and 'targetProfile' when the type is reference, so the best we can do is by name.
|
||||
tgt.addProfile(t.getValue().toString());
|
||||
String s = ((org.hl7.fhir.dstu2016may.model.PrimitiveType<String>)t.getValue()).getValue();
|
||||
tgt.addProfile(s);
|
||||
}
|
||||
} else {
|
||||
for (org.hl7.fhir.dstu2016may.model.UriType u : src.getProfile())
|
||||
|
@ -3997,6 +3998,26 @@ public class VersionConvertor_14_40 {
|
|||
tgt.setReliableCache(src.getReliableCache());
|
||||
if (src.hasDocumentation())
|
||||
tgt.setDocumentation(src.getDocumentation());
|
||||
for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent t : src.getEvent()) {
|
||||
org.hl7.fhir.r4.model.Extension e = new org.hl7.fhir.r4.model.Extension(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT);
|
||||
e.addExtension(new org.hl7.fhir.r4.model.Extension("code", convertCoding(t.getCode())));
|
||||
if (t.hasCategory())
|
||||
e.addExtension(new org.hl7.fhir.r4.model.Extension("category", new org.hl7.fhir.r4.model.CodeType(t.getCategory().toCode())));
|
||||
e.addExtension(new org.hl7.fhir.r4.model.Extension("mode", new org.hl7.fhir.r4.model.CodeType(t.getMode().toCode())));
|
||||
if (t.getFocusElement().hasValue())
|
||||
e.addExtension(new org.hl7.fhir.r4.model.Extension("focus", new org.hl7.fhir.r4.model.StringType(t.getFocus())));
|
||||
else {
|
||||
org.hl7.fhir.r4.model.CodeType focus = new org.hl7.fhir.r4.model.CodeType();
|
||||
org.hl7.fhir.r4.model.Extension focusE = new org.hl7.fhir.r4.model.Extension("focus", focus);
|
||||
copyElement(t.getFocusElement(), focus);
|
||||
e.addExtension(focusE);
|
||||
}
|
||||
e.addExtension(new org.hl7.fhir.r4.model.Extension("request", convertReference(t.getRequest())));
|
||||
e.addExtension(new org.hl7.fhir.r4.model.Extension("response", convertReference(t.getResponse())));
|
||||
if (t.hasDocumentation())
|
||||
e.addExtension(new org.hl7.fhir.r4.model.Extension("documentation", new org.hl7.fhir.r4.model.StringType(t.getDocumentation())));
|
||||
tgt.addExtension(e);
|
||||
}
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
@ -4011,6 +4032,29 @@ public class VersionConvertor_14_40 {
|
|||
tgt.setReliableCache(src.getReliableCache());
|
||||
if (src.hasDocumentation())
|
||||
tgt.setDocumentation(src.getDocumentation());
|
||||
for (org.hl7.fhir.r4.model.Extension e : src.getExtensionsByUrl(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT)) {
|
||||
org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent event = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent();
|
||||
tgt.addEvent(event);
|
||||
event.setCode(convertCoding((org.hl7.fhir.r4.model.Coding)e.getExtensionByUrl("code").getValue()));
|
||||
if (e.hasExtension("category"))
|
||||
event.setCategory(org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString()));
|
||||
event.setMode(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.fromCode(e.getExtensionByUrl("mode").getValue().toString()));
|
||||
event.setCode(convertCoding((org.hl7.fhir.r4.model.Coding)e.getExtensionByUrl("code").getValue()));
|
||||
if (e.hasExtension("category"))
|
||||
event.setCategory(org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString()));
|
||||
event.setMode(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.fromCode(e.getExtensionByUrl("mode").getValue().toString()));
|
||||
org.hl7.fhir.r4.model.Extension focusE = e.getExtensionByUrl("focus");
|
||||
if (focusE.getValue().hasPrimitiveValue())
|
||||
event.setFocus(focusE.getValue().toString());
|
||||
else {
|
||||
event.setFocusElement(new org.hl7.fhir.dstu2016may.model.CodeType());
|
||||
copyElement(focusE.getValue(), event.getFocusElement());
|
||||
}
|
||||
event.setRequest(convertReference((org.hl7.fhir.r4.model.Reference)e.getExtensionByUrl("request").getValue()));
|
||||
event.setResponse(convertReference((org.hl7.fhir.r4.model.Reference)e.getExtensionByUrl("response").getValue()));
|
||||
if (e.hasExtension("documentation"))
|
||||
event.setDocumentation(e.getExtensionByUrl("documentation").getValue().toString());
|
||||
}
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
|
|
@ -112,11 +112,22 @@ public class VersionConvertor_14_50 {
|
|||
CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-system");
|
||||
}
|
||||
|
||||
private static boolean mappedExtension(String url) {
|
||||
if (
|
||||
url.equals(VersionConvertorConstants.PROFILE_EXTENSION) ||
|
||||
url.equals(VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION) ||
|
||||
url.equals(VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION) ||
|
||||
url.equals(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT)
|
||||
)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void copyElement(org.hl7.fhir.dstu2016may.model.Element src, org.hl7.fhir.r5.model.Element tgt, String... exemptExtensions) throws FHIRException {
|
||||
if (src.hasId())
|
||||
tgt.setId(src.getId());
|
||||
for (org.hl7.fhir.dstu2016may.model.Extension e : src.getExtension()) {
|
||||
if (!Utilities.existsInList(e.getUrl(), exemptExtensions) && (!(e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION) || e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION))))
|
||||
if (!Utilities.existsInList(e.getUrl(), exemptExtensions) && !mappedExtension(e.getUrl().toString()))
|
||||
tgt.addExtension(convertExtension(e));
|
||||
}
|
||||
}
|
||||
|
@ -1519,7 +1530,8 @@ public class VersionConvertor_14_50 {
|
|||
}
|
||||
for (org.hl7.fhir.dstu2016may.model.Extension t : src.getExtensionsByUrl(VersionConvertorConstants.PROFILE_EXTENSION)) {
|
||||
// We don't have a good way to distinguish resources that have both 'profile' and 'targetProfile' when the type is reference, so the best we can do is by name.
|
||||
tgt.addProfile(t.getValue().toString());
|
||||
String s = ((org.hl7.fhir.dstu2016may.model.PrimitiveType<String>)t.getValue()).getValue();
|
||||
tgt.addProfile(s);
|
||||
}
|
||||
} else {
|
||||
for (org.hl7.fhir.dstu2016may.model.UriType u : src.getProfile())
|
||||
|
@ -4007,6 +4019,26 @@ public class VersionConvertor_14_50 {
|
|||
tgt.setReliableCache(src.getReliableCache());
|
||||
if (src.hasDocumentation())
|
||||
tgt.setDocumentation(src.getDocumentation());
|
||||
for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent t : src.getEvent()) {
|
||||
org.hl7.fhir.r5.model.Extension e = new org.hl7.fhir.r5.model.Extension(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT);
|
||||
e.addExtension(new org.hl7.fhir.r5.model.Extension("code", convertCoding(t.getCode())));
|
||||
if (t.hasCategory())
|
||||
e.addExtension(new org.hl7.fhir.r5.model.Extension("category", new org.hl7.fhir.r5.model.CodeType(t.getCategory().toCode())));
|
||||
e.addExtension(new org.hl7.fhir.r5.model.Extension("mode", new org.hl7.fhir.r5.model.CodeType(t.getMode().toCode())));
|
||||
if (t.getFocusElement().hasValue())
|
||||
e.addExtension(new org.hl7.fhir.r5.model.Extension("focus", new org.hl7.fhir.r5.model.StringType(t.getFocus())));
|
||||
else {
|
||||
org.hl7.fhir.r5.model.CodeType focus = new org.hl7.fhir.r5.model.CodeType();
|
||||
org.hl7.fhir.r5.model.Extension focusE = new org.hl7.fhir.r5.model.Extension("focus", focus);
|
||||
copyElement(t.getFocusElement(), focus);
|
||||
e.addExtension(focusE);
|
||||
}
|
||||
e.addExtension(new org.hl7.fhir.r5.model.Extension("request", convertReference(t.getRequest())));
|
||||
e.addExtension(new org.hl7.fhir.r5.model.Extension("response", convertReference(t.getResponse())));
|
||||
if (t.hasDocumentation())
|
||||
e.addExtension(new org.hl7.fhir.r5.model.Extension("documentation", new org.hl7.fhir.r5.model.StringType(t.getDocumentation())));
|
||||
tgt.addExtension(e);
|
||||
}
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
@ -4021,6 +4053,25 @@ public class VersionConvertor_14_50 {
|
|||
tgt.setReliableCache(src.getReliableCache());
|
||||
if (src.hasDocumentation())
|
||||
tgt.setDocumentation(src.getDocumentation());
|
||||
for (org.hl7.fhir.r5.model.Extension e : src.getExtensionsByUrl(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT)) {
|
||||
org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent event = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent();
|
||||
tgt.addEvent(event);
|
||||
event.setCode(convertCoding((org.hl7.fhir.r5.model.Coding)e.getExtensionByUrl("code").getValue()));
|
||||
if (e.hasExtension("category"))
|
||||
event.setCategory(org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString()));
|
||||
event.setMode(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.fromCode(e.getExtensionByUrl("mode").getValue().toString()));
|
||||
org.hl7.fhir.r5.model.Extension focusE = e.getExtensionByUrl("focus");
|
||||
if (focusE.getValue().hasPrimitiveValue())
|
||||
event.setFocus(focusE.getValue().toString());
|
||||
else {
|
||||
event.setFocusElement(new org.hl7.fhir.dstu2016may.model.CodeType());
|
||||
copyElement(focusE.getValue(), event.getFocusElement());
|
||||
}
|
||||
event.setRequest(convertReference((org.hl7.fhir.r5.model.Reference)e.getExtensionByUrl("request").getValue()));
|
||||
event.setResponse(convertReference((org.hl7.fhir.r5.model.Reference)e.getExtensionByUrl("response").getValue()));
|
||||
if (e.hasExtension("documentation"))
|
||||
event.setDocumentation(e.getExtensionByUrl("documentation").getValue().toString());
|
||||
}
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
|
|
@ -5382,6 +5382,26 @@ public class VersionConvertor_30_40 {
|
|||
tgt.setDocumentation(src.getDocumentation());
|
||||
for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent t : src.getSupportedMessage())
|
||||
tgt.addSupportedMessage(convertCapabilityStatementMessagingSupportedMessageComponent(t));
|
||||
for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent t : src.getEvent()) {
|
||||
org.hl7.fhir.r4.model.Extension e = new org.hl7.fhir.r4.model.Extension(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT);
|
||||
e.addExtension(new org.hl7.fhir.r4.model.Extension("code", convertCoding(t.getCode())));
|
||||
if (t.hasCategory())
|
||||
e.addExtension(new org.hl7.fhir.r4.model.Extension("category", new org.hl7.fhir.r4.model.CodeType(t.getCategory().toCode())));
|
||||
e.addExtension(new org.hl7.fhir.r4.model.Extension("mode", new org.hl7.fhir.r4.model.CodeType(t.getMode().toCode())));
|
||||
if (t.getFocusElement().hasValue())
|
||||
e.addExtension(new org.hl7.fhir.r4.model.Extension("focus", new org.hl7.fhir.r4.model.StringType(t.getFocus())));
|
||||
else {
|
||||
org.hl7.fhir.r4.model.CodeType focus = new org.hl7.fhir.r4.model.CodeType();
|
||||
org.hl7.fhir.r4.model.Extension focusE = new org.hl7.fhir.r4.model.Extension("focus", focus);
|
||||
copyElement(t.getFocusElement(), focus);
|
||||
e.addExtension(focusE);
|
||||
}
|
||||
e.addExtension(new org.hl7.fhir.r4.model.Extension("request", convertReference(t.getRequest())));
|
||||
e.addExtension(new org.hl7.fhir.r4.model.Extension("response", convertReference(t.getResponse())));
|
||||
if (t.hasDocumentation())
|
||||
e.addExtension(new org.hl7.fhir.r4.model.Extension("documentation", new org.hl7.fhir.r4.model.StringType(t.getDocumentation())));
|
||||
tgt.addExtension(e);
|
||||
}
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
@ -5398,6 +5418,29 @@ public class VersionConvertor_30_40 {
|
|||
tgt.setDocumentation(src.getDocumentation());
|
||||
for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent t : src.getSupportedMessage())
|
||||
tgt.addSupportedMessage(convertCapabilityStatementMessagingSupportedMessageComponent(t));
|
||||
for (org.hl7.fhir.r4.model.Extension e : src.getExtensionsByUrl(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT)) {
|
||||
org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent event = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent();
|
||||
tgt.addEvent(event);
|
||||
event.setCode(convertCoding((org.hl7.fhir.r4.model.Coding)e.getExtensionByUrl("code").getValue()));
|
||||
if (e.hasExtension("category"))
|
||||
event.setCategory(org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString()));
|
||||
event.setMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.fromCode(e.getExtensionByUrl("mode").getValue().toString()));
|
||||
event.setCode(convertCoding((org.hl7.fhir.r4.model.Coding)e.getExtensionByUrl("code").getValue()));
|
||||
if (e.hasExtension("category"))
|
||||
event.setCategory(org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString()));
|
||||
event.setMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.fromCode(e.getExtensionByUrl("mode").getValue().toString()));
|
||||
org.hl7.fhir.r4.model.Extension focusE = e.getExtensionByUrl("focus");
|
||||
if (focusE.getValue().hasPrimitiveValue())
|
||||
event.setFocus(focusE.getValue().toString());
|
||||
else {
|
||||
event.setFocusElement(new org.hl7.fhir.dstu3.model.CodeType());
|
||||
copyElement(focusE.getValue(), event.getFocusElement());
|
||||
}
|
||||
event.setRequest(convertReference((org.hl7.fhir.r4.model.Reference)e.getExtensionByUrl("request").getValue()));
|
||||
event.setResponse(convertReference((org.hl7.fhir.r4.model.Reference)e.getExtensionByUrl("response").getValue()));
|
||||
if (e.hasExtension("documentation"))
|
||||
event.setDocumentation(e.getExtensionByUrl("documentation").getValue().toString());
|
||||
}
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
|
|
@ -5388,6 +5388,26 @@ public class VersionConvertor_30_50 {
|
|||
tgt.setDocumentation(src.getDocumentation());
|
||||
for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent t : src.getSupportedMessage())
|
||||
tgt.addSupportedMessage(convertCapabilityStatementMessagingSupportedMessageComponent(t));
|
||||
for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent t : src.getEvent()) {
|
||||
org.hl7.fhir.r5.model.Extension e = new org.hl7.fhir.r5.model.Extension(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT);
|
||||
e.addExtension(new org.hl7.fhir.r5.model.Extension("code", convertCoding(t.getCode())));
|
||||
if (t.hasCategory())
|
||||
e.addExtension(new org.hl7.fhir.r5.model.Extension("category", new org.hl7.fhir.r5.model.CodeType(t.getCategory().toCode())));
|
||||
e.addExtension(new org.hl7.fhir.r5.model.Extension("mode", new org.hl7.fhir.r5.model.CodeType(t.getMode().toCode())));
|
||||
if (t.getFocusElement().hasValue())
|
||||
e.addExtension(new org.hl7.fhir.r5.model.Extension("focus", new org.hl7.fhir.r5.model.StringType(t.getFocus())));
|
||||
else {
|
||||
org.hl7.fhir.r5.model.CodeType focus = new org.hl7.fhir.r5.model.CodeType();
|
||||
org.hl7.fhir.r5.model.Extension focusE = new org.hl7.fhir.r5.model.Extension("focus", focus);
|
||||
copyElement(t.getFocusElement(), focus);
|
||||
e.addExtension(focusE);
|
||||
}
|
||||
e.addExtension(new org.hl7.fhir.r5.model.Extension("request", convertReference(t.getRequest())));
|
||||
e.addExtension(new org.hl7.fhir.r5.model.Extension("response", convertReference(t.getResponse())));
|
||||
if (t.hasDocumentation())
|
||||
e.addExtension(new org.hl7.fhir.r5.model.Extension("documentation", new org.hl7.fhir.r5.model.StringType(t.getDocumentation())));
|
||||
tgt.addExtension(e);
|
||||
}
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
@ -5404,6 +5424,25 @@ public class VersionConvertor_30_50 {
|
|||
tgt.setDocumentation(src.getDocumentation());
|
||||
for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent t : src.getSupportedMessage())
|
||||
tgt.addSupportedMessage(convertCapabilityStatementMessagingSupportedMessageComponent(t));
|
||||
for (org.hl7.fhir.r5.model.Extension e : src.getExtensionsByUrl(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT)) {
|
||||
org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent event = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent();
|
||||
tgt.addEvent(event);
|
||||
event.setCode(convertCoding((org.hl7.fhir.r5.model.Coding)e.getExtensionByUrl("code").getValue()));
|
||||
if (e.hasExtension("category"))
|
||||
event.setCategory(org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString()));
|
||||
event.setMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.fromCode(e.getExtensionByUrl("mode").getValue().toString()));
|
||||
org.hl7.fhir.r5.model.Extension focusE = e.getExtensionByUrl("focus");
|
||||
if (focusE.getValue().hasPrimitiveValue())
|
||||
event.setFocus(focusE.getValue().toString());
|
||||
else {
|
||||
event.setFocusElement(new org.hl7.fhir.dstu3.model.CodeType());
|
||||
copyElement(focusE.getValue(), event.getFocusElement());
|
||||
}
|
||||
event.setRequest(convertReference((org.hl7.fhir.r5.model.Reference)e.getExtensionByUrl("request").getValue()));
|
||||
event.setResponse(convertReference((org.hl7.fhir.r5.model.Reference)e.getExtensionByUrl("response").getValue()));
|
||||
if (e.hasExtension("documentation"))
|
||||
event.setDocumentation(e.getExtensionByUrl("documentation").getValue().toString());
|
||||
}
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,8 @@ import org.hl7.fhir.convertors.VersionConvertor_40_50;
|
|||
|
||||
|
||||
public class CommunicationRequest extends VersionConvertor_40_50 {
|
||||
|
||||
public final static String EXT_PAYLOAD_CONTENT = "http://hl7.org/fhir/4.0/StructureDefinition/extension-CommunicationRequest.payload.content";
|
||||
|
||||
public static org.hl7.fhir.r5.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.r4.model.CommunicationRequest src) throws FHIRException {
|
||||
if (src == null)
|
||||
return null;
|
||||
|
@ -225,8 +226,20 @@ public class CommunicationRequest extends VersionConvertor_40_50 {
|
|||
return null;
|
||||
org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestPayloadComponent();
|
||||
copyElement(src, tgt);
|
||||
if (src.hasContent())
|
||||
tgt.setContent(convertType(src.getContent()));
|
||||
if (org.hl7.fhir.r4.utils.ToolingExtensions.hasExtension(src, EXT_PAYLOAD_CONTENT)) {
|
||||
org.hl7.fhir.r4.model.Extension e = org.hl7.fhir.r4.utils.ToolingExtensions.getExtension(src, EXT_PAYLOAD_CONTENT);
|
||||
tgt.setContent(convertType(e.getValue()));
|
||||
org.hl7.fhir.r5.utils.ToolingExtensions.removeExtension(tgt, EXT_PAYLOAD_CONTENT);
|
||||
} else if (src.hasContent()) {
|
||||
org.hl7.fhir.r4.model.Type content = src.getContent();
|
||||
if (content instanceof org.hl7.fhir.r4.model.StringType) {
|
||||
org.hl7.fhir.r4.model.StringType string = (org.hl7.fhir.r4.model.StringType)content;
|
||||
org.hl7.fhir.r5.model.CodeableConcept code = new org.hl7.fhir.r5.model.CodeableConcept();
|
||||
code.setTextElement((org.hl7.fhir.r5.model.StringType)convertType(string));
|
||||
tgt.setContent(code);
|
||||
} else
|
||||
tgt.setContent(convertType(content));
|
||||
}
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
@ -235,10 +248,20 @@ public class CommunicationRequest extends VersionConvertor_40_50 {
|
|||
return null;
|
||||
org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent();
|
||||
copyElement(src, tgt);
|
||||
if (src.hasContent())
|
||||
tgt.setContent(convertType(src.getContent()));
|
||||
if (src.hasContent()) {
|
||||
org.hl7.fhir.r5.model.DataType content = src.getContent();
|
||||
if (content instanceof org.hl7.fhir.r5.model.CodeableConcept) {
|
||||
org.hl7.fhir.r5.model.CodeableConcept code = (org.hl7.fhir.r5.model.CodeableConcept)content;
|
||||
if (code.hasText())
|
||||
tgt.setContent(new org.hl7.fhir.r4.model.StringType(code.getText()));
|
||||
if (code.hasCoding() || code.hasExtension()) {
|
||||
org.hl7.fhir.r4.model.Extension e = new org.hl7.fhir.r4.model.Extension(EXT_PAYLOAD_CONTENT);
|
||||
e.setValue(convertType(code));
|
||||
tgt.addExtension(e);
|
||||
}
|
||||
} else
|
||||
tgt.setContent(convertType(content));
|
||||
}
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue