adding advisor enhancements

This commit is contained in:
markiantorno 2021-05-26 15:59:37 -04:00
parent 30e45f54ed
commit e12e24785d
25 changed files with 136 additions and 161 deletions

View File

@ -2290,16 +2290,16 @@ public class VersionConvertor_10_40 extends VersionConvertor_Base {
.map(resource -> convertResource(resource, advisor))
.forEach(tgt::addContained);
src.getExtension().forEach(ext -> {
if (advisor.useAdvisorForExtension(ext)) {
if (advisor.useAdvisorForExtension("", ext)) {//TODO add path
Extension convertExtension = new Extension();
advisor.handleExtension(ext, convertExtension);
advisor.handleExtension("", ext, convertExtension);//TODO add path
tgt.addExtension(convertExtension);
} else if (!advisor.ignoreExtension(ext) && !Arrays.asList(extensionsToIgnore).contains(ext.getUrl())) {
} else if (!advisor.ignoreExtension("", ext) && !Arrays.asList(extensionsToIgnore).contains(ext.getUrl())) {//TODO add path
tgt.addExtension(convertExtension(ext));
}
});
src.getModifierExtension().stream()
.filter(extension -> !advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))
.filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))//TODO add path
.map(VersionConvertor_10_40::convertExtension)
.forEach(tgt::addModifierExtension);
}
@ -2315,16 +2315,16 @@ public class VersionConvertor_10_40 extends VersionConvertor_Base {
.map(resource -> convertResource(resource, advisor))
.forEach(tgt::addContained);
src.getExtension().forEach(extension -> {
if (advisor.useAdvisorForExtension(extension)) {
if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
org.hl7.fhir.dstu2.model.Extension convertExtension = new org.hl7.fhir.dstu2.model.Extension();
advisor.handleExtension(extension, convertExtension);
advisor.handleExtension("", extension, convertExtension);//TODO add path
tgt.addExtension(convertExtension);
} else if (!advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {
} else if (!advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {//TODO add path
tgt.addExtension(convertExtension(extension));
}
});
src.getModifierExtension().stream()
.filter(extension -> !advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))
.filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))//TODO add path
.map(VersionConvertor_10_40::convertExtension)
.forEach(tgt::addModifierExtension);
}

View File

@ -2311,16 +2311,16 @@ public class VersionConvertor_10_50 extends VersionConvertor_Base {
.map(resource -> convertResource(resource, advisor))
.forEach(tgt::addContained);
src.getExtension().forEach(extension -> {
if (advisor.useAdvisorForExtension(extension)) {
org.hl7.fhir.r5.model.Extension convertExtension = new org.hl7.fhir.r5.model.Extension();
advisor.handleExtension(extension, convertExtension);
if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
org.hl7.fhir.r5.model.Extension convertExtension = new org.hl7.fhir.r5.model.Extension();//TODO add path
advisor.handleExtension("", extension, convertExtension);
tgt.addExtension(convertExtension);
} else if (!advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {
} else if (!advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {//TODO add path
tgt.addExtension(convertExtension(extension));
}
});
src.getModifierExtension().stream()
.filter(extension -> !advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))
.filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))//TODO add path
.map(VersionConvertor_10_50::convertExtension)
.forEach(tgt::addModifierExtension);
}
@ -2336,16 +2336,16 @@ public class VersionConvertor_10_50 extends VersionConvertor_Base {
.map(resource -> convertResource(resource, advisor))
.forEach(tgt::addContained);
src.getExtension().forEach(extension -> {
if (advisor.useAdvisorForExtension(extension)) {
if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
Extension convertExtension = new Extension();
advisor.handleExtension(extension, convertExtension);
advisor.handleExtension("", extension, convertExtension);//TODO add path
tgt.addExtension(convertExtension);
} else if (!advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {
} else if (!advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {//TODO add path
tgt.addExtension(convertExtension(extension));
}
});
src.getModifierExtension().stream()
.filter(extension -> !advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))
.filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))//TODO add path
.map(VersionConvertor_10_50::convertExtension)
.forEach(tgt::addModifierExtension);
}

View File

