Merge pull request #1255 from hapifhir/gg-202305-server-error
Fix for wrong display when server returns error
This commit is contained in:
commit
34c5ff93c4
|
@ -44,6 +44,9 @@ public class VersionConvertorConstants {
|
|||
public static final String EXT_OLD_CONCEPTMAP_EQUIVALENCE = "http://hl7.org/fhir/1.0/StructureDefinition/extension-ConceptMap.element.target.equivalence";
|
||||
public static final String EXT_ACTUAL_RESOURCE_NAME = "http://hl7.org/fhir/tools/StructureDefinition/original-resource-name";
|
||||
public static final String EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL = QuestionnaireRenderer.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL;
|
||||
public static final String EXT_NAMINGSYSTEM_TITLE = "http://hl7.org/fhir/5.0/StructureDefinition/extension-NamingSystem.title";
|
||||
public static final String EXT_NAMINGSYSTEM_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-NamingSystem.url";
|
||||
public static final String EXT_NAMINGSYSTEM_VERSION = "http://hl7.org/fhir/5.0/StructureDefinition/extension-NamingSystem.version";
|
||||
|
||||
public static String refToVS(String url) {
|
||||
if (url == null)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.hl7.fhir.convertors.conv10_50.resources10_50;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||
import org.hl7.fhir.convertors.context.ConversionContext10_50;
|
||||
import org.hl7.fhir.convertors.conv10_50.VersionConvertor_10_50;
|
||||
import org.hl7.fhir.convertors.conv10_50.datatypes10_50.complextypes10_50.CodeableConcept10_50;
|
||||
|
@ -8,6 +9,12 @@ import org.hl7.fhir.convertors.conv10_50.datatypes10_50.complextypes10_50.Period
|
|||
import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Boolean10_50;
|
||||
import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.DateTime10_50;
|
||||
import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.String10_50;
|
||||
import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Uri10_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50;
|
||||
import org.hl7.fhir.dstu2.model.Extension;
|
||||
import org.hl7.fhir.dstu2.model.StringType;
|
||||
import org.hl7.fhir.dstu2.model.UriType;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
|
||||
public class NamingSystem10_50 {
|
||||
|
@ -17,8 +24,14 @@ public class NamingSystem10_50 {
|
|||
return null;
|
||||
org.hl7.fhir.dstu2.model.NamingSystem tgt = new org.hl7.fhir.dstu2.model.NamingSystem();
|
||||
ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyDomainResource(src, tgt);
|
||||
if (src.hasUrlElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL).setValue(Uri10_50.convertUri(src.getUrlElement())));
|
||||
if (src.hasVersionElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION).setValue(String10_50.convertString(src.getVersionElement())));
|
||||
if (src.hasNameElement())
|
||||
tgt.setNameElement(String10_50.convertString(src.getNameElement()));
|
||||
if (src.hasTitleElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).setValue(String10_50.convertString(src.getTitleElement())));
|
||||
if (src.hasStatus())
|
||||
tgt.setStatusElement(Enumerations10_50.convertConformanceResourceStatus(src.getStatusElement()));
|
||||
if (src.hasKind())
|
||||
|
@ -51,9 +64,20 @@ public class NamingSystem10_50 {
|
|||
if (src == null || src.isEmpty())
|
||||
return null;
|
||||
org.hl7.fhir.r5.model.NamingSystem tgt = new org.hl7.fhir.r5.model.NamingSystem();
|
||||
ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyDomainResource(src, tgt);
|
||||
ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyDomainResource(src, tgt, VersionConvertorConstants.EXT_NAMINGSYSTEM_URL, VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION, VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE);
|
||||
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL)) {
|
||||
tgt.setUrlElement(Uri10_50.convertUri((UriType) src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL).getValue()));
|
||||
}
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION)) {
|
||||
tgt.setVersionElement(String10_50.convertString((StringType) src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION).getValue()));
|
||||
}
|
||||
if (src.hasNameElement())
|
||||
tgt.setNameElement(String10_50.convertString(src.getNameElement()));
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE)) {
|
||||
tgt.setTitleElement(String10_50.convertString((StringType) src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).getValue()));
|
||||
}
|
||||
|
||||
if (src.hasStatus())
|
||||
tgt.setStatusElement(Enumerations10_50.convertConformanceResourceStatus(src.getStatusElement()));
|
||||
if (src.hasKind())
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.hl7.fhir.convertors.conv14_50.resources14_50;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||
import org.hl7.fhir.convertors.context.ConversionContext14_50;
|
||||
import org.hl7.fhir.convertors.conv14_50.datatypes14_50.complextypes14_50.CodeableConcept14_50;
|
||||
import org.hl7.fhir.convertors.conv14_50.datatypes14_50.complextypes14_50.ContactPoint14_50;
|
||||
|
@ -7,6 +8,9 @@ import org.hl7.fhir.convertors.conv14_50.datatypes14_50.complextypes14_50.Period
|
|||
import org.hl7.fhir.convertors.conv14_50.datatypes14_50.primitivetypes14_50.Boolean14_50;
|
||||
import org.hl7.fhir.convertors.conv14_50.datatypes14_50.primitivetypes14_50.DateTime14_50;
|
||||
import org.hl7.fhir.convertors.conv14_50.datatypes14_50.primitivetypes14_50.String14_50;
|
||||
import org.hl7.fhir.convertors.conv14_50.datatypes14_50.primitivetypes14_50.Uri14_50;
|
||||
import org.hl7.fhir.dstu2016may.model.Extension;
|
||||
import org.hl7.fhir.dstu2016may.model.StringType;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
|
||||
public class NamingSystem14_50 {
|
||||
|
@ -14,10 +18,14 @@ public class NamingSystem14_50 {
|
|||
public static org.hl7.fhir.r5.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu2016may.model.NamingSystem src) throws FHIRException {
|
||||
if (src == null || src.isEmpty())
|
||||
return null;
|
||||
|
||||
org.hl7.fhir.r5.model.NamingSystem tgt = new org.hl7.fhir.r5.model.NamingSystem();
|
||||
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyDomainResource(src, tgt);
|
||||
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyDomainResource(src, tgt, VersionConvertorConstants.EXT_NAMINGSYSTEM_URL, VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION, VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE);
|
||||
if (src.hasNameElement())
|
||||
tgt.setNameElement(String14_50.convertString(src.getNameElement()));
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE)) {
|
||||
tgt.setTitleElement(String14_50.convertString((StringType) src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).getValue()));
|
||||
}
|
||||
if (src.hasStatus())
|
||||
tgt.setStatusElement(Enumerations14_50.convertConformanceResourceStatus(src.getStatusElement()));
|
||||
if (src.hasKind())
|
||||
|
@ -51,8 +59,15 @@ public class NamingSystem14_50 {
|
|||
return null;
|
||||
org.hl7.fhir.dstu2016may.model.NamingSystem tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem();
|
||||
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyDomainResource(src, tgt);
|
||||
if (src.hasUrlElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL).setValue(Uri14_50.convertUri(src.getUrlElement())));
|
||||
if (src.hasVersionElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION).setValue(String14_50.convertString(src.getVersionElement())));
|
||||
|
||||
if (src.hasNameElement())
|
||||
tgt.setNameElement(String14_50.convertString(src.getNameElement()));
|
||||
if (src.hasTitleElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).setValue(String14_50.convertString(src.getTitleElement())));
|
||||
if (src.hasStatus())
|
||||
tgt.setStatusElement(Enumerations14_50.convertConformanceResourceStatus(src.getStatusElement()));
|
||||
if (src.hasKind())
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.hl7.fhir.convertors.conv30_50.resources30_50;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||
import org.hl7.fhir.convertors.context.ConversionContext30_50;
|
||||
import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Uri10_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.ContactDetail30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.UsageContext30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.CodeableConcept30_50;
|
||||
|
@ -9,6 +11,12 @@ import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Bool
|
|||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.DateTime30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.MarkDown30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.String30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Uri30_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50;
|
||||
import org.hl7.fhir.dstu3.model.Extension;
|
||||
import org.hl7.fhir.dstu3.model.StringType;
|
||||
import org.hl7.fhir.dstu3.model.UriType;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
|
||||
public class NamingSystem30_50 {
|
||||
|
@ -18,8 +26,15 @@ public class NamingSystem30_50 {
|
|||
return null;
|
||||
org.hl7.fhir.dstu3.model.NamingSystem tgt = new org.hl7.fhir.dstu3.model.NamingSystem();
|
||||
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
|
||||
if (src.hasUrlElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL).setValue(Uri30_50.convertUri(src.getUrlElement())));
|
||||
if (src.hasVersionElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION).setValue(String30_50.convertString(src.getVersionElement())));
|
||||
if (src.hasName())
|
||||
tgt.setNameElement(String30_50.convertString(src.getNameElement()));
|
||||
if (src.hasTitleElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).setValue(String30_50.convertString(src.getTitleElement())));
|
||||
|
||||
if (src.hasStatus())
|
||||
tgt.setStatusElement(Enumerations30_50.convertPublicationStatus(src.getStatusElement()));
|
||||
if (src.hasKind())
|
||||
|
@ -51,9 +66,19 @@ public class NamingSystem30_50 {
|
|||
if (src == null)
|
||||
return null;
|
||||
org.hl7.fhir.r5.model.NamingSystem tgt = new org.hl7.fhir.r5.model.NamingSystem();
|
||||
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
|
||||
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt, VersionConvertorConstants.EXT_NAMINGSYSTEM_URL, VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION, VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE);
|
||||
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL)) {
|
||||
tgt.setUrlElement(Uri30_50.convertUri((UriType) src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL).getValue()));
|
||||
}
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION)) {
|
||||
tgt.setVersionElement(String30_50.convertString((StringType) src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION).getValue()));
|
||||
}
|
||||
if (src.hasName())
|
||||
tgt.setNameElement(String30_50.convertString(src.getNameElement()));
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE)) {
|
||||
tgt.setTitleElement(String30_50.convertString((StringType) src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).getValue()));
|
||||
}
|
||||
if (src.hasStatus())
|
||||
tgt.setStatusElement(Enumerations30_50.convertPublicationStatus(src.getStatusElement()));
|
||||
if (src.hasKind())
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package org.hl7.fhir.convertors.conv40_50.resources40_50;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||
import org.hl7.fhir.convertors.context.ConversionContext40_50;
|
||||
import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.String10_50;
|
||||
import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Uri10_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.CodeableConcept40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Period40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.metadata40_50.ContactDetail40_50;
|
||||
|
@ -9,7 +12,13 @@ import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Boolean40
|
|||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.DateTime40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.MarkDown40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Uri40_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r4.model.Extension;
|
||||
import org.hl7.fhir.r4.model.StringType;
|
||||
import org.hl7.fhir.r4.model.UriType;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
|
@ -45,10 +54,22 @@ public class NamingSystem40_50 {
|
|||
public static org.hl7.fhir.r5.model.NamingSystem convertNamingSystem(org.hl7.fhir.r4.model.NamingSystem src) throws FHIRException {
|
||||
if (src == null)
|
||||
return null;
|
||||
|
||||
org.hl7.fhir.r5.model.NamingSystem tgt = new org.hl7.fhir.r5.model.NamingSystem();
|
||||
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
|
||||
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt, VersionConvertorConstants.EXT_NAMINGSYSTEM_URL, VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION, VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE);
|
||||
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL)) {
|
||||
tgt.setUrlElement(Uri40_50.convertUri((UriType) src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL).getValue()));
|
||||
}
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION)) {
|
||||
tgt.setVersionElement(String40_50.convertString((StringType) src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION).getValue()));
|
||||
}
|
||||
if (src.hasName())
|
||||
tgt.setNameElement(String40_50.convertString(src.getNameElement()));
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE)) {
|
||||
tgt.setTitleElement(String40_50.convertString((StringType) src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).getValue()));
|
||||
}
|
||||
|
||||
if (src.hasStatus())
|
||||
tgt.setStatusElement(Enumerations40_50.convertPublicationStatus(src.getStatusElement()));
|
||||
if (src.hasKind())
|
||||
|
@ -81,8 +102,15 @@ public class NamingSystem40_50 {
|
|||
return null;
|
||||
org.hl7.fhir.r4.model.NamingSystem tgt = new org.hl7.fhir.r4.model.NamingSystem();
|
||||
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
|
||||
if (src.hasUrlElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL).setValue(Uri40_50.convertUri(src.getUrlElement())));
|
||||
if (src.hasVersionElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION).setValue(String40_50.convertString(src.getVersionElement())));
|
||||
if (src.hasName())
|
||||
tgt.setNameElement(String40_50.convertString(src.getNameElement()));
|
||||
if (src.hasTitleElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).setValue(String40_50.convertString(src.getTitleElement())));
|
||||
|
||||
if (src.hasStatus())
|
||||
tgt.setStatusElement(Enumerations40_50.convertPublicationStatus(src.getStatusElement()));
|
||||
if (src.hasKind())
|
||||
|
|
|
@ -2,6 +2,9 @@ package org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50;
|
|||
|
||||
import org.hl7.fhir.convertors.context.ConversionContext43_50;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r4b.model.DataType;
|
||||
import org.hl7.fhir.r4b.model.PrimitiveType;
|
||||
import org.hl7.fhir.r5.model.UriType;
|
||||
|
||||
public class Uri43_50 {
|
||||
public static org.hl7.fhir.r5.model.UriType convertUri(org.hl7.fhir.r4b.model.UriType src) throws FHIRException {
|
||||
|
@ -15,4 +18,15 @@ public class Uri43_50 {
|
|||
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
|
||||
return tgt;
|
||||
}
|
||||
|
||||
public static UriType convertToUri(DataType src) {
|
||||
if (src instanceof PrimitiveType<?>) {
|
||||
PrimitiveType<?> p = (PrimitiveType<?>) src;
|
||||
org.hl7.fhir.r5.model.UriType tgt = p.hasValue() ? new org.hl7.fhir.r5.model.UriType(p.getValueAsString()) : new org.hl7.fhir.r5.model.UriType();
|
||||
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
|
||||
return tgt;
|
||||
} else {
|
||||
throw new FHIRException("Unable to convert "+src.fhirType()+" to a URI Type");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package org.hl7.fhir.convertors.conv43_50.resources43_50;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||
import org.hl7.fhir.convertors.context.ConversionContext43_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Uri40_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.CodeableConcept43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Period43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.ContactDetail43_50;
|
||||
|
@ -9,7 +12,9 @@ import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Boolean43
|
|||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.DateTime43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.MarkDown43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r4b.model.Extension;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
|
@ -46,9 +51,19 @@ public class NamingSystem43_50 {
|
|||
if (src == null)
|
||||
return null;
|
||||
org.hl7.fhir.r5.model.NamingSystem tgt = new org.hl7.fhir.r5.model.NamingSystem();
|
||||
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
|
||||
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt, VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE);
|
||||
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL)) {
|
||||
tgt.setUrlElement(Uri43_50.convertToUri(src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL).getValue()));
|
||||
}
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION)) {
|
||||
tgt.setVersionElement(String43_50.convertString(src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION).getValueStringType()));
|
||||
}
|
||||
if (src.hasName())
|
||||
tgt.setNameElement(String43_50.convertString(src.getNameElement()));
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE)) {
|
||||
tgt.setTitleElement(String43_50.convertString(src.getExtensionByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).getValueStringType()));
|
||||
}
|
||||
if (src.hasStatus())
|
||||
tgt.setStatusElement(Enumerations43_50.convertPublicationStatus(src.getStatusElement()));
|
||||
if (src.hasKind())
|
||||
|
@ -81,8 +96,16 @@ public class NamingSystem43_50 {
|
|||
return null;
|
||||
org.hl7.fhir.r4b.model.NamingSystem tgt = new org.hl7.fhir.r4b.model.NamingSystem();
|
||||
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
|
||||
|
||||
if (src.hasUrlElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_URL).setValue(Uri43_50.convertUri(src.getUrlElement())));
|
||||
if (src.hasVersionElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_VERSION).setValue(String43_50.convertString(src.getVersionElement())));
|
||||
if (src.hasName())
|
||||
tgt.setNameElement(String43_50.convertString(src.getNameElement()));
|
||||
if (src.hasTitleElement())
|
||||
tgt.getExtension().add(new Extension().setUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).setValue(String43_50.convertString(src.getTitleElement())));
|
||||
|
||||
if (src.hasStatus())
|
||||
tgt.setStatusElement(Enumerations43_50.convertPublicationStatus(src.getStatusElement()));
|
||||
if (src.hasKind())
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package org.hl7.fhir.convertors.conv40_50;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class NamingSystem40_50Test {
|
||||
|
||||
|
||||
@Test
|
||||
@DisplayName("Test r5 -> r4 NamingSystem conversion.")
|
||||
public void testR5_R4() throws IOException {
|
||||
InputStream r4b_input = this.getClass().getResourceAsStream("/naming_system_r4.xml");
|
||||
|
||||
org.hl7.fhir.r4.model.NamingSystem r4b_actual = (org.hl7.fhir.r4.model.NamingSystem) new org.hl7.fhir.r4.formats.XmlParser().parse(r4b_input);
|
||||
org.hl7.fhir.r5.model.NamingSystem r5_conv = (org.hl7.fhir.r5.model.NamingSystem) VersionConvertorFactory_40_50.convertResource(r4b_actual);
|
||||
org.hl7.fhir.r4.model.NamingSystem r4b_conv = (org.hl7.fhir.r4.model.NamingSystem) VersionConvertorFactory_40_50.convertResource(r5_conv);
|
||||
|
||||
assertEquals(1, r4b_actual.getExtensionsByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).size());
|
||||
assertEquals(0, r5_conv.getExtensionsByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).size());
|
||||
assertEquals("American Dental Association Area of Oral Cavity System", r5_conv.getTitle());
|
||||
assertEquals("http://terminology.hl7.org/NamingSystem/ADAAreaOralCavitySystem", r5_conv.getUrl());
|
||||
assertEquals("1.0.0", r5_conv.getVersion());
|
||||
assertEquals(1, r4b_conv.getExtensionsByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).size());
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package org.hl7.fhir.convertors.conv43_50;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_43_50;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class NamingSystem43_50Test {
|
||||
|
||||
|
||||
@Test
|
||||
@DisplayName("Test r5 -> r4 NamingSystem conversion.")
|
||||
public void testR5_R4() throws IOException {
|
||||
InputStream r4b_input = this.getClass().getResourceAsStream("/naming_system_r4.xml");
|
||||
|
||||
org.hl7.fhir.r4b.model.NamingSystem r4b_actual = (org.hl7.fhir.r4b.model.NamingSystem) new org.hl7.fhir.r4b.formats.XmlParser().parse(r4b_input);
|
||||
org.hl7.fhir.r5.model.NamingSystem r5_conv = (org.hl7.fhir.r5.model.NamingSystem) VersionConvertorFactory_43_50.convertResource(r4b_actual);
|
||||
org.hl7.fhir.r4b.model.NamingSystem r4b_conv = (org.hl7.fhir.r4b.model.NamingSystem) VersionConvertorFactory_43_50.convertResource(r5_conv);
|
||||
|
||||
assertEquals(1, r4b_actual.getExtensionsByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).size());
|
||||
assertEquals(0, r5_conv.getExtensionsByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).size());
|
||||
assertEquals("American Dental Association Area of Oral Cavity System", r5_conv.getTitle());
|
||||
assertEquals("http://terminology.hl7.org/NamingSystem/ADAAreaOralCavitySystem", r5_conv.getUrl());
|
||||
assertEquals("1.0.0", r5_conv.getVersion());
|
||||
assertEquals(1, r4b_conv.getExtensionsByUrl(VersionConvertorConstants.EXT_NAMINGSYSTEM_TITLE).size());
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<NamingSystem xmlns="http://hl7.org/fhir">
|
||||
<id value="ADAAreaOralCavitySystem"/>
|
||||
<extension url="http://hl7.org/fhir/5.0/StructureDefinition/extension-NamingSystem.title">
|
||||
<valueString value="American Dental Association Area of Oral Cavity System"/>
|
||||
</extension>
|
||||
<extension url="http://hl7.org/fhir/5.0/StructureDefinition/extension-NamingSystem.url">
|
||||
<valueUri value="http://terminology.hl7.org/NamingSystem/ADAAreaOralCavitySystem"/>
|
||||
</extension>
|
||||
<extension url="http://hl7.org/fhir/5.0/StructureDefinition/extension-NamingSystem.version">
|
||||
<valueString value="1.0.0"/>
|
||||
</extension>
|
||||
<name value="ADAAreaOralCavitySystem"/>
|
||||
<status value="active"/>
|
||||
<kind value="codesystem"/>
|
||||
<date value="2022-04-07T00:00:00-00:00"/>
|
||||
<publisher value="American Dental Association"/>
|
||||
<contact>
|
||||
<name value="American Dental Association; 211 East Chicago Avenue Chicago, IL 60610-2678"/>
|
||||
</contact>
|
||||
<description value="The Area of Oral Cavity System is accepted and approved by the ADA and is the most commonly used system used by dental professionals in America. Area of the oral cavity is designated by a two-digit code. The Area of Oral Cavity System can be found in the ADA Comprehensive ADA Dental Claim Form Completion Instructions (see https://www.ada.org/-/media/project/ada-organization/ada/ada-org/files/publications/cdt/v2019adadentalclaimcompletioninstructions_v3_2022feb.pdf). For more information see here: https://www.ada.org/publications/cdt/ada-dental-claim-form. A Statement of Understanding (SOU) between ADA and HL7 exists here: http://www.hl7.org/documentcenter/public/mou/ADA%20HL7%20SOU%202021_signed.pdf"/>
|
||||
<uniqueId>
|
||||
<type value="uri"/>
|
||||
<value value="http://terminology.hl7.org/CodeSystem/ADAAreaOralCavitySystem"/>
|
||||
<preferred value="true"/>
|
||||
<comment value="This is the URL endorsed by the HTA and is considered authoritative."/>
|
||||
<period>
|
||||
<start value="2022-04-07"/>
|
||||
</period>
|
||||
</uniqueId>
|
||||
</NamingSystem>
|
|
@ -316,4 +316,26 @@ public abstract class DomainResource extends Resource implements IBaseHasExtensi
|
|||
}
|
||||
|
||||
|
||||
public boolean hasExtension(String url) {
|
||||
for (Extension e : getExtension())
|
||||
if (url.equals(e.getUrl()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public Extension getExtensionByUrl(String theUrl) {
|
||||
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
|
||||
ArrayList<Extension> retVal = new ArrayList<Extension>();
|
||||
for (Extension next : getExtension()) {
|
||||
if (theUrl.equals(next.getUrl())) {
|
||||
retVal.add(next);
|
||||
}
|
||||
}
|
||||
if (retVal.size() == 0)
|
||||
return null;
|
||||
else {
|
||||
org.apache.commons.lang3.Validate.isTrue(retVal.size() == 1, "Url "+theUrl+" must have only one match");
|
||||
return retVal.get(0);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -390,4 +390,28 @@ public abstract class DomainResource extends Resource implements IBaseHasExtensi
|
|||
}
|
||||
|
||||
|
||||
|
||||
public boolean hasExtension(String url) {
|
||||
for (Extension e : getExtension())
|
||||
if (url.equals(e.getUrl()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public Extension getExtensionByUrl(String theUrl) {
|
||||
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
|
||||
ArrayList<Extension> retVal = new ArrayList<Extension>();
|
||||
for (Extension next : getExtension()) {
|
||||
if (theUrl.equals(next.getUrl())) {
|
||||
retVal.add(next);
|
||||
}
|
||||
}
|
||||
if (retVal.size() == 0)
|
||||
return null;
|
||||
else {
|
||||
org.apache.commons.lang3.Validate.isTrue(retVal.size() == 1, "Url "+theUrl+" must have only one match");
|
||||
return retVal.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -84,16 +84,34 @@ public class ResourceUtilities {
|
|||
StringBuilder b = new StringBuilder();
|
||||
for (OperationOutcomeIssueComponent t : error.getIssue())
|
||||
if (t.getSeverity() == IssueSeverity.ERROR)
|
||||
b.append("Error:" +t.getDetails()+"\r\n");
|
||||
b.append("Error:" +gen(t.getDetails())+"\r\n");
|
||||
else if (t.getSeverity() == IssueSeverity.FATAL)
|
||||
b.append("Fatal:" +t.getDetails()+"\r\n");
|
||||
b.append("Fatal:" +gen(t.getDetails())+"\r\n");
|
||||
else if (t.getSeverity() == IssueSeverity.WARNING)
|
||||
b.append("Warning:" +t.getDetails()+"\r\n");
|
||||
b.append("Warning:" +gen(t.getDetails())+"\r\n");
|
||||
else if (t.getSeverity() == IssueSeverity.INFORMATION)
|
||||
b.append("Information:" +t.getDetails()+"\r\n");
|
||||
b.append("Information:" +gen(t.getDetails())+"\r\n");
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
|
||||
private static String gen(CodeableConcept details) {
|
||||
if (details.hasText()) {
|
||||
return details.getText();
|
||||
}
|
||||
for (Coding c : details.getCoding()) {
|
||||
if (c.hasDisplay()) {
|
||||
return c.getDisplay();
|
||||
}
|
||||
}
|
||||
for (Coding c : details.getCoding()) {
|
||||
if (c.hasCode()) {
|
||||
return c.getCode();
|
||||
}
|
||||
}
|
||||
return "(no details supplied)";
|
||||
}
|
||||
|
||||
public static Resource getById(Bundle feed, ResourceType type, String reference) {
|
||||
for (BundleEntryComponent item : feed.getEntry()) {
|
||||
if (item.getResource().getId().equals(reference) && item.getResource().getResourceType() == type)
|
||||
|
|
|
@ -85,16 +85,34 @@ public class ResourceUtilities {
|
|||
StringBuilder b = new StringBuilder();
|
||||
for (OperationOutcomeIssueComponent t : error.getIssue())
|
||||
if (t.getSeverity() == IssueSeverity.ERROR)
|
||||
b.append("Error:" +t.getDetails()+"\r\n");
|
||||
b.append("Error:" +gen(t.getDetails())+"\r\n");
|
||||
else if (t.getSeverity() == IssueSeverity.FATAL)
|
||||
b.append("Fatal:" +t.getDetails()+"\r\n");
|
||||
b.append("Fatal:" +gen(t.getDetails())+"\r\n");
|
||||
else if (t.getSeverity() == IssueSeverity.WARNING)
|
||||
b.append("Warning:" +t.getDetails()+"\r\n");
|
||||
b.append("Warning:" +gen(t.getDetails())+"\r\n");
|
||||
else if (t.getSeverity() == IssueSeverity.INFORMATION)
|
||||
b.append("Information:" +t.getDetails()+"\r\n");
|
||||
b.append("Information:" +gen(t.getDetails())+"\r\n");
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
|
||||
private static String gen(CodeableConcept details) {
|
||||
if (details.hasText()) {
|
||||
return details.getText();
|
||||
}
|
||||
for (Coding c : details.getCoding()) {
|
||||
if (c.hasDisplay()) {
|
||||
return c.getDisplay();
|
||||
}
|
||||
}
|
||||
for (Coding c : details.getCoding()) {
|
||||
if (c.hasCode()) {
|
||||
return c.getCode();
|
||||
}
|
||||
}
|
||||
return "(no details supplied)";
|
||||
}
|
||||
|
||||
public static Resource getById(Bundle feed, ResourceType type, String reference) {
|
||||
for (BundleEntryComponent item : feed.getEntry()) {
|
||||
if (item.getResource().getId().equals(reference) && item.getResource().getResourceType() == type)
|
||||
|
|
|
@ -78,16 +78,34 @@ public class ResourceUtilities {
|
|||
StringBuilder b = new StringBuilder();
|
||||
for (OperationOutcomeIssueComponent t : error.getIssue())
|
||||
if (t.getSeverity() == IssueSeverity.ERROR)
|
||||
b.append("Error:" +t.getDetails()+"\r\n");
|
||||
b.append("Error:" + gen(t.getDetails())+"\r\n");
|
||||
else if (t.getSeverity() == IssueSeverity.FATAL)
|
||||
b.append("Fatal:" +t.getDetails()+"\r\n");
|
||||
b.append("Fatal:"+gen(t.getDetails())+"\r\n");
|
||||
else if (t.getSeverity() == IssueSeverity.WARNING)
|
||||
b.append("Warning:" +t.getDetails()+"\r\n");
|
||||
b.append("Warning:" +gen(t.getDetails())+"\r\n");
|
||||
else if (t.getSeverity() == IssueSeverity.INFORMATION)
|
||||
b.append("Information:" +t.getDetails()+"\r\n");
|
||||
b.append("Information:" +gen(t.getDetails())+"\r\n");
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
|
||||
private static String gen(CodeableConcept details) {
|
||||
if (details.hasText()) {
|
||||
return details.getText();
|
||||
}
|
||||
for (Coding c : details.getCoding()) {
|
||||
if (c.hasDisplay()) {
|
||||
return c.getDisplay();
|
||||
}
|
||||
}
|
||||
for (Coding c : details.getCoding()) {
|
||||
if (c.hasCode()) {
|
||||
return c.getCode();
|
||||
}
|
||||
}
|
||||
return "(no details supplied)";
|
||||
}
|
||||
|
||||
public static Resource getById(Bundle feed, ResourceType type, String reference) {
|
||||
for (BundleEntryComponent item : feed.getEntry()) {
|
||||
if (item.getResource().getId().equals(reference) && item.getResource().getResourceType() == type)
|
||||
|
|
|
@ -79,18 +79,36 @@ public class ResourceUtilities {
|
|||
StringBuilder b = new StringBuilder();
|
||||
for (OperationOutcomeIssueComponent t : error.getIssue()) {
|
||||
if (t.getSeverity() == IssueSeverity.ERROR) {
|
||||
b.append("Error:" +t.getDetails()+"\r\n");
|
||||
b.append("Error:" +gen(t.getDetails())+"\r\n");
|
||||
} else if (t.getSeverity() == IssueSeverity.FATAL) {
|
||||
b.append("Fatal:" +t.getDetails()+"\r\n");
|
||||
b.append("Fatal:" +gen(t.getDetails())+"\r\n");
|
||||
} else if (t.getSeverity() == IssueSeverity.WARNING) {
|
||||
b.append("Warning:" +t.getDetails()+"\r\n");
|
||||
b.append("Warning:" +gen(t.getDetails())+"\r\n");
|
||||
} else if (t.getSeverity() == IssueSeverity.INFORMATION) {
|
||||
b.append("Information:" +t.getDetails()+"\r\n");
|
||||
b.append("Information:" +gen(t.getDetails())+"\r\n");
|
||||
}
|
||||
}
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
|
||||
private static String gen(CodeableConcept details) {
|
||||
if (details.hasText()) {
|
||||
return details.getText();
|
||||
}
|
||||
for (Coding c : details.getCoding()) {
|
||||
if (c.hasDisplay()) {
|
||||
return c.getDisplay();
|
||||
}
|
||||
}
|
||||
for (Coding c : details.getCoding()) {
|
||||
if (c.hasCode()) {
|
||||
return c.getCode();
|
||||
}
|
||||
}
|
||||
return "(no details supplied)";
|
||||
}
|
||||
|
||||
public static Resource getById(Bundle feed, ResourceType type, String reference) {
|
||||
for (BundleEntryComponent item : feed.getEntry()) {
|
||||
if (item.getResource().getId().equals(reference) && item.getResource().getResourceType() == type)
|
||||
|
|
|
@ -122,6 +122,7 @@ public interface IWorkerContext {
|
|||
private String txLink;
|
||||
private String diagnostics;
|
||||
private List<OperationOutcomeIssueComponent> issues = new ArrayList<>();
|
||||
private CodeableConcept codeableConcept;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -277,6 +278,16 @@ public interface IWorkerContext {
|
|||
return issues;
|
||||
}
|
||||
|
||||
public ValidationResult addCodeableConcept(CodeableConcept vcc) {
|
||||
if (!vcc.isEmpty()) {
|
||||
codeableConcept = vcc;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public CodeableConcept getCodeableConcept() {
|
||||
return codeableConcept;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -410,6 +410,13 @@ public boolean hasCoding(String system, String code) {
|
|||
return hasCoding() ? getCoding().toString() : "["+getText()+"]";
|
||||
}
|
||||
|
||||
public void removeCoding(String system, String version, String code) {
|
||||
getCoding().removeIf(c ->
|
||||
(system == null || system.equals(c.getSystem())) &&
|
||||
(version == null || version.equals(c.getVersion())) &&
|
||||
(code == null || code.equals(c.getCode())));
|
||||
}
|
||||
|
||||
// end addition
|
||||
|
||||
}
|
||||
|
|
|
@ -32,29 +32,19 @@ package org.hl7.fhir.r5.model;
|
|||
// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.hl7.fhir.r5.model.Enumerations.*;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
||||
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.ChildOrder;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import org.hl7.fhir.instance.model.api.IDomainResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
|
||||
import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
|
||||
import org.hl7.fhir.instance.model.api.IBaseHasModifierExtensions;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.utilities.StandardsStatus;
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
|
||||
import org.hl7.fhir.instance.model.api.IBaseHasModifierExtensions;
|
||||
import org.hl7.fhir.instance.model.api.IDomainResource;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.utilities.StandardsStatus;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
|
||||
/**
|
||||
* A resource that includes narrative, extensions, and contained resources.
|
||||
*/
|
||||
|
@ -522,6 +512,7 @@ public void checkNoModifiers(String noun, String verb) throws FHIRException {
|
|||
ToolingExtensions.setStandardsStatus(this, status, null);
|
||||
}
|
||||
|
||||
|
||||
// end addition
|
||||
|
||||
}
|
||||
|
|
|
@ -158,6 +158,7 @@ public class ValueSetValidator {
|
|||
// first, we validate the codings themselves
|
||||
ValidationProcessInfo info = new ValidationProcessInfo();
|
||||
|
||||
CodeableConcept vcc = new CodeableConcept();
|
||||
if (options.getValueSetMode() != ValueSetMode.CHECK_MEMERSHIP_ONLY) {
|
||||
int i = 0;
|
||||
for (Coding c : code.getCoding()) {
|
||||
|
@ -183,7 +184,7 @@ public class ValueSetValidator {
|
|||
}
|
||||
} else {
|
||||
c.setUserData("cs", cs);
|
||||
res = validateCode(path+".coding["+i+"]", c, cs);
|
||||
res = validateCode(path+".coding["+i+"]", c, cs, vcc);
|
||||
}
|
||||
info.getIssues().addAll(res.getIssues());
|
||||
i++;
|
||||
|
@ -202,6 +203,12 @@ public class ValueSetValidator {
|
|||
} else if (ok) {
|
||||
result = true;
|
||||
foundCoding = c;
|
||||
if (options.getValueSetMode() == ValueSetMode.CHECK_MEMERSHIP_ONLY) {
|
||||
vcc.addCoding().setSystem(c.getSystem()).setVersion(c.getVersion()).setCode(c.getCode());
|
||||
}
|
||||
}
|
||||
if (ok == null || !ok) {
|
||||
vcc.removeCoding(c.getSystem(), c.getVersion(), c.getCode());
|
||||
}
|
||||
}
|
||||
if (result == null) {
|
||||
|
@ -222,6 +229,7 @@ public class ValueSetValidator {
|
|||
res.setVersion(foundCoding.hasVersion() ? foundCoding.getVersion() : ((CodeSystem) foundCoding.getUserData("cs")).getVersion());
|
||||
res.setDisplay(cd.getDisplay());
|
||||
}
|
||||
res.addCodeableConcept(vcc);
|
||||
return res;
|
||||
} else if (foundCoding == null) {
|
||||
return new ValidationResult(IssueSeverity.ERROR, "Internal Error that should not happen", makeIssue(IssueSeverity.FATAL, IssueType.EXCEPTION, path, "Internal Error that should not happen"));
|
||||
|
@ -229,11 +237,11 @@ public class ValueSetValidator {
|
|||
String disp = lookupDisplay(foundCoding);
|
||||
ConceptDefinitionComponent cd = new ConceptDefinitionComponent(foundCoding.getCode());
|
||||
cd.setDisplay(disp);
|
||||
return new ValidationResult(IssueSeverity.WARNING, info.summary(), foundCoding.getSystem(), getVersion(foundCoding), cd, disp, info.getIssues());
|
||||
return new ValidationResult(IssueSeverity.WARNING, info.summary(), foundCoding.getSystem(), getVersion(foundCoding), cd, disp, info.getIssues()).addCodeableConcept(vcc);
|
||||
} else {
|
||||
ConceptDefinitionComponent cd = new ConceptDefinitionComponent(foundCoding.getCode());
|
||||
cd.setDisplay(lookupDisplay(foundCoding));
|
||||
return new ValidationResult(foundCoding.getSystem(), getVersion(foundCoding), cd, getPreferredDisplay(cd, null));
|
||||
return new ValidationResult(foundCoding.getSystem(), getVersion(foundCoding), cd, getPreferredDisplay(cd, null)).addCodeableConcept(vcc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -406,7 +414,7 @@ public class ValueSetValidator {
|
|||
// we can't validate that here.
|
||||
throw new FHIRException("Unable to evaluate based on empty code system");
|
||||
}
|
||||
res = validateCode(path, code, cs);
|
||||
res = validateCode(path, code, cs, null);
|
||||
} else if (cs == null && valueset.hasExpansion() && inExpansion) {
|
||||
// we just take the value set as face value then
|
||||
res = new ValidationResult(system, wv, new ConceptDefinitionComponent().setCode(code.getCode()).setDisplay(code.getDisplay()), code.getDisplay());
|
||||
|
@ -589,7 +597,7 @@ public class ValueSetValidator {
|
|||
return false;
|
||||
}
|
||||
|
||||
private ValidationResult validateCode(String path, Coding code, CodeSystem cs) {
|
||||
private ValidationResult validateCode(String path, Coding code, CodeSystem cs, CodeableConcept vcc) {
|
||||
ConceptDefinitionComponent cc = cs.hasUserData("tx.cs.special") ? ((SpecialCodeSystem) cs.getUserData("tx.cs.special")).findConcept(code) : findCodeInConcept(cs.getConcept(), code.getCode());
|
||||
if (cc == null) {
|
||||
if (cs.getContent() == CodeSystemContentMode.FRAGMENT) {
|
||||
|
@ -600,8 +608,12 @@ public class ValueSetValidator {
|
|||
return new ValidationResult(IssueSeverity.ERROR, msg, makeIssue(IssueSeverity.ERROR, IssueType.INVALID, path+".code", msg));
|
||||
}
|
||||
}
|
||||
Coding vc = new Coding().setCode(code.getCode()).setSystem(cs.getUrl()).setVersion(cs.getVersion()).setDisplay(getPreferredDisplay(cc, cs));
|
||||
if (vcc != null) {
|
||||
vcc.addCoding(vc);
|
||||
}
|
||||
if (code.getDisplay() == null) {
|
||||
return new ValidationResult(code.getSystem(), cs.getVersion(), cc, getPreferredDisplay(cc, cs));
|
||||
return new ValidationResult(code.getSystem(), cs.getVersion(), cc, vc.getDisplay());
|
||||
}
|
||||
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
|
||||
if (cc.hasDisplay() && isOkLanguage(cs.getLanguage())) {
|
||||
|
|
|
@ -34,6 +34,7 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hl7.fhir.r5.model.Coding;
|
||||
import org.hl7.fhir.r5.model.Base;
|
||||
import org.hl7.fhir.r5.model.Bundle;
|
||||
import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent;
|
||||
|
@ -78,18 +79,36 @@ public class ResourceUtilities {
|
|||
StringBuilder b = new StringBuilder();
|
||||
for (OperationOutcomeIssueComponent t : error.getIssue()) {
|
||||
if (t.getSeverity() == IssueSeverity.ERROR) {
|
||||
b.append("Error:" +t.getDetails()+"\r\n");
|
||||
b.append("Error:" +gen(t.getDetails())+"\r\n");
|
||||
} else if (t.getSeverity() == IssueSeverity.FATAL) {
|
||||
b.append("Fatal:" +t.getDetails()+"\r\n");
|
||||
b.append("Fatal:" +gen(t.getDetails())+"\r\n");
|
||||
} else if (t.getSeverity() == IssueSeverity.WARNING) {
|
||||
b.append("Warning:" +t.getDetails()+"\r\n");
|
||||
b.append("Warning:" +gen(t.getDetails())+"\r\n");
|
||||
} else if (t.getSeverity() == IssueSeverity.INFORMATION) {
|
||||
b.append("Information:" +t.getDetails()+"\r\n");
|
||||
b.append("Information:" +gen(t.getDetails())+"\r\n");
|
||||
}
|
||||
}
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
|
||||
private static String gen(CodeableConcept details) {
|
||||
if (details.hasText()) {
|
||||
return details.getText();
|
||||
}
|
||||
for (Coding c : details.getCoding()) {
|
||||
if (c.hasDisplay()) {
|
||||
return c.getDisplay();
|
||||
}
|
||||
}
|
||||
for (Coding c : details.getCoding()) {
|
||||
if (c.hasCode()) {
|
||||
return c.getCode();
|
||||
}
|
||||
}
|
||||
return "(no details supplied)";
|
||||
}
|
||||
|
||||
public static Resource getById(Bundle feed, ResourceType type, String reference) {
|
||||
for (BundleEntryComponent item : feed.getEntry()) {
|
||||
if (item.getResource().getId().equals(reference) && item.getResource().getResourceType() == type)
|
||||
|
|
|
@ -536,7 +536,7 @@ XHTML_URL_INVALID_CHARS_one = URL contains Invalid Character ({1})
|
|||
XHTML_URL_INVALID_CHARS_other = URL contains {0} Invalid Characters ({1})
|
||||
TERMINOLOGY_TX_SYSTEM_HTTPS = The system URL ''{0}'' wrongly starts with https: not http:
|
||||
CODESYSTEM_CS_NO_VS_NOTCOMPLETE = Review the All Codes Value Set - incomplete CodeSystems generally should not have an all codes value set specified
|
||||
TYPE_SPECIFIC_CHECKS_DT_IDENTIFIER_IETF_SYSTEM_VALUE = if identifier.system is ''urn:ietf:rfc:3986'', then the identifier.value must be a full URI (e.g. start with a scheme)
|
||||
TYPE_SPECIFIC_CHECKS_DT_IDENTIFIER_IETF_SYSTEM_VALUE = if identifier.system is ''urn:ietf:rfc:3986'', then the identifier.value must be a full URI (e.g. start with a scheme), not ''{0}''
|
||||
TYPE_SPECIFIC_CHECKS_DT_ATT_SIZE_INVALID = Stated Attachment Size {0} is not valid
|
||||
TYPE_SPECIFIC_CHECKS_DT_ATT_SIZE_CORRECT = Stated Attachment Size {0} does not match actual attachment size {1}
|
||||
TYPE_SPECIFIC_CHECKS_DT_ATT_NO_FETCHER = Attachment size cannot be checked because the validator has not been set up to access the network (url = {0})
|
||||
|
|
|
@ -2255,7 +2255,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
ok = rule(errors, NO_RULE_DATE, IssueType.CODEINVALID, element.line(), element.col(), path, system == null || isIdentifierSystemReferenceValid(system), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_IDENTIFIER_SYSTEM) && ok;
|
||||
if ("urn:ietf:rfc:3986".equals(system)) {
|
||||
String value = element.getNamedChildValue("value");
|
||||
ok = rule(errors, NO_RULE_DATE, IssueType.CODEINVALID, element.line(), element.col(), path, value == null || isAbsolute(value), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_IDENTIFIER_IETF_SYSTEM_VALUE) && ok;
|
||||
ok = rule(errors, NO_RULE_DATE, IssueType.CODEINVALID, element.line(), element.col(), path, value == null || isAbsolute(value), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_IDENTIFIER_IETF_SYSTEM_VALUE, value) && ok;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
|
|
@ -1276,6 +1276,9 @@ public class StructureMapValidator extends BaseValidator {
|
|||
}
|
||||
}
|
||||
StructureDefinition tsd = context.fetchTypeDefinition(type);
|
||||
if (tsd == null) {
|
||||
return false;
|
||||
}
|
||||
StructureDefinition sd = context.fetchTypeDefinition(v.getType());
|
||||
while (sd != null) {
|
||||
if (sd.getUrl().equals(tsd.getUrl())) {
|
||||
|
|
|
@ -50,6 +50,8 @@ public class ExternalTerminologyServiceTests implements ITxTesterLoader {
|
|||
|
||||
private static final String SERVER = FhirSettings.getTxFhirDevelopment();
|
||||
// private static final String SERVER = FhirSettings.getTxFhirLocal();
|
||||
// private static final String SERVER = "https://r4.ontoserver.csiro.au/fhir";
|
||||
|
||||
|
||||
@Parameters(name = "{index}: id {0}")
|
||||
public static Iterable<Object[]> data() throws IOException {
|
||||
|
|
|
@ -274,6 +274,9 @@ public class TerminologyServiceTests {
|
|||
if (vm.getDisplay() != null) {
|
||||
res.addParameter("display", vm.getDisplay());
|
||||
}
|
||||
if (vm.getCodeableConcept() != null) {
|
||||
res.addParameter("codeableConcept", vm.getCodeableConcept());
|
||||
}
|
||||
if (vm.getIssues().size() > 0) {
|
||||
OperationOutcome oo = new OperationOutcome();
|
||||
oo.getIssue().addAll(vm.getIssues());
|
||||
|
|
Loading…
Reference in New Issue