@ -2421,16 +2421,16 @@ public class VersionConvertor_14_40 extends VersionConvertor_Base {
.map(resource -> convertResource(resource, advisor))
.forEach(tgt::addContained);
src.getExtension().forEach(extension -> {
if (advisor.useAdvisorForExtension(extension)) {
if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
org.hl7.fhir.r4.model.Extension convertExtension = new org.hl7.fhir.r4.model.Extension();
advisor.handleExtension(extension, convertExtension);
advisor.handleExtension("", extension, convertExtension);//TODO add path
tgt.addExtension(convertExtension);
} else if (!advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {
} else if (!advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {//TODO add path
tgt.addExtension(convertExtension(extension));
}
});
src.getModifierExtension().stream()
.filter(extension -> !advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))
.filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))//TODO add path
.map(VersionConvertor_14_40::convertExtension)
.forEach(tgt::addModifierExtension);
}
@ -2451,16 +2451,16 @@ public class VersionConvertor_14_40 extends VersionConvertor_Base {
.map(resource -> convertResource(resource, advisor))
.forEach(tgt::addContained);
src.getExtension().forEach(extension -> {
if (advisor.useAdvisorForExtension(extension)) {
if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
org.hl7.fhir.dstu2016may.model.Extension convertExtension = new org.hl7.fhir.dstu2016may.model.Extension();
advisor.handleExtension(extension, convertExtension);
advisor.handleExtension("", extension, convertExtension);//TODO add path
tgt.addExtension(convertExtension);
} else if (!advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {
} else if (!advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {//TODO add path
tgt.addExtension(convertExtension(extension));
}
});
src.getModifierExtension().stream()
.filter(extension -> !advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))
.filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))//TODO add path
.map(VersionConvertor_14_40::convertExtension)
.forEach(tgt::addModifierExtension);
}

View File

@ -2437,16 +2437,16 @@ public class VersionConvertor_14_50 extends VersionConvertor_Base {
.map(resource -> convertResource(resource, advisor))
.forEach(tgt::addContained);
src.getExtension().forEach(extension -> {
if (advisor.useAdvisorForExtension(extension)) {
if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
org.hl7.fhir.r5.model.Extension convertExtension = new org.hl7.fhir.r5.model.Extension();
advisor.handleExtension(extension, convertExtension);
advisor.handleExtension("", extension, convertExtension);//TODO add path
tgt.addExtension(convertExtension);
} else if (!advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {
} else if (!advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {//TODO add path
tgt.addExtension(convertExtension(extension));
}
});
src.getModifierExtension().stream()
.filter(extension -> !advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))
.filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))//TODO add path
.map(extension -> convertExtension(extension))
.forEach(tgt::addModifierExtension);
}
@ -2462,16 +2462,16 @@ public class VersionConvertor_14_50 extends VersionConvertor_Base {
.map(resource -> convertResource(resource, advisor))
.forEach(tgt::addContained);
src.getExtension().forEach(extension -> {
if (advisor.useAdvisorForExtension(extension)) {
if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
org.hl7.fhir.dstu2016may.model.Extension convertExtension = new org.hl7.fhir.dstu2016may.model.Extension();
advisor.handleExtension(extension, convertExtension);
advisor.handleExtension("", extension, convertExtension);//TODO add path
tgt.addExtension(convertExtension);
} else if (!advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {
} else if (!advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {//TODO add path
tgt.addExtension(convertExtension(extension));
}
});
src.getModifierExtension().stream()
.filter(extension -> !advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))
.filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))//TODO add path
.map(VersionConvertor_14_50::convertExtension)
.forEach(tgt::addModifierExtension);
}

View File

@ -3152,16 +3152,17 @@ public class VersionConvertor_30_40 extends VersionConvertor_Base {
.map(resource -> convertResource(resource, advisor))
.forEach(tgt::addContained);
src.getExtension().forEach(extension -> {
if (advisor.useAdvisorForExtension(extension)) {
if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
org.hl7.fhir.r4.model.Extension convertExtension = new org.hl7.fhir.r4.model.Extension();
advisor.handleExtension(extension, convertExtension);
advisor.handleExtension("", extension, convertExtension);//TODO add path
tgt.addExtension(convertExtension);
} else if (!advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {
} else if (!advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {//TODO add path
tgt.addExtension(convertExtension(extension));
}
});
src.getModifierExtension().stream()
.filter(extension -> !advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))
.filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))//TODO add path
.map(VersionConvertor_30_40::convertExtension)
.forEach(tgt::addModifierExtension);
}
@ -3177,16 +3178,16 @@ public class VersionConvertor_30_40 extends VersionConvertor_Base {
.map(resource -> convertResource(resource, advisor))
.forEach(tgt::addContained);
src.getExtension().forEach(extension -> {
if (advisor.useAdvisorForExtension(extension)) {
if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
org.hl7.fhir.dstu3.model.Extension convertExtension = new org.hl7.fhir.dstu3.model.Extension();
advisor.handleExtension(extension, convertExtension);
advisor.handleExtension("", extension, convertExtension);//TODO add path
tgt.addExtension(convertExtension);
} else if (!advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {
} else if (!advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {//TODO add path
tgt.addExtension(convertExtension(extension));
}
});
src.getModifierExtension().stream()
.filter(extension -> !advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))
.filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))//TODO add path
.map(VersionConvertor_30_40::convertExtension)
.forEach(tgt::addModifierExtension);
}

View File

@ -3232,16 +3232,16 @@ public class VersionConvertor_30_50 extends VersionConvertor_Base {
.map(resource -> convertResource(resource, advisor))
.forEach(tgt::addContained);
src.getExtension().forEach(extension -> {
if (advisor.useAdvisorForExtension(extension)) {
if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
org.hl7.fhir.r5.model.Extension convertExtension = new org.hl7.fhir.r5.model.Extension();
advisor.handleExtension(extension, convertExtension);
advisor.handleExtension("", extension, convertExtension);//TODO add path
tgt.addExtension(convertExtension);
} else if (!advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {
} else if (!advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {//TODO add path
tgt.addExtension(convertExtension(extension));
}
});
src.getModifierExtension().stream()
.filter(extension -> !advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))
.filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))//TODO add path
.map(VersionConvertor_30_50::convertExtension)
.forEach(tgt::addModifierExtension);
}
@ -3262,16 +3262,16 @@ public class VersionConvertor_30_50 extends VersionConvertor_Base {
.map(resource -> convertResource(resource, advisor))
.forEach(tgt::addContained);
src.getExtension().forEach(extension -> {
if (advisor.useAdvisorForExtension(extension)) {
if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
org.hl7.fhir.dstu3.model.Extension convertExtension = new org.hl7.fhir.dstu3.model.Extension();
advisor.handleExtension(extension, convertExtension);
advisor.handleExtension("", extension, convertExtension);//TODO add path
tgt.addExtension(convertExtension);
} else if (!advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {
} else if (!advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {//TODO add path
tgt.addExtension(convertExtension(extension));
}
});
src.getModifierExtension().stream()
.filter(extension -> !advisor.ignoreExtension(extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))
.filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))
.map(VersionConvertor_30_50::convertExtension)
.forEach(tgt::addModifierExtension);
}

View File

@ -3399,16 +3399,16 @@ public class VersionConvertor_40_50 extends VersionConvertor_Base {
.map(resource -> convertResource(resource, advisor))
.forEach(tgt::addContained);
src.getExtension().forEach(extension -> {
if (advisor.useAdvisorForExtension(extension)) {
if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
org.hl7.fhir.r5.model.Extension convertExtension = new org.hl7.fhir.r5.model.Extension();
advisor.handleExtension(extension, convertExtension);
advisor.handleExtension("", extension, convertExtension);//TODO add path
tgt.addExtension(convertExtension);
} else if (!advisor.ignoreExtension(extension)) {
} else if (!advisor.ignoreExtension("", extension)) {//TODO add path
tgt.addExtension(convertExtension(extension));
}
});
src.getModifierExtension().stream()
.filter(extension -> !advisor.ignoreExtension(extension))
.filter(extension -> !advisor.ignoreExtension("", extension))//TODO add path
.map(VersionConvertor_40_50::convertExtension)
.forEach(tgt::addModifierExtension);
}
@ -3424,16 +3424,16 @@ public class VersionConvertor_40_50 extends VersionConvertor_Base {
.map(resource -> convertResource(resource, advisor))
.forEach(tgt::addContained);
src.getExtension().forEach(extension -> {
if (advisor.useAdvisorForExtension(extension)) {
if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
org.hl7.fhir.r4.model.Extension convertExtension = new org.hl7.fhir.r4.model.Extension();
advisor.handleExtension(extension, convertExtension);
advisor.handleExtension("", extension, convertExtension);//TODO add path
tgt.addExtension(convertExtension);
} else if (!advisor.ignoreExtension(extension)) {
} else if (!advisor.ignoreExtension("", extension)) {//TODO add path
tgt.addExtension(convertExtension(extension));
}
});
src.getModifierExtension().stream()
.filter(extension -> !advisor.ignoreExtension(extension))
.filter(extension -> !advisor.ignoreExtension("", extension))//TODO add path
.map(VersionConvertor_40_50::convertExtension)
.forEach(tgt::addModifierExtension);
}

View File

@ -58,7 +58,7 @@ public class Conformance10_40 {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2.model.Conformance tgt = new org.hl7.fhir.dstu2.model.Conformance();
VersionConvertor_10_40.copyDomainResource(src, tgt, advisor);
VersionConvertor_10_40.copyDomainResource(src, tgt, "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown");
if (src.hasUrlElement())
tgt.setUrlElement(VersionConvertor_10_40.convertUri(src.getUrlElement()));
if (src.hasVersionElement())

View File

@ -62,7 +62,7 @@ public class Conformance10_50 {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2.model.Conformance tgt = new org.hl7.fhir.dstu2.model.Conformance();
VersionConvertor_10_50.copyDomainResource(src, tgt, advisor);
VersionConvertor_10_50.copyDomainResource(src, tgt, "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown");
if (src.hasUrlElement())
tgt.setUrlElement(VersionConvertor_10_50.convertUri(src.getUrlElement()));
if (src.hasVersionElement())

View File

@ -14,10 +14,14 @@ import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponen
public class Questionnaire10_50 {
public static org.hl7.fhir.r5.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2.model.Questionnaire src) throws FHIRException {
return convertQuestionnaire(src, new BaseAdvisor_10_50());
}
public static org.hl7.fhir.r5.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2.model.Questionnaire src, BaseAdvisor_10_50 advisor) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.r5.model.Questionnaire tgt = new org.hl7.fhir.r5.model.Questionnaire();
VersionConvertor_10_50.copyDomainResource(src, tgt);
VersionConvertor_10_50.copyDomainResource(src, tgt, advisor);
for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t));
if (src.hasVersionElement())
tgt.setVersionElement(VersionConvertor_10_50.convertString(src.getVersionElement()));
@ -44,7 +48,7 @@ public class Questionnaire10_50 {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2.model.Questionnaire tgt = new org.hl7.fhir.dstu2.model.Questionnaire();
VersionConvertor_10_50.copyDomainResource(src, tgt);
VersionConvertor_10_50.copyDomainResource(src, tgt, advisor);
for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t));
if (src.hasVersionElement())
tgt.setVersionElement(VersionConvertor_10_50.convertString(src.getVersionElement()));

View File

@ -6,9 +6,10 @@ import org.hl7.fhir.convertors.advisors.interfaces.codesystem.CodeSystemAdvisor3
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor30
import org.hl7.fhir.dstu3.model.CodeSystem
import org.hl7.fhir.dstu3.model.ValueSet
import java.util.ArrayList
import java.util.*
open class BaseAdvisor_10_30(val failFast: Boolean = true): BaseAdvisor, BundleAdvisor30, CodeSystemAdvisor30, ExtensionAdvisor30<org.hl7.fhir.dstu2.model.Extension> {
open class BaseAdvisor_10_30(val failFast: Boolean = true) : BaseAdvisor, BundleAdvisor30, CodeSystemAdvisor30,
ExtensionAdvisor30<org.hl7.fhir.dstu2.model.Extension> {
val cslist = ArrayList<CodeSystem>()

View File

@ -1,16 +1,17 @@
package org.hl7.fhir.convertors.advisors.impl
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor40
import org.hl7.fhir.convertors.advisors.interfaces.bundle.BundleAdvisor40
import org.hl7.fhir.convertors.advisors.interfaces.codesystem.CodeSystemAdvisor40
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor40
import org.hl7.fhir.r4.model.CodeSystem
import org.hl7.fhir.r4.model.Expression
import org.hl7.fhir.r4.model.Type
import org.hl7.fhir.r4.model.ValueSet
import java.util.ArrayList
import java.util.*
open class BaseAdvisor_10_40(val failFast: Boolean = true): BaseAdvisor, BundleAdvisor40, CodeSystemAdvisor40, ExtensionAdvisor40<org.hl7.fhir.dstu2.model.Extension> {
open class BaseAdvisor_10_40(val failFast: Boolean = true) : BaseAdvisor, BundleAdvisor40, CodeSystemAdvisor40,
ExtensionAdvisor40<org.hl7.fhir.dstu2.model.Extension> {
val cslist = ArrayList<CodeSystem>()
@ -31,12 +32,12 @@ open class BaseAdvisor_10_40(val failFast: Boolean = true): BaseAdvisor, BundleA
//todo path - Observation.value
// "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"
//
override fun ignoreExtension(url: String): Boolean {
override fun ignoreExtension(path: String, url: String): Boolean {
return ignoredUrls.contains(url)
}
override fun ignoreType(type: Type): Boolean {
override fun ignoreType(path: String, type: Type): Boolean {
return ignoredExtensionTypes.contains(type::class.java)
}

View File

@ -1,16 +1,17 @@
package org.hl7.fhir.convertors.advisors.impl
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor50
import org.hl7.fhir.convertors.advisors.interfaces.bundle.BundleAdvisor50
import org.hl7.fhir.convertors.advisors.interfaces.codesystem.CodeSystemAdvisor50
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor50
import org.hl7.fhir.r5.model.CodeSystem
import org.hl7.fhir.r5.model.DataType
import org.hl7.fhir.r5.model.Expression
import org.hl7.fhir.r5.model.ValueSet
import java.util.ArrayList
import java.util.*
open class BaseAdvisor_10_50(val failFast: Boolean = true): BaseAdvisor, BundleAdvisor50, CodeSystemAdvisor50, ExtensionAdvisor50<org.hl7.fhir.dstu2.model.Extension> {
open class BaseAdvisor_10_50(val failFast: Boolean = true) : BaseAdvisor, BundleAdvisor50, CodeSystemAdvisor50,
ExtensionAdvisor50<org.hl7.fhir.dstu2.model.Extension> {
val cslist = ArrayList<CodeSystem>()
@ -26,11 +27,11 @@ open class BaseAdvisor_10_50(val failFast: Boolean = true): BaseAdvisor, BundleA
return failFast
}
override fun ignoreExtension(url: String): Boolean {
override fun ignoreExtension(path: String, url: String): Boolean {
return ignoredUrls.contains(url)
}
override fun ignoreType(type: DataType): Boolean {
override fun ignoreType(path: String, type: DataType): Boolean {
return ignoredExtensionTypes.contains(type::class.java)
}

View File

@ -1,15 +1,15 @@
package org.hl7.fhir.convertors.advisors.impl
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor30
import org.hl7.fhir.convertors.advisors.interfaces.bundle.BundleAdvisor30
import org.hl7.fhir.convertors.advisors.interfaces.codesystem.CodeSystemAdvisor30
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor30
import org.hl7.fhir.dstu3.model.CodeSystem
import org.hl7.fhir.dstu3.model.Type
import org.hl7.fhir.dstu3.model.ValueSet
import java.util.ArrayList
import java.util.*
open class BaseAdvisor_14_30(val failFast: Boolean = true): BaseAdvisor, BundleAdvisor30, CodeSystemAdvisor30, ExtensionAdvisor30<org.hl7.fhir.dstu2016may.model.Extension> {
open class BaseAdvisor_14_30(val failFast: Boolean = true) : BaseAdvisor, BundleAdvisor30, CodeSystemAdvisor30,
ExtensionAdvisor30<org.hl7.fhir.dstu2016may.model.Extension> {
val cslist = ArrayList<CodeSystem>()

View File

@ -1,16 +1,17 @@
package org.hl7.fhir.convertors.advisors.impl
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor40
import org.hl7.fhir.convertors.advisors.interfaces.bundle.BundleAdvisor40
import org.hl7.fhir.convertors.advisors.interfaces.codesystem.CodeSystemAdvisor40
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor40
import org.hl7.fhir.r4.model.CodeSystem
import org.hl7.fhir.r4.model.Expression
import org.hl7.fhir.r4.model.Type
import org.hl7.fhir.r4.model.ValueSet
import java.util.ArrayList
import java.util.*
open class BaseAdvisor_14_40(val failFast: Boolean = true): BaseAdvisor, BundleAdvisor40, CodeSystemAdvisor40, ExtensionAdvisor40<org.hl7.fhir.dstu2016may.model.Extension> {
open class BaseAdvisor_14_40(val failFast: Boolean = true) : BaseAdvisor, BundleAdvisor40, CodeSystemAdvisor40,
ExtensionAdvisor40<org.hl7.fhir.dstu2016may.model.Extension> {
val cslist = ArrayList<CodeSystem>()
@ -26,11 +27,11 @@ open class BaseAdvisor_14_40(val failFast: Boolean = true): BaseAdvisor, BundleA
return failFast
}
override fun ignoreExtension(url: String): Boolean {
override fun ignoreExtension(path: String, url: String): Boolean {
return ignoredUrls.contains(url)
}
override fun ignoreType(type: Type): Boolean {
override fun ignoreType(path: String, type: Type): Boolean {
return ignoredExtensionTypes.contains(type::class.java)
}

View File

@ -3,29 +3,20 @@ package org.hl7.fhir.convertors.advisors.impl
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor
import org.hl7.fhir.convertors.advisors.interfaces.bundle.BundleAdvisor50
import org.hl7.fhir.convertors.advisors.interfaces.codesystem.CodeSystemAdvisor50
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor40
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor50
import org.hl7.fhir.r5.model.CodeSystem
import org.hl7.fhir.r5.model.ValueSet
import java.util.*
open class BaseAdvisor_14_50(val failFast: Boolean = true): BaseAdvisor, BundleAdvisor50, CodeSystemAdvisor50,
open class BaseAdvisor_14_50(val failFast: Boolean = true) : BaseAdvisor, BundleAdvisor50, CodeSystemAdvisor50,
ExtensionAdvisor50<org.hl7.fhir.dstu2016may.model.Extension> {
val cslist = ArrayList<CodeSystem>()
private val ignoredUrls = listOf(
"http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown",
)
override fun failFastOnNullOrUnknownEntry(): Boolean {
return failFast
}
override fun ignoreExtension(url: String): Boolean {
return ignoredUrls.contains(url)
}
override fun handleCodeSystem(tgtcs: CodeSystem, source: ValueSet) {
tgtcs.id = source.id
tgtcs.valueSet = source.url

View File

@ -1,35 +1,22 @@
package org.hl7.fhir.convertors.advisors.impl
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor40
import org.hl7.fhir.convertors.advisors.interfaces.bundle.BundleAdvisor40
import org.hl7.fhir.convertors.advisors.interfaces.codesystem.CodeSystemAdvisor40
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor40
import org.hl7.fhir.r4.model.CodeSystem
import org.hl7.fhir.r4.model.Expression
import org.hl7.fhir.r4.model.Extension
import org.hl7.fhir.r4.model.ValueSet
import java.util.ArrayList
import java.util.*
open class BaseAdvisor_30_40(val failFast: Boolean = true): BaseAdvisor, BundleAdvisor40, CodeSystemAdvisor40, ExtensionAdvisor40<org.hl7.fhir.dstu3.model.Extension> {
open class BaseAdvisor_30_40(val failFast: Boolean = true) : BaseAdvisor, BundleAdvisor40, CodeSystemAdvisor40,
ExtensionAdvisor40<org.hl7.fhir.dstu3.model.Extension> {
val cslist = ArrayList<CodeSystem>()
private val ignoredUrls = listOf(
"http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown",
)
override fun failFastOnNullOrUnknownEntry(): Boolean {
return failFast
}
private val ignoredExtensionTypes = listOf(
Expression::class.java,
)
override fun ignoreExtension(ext: Extension): Boolean {
return (ignoredUrls.contains(ext.url) || (ignoredExtensionTypes.contains(ext.value::class.java)))
}
override fun handleCodeSystem(tgtcs: CodeSystem, srcvs: ValueSet) {
tgtcs.id = srcvs.id
tgtcs.valueSet = srcvs.url

View File

@ -1,26 +1,18 @@
package org.hl7.fhir.convertors.advisors.impl
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor50
import org.hl7.fhir.convertors.advisors.interfaces.bundle.BundleAdvisor50
import org.hl7.fhir.convertors.advisors.interfaces.codesystem.CodeSystemAdvisor50
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor50
import org.hl7.fhir.r5.model.CodeSystem
import org.hl7.fhir.r5.model.Expression
import org.hl7.fhir.r5.model.ValueSet
import java.util.ArrayList
import java.util.*
open class BaseAdvisor_30_50(val failFast: Boolean = true): BaseAdvisor, BundleAdvisor50, CodeSystemAdvisor50, ExtensionAdvisor50<org.hl7.fhir.dstu3.model.Extension> {
open class BaseAdvisor_30_50(val failFast: Boolean = true) : BaseAdvisor, BundleAdvisor50, CodeSystemAdvisor50,
ExtensionAdvisor50<org.hl7.fhir.dstu3.model.Extension> {
val cslist = ArrayList<CodeSystem>()
private val ignoredUrls = listOf(
"http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown",
)
private val ignoredExtensionTypes = listOf(
Expression::class.java,
)
override fun failFastOnNullOrUnknownEntry(): Boolean {
return failFast
}

View File

@ -1,26 +1,18 @@
package org.hl7.fhir.convertors.advisors.impl
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor50
import org.hl7.fhir.convertors.advisors.interfaces.bundle.BundleAdvisor50
import org.hl7.fhir.convertors.advisors.interfaces.codesystem.CodeSystemAdvisor50
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor50
import org.hl7.fhir.r5.model.CodeSystem
import org.hl7.fhir.r5.model.Expression
import org.hl7.fhir.r5.model.ValueSet
import java.util.ArrayList
import java.util.*
open class BaseAdvisor_40_50(val failFast: Boolean = true): BaseAdvisor, BundleAdvisor50, CodeSystemAdvisor50, ExtensionAdvisor50<org.hl7.fhir.r4.model.Extension> {
open class BaseAdvisor_40_50(val failFast: Boolean = true) : BaseAdvisor, BundleAdvisor50, CodeSystemAdvisor50,
ExtensionAdvisor50<org.hl7.fhir.r4.model.Extension> {
val cslist = ArrayList<CodeSystem>()
private val ignoredUrls = listOf(
"http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown",
)
private val ignoredExtensionTypes = listOf(
Expression::class.java,
)
override fun failFastOnNullOrUnknownEntry(): Boolean {
return failFast
}

View File

@ -19,55 +19,55 @@ interface ExtensionAdvisor40<T : IBaseExtension<T, *>> {
@JvmDefault
@Throws(FHIRException::class)
fun ignoreExtension(ext: Extension): Boolean {
return ext.url?.let { ignoreExtension(ext.url) } ?: false || ext.value?.let { ignoreType(ext.value) } ?: false
fun ignoreExtension(path: String, ext: Extension): Boolean {
return ext.url?.let { ignoreExtension(path, ext.url) } ?: false || ext.value?.let { ignoreType(path, ext.value) } ?: false
}
@JvmDefault
@Throws(FHIRException::class)
fun ignoreExtension(ext: T): Boolean {
return ext.url?.let { ignoreExtension(ext.url) } ?: false || ext.value?.let { ignoreType(ext.value) } ?: false
fun ignoreExtension(path: String, ext: T): Boolean {
return ext.url?.let { ignoreExtension(path, ext.url) } ?: false || ext.value?.let { ignoreType(path, ext.value) } ?: false
}
@JvmDefault
@Throws(FHIRException::class)
fun ignoreExtension(url: String): Boolean {
fun ignoreExtension(path: String, url: String): Boolean {
return false
}
@JvmDefault
@Throws(FHIRException::class)
fun ignoreType(type: Any): Boolean {
fun ignoreType(path: String, type: Any): Boolean {
return false
}
@JvmDefault
@Throws(FHIRException::class)
fun ignoreType(type: Type): Boolean {
fun ignoreType(path: String, type: Type): Boolean {
return false
}
@JvmDefault
@Throws(FHIRException::class)
fun useAdvisorForExtension(ext: Extension): Boolean {
fun useAdvisorForExtension(path: String, ext: Extension): Boolean {
return false
}
@JvmDefault
@Throws(FHIRException::class)
fun useAdvisorForExtension(ext: T): Boolean {
fun useAdvisorForExtension(path: String, ext: T): Boolean {
return false
}
@JvmDefault
@Throws(FHIRException::class)
fun handleExtension(src: Extension, tgt: T) {
fun handleExtension(path: String, src: Extension, tgt: T) {
// Override to add code to handle specific extensions
}
@JvmDefault
@Throws(FHIRException::class)
fun handleExtension(src: T, tgt: Extension) {
fun handleExtension(path: String, src: T, tgt: Extension) {
// Override to add code to handle specific extensions
}
}

View File

@ -19,55 +19,55 @@ interface ExtensionAdvisor50<T: IBaseExtension<T, *>> {
@JvmDefault
@Throws(FHIRException::class)
fun ignoreExtension(ext: Extension): Boolean {
return ext.url?.let { ignoreExtension(ext.url) } ?: false || ext.value?.let { ignoreType(ext.value) } ?: false
fun ignoreExtension(path: String, ext: Extension): Boolean {
return ext.url?.let { ignoreExtension(path, ext.url) } ?: false || ext.value?.let { ignoreType(path, ext.value) } ?: false
}
@JvmDefault
@Throws(FHIRException::class)
fun ignoreExtension(ext: T): Boolean {
return ext.url?.let { ignoreExtension(ext.url) } ?: false || ext.value?.let { ignoreType(ext.value) } ?: false
fun ignoreExtension(path: String, ext: T): Boolean {
return ext.url?.let { ignoreExtension(path, ext.url) } ?: false || ext.value?.let { ignoreType(path, ext.value) } ?: false
}
@JvmDefault
@Throws(FHIRException::class)
fun ignoreExtension(url: String): Boolean {
fun ignoreExtension(path: String, url: String): Boolean {
return false
}
@JvmDefault
@Throws(FHIRException::class)
fun ignoreType(type: DataType): Boolean {
fun ignoreType(path: String, type: DataType): Boolean {
return false
}
@JvmDefault
@Throws(FHIRException::class)
fun ignoreType(type: Any): Boolean {
fun ignoreType(path: String, type: Any): Boolean {
return false
}
@JvmDefault
@Throws(FHIRException::class)
fun useAdvisorForExtension(ext: Extension): Boolean {
fun useAdvisorForExtension(path: String, ext: Extension): Boolean {
return false
}
@JvmDefault
@Throws(FHIRException::class)
fun useAdvisorForExtension(ext: T): Boolean {
fun useAdvisorForExtension(path: String, ext: T): Boolean {
return false
}
@JvmDefault
@Throws(FHIRException::class)
fun handleExtension(src: Extension, tgt: T) {
fun handleExtension(path: String, src: Extension, tgt: T) {
// Override to add code to handle specific extensions
}
@JvmDefault
@Throws(FHIRException::class)
fun handleExtension(src: T, tgt: Extension) {
fun handleExtension(path: String, src: T, tgt: Extension) {
// Override to add code to handle specific extensions
}
}

View File

@ -41,7 +41,7 @@ public class Expression40Test {
Extension ext = new Extension();
ext.setValue(exp);
BaseAdvisor_10_40 baseAdvisor1040 = new BaseAdvisor_10_40();
Assertions.assertTrue(baseAdvisor1040.ignoreExtension(ext));
Assertions.assertTrue(baseAdvisor1040.ignoreExtension("", ext));
}
@Test

View File

@ -41,7 +41,7 @@ public class Expression50Test {
Extension ext = new Extension();
ext.setValue(exp);
BaseAdvisor_10_50 baseAdvisor50 = new BaseAdvisor_10_50();
Assertions.assertTrue(baseAdvisor50.ignoreExtension(ext));
Assertions.assertTrue(baseAdvisor50.ignoreExtension("", ext));
}
@Test

View File

@ -10,12 +10,12 @@ import org.hl7.fhir.r4.model.Extension
class ExpressionAdvisor40 : BaseAdvisor_10_40() {
@Throws(FHIRException::class)
override fun useAdvisorForExtension(ext: Extension): Boolean {
override fun useAdvisorForExtension(path: String, ext: Extension): Boolean {
return ext.hasValue() && ext.value is Expression
}
@Throws(FHIRException::class)
override fun handleExtension(src: Extension, tgt: org.hl7.fhir.dstu2.model.Extension) {
override fun handleExtension(path:String, src: Extension, tgt: org.hl7.fhir.dstu2.model.Extension) {
when {
(src.value is Expression) -> {
val type = StringType()

View File

@ -9,11 +9,15 @@ import org.hl7.fhir.r5.model.Extension
open class ExpressionAdvisor50 : BaseAdvisor_10_50() {
override fun useAdvisorForExtension(ext: Extension): Boolean {
override fun useAdvisorForExtension(path: String, ext: org.hl7.fhir.dstu2.model.Extension): Boolean {
return super.useAdvisorForExtension(path, ext)
}
override fun useAdvisorForExtension(path: String, ext: Extension): Boolean {
return ext.hasValue() && ext.value is Expression
}
override fun handleExtension(src: Extension, tgt: org.hl7.fhir.dstu2.model.Extension) {
override fun handleExtension(path: String, src: Extension, tgt: org.hl7.fhir.dstu2.model.Extension) {
when {
(src.value is Expression) -> {
val type = StringType()